This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
/
Products.php
160 lines (134 loc) · 3.04 KB
/
Products.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
namespace Model\Ontology;
use DateTime;
use Model\Entity\Entity;
abstract class AbstractProduct
{
use \Nette\SmartObject;
public $id;
public $entity;
public function __construct(Entity $entity)
{
$this->entity = $entity;
$this->id = !$entity->isDetached() ? $entity->id : null;
}
}
class CourseProduct extends AbstractProduct
{
public $author;
public $name;
public $goals;
public $methods;
public $support;
public $menu;
public $calendar;
public $reviewCount;
public $uploadMaxFilesizeKb;
public $gaCode;
}
/**
* @property int $currentPhase
* @property string $currentPhaseName
* @property array $phaseNames
* @property string $nextPhaseName
*/
class UnitProduct extends AbstractProduct
{
public $name;
public $summary;
public $goals;
public $reading;
public $preface;
public $rubrics;
public $tags;
public $published_since;
public $reviews_since;
public $objections_since;
public $finalized_since;
public function getCurrentPhase()
{
return $this->entity->getCurrentPhase();
}
public function isCurrentPhase($phase)
{
return $this->entity->isCurrentPhase($phase);
}
public function getCurrentPhaseName()
{
return $this->entity->getCurrentPhaseName();
}
public function getPhaseNames()
{
return $this->entity->getPhaseNames();
}
public function getNextPhaseName()
{
return $this->entity->getNextPhaseName();
}
public function hasBeenPublished()
{
return $this->entity->hasBeenPublished();
}
public function hasReviewsPhaseStarted()
{
return $this->entity->hasReviewsPhaseStarted();
}
public function hasObjectionsPhaseStarted()
{
return $this->entity->hasObjectionsPhaseStarted();
}
public function isFinalized()
{
return $this->entity->isFinalized();
}
}
class AssignmentProduct extends AbstractProduct
{
public $generated_at;
public $rubrics;
public $structure;
public $questions = array();
public function getAllRubrics() {
$questionRubrics = array();
foreach ($this->structure as $question) {
if ($question instanceof \Model\Ontology\Reading) continue;
$questionRubrics = array_merge($questionRubrics, $question->rubrics);
}
return array_merge($questionRubrics, $this->rubrics);
}
}
class QuestionProduct extends AbstractProduct
{
public $source;
public $order;
public $bloom;
public $input;
public $text;
public $prefill;
public $comments;
public $rubrics;
public $hashMatch;
public $textDump;
public $prefillDump;
public $inputDump;
/**
* Checks whether syntax highlighting is
* available for question's input method.
* @return bool
*/
public function isHighlightingAvailable()
{
return in_array($this->input, array(
'markdown',
'javascript',
'html',
'sql',
'css',
'livecss',
'xml',
'turtle',
'p5',
'p5js'
));
}
}