getOptions should have been optionsDefinition
[project/course.git] / modules / course_object_manual / course_object_manual.classes.inc
1 <?php
2
3 class CourseObjectManual extends CourseObject {
4
5 /**
6 * Display status message as course content.
7 */
8 public function take() {
9 return $this->getStatus();
10 }
11
12 /**
13 * Return a message about the user's status in this object, for when this
14 * object is hidden.
15 */
16 public function getStatus($type = 'short') {
17 $grade = $this->getFulfillment()->getGrade();
18 $config = $this->getOptions();
19 if (!$this->getFulfillment()->getId()) {
20 // User has not been given a status yet.
21 return $config['incomplete_msg'];
22 }
23
24 if ($this->getFulfillment()->isComplete()) {
25 // Complete. User given passed status.
26 return $config['complete_msg'];
27 }
28 else {
29 // User given a status but it wasn't complete. This means they failed.
30 return $config['failed_msg'];
31 }
32 }
33
34 public function optionsDefinition() {
35 $defaults = parent::optionsDefinition();
36
37 $defaults['complete_msg'] = 'Your instructor has marked you as passed.';
38 $defaults['incomplete_msg'] = 'Your instructor has not given you a pass/fail grade yet.';
39 $defaults['failed_msg'] = 'Your instructor has marked you as failed.';
40
41 return $defaults;
42 }
43
44 public function optionsForm(&$form, &$form_state) {
45 parent::optionsForm($form, $form_state);
46
47 $config = $this->getOptions();
48
49 $form['complete_msg'] = array(
50 '#type' => 'textfield',
51 '#title' => 'Complete message',
52 '#default_value' => $config['complete_msg'],
53 );
54
55 $form['failed_msg'] = array(
56 '#type' => 'textfield',
57 '#title' => 'Failed message',
58 '#default_value' => $config['failed_msg'],
59 );
60
61 $form['incomplete_msg'] = array(
62 '#type' => 'textfield',
63 '#title' => 'Incomplete message',
64 '#default_value' => $config['incomplete_msg'],
65 );
66 }
67
68 }