1
|
|
|
<?php |
2
|
|
|
/* For licensing terms, see /license.txt */ |
3
|
|
|
|
4
|
|
|
namespace Chamilo\PluginBundle\ImsLti\Entity; |
5
|
|
|
|
6
|
|
|
use Chamilo\CoreBundle\Entity\GradebookEvaluation; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class LineItem. |
11
|
|
|
* |
12
|
|
|
* @ORM\Table(name="plugin_ims_lti_lineitem") |
13
|
|
|
* @ORM\Entity() |
14
|
|
|
*/ |
15
|
|
|
class LineItem |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var int |
19
|
|
|
* |
20
|
|
|
* @ORM\Column(name="id", type="integer") |
21
|
|
|
* @ORM\Id |
22
|
|
|
* @ORM\GeneratedValue |
23
|
|
|
*/ |
24
|
|
|
protected $id; |
25
|
|
|
/** |
26
|
|
|
* @var ImsLtiTool |
27
|
|
|
* |
28
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\PluginBundle\ImsLti\Entity\ImsLtiTool", inversedBy="lineItems") |
29
|
|
|
* @ORM\JoinColumn(name="tool_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
30
|
|
|
*/ |
31
|
|
|
private $tool; |
32
|
|
|
/** |
33
|
|
|
* @var GradebookEvaluation |
34
|
|
|
* |
35
|
|
|
* @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation") |
36
|
|
|
* @ORM\JoinColumn(name="evaluation", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
37
|
|
|
*/ |
38
|
|
|
private $evaluation; |
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
* |
42
|
|
|
* @ORM\Column(name="resource_id", type="string", nullable=true) |
43
|
|
|
*/ |
44
|
|
|
private $resourceId; |
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
* |
48
|
|
|
* @ORM\Column(name="tag", type="string", nullable=true) |
49
|
|
|
*/ |
50
|
|
|
private $tag; |
51
|
|
|
/** |
52
|
|
|
* @var \DateTime |
53
|
|
|
* |
54
|
|
|
* @ORM\Column(name="start_date", type="datetime", nullable=true) |
55
|
|
|
*/ |
56
|
|
|
private $startDate; |
57
|
|
|
/** |
58
|
|
|
* @var \DateTime |
59
|
|
|
* |
60
|
|
|
* @ORM\Column(name="end_date", type="datetime", nullable=true) |
61
|
|
|
*/ |
62
|
|
|
private $endDate; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get id. |
66
|
|
|
* |
67
|
|
|
* @return int |
68
|
|
|
*/ |
69
|
|
|
public function getId() |
70
|
|
|
{ |
71
|
|
|
return $this->id; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get tool. |
76
|
|
|
* |
77
|
|
|
* @return ImsLtiTool |
78
|
|
|
*/ |
79
|
|
|
public function getTool() |
80
|
|
|
{ |
81
|
|
|
return $this->tool; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set tool. |
86
|
|
|
* |
87
|
|
|
* @param ImsLtiTool $tool |
88
|
|
|
* |
89
|
|
|
* @return LineItem |
90
|
|
|
*/ |
91
|
|
|
public function setTool($tool) |
92
|
|
|
{ |
93
|
|
|
$this->tool = $tool; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get evaluation. |
100
|
|
|
* |
101
|
|
|
* @return GradebookEvaluation |
102
|
|
|
*/ |
103
|
|
|
public function getEvaluation() |
104
|
|
|
{ |
105
|
|
|
return $this->evaluation; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Set evaluation. |
110
|
|
|
* |
111
|
|
|
* @param GradebookEvaluation $evaluation |
112
|
|
|
* |
113
|
|
|
* @return LineItem |
114
|
|
|
*/ |
115
|
|
|
public function setEvaluation($evaluation) |
116
|
|
|
{ |
117
|
|
|
$this->evaluation = $evaluation; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get tag. |
124
|
|
|
* |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public function getTag() |
128
|
|
|
{ |
129
|
|
|
return $this->tag; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Set tag. |
134
|
|
|
* |
135
|
|
|
* @param string $tag |
136
|
|
|
* |
137
|
|
|
* @return LineItem |
138
|
|
|
*/ |
139
|
|
|
public function setTag($tag) |
140
|
|
|
{ |
141
|
|
|
$this->tag = $tag; |
142
|
|
|
|
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Get startDate. |
148
|
|
|
* |
149
|
|
|
* @return \DateTime |
150
|
|
|
*/ |
151
|
|
|
public function getStartDate() |
152
|
|
|
{ |
153
|
|
|
return $this->startDate; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Set startDate. |
158
|
|
|
* |
159
|
|
|
* @param \DateTime $startDate |
160
|
|
|
* |
161
|
|
|
* @return LineItem |
162
|
|
|
*/ |
163
|
|
|
public function setStartDate($startDate) |
164
|
|
|
{ |
165
|
|
|
$this->startDate = $startDate; |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Get endDate. |
172
|
|
|
* |
173
|
|
|
* @return \DateTime |
174
|
|
|
*/ |
175
|
|
|
public function getEndDate() |
176
|
|
|
{ |
177
|
|
|
return $this->endDate; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Set endDate. |
182
|
|
|
* |
183
|
|
|
* @param \DateTime $endDate |
184
|
|
|
* |
185
|
|
|
* @return LineItem |
186
|
|
|
*/ |
187
|
|
|
public function setEndDate($endDate) |
188
|
|
|
{ |
189
|
|
|
$this->endDate = $endDate; |
190
|
|
|
|
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return string |
196
|
|
|
*/ |
197
|
|
|
public function getResourceId() |
198
|
|
|
{ |
199
|
|
|
return $this->resourceId; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param string $resourceId |
204
|
|
|
* |
205
|
|
|
* @return LineItem |
206
|
|
|
*/ |
207
|
|
|
public function setResourceId($resourceId) |
208
|
|
|
{ |
209
|
|
|
$this->resourceId = $resourceId; |
210
|
|
|
|
211
|
|
|
return $this; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @return array |
216
|
|
|
*/ |
217
|
|
|
public function toArray() |
218
|
|
|
{ |
219
|
|
|
$baseTool = $this->tool->getParent() ?: $this->tool; |
220
|
|
|
|
221
|
|
|
$data = [ |
222
|
|
|
'scoreMaximum' => $this->evaluation->getMax(), |
223
|
|
|
'label' => $this->evaluation->getName(), |
|
|
|
|
224
|
|
|
'tag' => (string) $this->tag, |
225
|
|
|
'resourceLinkId' => (string) $baseTool->getId(), |
226
|
|
|
'resourceId' => (string) $this->resourceId, |
227
|
|
|
]; |
228
|
|
|
|
229
|
|
|
if ($this->startDate) { |
230
|
|
|
$data['startDateTime'] = $this->startDate->format(\DateTime::ATOM); |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
if ($this->endDate) { |
234
|
|
|
$data['endDateTime'] = $this->endDate->format(\DateTime::ATOM); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
return $data; |
238
|
|
|
} |
239
|
|
|
} |
240
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.