course_object_manual.classes.inc in Course 7.2
File
modules/course_object_manual/course_object_manual.classes.inc
View source
<?php
class CourseObjectManual extends CourseObject {
public function take() {
return $this
->getStatus();
}
public function getStatus() {
global $user;
$grade = $this
->getFulfillment($user)
->getGrade();
$config = $this
->getOptions();
if ($this
->getFulfillment($user)
->isComplete()) {
return check_plain(t($config['complete_msg']));
}
elseif ($this
->getFulfillment($user)
->getGrade() == '') {
return check_plain(t($config['incomplete_msg']));
}
else {
return check_plain(t($config['failed_msg']));
}
}
public function optionsDefinition() {
$defaults = parent::optionsDefinition();
$defaults['complete_msg'] = 'Your instructor has marked you as passed.';
$defaults['incomplete_msg'] = 'Your instructor has not given you a pass/fail grade yet.';
$defaults['failed_msg'] = 'Your instructor has marked you as failed.';
return $defaults;
}
public function optionsForm(&$form, &$form_state) {
parent::optionsForm($form, $form_state);
$config = $this
->getOptions();
$form['complete_msg'] = array(
'#type' => 'textfield',
'#title' => t('Complete message'),
'#default_value' => $config['complete_msg'],
);
$form['failed_msg'] = array(
'#type' => 'textfield',
'#title' => t('Failed message'),
'#default_value' => $config['failed_msg'],
);
$form['incomplete_msg'] = array(
'#type' => 'textfield',
'#title' => t('Incomplete message'),
'#default_value' => $config['incomplete_msg'],
);
}
}