|
@@ -1,7 +1,7 @@
|
1
|
1
|
<?php
|
|
2
|
+
|
2
|
3
|
namespace Logipro\Bundle\SCORMBundle\Player\SCORM2004;
|
3
|
4
|
|
4
|
|
-use Doctrine\Common\Persistence\ManagerRegistry;
|
5
|
5
|
use Doctrine\ORM\EntityManagerInterface;
|
6
|
6
|
use Logipro\Bundle\SCORMBundle\ClientAPI\ApiScorm2004;
|
7
|
7
|
use Logipro\Bundle\SCORMBundle\Crypto\Crypto;
|
|
@@ -21,11 +21,11 @@ use Symfony\Component\Routing\RouterInterface;
|
21
|
21
|
class Scorm2004PlayerView
|
22
|
22
|
{
|
23
|
23
|
protected $router;
|
24
|
|
-
|
|
24
|
+
|
25
|
25
|
protected $parameters;
|
26
|
26
|
|
27
|
27
|
protected $em;
|
28
|
|
-
|
|
28
|
+
|
29
|
29
|
protected $response;
|
30
|
30
|
|
31
|
31
|
protected $dom;
|
|
@@ -42,8 +42,16 @@ class Scorm2004PlayerView
|
42
|
42
|
|
43
|
43
|
protected $tocValidations;
|
44
|
44
|
|
45
|
|
- public function __construct(RouterInterface $router, ParameterBagInterface $parameters, EntityManagerInterface $em, DOMSCORM2004 $dom, Scorm2004Track $track, string $registrationKey, string $organization, string $item)
|
46
|
|
- {
|
|
45
|
+ public function __construct(
|
|
46
|
+ RouterInterface $router,
|
|
47
|
+ ParameterBagInterface $parameters,
|
|
48
|
+ EntityManagerInterface $em,
|
|
49
|
+ DOMSCORM2004 $dom,
|
|
50
|
+ Scorm2004Track $track,
|
|
51
|
+ string $registrationKey,
|
|
52
|
+ string $organization,
|
|
53
|
+ string $item
|
|
54
|
+ ) {
|
47
|
55
|
// Récupération des services
|
48
|
56
|
$this->router = $router;
|
49
|
57
|
$this->parameters = $parameters;
|
|
@@ -54,10 +62,10 @@ class Scorm2004PlayerView
|
54
|
62
|
$this->registrationKey = $registrationKey;
|
55
|
63
|
$this->organization = $organization;
|
56
|
64
|
$this->item = $item;
|
57
|
|
-
|
|
65
|
+
|
58
|
66
|
$this->navUIControls = null;
|
59
|
67
|
$this->tocValidations = null;
|
60
|
|
-
|
|
68
|
+
|
61
|
69
|
$this->response = array(
|
62
|
70
|
'result' => 'player',
|
63
|
71
|
'player' => array(
|
|
@@ -93,7 +101,21 @@ class Scorm2004PlayerView
|
93
|
101
|
$this->response['player']['toc'] = $this->getToc();
|
94
|
102
|
$this->response['player']['previous'] = $this->getNavigationAction(SCORM2004_HIDE_LMS_UI_PREVIOUS);
|
95
|
103
|
$this->response['player']['next'] = $this->getNavigationAction(SCORM2004_HIDE_LMS_UI_CONTINUE);
|
96
|
|
-
|
|
104
|
+
|
|
105
|
+ return $this->response;
|
|
106
|
+ }
|
|
107
|
+
|
|
108
|
+ public function getSelectionResponse()
|
|
109
|
+ {
|
|
110
|
+ $this->response['result'] = 'selection';
|
|
111
|
+ $this->response['player']['current'] = $this->getCurrent();
|
|
112
|
+ $this->response['player']['toc'] = $this->getToc();
|
|
113
|
+ $this->response['player']['previous'] = $this->getNavigationAction(SCORM2004_HIDE_LMS_UI_PREVIOUS);
|
|
114
|
+ $this->response['player']['next'] = $this->getNavigationAction(SCORM2004_HIDE_LMS_UI_CONTINUE);
|
|
115
|
+ $this->response['player']['exit'] = $this->getNavigationAction(SCORM2004_HIDE_LMS_UI_EXIT);
|
|
116
|
+ $this->response['player']['content'] = null;
|
|
117
|
+ $this->response['api'] = null;
|
|
118
|
+
|
97
|
119
|
return $this->response;
|
98
|
120
|
}
|
99
|
121
|
|
|
@@ -105,39 +127,39 @@ class Scorm2004PlayerView
|
105
|
127
|
// init des états
|
106
|
128
|
$this->navUIControls = array(
|
107
|
129
|
SCORM2004_HIDE_LMS_UI_PREVIOUS => array(
|
108
|
|
- 'visible' => true,
|
109
|
|
- 'enable' => true,
|
110
|
|
- 'nav'=> NavigationRequest::NAVIGATION_PREVIOUS
|
|
130
|
+ 'visible' => true,
|
|
131
|
+ 'enable' => true,
|
|
132
|
+ 'nav' => NavigationRequest::NAVIGATION_PREVIOUS
|
111
|
133
|
),
|
112
|
134
|
SCORM2004_HIDE_LMS_UI_CONTINUE => array(
|
113
|
|
- 'visible' => true,
|
114
|
|
- 'enable' => true,
|
115
|
|
- 'nav'=> NavigationRequest::NAVIGATION_CONTINUE
|
|
135
|
+ 'visible' => true,
|
|
136
|
+ 'enable' => true,
|
|
137
|
+ 'nav' => NavigationRequest::NAVIGATION_CONTINUE
|
116
|
138
|
),
|
117
|
139
|
SCORM2004_HIDE_LMS_UI_EXIT => array(
|
118
|
|
- 'visible' => true,
|
119
|
|
- 'enable' => true,
|
120
|
|
- 'nav'=> NavigationRequest::NAVIGATION_EXIT
|
|
140
|
+ 'visible' => true,
|
|
141
|
+ 'enable' => true,
|
|
142
|
+ 'nav' => NavigationRequest::NAVIGATION_EXIT
|
121
|
143
|
),
|
122
|
144
|
SCORM2004_HIDE_LMS_UI_EXIT_ALL => array(
|
123
|
|
- 'visible' => true,
|
124
|
|
- 'enable' => true,
|
125
|
|
- 'nav'=> NavigationRequest::NAVIGATION_EXIT_ALL
|
|
145
|
+ 'visible' => true,
|
|
146
|
+ 'enable' => true,
|
|
147
|
+ 'nav' => NavigationRequest::NAVIGATION_EXIT_ALL
|
126
|
148
|
),
|
127
|
149
|
SCORM2004_HIDE_LMS_UI_ABANDON => array(
|
128
|
|
- 'visible' => true,
|
129
|
|
- 'enable' => true,
|
130
|
|
- 'nav'=> NavigationRequest::NAVIGATION_ABANDON
|
|
150
|
+ 'visible' => true,
|
|
151
|
+ 'enable' => true,
|
|
152
|
+ 'nav' => NavigationRequest::NAVIGATION_ABANDON
|
131
|
153
|
),
|
132
|
154
|
SCORM2004_HIDE_LMS_UI_ABANDON_ALL => array(
|
133
|
|
- 'visible' => true,
|
134
|
|
- 'enable' => true,
|
135
|
|
- 'nav'=> NavigationRequest::NAVIGATION_ABANDON_ALL
|
|
155
|
+ 'visible' => true,
|
|
156
|
+ 'enable' => true,
|
|
157
|
+ 'nav' => NavigationRequest::NAVIGATION_ABANDON_ALL
|
136
|
158
|
),
|
137
|
159
|
SCORM2004_HIDE_LMS_UI_SUSPEND_ALL => array(
|
138
|
|
- 'visible' => true,
|
139
|
|
- 'enable' => true,
|
140
|
|
- 'nav'=> NavigationRequest::NAVIGATION_SUSPEND_ALL
|
|
160
|
+ 'visible' => true,
|
|
161
|
+ 'enable' => true,
|
|
162
|
+ 'nav' => NavigationRequest::NAVIGATION_SUSPEND_ALL
|
141
|
163
|
)
|
142
|
164
|
);
|
143
|
165
|
|
|
@@ -153,13 +175,13 @@ class Scorm2004PlayerView
|
153
|
175
|
$this->navUIControls[SCORM2004_HIDE_LMS_UI_CONTINUE]['enable'] = $navigationRequestValidator->checkContinueValidity($this->item);
|
154
|
176
|
}
|
155
|
177
|
|
156
|
|
- /**
|
|
178
|
+ /**
|
157
|
179
|
* Retourne l'ensemble des données necessaires pour l'affichage des infos du noeud courant
|
158
|
180
|
*/
|
159
|
181
|
protected function getCurrent()
|
160
|
182
|
{
|
161
|
183
|
$response = array();
|
162
|
|
-
|
|
184
|
+
|
163
|
185
|
// Nom de l'activité
|
164
|
186
|
$response['activity'] = $this->dom->getTitle($this->organization);
|
165
|
187
|
// Nom de l'item
|
|
@@ -176,9 +198,9 @@ class Scorm2004PlayerView
|
176
|
198
|
// Récupération de l'état des plannodes pour une requete de type 'choice' en fonction de l'état du system
|
177
|
199
|
$navigationRequestValidator = new NavigationRequestValidator($this->parameters, $this->em, $this->registrationKey);
|
178
|
200
|
$this->tocValidations = $navigationRequestValidator->defineTableOfContent($this->item);
|
179
|
|
-
|
|
201
|
+
|
180
|
202
|
$response = array();
|
181
|
|
-
|
|
203
|
+
|
182
|
204
|
// Récupération des enfants disponibles
|
183
|
205
|
$children = $this->dom->getChildren($this->organization);
|
184
|
206
|
|
|
@@ -193,7 +215,7 @@ class Scorm2004PlayerView
|
193
|
215
|
}
|
194
|
216
|
}
|
195
|
217
|
}
|
196
|
|
-
|
|
218
|
+
|
197
|
219
|
return $response;
|
198
|
220
|
}
|
199
|
221
|
|
|
@@ -205,13 +227,13 @@ class Scorm2004PlayerView
|
205
|
227
|
// si l'item est visible
|
206
|
228
|
if ($isVisible) {
|
207
|
229
|
$response = array();
|
208
|
|
-
|
|
230
|
+
|
209
|
231
|
// Nom du noeud
|
210
|
232
|
$response['name'] = $this->dom->getTitle($item);
|
211
|
233
|
$response['current'] = $validations['is-Active'];
|
212
|
234
|
$response['state'] = $validations['state'];
|
213
|
235
|
$response['enable'] = $validations['enable'];
|
214
|
|
-
|
|
236
|
+
|
215
|
237
|
// Enable/Disable
|
216
|
238
|
$data = null;
|
217
|
239
|
if ($validations['enable']) {
|
|
@@ -222,7 +244,7 @@ class Scorm2004PlayerView
|
222
|
244
|
'nav' => NavigationRequest::NAVIGATION_CHOICE,
|
223
|
245
|
'target' => $item
|
224
|
246
|
);
|
225
|
|
-
|
|
247
|
+
|
226
|
248
|
$serialize = \serialize($dataArray);
|
227
|
249
|
$data = Crypto::crypt($serialize);
|
228
|
250
|
}
|
|
@@ -287,7 +309,7 @@ class Scorm2004PlayerView
|
287
|
309
|
protected function getNavigationAction(string $action)
|
288
|
310
|
{
|
289
|
311
|
$information = $this->navUIControls[$action];
|
290
|
|
-
|
|
312
|
+
|
291
|
313
|
$dataArray = array(
|
292
|
314
|
'regKey' => $this->registrationKey,
|
293
|
315
|
'org' => $this->organization,
|
|
@@ -311,7 +333,7 @@ class Scorm2004PlayerView
|
311
|
333
|
/**
|
312
|
334
|
* Retourne les données necessaires pour l'affichage du contenu
|
313
|
335
|
*/
|
314
|
|
- protected function getContent() : string
|
|
336
|
+ protected function getContent(): string
|
315
|
337
|
{
|
316
|
338
|
// Récupérer l'url de la ressource liée à l'item
|
317
|
339
|
$href = $this->dom->getHref($this->item);
|
|
@@ -322,7 +344,7 @@ class Scorm2004PlayerView
|
322
|
344
|
/**
|
323
|
345
|
* Retourne l'API SCORM2004 paramétrée pour l'item courant
|
324
|
346
|
*/
|
325
|
|
- protected function getApi() : string
|
|
347
|
+ protected function getApi(): string
|
326
|
348
|
{
|
327
|
349
|
$apiScorm2004 = new ApiScorm2004($this->router, $this->parameters, $this->em);
|
328
|
350
|
$api = $apiScorm2004->getAPI($this->dom, $this->registrationKey, $this->organization, $this->item);
|