|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
namespace Chamilo\PluginBundle\Entity\ImsLti; |
|
5
|
|
|
|
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class ImsLtiTool |
|
10
|
|
|
* |
|
11
|
|
|
* @ORM\Table(name="plugin_ims_lti_tool") |
|
12
|
|
|
* @ORM\Entity() |
|
13
|
|
|
*/ |
|
14
|
|
|
class ImsLtiTool |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @var integer |
|
18
|
|
|
* |
|
19
|
|
|
* @ORM\Column(name="id", type="integer") |
|
20
|
|
|
* @ORM\Id |
|
21
|
|
|
* @ORM\GeneratedValue |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $id; |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
* |
|
27
|
|
|
* @ORM\Column(name="name", type="string") |
|
28
|
|
|
*/ |
|
29
|
|
|
private $name = ''; |
|
30
|
|
|
/** |
|
31
|
|
|
* @var string|null |
|
32
|
|
|
* |
|
33
|
|
|
* @ORM\Column(name="description", type="text", nullable=true) |
|
34
|
|
|
*/ |
|
35
|
|
|
private $description = null; |
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
* |
|
39
|
|
|
* @ORM\Column(name="launch_url", type="string") |
|
40
|
|
|
*/ |
|
41
|
|
|
private $launchUrl = ''; |
|
42
|
|
|
/** |
|
43
|
|
|
* @var string |
|
44
|
|
|
* |
|
45
|
|
|
* @ORM\Column(name="consumer_key", type="string") |
|
46
|
|
|
*/ |
|
47
|
|
|
private $consumerKey = ''; |
|
48
|
|
|
/** |
|
49
|
|
|
* @var string |
|
50
|
|
|
* |
|
51
|
|
|
* @ORM\Column(name="shared_secret", type="string") |
|
52
|
|
|
*/ |
|
53
|
|
|
private $sharedSecret = ''; |
|
54
|
|
|
/** |
|
55
|
|
|
* @var string|null |
|
56
|
|
|
* |
|
57
|
|
|
* @ORM\Column(name="custom_params", type="text", nullable=true) |
|
58
|
|
|
*/ |
|
59
|
|
|
private $customParams = null; |
|
60
|
|
|
/** |
|
61
|
|
|
* @var bool |
|
62
|
|
|
* |
|
63
|
|
|
* @ORM\Column(name="is_global", type="boolean") |
|
64
|
|
|
*/ |
|
65
|
|
|
private $isGlobal = false; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return int |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getId() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->id; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return string |
|
77
|
|
|
*/ |
|
78
|
|
|
public function getName() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->name; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @param string $name |
|
85
|
|
|
* @return ImsLtiTool |
|
86
|
|
|
*/ |
|
87
|
|
|
public function setName($name) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->name = $name; |
|
90
|
|
|
|
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return null|string |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getDescription() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->description; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @param null|string $description |
|
104
|
|
|
* @return ImsLtiTool |
|
105
|
|
|
*/ |
|
106
|
|
|
public function setDescription($description) |
|
107
|
|
|
{ |
|
108
|
|
|
$this->description = $description; |
|
109
|
|
|
|
|
110
|
|
|
return $this; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @return string |
|
115
|
|
|
*/ |
|
116
|
|
|
public function getLaunchUrl() |
|
117
|
|
|
{ |
|
118
|
|
|
return $this->launchUrl; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param string $launchUrl |
|
123
|
|
|
* @return ImsLtiTool |
|
124
|
|
|
*/ |
|
125
|
|
|
public function setLaunchUrl($launchUrl) |
|
126
|
|
|
{ |
|
127
|
|
|
$this->launchUrl = $launchUrl; |
|
128
|
|
|
|
|
129
|
|
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getConsumerKey() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->consumerKey; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @param string $consumerKey |
|
142
|
|
|
* @return ImsLtiTool |
|
143
|
|
|
*/ |
|
144
|
|
|
public function setConsumerKey($consumerKey) |
|
145
|
|
|
{ |
|
146
|
|
|
$this->consumerKey = $consumerKey; |
|
147
|
|
|
|
|
148
|
|
|
return $this; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* @return string |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getSharedSecret() |
|
155
|
|
|
{ |
|
156
|
|
|
return $this->sharedSecret; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @param string $sharedSecret |
|
161
|
|
|
* @return ImsLtiTool |
|
162
|
|
|
*/ |
|
163
|
|
|
public function setSharedSecret($sharedSecret) |
|
164
|
|
|
{ |
|
165
|
|
|
$this->sharedSecret = $sharedSecret; |
|
166
|
|
|
|
|
167
|
|
|
return $this; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @return null|string |
|
172
|
|
|
*/ |
|
173
|
|
|
public function getCustomParams() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->customParams; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @param null|string $customParams |
|
180
|
|
|
* @return ImsLtiTool |
|
181
|
|
|
*/ |
|
182
|
|
|
public function setCustomParams($customParams) |
|
183
|
|
|
{ |
|
184
|
|
|
$this->customParams = $customParams; |
|
185
|
|
|
|
|
186
|
|
|
return $this; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* @return bool |
|
191
|
|
|
*/ |
|
192
|
|
|
public function isGlobal() |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->isGlobal; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @param bool $isGlobal |
|
199
|
|
|
* @return ImsLtiTool |
|
200
|
|
|
*/ |
|
201
|
|
|
public function setIsGlobal($isGlobal) |
|
202
|
|
|
{ |
|
203
|
|
|
$this->isGlobal = $isGlobal; |
|
204
|
|
|
|
|
205
|
|
|
return $this; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* @return array |
|
210
|
|
|
*/ |
|
211
|
|
|
public function parseCustomParams() |
|
212
|
|
|
{ |
|
213
|
|
|
$strings = explode($this->customParams, "\n"); |
|
214
|
|
|
$pairs = explode('=', $strings); |
|
215
|
|
|
|
|
216
|
|
|
return [ |
|
217
|
|
|
'key' => 'custom_'.$pairs[0], |
|
218
|
|
|
'value' => $pairs[1] |
|
219
|
|
|
]; |
|
220
|
|
|
} |
|
221
|
|
|
} |
|
222
|
|
|
|