Browse Source

Merge branch 'hotfix'

raphael 3 years ago
parent
commit
fa0ea205e4

+ 10
- 4
.env.test View File

@@ -1,4 +1,10 @@
1
-# define your env variables for the test env here
2
-KERNEL_CLASS='Symfony\Component\HttpKernel\Kernel\AppKernel'
3
-APP_SECRET='s$cretf0rt3st'
4
-SYMFONY_DEPRECATIONS_HELPER=999999
1
+    APP_ENV=test
2
+    APP_URL_PREFIX="/phoenix"
3
+    APP_LANGUAGE="fr"
4
+
5
+    # define your env variables for the test env here
6
+    KERNEL_CLASS='Logipro\Phoenix\Kernel\AppKernel'
7
+    APP_SECRET='s$cretf0rt3st'
8
+    SYMFONY_DEPRECATIONS_HELPER=999999
9
+
10
+    DATABASE_TEST_URL="sqlite:///%kernel.project_dir%/var/app.db"

+ 5
- 0
composer.json View File

@@ -10,6 +10,11 @@
10 10
 			"Logipro\\Phoenix\\" : "src/Phoenix"
11 11
 		}
12 12
 	},
13
+	"autoload-dev": {
14
+        "psr-4": {
15
+            "Logipro\\Phoenix\\tests\\": "tests/"
16
+        }
17
+    },
13 18
 	"require" : {
14 19
 		"symfony/flex" : "~1.1",
15 20
 		"symfony/console" : "~4.0",

+ 2
- 0
config/packages/security.yaml View File

@@ -68,12 +68,14 @@ security:
68 68
     - { path: ^/learning-space, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
69 69
     - { path: ^/catalog, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
70 70
     - { path: ^/settings, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
71
+
71 72
     # ressource cache (mignature image)
72 73
     - { path: ^/media/cache/resolve/my_thumb, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
73 74
 
74 75
     # Zone de telechargmement de document accessible à toute personne connectée
75 76
     - { path: ^/file, roles: [IS_AUTHENTICATED_REMEMBERED] }
76 77
     - { path: ^/upload/download, roles: [IS_AUTHENTICATED_REMEMBERED] }
78
+    - { path: ^/scorm, roles: [IS_AUTHENTICATED_REMEMBERED] }
77 79
 
78 80
     # Espace reserver aux Owner
79 81
     - { path: ^/owner-space, roles: [ROLE_TRAINER, ROLE_TRAINER_AND_AUTHOR, ROLE_AUTHOR] }

+ 6
- 1
src/Phoenix/Component/PhxCrypt.php View File

@@ -6,6 +6,11 @@ class PhxCrypt
6 6
     private static $cryptPassword = "__Pas.s:Word_!/_";
7 7
     private static $cryptIV = '1234567812345678';
8 8
 
9
+    protected static function serialize(array $data): string
10
+    {
11
+        return serialize($data);
12
+    }
13
+
9 14
     public static function crypt($data,$withDate = true)
10 15
     {
11 16
         if (is_string($data))
@@ -15,7 +20,7 @@ class PhxCrypt
15 20
         
16 21
         $data['_d_'] = time();
17 22
 
18
-        $data = serialize($data);
23
+        $data = self::serialize($data);
19 24
 		$openSslCrypt = openssl_encrypt($data, 'aes128',self::$cryptPassword,0,self::$cryptIV);
20 25
         return rtrim(strtr(($openSslCrypt), '+/', '-_'), '=');
21 26
     }

+ 79
- 72
src/Phoenix/Controller/AppController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller;
3 4
 
4 5
 use Symfony\Component\HttpFoundation\Response;
@@ -36,12 +37,10 @@ class AppController extends AbstractController
36 37
 		FormHandler $formHandler,
37 38
 		EventDispatcherInterface $dispatcher = null,
38 39
 		ImageListener $listener = null
39
-	)
40
-	{
40
+	) {
41 41
 		// FIXME parfois le dispatcher est à null
42 42
 		// cas trouvé: file/download/{[id]}
43
-		if ($dispatcher && $listener)
44
-		{
43
+		if ($dispatcher && $listener) {
45 44
 			$dispatcher->addListener(\Vich\UploaderBundle\Event\Events::PRE_REMOVE, [$listener, 'preRemove']);
46 45
 		}
47 46
 		$this->formHandler = $formHandler;
@@ -65,7 +64,7 @@ class AppController extends AbstractController
65 64
 		return $this->formHandler->validForm($form);
66 65
 	}
67 66
 
68
-    /**
67
+	/**
69 68
 	 * retourne le manager de la BD
70 69
 	 * 
71 70
 	 * @param string $name
@@ -73,8 +72,7 @@ class AppController extends AbstractController
73 72
 	protected function getManager($name = null)
74 73
 	{
75 74
 		$doctrine = $this->getDoctrine();
76
-		if (!$doctrine)
77
-		{
75
+		if (!$doctrine) {
78 76
 			return;
79 77
 		}
80 78
 		return $doctrine->getManager($name);
@@ -86,11 +84,10 @@ class AppController extends AbstractController
86 84
 	 * @param $class
87 85
 	 * @param $managerName
88 86
 	 */
89
-	protected function getRepository($class,$managerName = null)
87
+	protected function getRepository($class, $managerName = null)
90 88
 	{
91 89
 		$manager = $this->getManager($managerName);
92
-		if (!$manager)
93
-		{
90
+		if (!$manager) {
94 91
 			return;
95 92
 		}
96 93
 		return $manager->getRepository($class);
@@ -102,22 +99,20 @@ class AppController extends AbstractController
102 99
 	 * @param $const
103 100
 	 * @param $number
104 101
 	 */
105
-	protected function translate($const,$number = null,$params = array(),$namespace = null)
102
+	protected function translate($const, $number = null, $params = array(), $namespace = null)
106 103
 	{
107 104
 		$translator = $this->get('translator');
108
-		if (!$translator)
109
-		{
105
+		if (!$translator) {
110 106
 			return $const;
111 107
 		}
112
-		if ($number)
113
-		{
108
+		if ($number) {
114 109
 			$params['count'] = $number;
115
-			return $translator->trans($const,$params,$namespace);
110
+			return $translator->trans($const, $params, $namespace);
116 111
 		}
117
-		return $translator->trans($const,$params,$namespace);
118
-    }
119
-    
120
-    /**
112
+		return $translator->trans($const, $params, $namespace);
113
+	}
114
+
115
+	/**
121 116
 	 * équivalent de render avec ajout de variable communes
122 117
 	 * 
123 118
 	 * @param string $view
@@ -127,34 +122,32 @@ class AppController extends AbstractController
127 122
 	 */
128 123
 	protected function phxRender(string $view, array $parameters = array(), Response $response = null): Response
129 124
 	{
130
-        // étend les variables de rendu
125
+		// étend les variables de rendu
131 126
 		$this->extendsRenderVars($parameters);
132
-		
127
+
133 128
 		return $this->render($view, $parameters, $response);
134 129
 	}
135 130
 
136
-	protected function renderBlock(string $blockName,string $view,array $parameters = array())
131
+	protected function renderBlock(string $blockName, string $view, array $parameters = array())
137 132
 	{
138
-		$content = $this->renderBlockView($blockName,$view,$parameters);
133
+		$content = $this->renderBlockView($blockName, $view, $parameters);
139 134
 		return new Response($content);
140 135
 	}
141 136
 
142
-	protected function renderBlockView(string $blockName,string $view,array $parameters = array())
137
+	protected function renderBlockView(string $blockName, string $view, array $parameters = array())
143 138
 	{
144 139
 		$template = $this->container->get('twig')->load($view);
145
-		$result =  $template->renderBlock($blockName,$parameters);
140
+		$result =  $template->renderBlock($blockName, $parameters);
146 141
 		return $result;
147 142
 	}
148 143
 
149
-    /**
150
-     * étend les variables pour tous les rendus de la classe
151
-     * à surcharger pour chacun des espaces
152
-     */
144
+	/**
145
+	 * étend les variables pour tous les rendus de la classe
146
+	 * à surcharger pour chacun des espaces
147
+	 */
153 148
 	protected function extendsRenderVars(&$parameters)
154 149
 	{
155
-		$golbalParameters = array
156
-		(
157
-		);
150
+		$golbalParameters = array();
158 151
 		$parameters = array_merge($golbalParameters, $parameters);
159 152
 	}
160 153
 
@@ -162,10 +155,10 @@ class AppController extends AbstractController
162 155
 	 * équivalent de renderView avec ajout de variable communes
163 156
 	 */
164 157
 	protected function phxRenderView(string $view, array $parameters = array()): string
165
-    {
166
-        // étend les variables de rendu
167
-        $this->extendsRenderVars($parameters);
168
-        
158
+	{
159
+		// étend les variables de rendu
160
+		$this->extendsRenderVars($parameters);
161
+
169 162
 		return $this->renderView($view, $parameters);
170 163
 	}
171 164
 
@@ -177,7 +170,7 @@ class AppController extends AbstractController
177 170
 	 * 
178 171
 	 * @eturn string
179 172
 	 */
180
-	public function renderString($string,$renderVars = array())
173
+	public function renderString($string, $renderVars = array())
181 174
 	{
182 175
 		$twig = $this->get('twig');
183 176
 		// garde l'ancien loader
@@ -185,10 +178,10 @@ class AppController extends AbstractController
185 178
 		// change le loader
186 179
 		$twig->setLoader(new \Twig\Loader\ArrayLoader(['string' => $string]));
187 180
 		// fait le rendu
188
-		$content = $twig->render('string',$renderVars);
181
+		$content = $twig->render('string', $renderVars);
189 182
 		// remet le loader
190 183
 		$twig->setLoader($oldLoader);
191
-		
184
+
192 185
 		return $content;
193 186
 	}
194 187
 
@@ -204,8 +197,7 @@ class AppController extends AbstractController
204 197
 	 */
205 198
 	public function arrayGet($array, $key, $default = null)
206 199
 	{
207
-		if (array_key_exists($key, $array))
208
-		{
200
+		if (array_key_exists($key, $array)) {
209 201
 			return $array[$key];
210 202
 		}
211 203
 		return $default;
@@ -219,15 +211,15 @@ class AppController extends AbstractController
219 211
 	 * 
220 212
 	 * @deprecated use FormHandler::getFormFieldError instead
221 213
 	 */
222
-	protected function getFormFieldError(Form $form) : array
223
-	{    
214
+	protected function getFormFieldError(Form $form): array
215
+	{
224 216
 		return $this->formHandler->getFormFieldError($form);
225 217
 	}
226 218
 
227 219
 	/**
228 220
 	 * @deprecated  use FormHandler::getViewId instead
229 221
 	 */
230
-	protected function getViewId(Form $form) : string
222
+	protected function getViewId(Form $form): string
231 223
 	{
232 224
 		return $this->formHandler->getViewId($form);
233 225
 	}
@@ -238,7 +230,7 @@ class AppController extends AbstractController
238 230
 	 */
239 231
 	protected function getFormFieldErrorMessage(Form $form)
240 232
 	{
241
-		return $this->formHandler->getFormFieldErrorMessage($form);	
233
+		return $this->formHandler->getFormFieldErrorMessage($form);
242 234
 	}
243 235
 
244 236
 	/**
@@ -250,7 +242,7 @@ class AppController extends AbstractController
250 242
 	 * 
251 243
 	 * @deprecated use FormHandler::serializeFormFieldError instead
252 244
 	 */
253
-	protected function serializeFormFieldError($errors) : string
245
+	protected function serializeFormFieldError($errors): string
254 246
 	{
255 247
 		return $this->formHandler->serializeFormFieldError($errors);
256 248
 	}
@@ -258,37 +250,33 @@ class AppController extends AbstractController
258 250
 	/**
259 251
 	 * @deprecated use FormHandler::addFormError instead
260 252
 	 */
261
-	protected function addFormError(\Symfony\Component\Form\Form $form,$baseMessage,$templateMessage = null)
253
+	protected function addFormError(\Symfony\Component\Form\Form $form, $baseMessage, $templateMessage = null)
262 254
 	{
263
-		return $this->formHandler->addFormError($form,$baseMessage,$templateMessage);
255
+		return $this->formHandler->addFormError($form, $baseMessage, $templateMessage);
264 256
 	}
265 257
 
266
-	private function getUploadFile($token,$factory,$responseHeader)
258
+	private function getUploadFile($token, $factory, $responseHeader)
267 259
 	{
268 260
 		$tokenData = PhxCrypt::decrypt($token);
269
-		if (!is_array($tokenData))
270
-		{
261
+		if (!is_array($tokenData)) {
271 262
 			throw new \Exception();
272 263
 		}
273 264
 
274 265
 		$attribut = $tokenData[1];
275 266
 
276 267
 		$entityName = '\\Logipro\\Phoenix\\Entity\\' . $tokenData[0];
277
-		
268
+
278 269
 		$manager = $this->getDoctrine()->getManager();
279 270
 		$repository = $manager->getRepository($entityName);
280 271
 		$object = $repository->find($tokenData[2]);
281 272
 
282 273
 		$search = null;
283
-		if ($object)
284
-		{
274
+		if ($object) {
285 275
 			$mapping = $factory->fromObject($object);
286 276
 
287
-			foreach ($mapping as $map)
288
-			{
277
+			foreach ($mapping as $map) {
289 278
 				$attribut = $map->getFileNamePropertyName();
290
-				if ($attribut == $tokenData[1])
291
-				{
279
+				if ($attribut == $tokenData[1]) {
292 280
 					$search = $map;
293 281
 					break;
294 282
 				}
@@ -298,28 +286,27 @@ class AppController extends AbstractController
298 286
 		$getter = 'get' . ucfirst($attribut);
299 287
 		$path = $search->getUploadDestination() . DIRECTORY_SEPARATOR . $object->$getter();
300 288
 
301
-		return $this->creatFileResponse($path,$object->getDownloadName($attribut),$responseHeader);
289
+		return $this->creatFileResponse($path, $object->getDownloadName($attribut), $responseHeader);
302 290
 	}
303 291
 
304
-	public function donwloadUpload($token,PropertyMappingFactory $factory)
292
+	public function donwloadUpload($token, PropertyMappingFactory $factory)
305 293
 	{
306
-		return $this->getUploadFile($token,$factory,ResponseHeaderBag::DISPOSITION_ATTACHMENT);
294
+		return $this->getUploadFile($token, $factory, ResponseHeaderBag::DISPOSITION_ATTACHMENT);
307 295
 	}
308 296
 
309
-	public function drawUpload($token,PropertyMappingFactory $factory)
297
+	public function drawUpload($token, PropertyMappingFactory $factory)
310 298
 	{
311
-		return $this->getUploadFile($token,$factory,ResponseHeaderBag::DISPOSITION_INLINE);
299
+		return $this->getUploadFile($token, $factory, ResponseHeaderBag::DISPOSITION_INLINE);
312 300
 	}
313 301
 
314
-	public function creatFileResponse($path,$name,$disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT)
302
+	public function creatFileResponse($path, $name, $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT)
315 303
 	{
316
-		if (file_exists($path))
317
-		{
318
-			$fileName = PhxFileGuesser::guessDownloadName($path,$name);
319
-			$mime = PhxFileGuesser::guessMimeTypeByPath($path,$name);
304
+		if (file_exists($path)) {
305
+			$fileName = PhxFileGuesser::guessDownloadName($path, $name);
306
+			$mime = PhxFileGuesser::guessMimeTypeByPath($path, $name);
320 307
 
321 308
 			$response = new BinaryFileResponse($path);
322
-			$response->headers->set('Content-Type',$mime);
309
+			$response->headers->set('Content-Type', $mime);
323 310
 			$response->setContentDisposition(
324 311
 				$disposition,
325 312
 				$fileName
@@ -329,6 +316,26 @@ class AppController extends AbstractController
329 316
 		}
330 317
 		return null;
331 318
 	}
332
-	
333 319
 
334
-}
320
+	/**
321
+	 * Amélioration de file_put_contents
322
+	 * Ici la méthode crée les dossiers contenu dans le chemin
323
+	 * si ces derniers n'existent pas
324
+	 * 
325
+	 * @param string $fullPath
326
+	 * @param mixed $contents
327
+	 * @param int $flags
328
+	 */
329
+	protected function file_force_contents($fullPath, $contents, $flags = 0)
330
+	{
331
+		$parts = explode('/', $fullPath);
332
+		array_pop($parts);
333
+		$dir = implode('/', $parts);
334
+
335
+		if (!is_dir($dir)) {
336
+			mkdir($dir, 0777, true);
337
+		}
338
+
339
+		file_put_contents($fullPath, $contents, $flags);
340
+	}
341
+}

+ 75
- 95
src/Phoenix/Controller/Catalog/LoginController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\Catalog;
3 4
 
4 5
 use Logipro\Phoenix\Events;
@@ -32,11 +33,11 @@ use Logipro\Phoenix\Service\LoginService;
32 33
 class LoginController extends CatalogController
33 34
 {
34 35
 	protected function phxRenderView(string $view, array $parameters = array()): string
35
-    {
36
-		$view = str_replace($this->viewPath,'',$view);
36
+	{
37
+		$view = str_replace($this->viewPath, '', $view);
37 38
 		$view = $this->viewPath . $view;
38 39
 
39
-		return parent::phxRenderView($view,$parameters);
40
+		return parent::phxRenderView($view, $parameters);
40 41
 	}
41 42
 
42 43
 	private function createLoginForm()
@@ -63,16 +64,16 @@ class LoginController extends CatalogController
63 64
 	private function createRecoverForm()
64 65
 	{
65 66
 		$formBuilder = $this->createFormBuilder();
66
-		
67
+
67 68
 		$formBuilder->add('username', TextType::class, array(
68
-			'required' => true, 
69
+			'required' => true,
69 70
 			'label_format' => 'catalog_recover_%id%'
70 71
 		));
71 72
 
72 73
 		return $formBuilder->getForm();
73 74
 	}
74 75
 
75
-	public function manageLogin(Request $request, UserPasswordEncoderInterface $passwordEncoder,SessionInterface $session)
76
+	public function manageLogin(Request $request, UserPasswordEncoderInterface $passwordEncoder, SessionInterface $session)
76 77
 	{
77 78
 		$continue = $request->request->get('continue');
78 79
 
@@ -80,7 +81,7 @@ class LoginController extends CatalogController
80 81
 
81 82
 		$formLogin = $this->createLoginForm();
82 83
 
83
-		$formSubscribe = $this->createForm(CatalogSubscribeType::class,$person); 
84
+		$formSubscribe = $this->createForm(CatalogSubscribeType::class, $person);
84 85
 
85 86
 		$formRecover = $this->createRecoverForm();
86 87
 
@@ -95,14 +96,13 @@ class LoginController extends CatalogController
95 96
 			"form_recover" => $formRecover->createView()
96 97
 		);
97 98
 
98
-		$html = $this->phxRenderView('layouts/partials/header/modal-login-content.html.twig',$renderVars);
99
+		$html = $this->phxRenderView('layouts/partials/header/modal-login-content.html.twig', $renderVars);
99 100
 
100 101
 		$response['html'] = $html;
101 102
 		$response['nav'] = $this->phxRenderView('layouts/partials/header/header.html.twig');
102
-		
103
+
103 104
 		$response['success'] = false;
104
-		if ($this->getUser())
105
-		{
105
+		if ($this->getUser()) {
106 106
 			$response['success'] = true;
107 107
 		}
108 108
 		$response['continue'] = $continue;
@@ -110,63 +110,56 @@ class LoginController extends CatalogController
110 110
 		return $this->json($response);
111 111
 	}
112 112
 
113
-	public function validateSubscribe(Request $request,LearnerAccountGenerator $accountGenerator,ValidatorInterface $validator, EventDispatcherInterface $eventDispatcher,LoginService $loginService)
113
+	public function validateSubscribe(Request $request, LearnerAccountGenerator $accountGenerator, ValidatorInterface $validator, EventDispatcherInterface $eventDispatcher, LoginService $loginService)
114 114
 	{
115 115
 		// si l'utilisateur est connecté => erreur
116
-		if ($this->getLearnerSpaceUser())
117
-		{
116
+		if ($this->getLearnerSpaceUser()) {
118 117
 			throw $this->createAccessDeniedException($this->translate('error_403_message'));
119 118
 		}
120
-		
119
+
121 120
 		$person = new Person();
122 121
 
123 122
 		$service = $this->get('phxSettings');
124 123
 		$person->setSociety($service->getDefaultSociety());
125 124
 
126
-		$formSubscribe = $this->createForm(CatalogSubscribeType::class,$person); 
125
+		$formSubscribe = $this->createForm(CatalogSubscribeType::class, $person);
127 126
 
128 127
 		$succes = $error = null;
129 128
 
130 129
 		$response = array();
131
-		try
132
-		{
133
-			if ($request->isMethod('POST'))
134
-			{
130
+		try {
131
+			if ($request->isMethod('POST')) {
135 132
 				$formSubscribe->handleRequest($request);
136 133
 
137 134
 				// valide l'objet distant et remonte l'erreur sur le formulaire d'origine
138 135
 				$result = $validator->validate($person->getLearnerAccount());
139 136
 				$learnerAccountField = $formSubscribe->get('learnerAccount');
140
-				foreach ($result as $error)
141
-				{
142
-					$this->addFormError($learnerAccountField->get($error->getPropertyPath()),$error->getMessage());
137
+				foreach ($result as $error) {
138
+					$this->addFormError($learnerAccountField->get($error->getPropertyPath()), $error->getMessage());
143 139
 				}
144 140
 
145 141
 				// test rgpd
146 142
 				$rgpdField = $formSubscribe->get('rgpd');
147
-				if (!$rgpdField->getData())
148
-				{
143
+				if (!$rgpdField->getData()) {
149 144
 					// ajoute une erreur sur le champ
150 145
 					$message = 'la case doit être cochée';
151
-					$this->addFormError($rgpdField,$message);
146
+					$this->addFormError($rgpdField, $message);
152 147
 				}
153 148
 
154 149
 				// test le mot de passe
155 150
 				$plainPasswordField = $learnerAccountField->get('plainPassword')->get('first');
156 151
 				$plainPassword = $plainPasswordField->getData();
157
-				$errorMsg = PasswordValidator::renderError($this->get('translator'),$this->get('phxSettings'),$plainPassword);
158
-				if ($errorMsg != '')
159
-				{
160
-					$this->addFormError($plainPasswordField,$errorMsg);
152
+				$errorMsg = PasswordValidator::renderError($this->get('translator'), $this->get('phxSettings'), $plainPassword);
153
+				if ($errorMsg != '') {
154
+					$this->addFormError($plainPasswordField, $errorMsg);
161 155
 				}
162 156
 
163
-				if ($formSubscribe->isSubmitted() && $formSubscribe->isValid())
164
-				{
157
+				if ($formSubscribe->isSubmitted() && $formSubscribe->isValid()) {
165 158
 					$learnerAccount = $accountGenerator->generateLearnerAccount($person);
166 159
 
167 160
 					//$learnerAccount = $person->getLearnerAccount();
168 161
 					$encoder = $this->get('security.password_encoder');
169
-					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount,$plainPassword));
162
+					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount, $plainPassword));
170 163
 					$learnerAccount->setUsername($learnerAccountField->get('username')->getData());
171 164
 					$learnerAccount->setStatus(EnumAccountStatusType::STATUS_ENABLED);
172 165
 					$person->setLearnerAccount($learnerAccount);
@@ -176,40 +169,34 @@ class LoginController extends CatalogController
176 169
 
177 170
 					$manager->persist($person);
178 171
 					$manager->persist($learnerAccount);
179
-					
172
+
180 173
 					$manager->flush();
181 174
 
182 175
 					// connecte l'utilisateur
183
-					$loginService->loginCatalogUser($learnerAccount,$plainPassword);
176
+					$loginService->loginCatalogUser($learnerAccount, $plainPassword);
184 177
 
185 178
 					// envoi l'email
186 179
 					$event = new GenericEvent($person);
187
-					$eventDispatcher->dispatch($event,Events::LEARNER_SUBSCRIBE);
180
+					$eventDispatcher->dispatch($event, Events::LEARNER_SUBSCRIBE);
188 181
 
189 182
 					$succes = true;
190
-				}
191
-				else
192
-				{
183
+				} else {
193 184
 					$errors = $this->getFormFieldError($formSubscribe);
194 185
 					throw $this->createNotFoundException($this->serializeFormFieldError($errors));
195 186
 				}
196 187
 			}
197
-		}
198
-		catch (\Exception $exp)
199
-		{
188
+		} catch (\Exception $exp) {
200 189
 			$succes = false;
201
-			
190
+
202 191
 			$errors = $this->getFormFieldError($formSubscribe);
203 192
 
204 193
 			$response['error'] = $exp->getMessage();
205 194
 			$response['formError'] = array();
206 195
 
207 196
 			// parcours les erreurs
208
-			foreach ($errors as $fieldId => $errorField)
209
-			{
197
+			foreach ($errors as $fieldId => $errorField) {
210 198
 				$message = $this->getFormFieldErrorMessage($errorField);
211
-				if ($message)
212
-				{
199
+				if ($message) {
213 200
 					$response['formError'][$fieldId] = $message;
214 201
 				}
215 202
 			}
@@ -224,36 +211,29 @@ class LoginController extends CatalogController
224 211
 
225 212
 	public function validateRecover(Request $request, EventDispatcherInterface $eventDispatcher)
226 213
 	{
227
-		if ($this->getLearnerSpaceUser())
228
-		{
214
+		if ($this->getLearnerSpaceUser()) {
229 215
 			throw $this->createErrorException($this->translate('error_recover_password_logged'));
230 216
 		}
231 217
 
232 218
 		$error = $succes = null;
233
-		try
234
-		{
235
-			if ($request->isMethod('POST'))
236
-			{
219
+		try {
220
+			if ($request->isMethod('POST')) {
237 221
 				$formRecover = $this->createRecoverForm();
238 222
 				$formRecover->handleRequest($request);
239
-				if ($formRecover->isSubmitted() && $formRecover->isValid())
240
-				{
223
+				if ($formRecover->isSubmitted() && $formRecover->isValid()) {
241 224
 					// cherche le compte
242 225
 					$learnerAccountRepository = $this->getRepository(LearnerAccount::class);
243 226
 					$learnerAccountSearch = $learnerAccountRepository->loadUserByUsername($formRecover->get('username')->getData());
244
-					if (!$learnerAccountSearch)
245
-					{
227
+					if (!$learnerAccountSearch) {
246 228
 						throw $this->createNotFoundException();
247 229
 					}
248 230
 
249 231
 					// déclanche l'événement du mail
250 232
 					$event = new GenericEvent($learnerAccountSearch);
251
-					$eventDispatcher->dispatch($event,Events::LEARNER_RECOVER_ON_CATALOG);
233
+					$eventDispatcher->dispatch($event, Events::LEARNER_RECOVER_ON_CATALOG);
252 234
 				}
253 235
 			}
254
-		}
255
-		catch (\Exception $exp)
256
-		{
236
+		} catch (\Exception $exp) {
257 237
 			$error = $exp->getMessage();
258 238
 		}
259 239
 
@@ -268,8 +248,7 @@ class LoginController extends CatalogController
268 248
 
269 249
 	public function validateLogout(Request $request)
270 250
 	{
271
-		if (!$this->getLearnerSpaceUser())
272
-		{
251
+		if (!$this->getLearnerSpaceUser()) {
273 252
 			throw $this->createAccessDeniedException($this->translate('error_403_message'));
274 253
 		}
275 254
 
@@ -281,84 +260,85 @@ class LoginController extends CatalogController
281 260
 		$session->set('_security_' . $name, null);
282 261
 		$session->save();
283 262
 
284
-//		$request->getSession()->invalidate();
263
+		//		$request->getSession()->invalidate();
285 264
 
286 265
 		$response['nav'] = $this->phxRenderView('layouts/partials/header/header.html.twig');
287 266
 		return $this->json($response);
288 267
 	}
289 268
 
290
-	public function manageDefinePassword(Request $request,LoginService $loginService)
269
+	public function manageDefinePassword(Request $request, LoginService $loginService)
291 270
 	{
292
-		if ($this->getLearnerSpaceUser())
293
-		{
271
+		if ($this->getLearnerSpaceUser()) {
294 272
 			throw $this->createErrorException($this->translate('error_recover_password_logged'));
295 273
 		}
296 274
 		$token = $request->get('token');
275
+		if (!$token) {
276
+			throw $this->createNotFoundException($this->translate('error_403_message'));
277
+		}
297 278
 
298 279
 		$tokenData = PasswordRecoverNotifyLearner::decrytUrlArg($token);
299
-		if (!$tokenData)
300
-		{
301
-			throw $this->createNotFoundException($this->translate('error_403_message'));
280
+		if (!$tokenData) {
281
+			$response = new Response('', 404);
282
+
283
+			// token expiré
284
+			$parameters = array(
285
+				'text' => $this->translate('catalog_password_expired'),
286
+				'path' => 'catalog_homepage',
287
+				'go' => $this->translate('catalog_password_return')
288
+			);
289
+			return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters,$response);
302 290
 		}
303 291
 
304 292
 		$respository = $this->getRepository(LearnerAccount::class);
305 293
 		$learnerAccount = $respository->findOneBy(array('learnerAccountId' => $tokenData['learnerAccountId']));
306
-		if (!$learnerAccount)
307
-		{
294
+		if (!$learnerAccount) {
308 295
 			throw $this->createNotFoundException($this->translate('error_403_message'));
309 296
 		}
310
-		$form = $this->createForm(CatalogDefinePasswordType::class,$learnerAccount); 
297
+		$form = $this->createForm(CatalogDefinePasswordType::class, $learnerAccount);
311 298
 
312
-		try
313
-		{
314
-			if ($request->isMethod('POST'))
315
-			{
299
+		try {
300
+			if ($request->isMethod('POST')) {
316 301
 				$form->handleRequest($request);
317 302
 
318 303
 				// test le mot de passe
319 304
 				$plainPasswordField = $form->get('plainPassword')->get('first');
320 305
 				$plainPassword = $plainPasswordField->getData();
321
-				$errorMsg = PasswordValidator::renderError($this->get('translator'),$this->get('phxSettings'),$plainPassword);
322
-				if ($errorMsg != '')
323
-				{
324
-					$this->addFormError($plainPasswordField,$errorMsg);
306
+				$errorMsg = PasswordValidator::renderError($this->get('translator'), $this->get('phxSettings'), $plainPassword);
307
+				if ($errorMsg != '') {
308
+					$this->addFormError($plainPasswordField, $errorMsg);
325 309
 				}
326 310
 
327 311
 				// test le formulaire
328
-				if ($form->isSubmitted() && $form->isValid())
329
-				{
312
+				if ($form->isSubmitted() && $form->isValid()) {
330 313
 					$encoder = $this->get('security.password_encoder');
331
-					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount,$plainPassword));
314
+					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount, $plainPassword));
332 315
 
333 316
 					$manager = $this->getManager();
334 317
 					$manager->flush();
335 318
 
336 319
 					// logue l'utilisateur
337
-					$loginService->loginCatalogUser($learnerAccount,$plainPassword);
338
-					
320
+					$loginService->loginCatalogUser($learnerAccount, $plainPassword);
321
+
339 322
 					//$this->addFlash('success', "mot de passe redéfini");
340 323
 
341 324
 					// redirige sur le catalogue
342 325
 					$route = $tokenData['route'];
343
-					if ($route)
344
-					{
326
+					if ($route) {
345 327
 						$route = 'catalog_homepage';
346 328
 					}
347 329
 
348 330
 					$this->addFlash('success', $this->translate('new_password_defined'));
349
-					
331
+
350 332
 					return $this->redirectToRoute($route);
351 333
 				}
352 334
 			}
353
-		}
354
-		catch (\Exception $exp)
355
-		{
335
+		} catch (\Exception $exp) {
356 336
 			$error = $exp->getMessage();
357 337
 			$succes = false;
358 338
 		}
359 339
 
360 340
 		// affiche la vue pour définir le mot de passe
361
-		$parameters = array('token' => $token,'form' => $form->createView());
362
-		return $this->phxRender('catalog/pages/define_password.html.twig',$parameters);
341
+		$parameters = array('token' => $token, 'form' => $form->createView());
342
+		return $this->phxRender('catalog/pages/define_password.html.twig', $parameters);
363 343
 	}
364
-}
344
+}

+ 85
- 76
src/Phoenix/Controller/LearningSpace/LoginController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\LearningSpace;
3 4
 
4 5
 use Symfony\Component\HttpFoundation\Request;
@@ -14,6 +15,7 @@ use Logipro\Phoenix\Form\CatalogType\CatalogDefinePasswordType;
14 15
 use Logipro\Phoenix\Entity\Account\Constraints\Password\PasswordValidator;
15 16
 use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
16 17
 use Logipro\Phoenix\Service\LoginService;
18
+use Symfony\Component\HttpFoundation\Response;
17 19
 
18 20
 class LoginController extends LearningSpaceController
19 21
 {
@@ -50,133 +52,140 @@ class LoginController extends LearningSpaceController
50 52
 
51 53
 	public function manageRecoverPassword(Request $request, EventDispatcherInterface $eventDispatcher)
52 54
 	{
53
-			// création du formulaire
54
-			$formBuilder = $this->createFormBuilder();
55
-			$formBuilder->add('username', TextType::class);
56
-			$form = $formBuilder->getForm();
57
-	
58
-			// Traitement du POST
59
-			if ($request->isMethod('POST'))
60
-			{
61
-				$form->handleRequest($request);
62
-	
63
-				if ($form->isSubmitted() && $form->isValid())
64
-				{
65
-					$email = $form->get('username')->getData();
66
-	
67
-					$manager = $this->getDoctrine()->getManager();
68
-					$repository = $manager->getRepository(LearnerAccount::class);
69
-	
55
+		// création du formulaire
56
+		$formBuilder = $this->createFormBuilder();
57
+		$formBuilder->add('username', TextType::class);
58
+		$form = $formBuilder->getForm();
59
+
60
+		// Traitement du POST
61
+		if ($request->isMethod('POST')) {
62
+			$form->handleRequest($request);
63
+
64
+			if ($form->isSubmitted() && $form->isValid()) {
65
+				$email = $form->get('username')->getData();
66
+
67
+				$manager = $this->getDoctrine()->getManager();
68
+				$repository = $manager->getRepository(LearnerAccount::class);
69
+
70
+				try {
70 71
 					$learnerAccount = $repository->loadUserByUsername($email);
71
-					if ($learnerAccount)
72
-					{
73
-						//On déclenche l'event si l'adresse email est précisée
74
-						if ($learnerAccount->getEmail() != "")
75
-						{
76
-							$event = new GenericEvent($learnerAccount);
77
-							$eventDispatcher->dispatch($event,Events::LEARNER_RECOVER_PASSWORD);
78
-		
79
-							$this->addFlash('success', $this->get('translator')->trans('ls__success_password_recovery_email_sent'));
80
-						}
81
-						// sinon on invite l'utilisateur à contacter le support
82
-						else
83
-						{
84
-							$this->addFlash('success', $this->get('translator')->trans('ls__success_password_recovery_email_not_send'));
85
-						}
72
+				} catch (\Exception $exp) {
73
+
74
+					$response = new Response('', 409);
75
+
76
+					// token expiré
77
+					$parameters = array(
78
+						'text' => $exp->getMessage(),
79
+						'path' => 'ls_password_recover',
80
+						'go' => $this->translate('catalog_form_catalog_password_title')
81
+					);
82
+					return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters, $response);
83
+				}
84
+
85
+				if ($learnerAccount) {
86
+					//On déclenche l'event si l'adresse email est précisée
87
+					if ($learnerAccount->getEmail() != "") {
88
+						$event = new GenericEvent($learnerAccount);
89
+						$eventDispatcher->dispatch($event, Events::LEARNER_RECOVER_PASSWORD);
90
+
91
+						$this->addFlash('success', $this->get('translator')->trans('ls__success_password_recovery_email_sent'));
86 92
 					}
87
-					else
88
-					{
89
-						$this->addFlash('warning', $this->get('translator')->trans('ls__warning_user_not_seem_exist'));
93
+					// sinon on invite l'utilisateur à contacter le support
94
+					else {
95
+						$this->addFlash('error', $this->get('translator')->trans('ls__success_password_recovery_email_not_send'));
90 96
 					}
97
+				} else {
98
+					$this->addFlash('warning', $this->get('translator')->trans('ls__warning_user_not_seem_exist'));
91 99
 				}
92
-	
93
-				// Redirection pour vider le POST
94
-				return $this->redirectToRoute('ls_password_recover');
95 100
 			}
96
-	
97
-			$variables = array(
98
-				'form' => $form->createView(),
99
-			);
100
-	
101
-			return $this->phxRender('learning_space/pages/password/password-recover.html.twig', $variables);
101
+
102
+			// Redirection pour vider le POST
103
+			return $this->redirectToRoute('ls_password_recover');
104
+		}
105
+
106
+		$variables = array(
107
+			'form' => $form->createView(),
108
+		);
109
+
110
+		return $this->phxRender('learning_space/pages/password/password-recover.html.twig', $variables);
102 111
 	}
103 112
 
104 113
 
105
-	public function manageDefinePassword(Request $request,LoginService $loginService)
114
+	public function manageDefinePassword(Request $request, LoginService $loginService)
106 115
 	{
107
-		if ($this->getUser())
108
-		{
116
+		if ($this->getUser()) {
109 117
 			throw $this->createErrorException($this->translate('error_recover_password_logged'));
110 118
 		}
111 119
 		$token = $request->get('token');
112 120
 
113
-		$tokenData = PasswordRecoverNotifyLearner::decrytUrlArg($token);
114
-		if (!$tokenData)
115
-		{
121
+		if (!$token) {
116 122
 			throw $this->createNotFoundException($this->translate('error_403_message'));
117 123
 		}
118 124
 
125
+		$tokenData = PasswordRecoverNotifyLearner::decrytUrlArg($token);
126
+		if (!$tokenData) {
127
+			$response = new Response('', 404);
128
+			// token expiré
129
+			$parameters = array(
130
+				'text' => $this->translate('ls_password_expired'),
131
+				'path' => 'ls_homepage',
132
+				'go' => $this->translate('ls_password_return')
133
+			);
134
+			return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters, $response);
135
+		}
136
+
119 137
 		$respository = $this->getRepository(LearnerAccount::class);
120 138
 		$learnerAccount = $respository->findOneBy(array('learnerAccountId' => $tokenData['learnerAccountId']));
121
-		if (!$learnerAccount)
122
-		{
139
+		if (!$learnerAccount) {
123 140
 			throw $this->createNotFoundException($this->translate('error_403_message'));
124 141
 		}
125
-		$form = $this->createForm(CatalogDefinePasswordType::class,$learnerAccount); 
142
+		$form = $this->createForm(CatalogDefinePasswordType::class, $learnerAccount);
126 143
 
127
-		try
128
-		{
129
-			if ($request->isMethod('POST'))
130
-			{
144
+		try {
145
+			if ($request->isMethod('POST')) {
131 146
 				$form->handleRequest($request);
132 147
 
133 148
 				// test le mot de passe
134 149
 				$plainPasswordField = $form->get('plainPassword')->get('first');
135 150
 				$plainPassword = $plainPasswordField->getData();
136
-				$errorMsg = PasswordValidator::renderError($this->get('translator'),$this->get('phxSettings'),$plainPassword);
137
-				if ($errorMsg != '')
138
-				{
139
-					$this->addFormError($plainPasswordField,$errorMsg);
151
+				$errorMsg = PasswordValidator::renderError($this->get('translator'), $this->get('phxSettings'), $plainPassword);
152
+				if ($errorMsg != '') {
153
+					$this->addFormError($plainPasswordField, $errorMsg);
140 154
 				}
141 155
 
142 156
 				// test le formulaire
143
-				if ($form->isSubmitted() && $form->isValid())
144
-				{
157
+				if ($form->isSubmitted() && $form->isValid()) {
145 158
 					$oldPassword = $learnerAccount->getPassword();
146 159
 					$encoder = $this->get('security.password_encoder');
147
-					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount,$plainPassword));
160
+					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount, $plainPassword));
148 161
 
149 162
 					$manager = $this->getManager();
150 163
 					$manager->flush();
151 164
 
152 165
 					if ($oldPassword == '') {
153 166
 						$this->addFlash('success', $this->translate('password_defined'));
154
-					}
155
-					else {
156
-						$this->addFlash('success',$this->translate('new_password_defined'));
167
+					} else {
168
+						$this->addFlash('success', $this->translate('new_password_defined'));
157 169
 					}
158 170
 
159 171
 					// logue l'utilisateur
160
-                    $loginService->loginLearningSpaceUser($learnerAccount,$plainPassword);
172
+					$loginService->loginLearningSpaceUser($learnerAccount, $plainPassword);
161 173
 
162 174
 					// redirige sur le catalogue
163 175
 					$route = $tokenData['route'];
164
-					if ($route == "")
165
-					{
176
+					if ($route == "") {
166 177
 						$route = 'ls_homepage';
167 178
 					}
168 179
 					return $this->redirectToRoute($route);
169 180
 				}
170 181
 			}
171
-		}
172
-		catch (\Exception $exp)
173
-		{
182
+		} catch (\Exception $exp) {
174 183
 			$error = $exp->getMessage();
175 184
 			$succes = false;
176 185
 		}
177 186
 
178 187
 		// affiche la vue pour définir le mot de passe
179
-		$parameters = array('token' => $token,'form' => $form->createView(), 'learnerAccount' => $learnerAccount);
180
-		return $this->phxRender('learning_space/pages/password/define_password.html.twig',$parameters);
188
+		$parameters = array('token' => $token, 'form' => $form->createView(), 'learnerAccount' => $learnerAccount);
189
+		return $this->phxRender('learning_space/pages/password/define_password.html.twig', $parameters);
181 190
 	}
182
-}
191
+}

+ 23
- 11
src/Phoenix/Controller/NewBackOffice/Admin/LoginController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\NewBackOffice\Admin;
3 4
 
4 5
 use Symfony\Component\HttpFoundation\Request;
@@ -17,6 +18,7 @@ use Logipro\Phoenix\Entity\Account\LearnerAccount;
17 18
 use Symfony\Component\Security\Http\Firewall\ContextListener;
18 19
 use Symfony\Component\HttpKernel\KernelInterface;
19 20
 use Logipro\Phoenix\Service\LoginService;
21
+use Symfony\Component\HttpFoundation\Response;
20 22
 
21 23
 class LoginController extends BackOfficeAdminController
22 24
 {
@@ -46,7 +48,7 @@ class LoginController extends BackOfficeAdminController
46 48
             'last_username' => $lastUsername,
47 49
             'error'         => $error,
48 50
             'site_name'     => $siteName,
49
-            'site_logo_path'=> $siteLogoPath,
51
+            'site_logo_path' => $siteLogoPath,
50 52
         ));
51 53
     }
52 54
 
@@ -60,7 +62,7 @@ class LoginController extends BackOfficeAdminController
60 62
         if ($this->getUser()) {
61 63
             throw $this->createNotFoundException($this->translate('error_403_message'));
62 64
         }
63
-        
65
+
64 66
         // Formulaire
65 67
         $formBuilder = $this->createFormBuilder();
66 68
         $formBuilder->add('email', EmailType::class);
@@ -80,7 +82,7 @@ class LoginController extends BackOfficeAdminController
80 82
                 if ($user) {
81 83
                     //On déclenche l'event
82 84
                     $event = new GenericEvent($user);
83
-                    $eventDispatcher->dispatch($event,Events::USER_RECOVER_PASSWORD);
85
+                    $eventDispatcher->dispatch($event, Events::USER_RECOVER_PASSWORD);
84 86
 
85 87
                     $this->addFlash('success', $this->get('translator')->trans('success_password_recovery_email_sent'));
86 88
                 } else {
@@ -106,23 +108,33 @@ class LoginController extends BackOfficeAdminController
106 108
         $variables = array(
107 109
             'form' => $form->createView(),
108 110
             'site_name'     => $siteName,
109
-            'site_logo_path'=> $siteLogoPath,
111
+            'site_logo_path' => $siteLogoPath,
110 112
         );
111 113
 
112 114
         return $this->phxRender('back-office/pages/password/password-recover.html.twig', $variables);
113 115
     }
114 116
 
115 117
 
116
-    public function manageDefinePassword(Request $request,LoginService $loginService)
118
+    public function manageDefinePassword(Request $request, LoginService $loginService)
117 119
     {
118 120
         if ($this->getUser()) {
119 121
             throw $this->createNotFoundException($this->translate('error_403_message'));
120 122
         }
121 123
         $token = $request->get('token');
124
+        if (!$token) {
125
+            throw $this->createNotFoundException($this->translate('error_403_message'));
126
+        }
122 127
 
123 128
         $tokenData = PasswordRecoverNotifyUser::decrytUrlArg($token);
124 129
         if (!$tokenData) {
125
-            throw $this->createNotFoundException($this->translate('error_403_message'));
130
+            $response = new Response('', 404);
131
+            // token expiré
132
+            $parameters = array(
133
+                'text' => $this->translate('bo_password_expired'),
134
+                'path' => 'bo_homepage',
135
+                'go' => $this->translate('back_homepage')
136
+            );
137
+            return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters, $response);
126 138
         }
127 139
 
128 140
         $respository = $this->getRepository(User::class);
@@ -143,10 +155,10 @@ class LoginController extends BackOfficeAdminController
143 155
                 if ($errorMsg != '') {
144 156
                     $this->addFormError($plainPasswordField, $errorMsg);
145 157
                 }
146
-                
158
+
147 159
                 // test le formulaire
148 160
                 if ($form->isSubmitted() && $form->isValid()) {
149
-                    $old = $user->getPassword() ;
161
+                    $old = $user->getPassword();
150 162
                     $plainPassword = $form->get('plainPassword')->getData();
151 163
                     $encoder = $this->get('security.password_encoder');
152 164
                     $user->setPassword($encoder->encodePassword($user, $plainPassword));
@@ -167,11 +179,11 @@ class LoginController extends BackOfficeAdminController
167 179
                             'button_text' => false,
168 180
                         );
169 181
                     }
170
-                    
182
+
171 183
                     $this->addToastFlash('success', $parameters);
172 184
 
173 185
                     // logue l'utilisateur
174
-                    $loginService->loginBackOfficeUser($user,$plainPassword);
186
+                    $loginService->loginBackOfficeUser($user, $plainPassword);
175 187
 
176 188
                     $route = $tokenData['route'];
177 189
                     if ($route == "") {
@@ -206,7 +218,7 @@ class LoginController extends BackOfficeAdminController
206 218
             'form' => $form->createView(),
207 219
             'user' => $user,
208 220
             'site_name'     => $siteName,
209
-            'site_logo_path'=> $siteLogoPath,
221
+            'site_logo_path' => $siteLogoPath,
210 222
         );
211 223
         return $this->phxRender('back-office/pages/password/define_password.html.twig', $parameters);
212 224
     }

+ 100
- 111
src/Phoenix/Controller/NewBackOffice/Admin/Settings/PreviewEmailController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\NewBackOffice\Admin\Settings;
3 4
 
4 5
 use Symfony\Component\HttpFoundation\Response;
@@ -14,7 +15,7 @@ class PreviewEmailController extends SettingsController
14 15
 	protected function createBreadcrumb()
15 16
 	{
16 17
 		$breadcrumb = parent::createBreadcrumb();
17
-		$breadcrumb->addItem('breadcrumb_settings',$this->generateUrl('nbo_settings'));
18
+		$breadcrumb->addItem('breadcrumb_settings', $this->generateUrl('nbo_settings'));
18 19
 
19 20
 		return $breadcrumb;
20 21
 	}
@@ -23,29 +24,29 @@ class PreviewEmailController extends SettingsController
23 24
 	 */
24 25
 	private function registerEmails()
25 26
 	{
26
-	// -- liste les emails disponible par espace
27
+		// -- liste les emails disponible par espace
27 28
 		// espace back office
28 29
 		$emailsBackOffice[] = $this->createEmailEntry(
29 30
 			'back_office/PasswordRecover.html.twig',
30
-			array('Identification',$this->translate('mail_password_recover_subject')),
31
+			array('Identification', $this->translate('mail_password_recover_subject')),
31 32
 			$this->translate('mail_password_recover_description'),
32 33
 			$this->translate('mail_destinary_user')
33 34
 		);
34 35
 		$emailsBackOffice[] = $this->createEmailEntry(
35 36
 			'back_office/AccessPlatform.html.twig',
36
-			array($this->translate('menu_settings'),$this->translate('title_user_accounts'),$this->translate('action_add_user')),
37
+			array($this->translate('menu_settings'), $this->translate('title_user_accounts'), $this->translate('action_add_user')),
37 38
 			$this->translate('mail_access_platform_subject_description'),
38 39
 			$this->translate('mail_destinary_user')
39 40
 		);
40 41
 		$emailsBackOffice[] = $this->createEmailEntry(
41 42
 			'back_office/InviteSession.html.twig',
42
-			array($this->translate('menu_follow_sessions'),$this->translate('action_explorer'),$this->translate('action_register_learner')),
43
+			array($this->translate('menu_follow_sessions'), $this->translate('action_explorer'), $this->translate('action_register_learner')),
43 44
 			$this->translate('mail_invite_session_subject_description'),
44 45
 			$this->translate('mail_destinary_learner')
45 46
 		);
46 47
 		$emailsBackOffice[] = $this->createEmailEntry(
47 48
 			'back_office/InviteSessionOpen.html.twig',
48
-			array($this->translate('menu_follow_sessions'),$this->translate('action_explorer'),$this->translate('action_register_learner')),
49
+			array($this->translate('menu_follow_sessions'), $this->translate('action_explorer'), $this->translate('action_register_learner')),
49 50
 			$this->translate('mail_invite_session_open_subject_description'),
50 51
 			$this->translate('mail_destinary_learner')
51 52
 		);
@@ -54,14 +55,14 @@ class PreviewEmailController extends SettingsController
54 55
 			array($this->translate('email_automatic')),
55 56
 			$this->translate('mail_verif_planning_session_subject_description'),
56 57
 			$this->translate('mail_destinary_user')
57
-		);		
58
+		);
58 59
 
59 60
 
60 61
 
61 62
 		// espace apprenant
62 63
 		$emailsLearningSpace[] = $this->createEmailEntry(
63 64
 			'learning_space/RecoverPassword.html.twig',
64
-			array('Identification',$this->translate('ls__mail_password_recover_subject',null,[],'recoverPassword')),
65
+			array('Identification', $this->translate('ls__mail_password_recover_subject', null, [], 'recoverPassword')),
65 66
 			$this->translate('ls__mail_password_recover_subject_description'),
66 67
 			$this->translate('mail_destinary_learner')
67 68
 		);
@@ -69,68 +70,67 @@ class PreviewEmailController extends SettingsController
69 70
 		// espace catalogue
70 71
 		$emailsCatalog[] = $this->createEmailEntry(
71 72
 			'catalog/RecoverPassword.html.twig',
72
-			array('Identification',$this->translate('catalog_form_catalog_password_title')),
73
+			array('Identification', $this->translate('catalog_form_catalog_password_title')),
73 74
 			$this->translate('ls__mail_create_account_description'),
74 75
 			$this->translate('mail_destinary_learner')
75 76
 		);
76 77
 		$emailsCatalog[] = $this->createEmailEntry(
77 78
 			'catalog/LearnerAccountSubscribe.dpo.html.twig',
78
-			array('Connexion/inscription (popup)','Inscription'),
79
+			array('Connexion/inscription (popup)', 'Inscription'),
79 80
 			$this->translate('catalog_email_create_account_dpo_description'),
80 81
 			$this->translate('mail_destinary_dpo')
81 82
 		);
82 83
 		$emailsCatalog[] = $this->createEmailEntry(
83 84
 			'catalog/LearnerAccountSubscribe.html.twig',
84
-			array('Connexion/inscription (popup)','Inscription'),
85
+			array('Connexion/inscription (popup)', 'Inscription'),
85 86
 			$this->translate('catalog_email_create_account_description'),
86 87
 			$this->translate('mail_destinary_learner')
87 88
 		);
88 89
 		$emailsCatalog[] = $this->createEmailEntry(
89 90
 			'catalog/LearnerAccountSubscribe.to.html.twig',
90
-			array('Connexion/inscription (popup)','Inscription'),
91
+			array('Connexion/inscription (popup)', 'Inscription'),
91 92
 			$this->translate('catalog_email_create_account_to_description'),
92 93
 			$this->translate('mail_destinary_training_organization')
93 94
 		);
94 95
 		$emailsCatalog[] = $this->createEmailEntry(
95 96
 			'catalog/AutomaticTrainingSubscribe.html.twig',
96
-			array($this->translate('title_catalog'),'formation',$this->translate('action_register_session')),
97
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_register_session')),
97 98
 			$this->translate('mail_automatic_training_subscribe_subject_description'),
98 99
 			$this->translate('mail_destinary_training_organization')
99 100
 		);
100 101
 		$emailsCatalog[] = $this->createEmailEntry(
101 102
 			'catalog/ManualTrainingOrganizationResponse.html.twig',
102
-			array($this->translate('title_catalog'),'formation',$this->translate('action_register_session')),
103
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_register_session')),
103 104
 			$this->translate('mail_manual_training_organization_response_description'),
104 105
 			$this->translate('mail_destinary_learner')
105 106
 		);
106 107
 		$emailsCatalog[] = $this->createEmailEntry(
107 108
 			'catalog/ManualTrainingSubscribe.html.twig',
108
-			array($this->translate('title_catalog'),'formation',$this->translate('action_register_session')),
109
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_register_session')),
109 110
 			$this->translate('mail_manual_training_subscribe_subject_description'),
110 111
 			$this->translate('mail_destinary_training_organization')
111 112
 		);
112
-		
113
+
113 114
 		$emailsCatalog[] = $this->createEmailEntry(
114 115
 			'catalog/PaymentSessionFixedAutoAcceptance.html.twig',
115
-			array($this->translate('title_catalog'),'formation',$this->translate('action_payment_session')),
116
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_payment_session')),
116 117
 			$this->translate('mail_payment_session_fixed_auto_acceptance_subject_description'),
117 118
 			$this->translate('mail_destinary_training_organization')
118 119
 		);
119 120
 		$emailsCatalog[] = $this->createEmailEntry(
120 121
 			'catalog/PaymentSessionFixedManualAcceptance.html.twig',
121
-			array($this->translate('title_catalog'),'formation',$this->translate('action_payment_session')),
122
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_payment_session')),
122 123
 			$this->translate('mail_payment_session_fixed_manual_acceptance_subject_description'),
123 124
 			$this->translate('mail_destinary_training_organization')
124 125
 		);
125 126
 		$emailsCatalog[] = $this->createEmailEntry(
126 127
 			'catalog/PaymentSessionOpen.html.twig',
127
-			array($this->translate('title_catalog'),'formation',$this->translate('action_payment_session')),
128
+			array($this->translate('title_catalog'), 'formation', $this->translate('action_payment_session')),
128 129
 			$this->translate('mail_payment_session_open_subject_description'),
129 130
 			$this->translate('mail_destinary_training_organization')
130 131
 		);
131
-	
132
-		return array
133
-		(
132
+
133
+		return array(
134 134
 			'emails_back_office' => $emailsBackOffice,
135 135
 			'emails_catalogue' => $emailsCatalog,
136 136
 			'emails_learning_space' => $emailsLearningSpace
@@ -140,16 +140,16 @@ class PreviewEmailController extends SettingsController
140 140
 	/**
141 141
 	 * créé un email pour la liste twig
142 142
 	 */
143
-	private function createEmailEntry($filePath,$entry,$description,$destinary)
143
+	private function createEmailEntry($filePath, $entry, $description, $destinary)
144 144
 	{
145 145
 		$base64Path =  base64_encode($filePath);
146 146
 		return array(
147 147
 			'base64' => $base64Path,
148
-			'subject' => $this->renderB64Block($base64Path,'subject_layout'),
148
+			'subject' => $this->renderB64Block($base64Path, 'subject_layout'),
149 149
 			'destinary' => $destinary,
150 150
 			'description' => $description,
151 151
 			'url' => $this->generateUrl('nbo_draw_email', array('base64Path' => $base64Path)),
152
-			'entry' => implode(' > ',$entry)
152
+			'entry' => implode(' > ', $entry)
153 153
 		);
154 154
 	}
155 155
 
@@ -163,8 +163,8 @@ class PreviewEmailController extends SettingsController
163 163
 		$breadcrumb = $this->createBreadcrumb();
164 164
 		$breadcrumb->addActiveItem($this->translate('bo_param_email_list'));
165 165
 		$variables['breadcrumb'] = $breadcrumb;
166
-		
167
-		return $this->phxRender($this->viewPath . 'list/lists.html.twig',$variables);
166
+
167
+		return $this->phxRender($this->viewPath . 'list/lists.html.twig', $variables);
168 168
 	}
169 169
 
170 170
 	/**
@@ -177,12 +177,9 @@ class PreviewEmailController extends SettingsController
177 177
 
178 178
 		// recherche parmis les emails l'email correspondant
179 179
 		$emailsAllSpaces = $this->registerEmails();
180
-		foreach ($emailsAllSpaces as $emailsBySpace)
181
-		{
182
-			foreach ($emailsBySpace as $email)
183
-			{
184
-				if ($email['base64'] == $base64Path)
185
-				{
180
+		foreach ($emailsAllSpaces as $emailsBySpace) {
181
+			foreach ($emailsBySpace as $email) {
182
+				if ($email['base64'] == $base64Path) {
186 183
 					$subject = $email['subject'];
187 184
 					$description = $email['description'];
188 185
 					$entry = $email['entry'];
@@ -191,8 +188,7 @@ class PreviewEmailController extends SettingsController
191 188
 		}
192 189
 
193 190
 		// fichier non reconnu
194
-		if ($subject == "" &&  $description == "" && $entry == "")
195
-		{
191
+		if ($subject == "" &&  $description == "" && $entry == "") {
196 192
 			throw $this->createNotFoundException();
197 193
 		}
198 194
 
@@ -200,11 +196,10 @@ class PreviewEmailController extends SettingsController
200 196
 		$url = $this->generateUrl('nbo_draw_email_content', array('base64Path' => $base64Path));
201 197
 
202 198
 		$breadcrumb = $this->createBreadcrumb();
203
-		$breadcrumb->addRouteItem($this->translate('bo_param_email_list'),'nbo_draw_emails_list');
199
+		$breadcrumb->addRouteItem($this->translate('bo_param_email_list'), 'nbo_draw_emails_list');
204 200
 		$breadcrumb->addActiveItem($subject);
205 201
 
206
-		$variables = array
207
-		(
202
+		$variables = array(
208 203
 			'iframe_url' => $url,
209 204
 			'subject' => $subject,
210 205
 			'description' => $description,
@@ -213,15 +208,15 @@ class PreviewEmailController extends SettingsController
213 208
 			'main_menu_active' => self::MAIN_MENU_CREATE,
214 209
 			'secondary_menu_active' => self::SECONDARY_MENU_LEARNING_PATH,
215 210
 		);
216
-		return $this->phxRender($this->viewPath . 'email.html.twig',$variables);
211
+		return $this->phxRender($this->viewPath . 'email.html.twig', $variables);
217 212
 	}
218 213
 
219 214
 	/**
220 215
 	 * Affiche le contenu d'un email
221 216
 	 */
222
-	public function drawContent(string $base64Path,Request $request)
217
+	public function drawContent(string $base64Path, Request $request)
223 218
 	{
224
-		$block = $this->renderB64Block($base64Path,'message_layout');
219
+		$block = $this->renderB64Block($base64Path, 'message_layout');
225 220
 
226 221
 		return new Response($block);
227 222
 	}
@@ -234,10 +229,10 @@ class PreviewEmailController extends SettingsController
234 229
 	 * 
235 230
 	 * @eturn string
236 231
 	 */
237
-	protected function renderB64Block($base64Path,$blockName)
232
+	protected function renderB64Block($base64Path, $blockName)
238 233
 	{
239 234
 		$path = \base64_decode($base64Path);
240
-		
235
+
241 236
 		$settingService = $this->get('phxSettings');
242 237
 
243 238
 		$session = new SessionFixed();
@@ -255,8 +250,7 @@ class PreviewEmailController extends SettingsController
255 250
 		$rootPath = realpath($this->get('kernel')->getRootDir() . '/../../../') . '/';
256 251
 
257 252
 		$emailTemplatePath = $rootPath . 'templates/emails/' . $path;
258
-		if (!is_file($emailTemplatePath))
259
-		{
253
+		if (!is_file($emailTemplatePath)) {
260 254
 			return '';
261 255
 		}
262 256
 
@@ -267,102 +261,97 @@ class PreviewEmailController extends SettingsController
267 261
 			'#{%((?!%}).)*%}|{{((?!}}).)*}}#s',
268 262
 		);
269 263
 
270
-		foreach ($patterns as $pattern)
271
-		{
272
-			$content = preg_replace_callback($pattern,function($matches)
273
-			{	
274
-				$needle = $matches[0];
264
+		foreach ($patterns as $pattern) {
265
+			$content = preg_replace_callback(
266
+				$pattern,
267
+				function ($matches) {
268
+					$needle = $matches[0];
275 269
 
276
-				if (is_null($this->previousNeedle)) {
277
-					$this->previousNeedle = $needle;
278
-				}
270
+					if (is_null($this->previousNeedle)) {
271
+						$this->previousNeedle = $needle;
272
+					}
279 273
 
280
-				// Cas particulier pour les sujets qui doivent etre interprété
281
-				/*$search = array('block[\s]{0,}subject');
274
+					// Cas particulier pour les sujets qui doivent etre interprété
275
+					/*$search = array('block[\s]{0,}subject');
282 276
 				if (preg_match('#' . implode('|',$search) . '#',$this->previousNeedle))
283 277
 				{
284 278
 					$this->previousNeedle = $needle;
285 279
 					return $needle;
286 280
 				}*/
287 281
 
288
-				// tag de suppression
289
-				
290
-				$search = array('[^a-z]set');
291
-				if (preg_match('#' . implode('|',$search) . '#',$needle))
292
-				{
293
-					$this->previousNeedle = $needle;
294
-					return '';
295
-				}
296
-				// tag de commencement
297
-				$search = array('extends','block','embed');
298
-				if (preg_match('#' . implode('|',$search) . '#',$needle))
299
-				{
300
-					$this->previousNeedle = $needle;
301
-					return $needle;
302
-				}
282
+					// tag de suppression
283
+
284
+					$search = array('[^a-z]set');
285
+					if (preg_match('#' . implode('|', $search) . '#', $needle)) {
286
+						$this->previousNeedle = $needle;
287
+						return '';
288
+					}
289
+					// tag de commencement
290
+					$search = array('extends', 'block', 'embed');
291
+					if (preg_match('#' . implode('|', $search) . '#', $needle)) {
292
+						$this->previousNeedle = $needle;
293
+						return $needle;
294
+					}
295
+
296
+					// tag de commentaire
297
+					$search = array('{\#', '\#}');
298
+					if (preg_match('#' . implode('|', $search) . '#', $needle)) {
299
+						$this->previousNeedle = $needle;
300
+						return $needle;
301
+					}
302
+
303
+					// tag de fin
304
+					$search = array('endblock', 'endembed');
305
+					if (preg_match('#' . implode('|', $search) . '#', $needle)) {
306
+						$this->previousNeedle = $needle;
307
+						return $needle;
308
+					}
309
+
310
+					// autre : tranductions etc...
311
+					$search = array(
312
+						// traductions trans
313
+						'{{[\s]{0,}["|\'][a-zA-Z_]+["|\'][\s]{0,}\|[\s]{0,}trans'
314
+					);
315
+
316
+					if (preg_match('#' . implode('|', $search) . '#', $needle)) {
317
+						$needle = preg_replace('#trans\((.*),{0,}["|\']([a-zA-Z_]+)["|\'][\s]{0,}#', 'trans({\'%backline%\':\'<br/>\'},"$2"', $needle);
318
+						return $needle;
319
+					}
303 320
 
304
-				// tag de commentaire
305
-				$search = array('{\#','\#}');
306
-				if (preg_match('#' . implode('|',$search) . '#',$needle))
307
-				{
308
-					$this->previousNeedle = $needle;
309
-					return $needle;
310
-				}
311
-				
312
-				// tag de fin
313
-				$search = array('endblock','endembed');
314
-				if (preg_match('#' . implode('|',$search) . '#',$needle))
315
-				{
316 321
 					$this->previousNeedle = $needle;
317
-					return $needle;
318
-				}
319 322
 
320
-				// autre : tranductions etc...
321
-				$search = array(
322
-					// traductions trans
323
-					'{{[\s]{0,}["|\'][a-zA-Z_]+["|\'][\s]{0,}\|[\s]{0,}trans'
324
-				);
325
-				
326
-				if (preg_match('#' . implode('|',$search) . '#',$needle))
327
-				{
328
-					$needle = preg_replace('#trans\((.*),{0,}["|\']([a-zA-Z_]+)["|\'][\s]{0,}#','trans({\'%backline%\':\'<br/>\'},"$2"',$needle);
329
-					return $needle;
330
-				}
331
-
332
-				$this->previousNeedle = $needle;
333
-
334
-				return '{% verbatim %}' . $needle . '{% endverbatim %}';
335
-			},
336
-			$content);
323
+					return '{% verbatim %}' . $needle . '{% endverbatim %}';
324
+				},
325
+				$content
326
+			);
337 327
 		}
338 328
 
339 329
 		// créé un fichier temp
340 330
 		$tmpAbsoluteDir = $rootPath . 'templates/';
341
-		
331
+
342 332
 		$name = uniqid();
343 333
 		$tmpRelativePath = 'temp/' . $name;
344
-		
334
+
345 335
 
346 336
 		$newPath = $tmpAbsoluteDir . $tmpRelativePath;
347
-		\file_put_contents($newPath,$content);
337
+		$this->file_force_contents($newPath, $content);
348 338
 
349
-		$block = $this->renderBlockView($blockName,$tmpRelativePath,$variables);
339
+		$block = $this->renderBlockView($blockName, $tmpRelativePath, $variables);
350 340
 
351 341
 		// supprime le fichier temp
352 342
 		unlink($newPath);
353
-		
354
-		return $block;
355 343
 
344
+		return $block;
356 345
 	}
357 346
 
358 347
 	/**
359
-     * étend les variables pour tous les rendus de la classe
360
-     * à surcharger pour chacun des espaces
361
-     */
348
+	 * étend les variables pour tous les rendus de la classe
349
+	 * à surcharger pour chacun des espaces
350
+	 */
362 351
 	protected function extendsRenderVars(&$parameters)
363 352
 	{
364 353
 		parent::extendsRenderVars($parameters);
365 354
 
366 355
 		$parameters['main_menu_active'] = self::MAIN_MENU_SETTINGS;
367 356
 	}
368
-}
357
+}

+ 15
- 18
src/Phoenix/Repository/LearningSpace/LearnerAccountRepository.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Repository\LearningSpace;
3 4
 
4 5
 use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
@@ -25,43 +26,39 @@ class LearnerAccountRepository extends ServiceEntityRepository implements UserLo
25 26
 	}
26 27
 
27 28
 	public function loadUserByUsername($username)
28
-    {
29
+	{
29 30
 		// recherche l'utilisateur par identifiant
30 31
 		$query = $this->createQueryBuilder('u')
31
-		->where('u.username = :username')
32
-		->setParameter('username', $username)
33
-		->getQuery();
32
+			->where('u.username = :username')
33
+			->setParameter('username', $username)
34
+			->getQuery();
34 35
 
35 36
 		// si 1 seul utilisateur trouvé => on le retourne
36 37
 		// si aucun ou plusieur, on regarde l'email
37 38
 		$users = $query->execute();
38
-		if ($users)
39
-		{
39
+		if ($users) {
40 40
 			// multi utilisateur = erreur
41
-			if (count($users) == 1)
42
-			{
41
+			if (count($users) == 1) {
43 42
 				return reset($users);
44 43
 			}
45 44
 		}
46 45
 
47 46
 		// recherche l'utilisateur par email
48
- 		$query = $this->createQueryBuilder('u')
49
-		->where('u.email = :email')
50
-		->setParameter('email', $username)
51
-		->getQuery();
47
+		$query = $this->createQueryBuilder('u')
48
+			->where('u.email = :email')
49
+			->setParameter('email', $username)
50
+			->getQuery();
52 51
 
53 52
 		$users = $query->execute();
54
-		if (!$users)
55
-		{
53
+		if (!$users) {
56 54
 			return null;
57 55
 		}
58 56
 
59 57
 		// multi utilisateur = erreur
60
-		if (count($users) > 1)
61
-		{
62
-            throw new \Exception('Cette adresse email correspond à plusieurs utilisateurs, veuillez saisir votre identifiant.');
58
+		if (count($users) > 1) {
59
+			throw new \Exception('Cette adresse email correspond à plusieurs utilisateurs, veuillez saisir votre identifiant.');
63 60
 		}
64 61
 
65 62
 		return reset($users);
66
-    }
63
+	}
67 64
 }

+ 26
- 16
src/Phoenix/Service/Monitoring/MonitoringExportHandler.php View File

@@ -547,7 +547,7 @@ class MonitoringExportHandler
547 547
         $learner = $data['learner'];
548 548
         $sheet->setCellValue('A1', $this->translator->trans('title_monitoring_title_learner_sessions_list', array(
549 549
             '%learnerName%' => $learner->getFullName()
550
-        )))->mergeCells('A1:H1');
550
+        )))->mergeCells('A1:I1');
551 551
 
552 552
         $sheet->getStyle('A1')->applyFromArray($this->exportHandler->getStyleTitle());
553 553
 
@@ -560,6 +560,7 @@ class MonitoringExportHandler
560 560
             $this->translator->trans('column_monitoring_session_learner_completion'),
561 561
             $this->translator->trans('column_monitoring_session_learner_time'),
562 562
             $this->translator->trans('column_monitoring_session_learner_score'),
563
+            $this->translator->trans('column_monitoring_session_learner_first_activity'),
563 564
             $this->translator->trans('column_monitoring_session_learner_last_activity')
564 565
         ];
565 566
         $columnLetter = 'A';
@@ -572,8 +573,8 @@ class MonitoringExportHandler
572 573
         }
573 574
 
574 575
 
575
-        $sheet->getStyle('A3:H3')->applyFromArray($this->exportHandler->getStyleHeader());
576
-        $sheet->getStyle('A3:H3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('000000');
576
+        $sheet->getStyle('A3:I3')->applyFromArray($this->exportHandler->getStyleHeader());
577
+        $sheet->getStyle('A3:I3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('000000');
577 578
 
578 579
         $columnValues = array();
579 580
         foreach ($data['sessions'] as $session) {
@@ -589,6 +590,7 @@ class MonitoringExportHandler
589 590
                 $this->exportHandler->formatPercentToExport($sessionData['completion']),
590 591
                 $this->exportHandler->formatDurationToExport($sessionData['time']),
591 592
                 $this->exportHandler->formatPercentToExport($sessionData['averageScore']),
593
+                $this->exportHandler->formatDateToExport($sessionData['firstConnexion']),
592 594
                 $this->exportHandler->formatDateToExport($sessionData['lastConnexion'])
593 595
             );
594 596
 
@@ -660,14 +662,14 @@ class MonitoringExportHandler
660 662
         // Cellules informative
661 663
         $sheet->setCellValue('A1', $this->translator->trans('title_monitoring_title_learner_activities_list', array(
662 664
             '%learnerName%' => $learner->getFullName()
663
-        )))->mergeCells('A1:E1');
665
+        )))->mergeCells('A1:F1');
664 666
 
665 667
 
666 668
         $sheet->setCellValue('A2', $this->translator->trans($i18nTitle, array(
667 669
             '%sessionTitle%' => $session->getTitle(),
668 670
             '%startDate%' => $datesSession['startDate'],
669 671
             '%endDate%' => $datesSession['endDate']
670
-        )))->mergeCells('A2:E2');
672
+        )))->mergeCells('A2:F2');
671 673
 
672 674
         // Formatage des Cellules
673 675
         $sheet->getStyle('A1')->applyFromArray($this->exportHandler->getStyleTitle());
@@ -680,6 +682,7 @@ class MonitoringExportHandler
680 682
             $this->translator->trans('column_monitoring_session_learner_completion'),
681 683
             $this->translator->trans('column_monitoring_session_learner_time'),
682 684
             $this->translator->trans('column_monitoring_session_learner_score'),
685
+            $this->translator->trans('column_monitoring_session_learner_first_activity'),
683 686
             $this->translator->trans('column_monitoring_session_learner_last_activity')
684 687
         ];
685 688
         $columnLetter = 'A';
@@ -691,8 +694,8 @@ class MonitoringExportHandler
691 694
             $columnLetter++;
692 695
         }
693 696
 
694
-        $sheet->getStyle('A3:E3')->applyFromArray($this->exportHandler->getStyleHeader());
695
-        $sheet->getStyle('A3:E3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('000000');
697
+        $sheet->getStyle('A3:F3')->applyFromArray($this->exportHandler->getStyleHeader());
698
+        $sheet->getStyle('A3:F3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('000000');
696 699
 
697 700
         $columnValues = array();
698 701
         foreach ($data['activities'] as $activity) {
@@ -703,6 +706,7 @@ class MonitoringExportHandler
703 706
                 $this->exportHandler->formatPercentToExport($activityData['completion']),
704 707
                 $this->exportHandler->formatDurationToExport($activityData['time']),
705 708
                 $this->exportHandler->formatPercentToExport($activityData['averageScore']),
709
+                $this->exportHandler->formatDateToExport($activityData['firstConnexion']),
706 710
                 $this->exportHandler->formatDateToExport($activityData['lastConnexion'])
707 711
             );
708 712
 
@@ -1032,7 +1036,7 @@ class MonitoringExportHandler
1032 1036
             '%sessionTitle%' => $session->getTitle(),
1033 1037
             '%startDate%' => $datesSession['startDate'],
1034 1038
             '%endDate%' => $datesSession['endDate']
1035
-        )))->mergeCells('A1:G1');
1039
+        )))->mergeCells('A1:H1');
1036 1040
 
1037 1041
         $sheet->getStyle('A1')->applyFromArray($this->exportHandler->getStyleTitle());
1038 1042
 
@@ -1045,6 +1049,7 @@ class MonitoringExportHandler
1045 1049
             $this->translator->trans('column_monitoring_session_learner_completion'),
1046 1050
             $this->translator->trans('column_monitoring_session_learner_time'),
1047 1051
             $this->translator->trans('column_monitoring_session_learner_score'),
1052
+            $this->translator->trans('column_monitoring_session_learner_first_activity'),
1048 1053
             $this->translator->trans('column_monitoring_session_learner_last_activity')
1049 1054
         ];
1050 1055
         $columnLetter = 'A';
@@ -1057,8 +1062,8 @@ class MonitoringExportHandler
1057 1062
         }
1058 1063
 
1059 1064
 
1060
-        $sheet->getStyle('A3:G3')->applyFromArray($this->exportHandler->getStyleHeader());
1061
-        $sheet->getStyle('A3:G3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1065
+        $sheet->getStyle('A3:H3')->applyFromArray($this->exportHandler->getStyleHeader());
1066
+        $sheet->getStyle('A3:H3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1062 1067
 
1063 1068
         $columnValues = array();
1064 1069
         foreach ($data['learners'] as $learner) {
@@ -1073,6 +1078,7 @@ class MonitoringExportHandler
1073 1078
                 $this->exportHandler->formatPercentToExport($learnerData['completion']),
1074 1079
                 $this->exportHandler->formatDurationToExport($learnerData['time']),
1075 1080
                 $this->exportHandler->formatPercentToExport($learnerData['averageScore']),
1081
+                $this->exportHandler->formatDateToExport($learnerData['firstConnexion']),
1076 1082
                 $this->exportHandler->formatDateToExport($learnerData['lastConnexion'])
1077 1083
             );
1078 1084
 
@@ -1133,7 +1139,7 @@ class MonitoringExportHandler
1133 1139
 
1134 1140
         $sheet->setCellValue('A1', $this->translator->trans('title_monitoring_title_activity', array(
1135 1141
             '%activityTitle%' => $activity->getTitle()
1136
-        )))->mergeCells('A1:E1');
1142
+        )))->mergeCells('A1:F1');
1137 1143
         $sheet->getStyle('A1')->applyFromArray($this->exportHandler->getStyleTitle());
1138 1144
 
1139 1145
 
@@ -1143,6 +1149,7 @@ class MonitoringExportHandler
1143 1149
             $this->translator->trans('column_monitoring_session_learner_completion'),
1144 1150
             $this->translator->trans('column_monitoring_session_learner_time'),
1145 1151
             $this->translator->trans('column_monitoring_session_learner_score'),
1152
+            $this->translator->trans('column_monitoring_session_learner_first_activity'),
1146 1153
             $this->translator->trans('column_monitoring_session_learner_last_activity')
1147 1154
         ];
1148 1155
         $columnLetter = 'A';
@@ -1155,8 +1162,8 @@ class MonitoringExportHandler
1155 1162
         }
1156 1163
 
1157 1164
 
1158
-        $sheet->getStyle('A3:E3')->applyFromArray($this->exportHandler->getStyleHeader());
1159
-        $sheet->getStyle('A3:E3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1165
+        $sheet->getStyle('A3:F3')->applyFromArray($this->exportHandler->getStyleHeader());
1166
+        $sheet->getStyle('A3:F3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1160 1167
 
1161 1168
         $columnValues = array();
1162 1169
         foreach ($data['learners'] as $learner) {
@@ -1169,6 +1176,7 @@ class MonitoringExportHandler
1169 1176
                 $this->exportHandler->formatPercentToExport($learnerData['completion']),
1170 1177
                 $this->exportHandler->formatDurationToExport($learnerData['time']),
1171 1178
                 $this->exportHandler->formatPercentToExport($learnerData['averageScore']),
1179
+                $this->exportHandler->formatDateToExport($learnerData['firstConnexion']),
1172 1180
                 $this->exportHandler->formatDateToExport($learnerData['lastConnexion'])
1173 1181
             );
1174 1182
 
@@ -1257,7 +1265,7 @@ class MonitoringExportHandler
1257 1265
 
1258 1266
         $sheet->setCellValue('A1', $this->translator->trans('title_monitoring_title_learner', array(
1259 1267
             '%learnerName%' => $learner->getFullName()
1260
-        )))->mergeCells('A1:E1');
1268
+        )))->mergeCells('A1:F1');
1261 1269
         $sheet->getStyle('A1')->applyFromArray($this->exportHandler->getStyleTitle());
1262 1270
 
1263 1271
 
@@ -1267,6 +1275,7 @@ class MonitoringExportHandler
1267 1275
             $this->translator->trans('column_monitoring_session_learner_completion'),
1268 1276
             $this->translator->trans('column_monitoring_session_learner_time'),
1269 1277
             $this->translator->trans('column_monitoring_session_learner_score'),
1278
+            $this->translator->trans('column_monitoring_session_learner_first_activity'),
1270 1279
             $this->translator->trans('column_monitoring_session_learner_last_activity')
1271 1280
         ];
1272 1281
         $columnLetter = 'A';
@@ -1279,8 +1288,8 @@ class MonitoringExportHandler
1279 1288
         }
1280 1289
 
1281 1290
 
1282
-        $sheet->getStyle('A3:E3')->applyFromArray($this->exportHandler->getStyleHeader());
1283
-        $sheet->getStyle('A3:E3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1291
+        $sheet->getStyle('A3:F3')->applyFromArray($this->exportHandler->getStyleHeader());
1292
+        $sheet->getStyle('A3:F3')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF000000');
1284 1293
 
1285 1294
         $columnValues = array();
1286 1295
         foreach ($data['activities'] as $activity) {
@@ -1293,6 +1302,7 @@ class MonitoringExportHandler
1293 1302
                 $this->exportHandler->formatPercentToExport($activityData['completion']),
1294 1303
                 $this->exportHandler->formatDurationToExport($activityData['time']),
1295 1304
                 $this->exportHandler->formatPercentToExport($activityData['averageScore']),
1305
+                $this->exportHandler->formatDateToExport($activityData['firstConnexion']),
1296 1306
                 $this->exportHandler->formatDateToExport($activityData['lastConnexion'])
1297 1307
             );
1298 1308
 

+ 1
- 1
templates/back-office/admin/monitoring/sessions/single/learner/single_learner.html.twig View File

@@ -15,7 +15,7 @@
15 15
 			{# / breadcrumb #}
16 16
 			{# Action supplementaire (...) #}
17 17
 			<div class="ali-ContentNavAction col-md-7 col-xl-5">
18
-                <a href="{{ path('nbo_os_sessions_monitoring_export_global', { 'sessionId': session.sessionId }) }}" class="btn btn-primary">
18
+                <a href="{{ path('nbo_sessions_monitoring_export_global', { 'sessionId': session.sessionId }) }}" class="btn btn-primary">
19 19
                 	<i class="icons">import_export</i>
20 20
                 	<span class="ali-ContentNavAction-libBtn">{{ 'action_global_export'|trans }}</span>
21 21
                 </a>		

+ 7
- 0
templates/bundles/TwigBundle/Exception/definePassword.html.twig View File

@@ -0,0 +1,7 @@
1
+{% extends "bundles/TwigBundle/Exception/error404.html.twig" %}
2
+{% block content %}
3
+    <p class="h3">{{ text }}</p>
4
+    <p class="">
5
+        <a href="{{ path(path) }}">{{ go }}</a>
6
+    </p>
7
+{% endblock %}

+ 9
- 8
templates/bundles/TwigBundle/Exception/error404.html.twig View File

@@ -13,15 +13,16 @@
13 13
 			
14 14
 			<h2 class="h5 text-muted">{{ 'error_404_message'|trans }}</h2>
15 15
 			
16
-			{% set text = exception.message %}
17
-			{% if text == '' %}
18
-				{% set text = 'error_404_funny_text'|trans %}
19
-			{% endif %}
20
-			<p class="h3">{{ text }}</p>
16
+			{% block content %}
17
+				{% set text = exception.message %}
18
+				{% if text != '' %}
19
+					<p class="h3">{{ text }}</p>
20
+				{% endif %}
21 21
 
22
-			<p class="">
23
-				<a href="{{ path('bo_homepage') }}">{{ 'action_go_back_home'|trans }}</a>
24
-			</p>
22
+				<p class="">
23
+					<a href="{{ path('bo_homepage') }}">{{ 'action_go_back_home'|trans }}</a>
24
+				</p>
25
+			{% endblock %}
25 26
 			
26 27
 			<img alt="Image" src="{{ asset('build/images/learning-path.png') }}" class="w-100"/>
27 28
 			

+ 14
- 0
tests/Phoenix/Component/ExpiredPhxCrypt.php View File

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+namespace Logipro\Phoenix\tests\Phoenix\Component;
4
+
5
+use Logipro\Phoenix\Component\PhxCrypt;
6
+
7
+class ExpiredPhxCrypt extends PhxCrypt
8
+{
9
+    protected static function serialize(array $data):string
10
+    {
11
+        $data['_d_'] = 0;
12
+        return parent::serialize($data);
13
+    }
14
+}

+ 99
- 0
tests/Phoenix/Controller/LearningSpace/LoginControllerTest.php View File

@@ -0,0 +1,99 @@
1
+<?php
2
+
3
+namespace Logipro\Phoenix\tests\Phoenix\Controller\NewBackOffice\Session\Follow;
4
+
5
+use Logipro\Phoenix\Component\PhxCrypt;
6
+use Logipro\Phoenix\tests\Phoenix\Component\ExpiredPhxCrypt;
7
+use Logipro\Phoenix\tests\PhxWebTestCase;
8
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9
+
10
+
11
+class LoginControllerTest extends PhxWebTestCase
12
+{
13
+    /*
14
+    sera développé quand les fatory seront présents
15
+    public function testManageDefinePasswordWithUser()
16
+    { }*/
17
+
18
+    public function testManageDefinePasswordWithoutToken()
19
+    {
20
+        $client = static::createClient();
21
+
22
+        $params = array();
23
+        $crawler = $client->request(
24
+            'GET',
25
+            $this->getRoutePath('ls_password_define'),
26
+            $params
27
+        );
28
+
29
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
30
+    }
31
+    public function testManageDefinePasswordWithEmptyToken()
32
+    {
33
+        $client = static::createClient();
34
+
35
+        $params = array(
36
+            'token' =>  ''
37
+        );
38
+        $crawler = $client->request(
39
+            'GET',
40
+            $this->getRoutePath('ls_password_define'),
41
+            $params
42
+        );
43
+
44
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
45
+    }
46
+
47
+    public function testManageDefinePasswordWithoutLearner()
48
+    {
49
+        $client = static::createClient();
50
+
51
+        $params = array(
52
+            'token' =>  PhxCrypt::crypt(array(
53
+                'learnerAccountId' => 0,
54
+                'route' => 'ls_homepage'
55
+            ))
56
+        );
57
+        $crawler = $client->request(
58
+            'GET',
59
+            $this->getRoutePath('ls_password_define'),
60
+            $params
61
+        );
62
+
63
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
64
+    }
65
+
66
+    public function testManageDefinePasswordWithExpiredToken()
67
+    {
68
+        $client = static::createClient();
69
+
70
+        $params = array(
71
+            'token' =>  ExpiredPhxCrypt::crypt(array(
72
+                'learnerAccountId' => 0,
73
+                'route' => 'ls_homepage'
74
+            ))
75
+        );
76
+        $crawler = $client->request(
77
+            'GET',
78
+            $this->getRoutePath('ls_password_define'),
79
+            $params
80
+        );
81
+
82
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
83
+    }
84
+
85
+    /*
86
+    // A TERMINER IL Y A UN PB AVEC L'AUTHENTIFCATION
87
+    public function testList()
88
+    {
89
+        $client = static::createClient();
90
+
91
+        $crawler = $client->request(
92
+            'GET',
93
+            '/follow/sessions'
94
+        );
95
+
96
+        $this->assertSame(200, $client->getResponse()->getStatusCode());
97
+    }
98
+    */
99
+}

+ 6
- 6
tests/Phoenix/Controller/NewBackOffice/Session/Follow/SessionFixedControllerTest.php View File

@@ -1,11 +1,12 @@
1 1
 <?php
2
-namespace Logipro\Phoenix\Tests\Controller\NewBackOffice\Session\Follow;
3 2
 
4
-use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
3
+namespace Logipro\Phoenix\tests\Phoenix\Controller\NewBackOffice\Session\Follow;
5 4
 
5
+use Logipro\Phoenix\tests\PhxWebTestCase;
6 6
 
7
-class SessionFiexedControllerTest extends WebTestCase
8
-{  
7
+
8
+class SessionFiexedControllerTest extends PhxWebTestCase
9
+{
9 10
 
10 11
     /*
11 12
     // A TERMINER IL Y A UN PB AVEC L'AUTHENTIFCATION
@@ -20,5 +21,4 @@ class SessionFiexedControllerTest extends WebTestCase
20 21
 
21 22
         $this->assertSame(200, $client->getResponse()->getStatusCode());
22 23
     }
23
-    */   
24
-}
24
+    */ }

+ 29
- 19
tests/Phoenix/Service/Comment/CommentHandlerTest.php View File

@@ -1,5 +1,6 @@
1 1
 <?php
2
-namespace Logipro\Phoenix\Tests\Service\Comment;
2
+
3
+namespace Logipro\Phoenix\tests\Phoenix\Service\Comment;
3 4
 
4 5
 use PHPUnit\Framework\TestCase;
5 6
 use Logipro\Phoenix\Entity\Comment;
@@ -16,26 +17,28 @@ use Twig\Environment;
16 17
 use Doctrine\ORM\EntityManagerInterface;
17 18
 use Symfony\Component\Security\Core\Security;
18 19
 
20
+use Logipro\Phoenix\Service\Session\SessionHandler;
21
+
19 22
 class CommentHandlerTest extends TestCase
20
-{	
23
+{
21 24
 	private $comment;
22 25
 	private $session;
23 26
 	private $person;
24 27
 
25 28
 
26
-    private $entityManager;
29
+	private $entityManager;
27 30
 
28
-    public function setUp()
29
-    {
31
+	public function setUp()
32
+	{
30 33
 		$this->person = new Person();
31 34
 		$this->person->setGivenName('Laurent');
32 35
 
33
-        $this->session = new SessionOpen();
36
+		$this->session = new SessionOpen();
34 37
 		$this->session->setTitle('Test CommentHandlerTest');
35 38
 
36 39
 		$this->comment = new Comment($this->person);
37 40
 		$this->comment->setContent('Mon commentaire');
38
-		$this->comment->setSession($this->session);	
41
+		$this->comment->setSession($this->session);
39 42
 	}
40 43
 
41 44
 	/**
@@ -54,10 +57,11 @@ class CommentHandlerTest extends TestCase
54 57
 		$translator = $this->createMock(TranslatorInterface::class);
55 58
 		$templing = $this->createMock(Environment::class);
56 59
 		$security = $this->createMock(Security::class);
60
+		$sessionHandler = $this->createMock(SessionHandler::class);
57 61
 
58
-		$commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
59
-		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');	
60
-	}		
62
+		$commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
63
+		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
64
+	}
61 65
 
62 66
 	/**
63 67
 	 * Test pour verifier que le mail nouveau commentaire ne soit pas envoyé si l'option notifyMailForum est à false
@@ -75,8 +79,10 @@ class CommentHandlerTest extends TestCase
75 79
 		$templing = $this->createMock(Environment::class);
76 80
 		$security = $this->createMock(Security::class);
77 81
 
78
-		$commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
79
-		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');	
82
+		$sessionHandler = $this->createMock(SessionHandler::class);
83
+
84
+		$commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
85
+		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
80 86
 	}
81 87
 
82 88
 
@@ -96,9 +102,11 @@ class CommentHandlerTest extends TestCase
96 102
 		$templing = $this->createMock(Environment::class);
97 103
 		$security = $this->createMock(Security::class);
98 104
 
99
-		$commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
100
-		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');	
101
-	}	
105
+		$sessionHandler = $this->createMock(SessionHandler::class);
106
+
107
+		$commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
108
+		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
109
+	}
102 110
 
103 111
 	/**
104 112
 	 * Test pour verifier que le mail nouveau commentaire ne soit pas envoyé si il n'y a pas de responsable pédagogique
@@ -116,7 +124,9 @@ class CommentHandlerTest extends TestCase
116 124
 		$templing = $this->createMock(Environment::class);
117 125
 		$security = $this->createMock(Security::class);
118 126
 
119
-		$commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
120
-		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');	
121
-	}	
122
-}
127
+		$sessionHandler = $this->createMock(SessionHandler::class);
128
+
129
+		$commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
130
+		$commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
131
+	}
132
+}

+ 19
- 17
tests/Phoenix/Service/FormHandlerTest.php View File

@@ -1,5 +1,6 @@
1 1
 <?php
2
-namespace Logipro\Phoenix\Tests\Service;
2
+
3
+namespace Logipro\Phoenix\tests\Phoenix\Service;
3 4
 
4 5
 use Symfony\Component\Form\Test\TypeTestCase;
5 6
 
@@ -12,35 +13,36 @@ use Symfony\Component\Form\FormError;
12 13
 use Logipro\Phoenix\Service\FormHandler;
13 14
 use Symfony\Component\HttpFoundation\RequestStack;
14 15
 use Symfony\Component\HttpFoundation\Request;
16
+use Symfony\Component\Form\FormFactoryInterface;
15 17
 
16 18
 class FormHandlerTest extends TypeTestCase
17 19
 {
18
-	private function generateHandler(bool $isMethod = true) : FormHandler
20
+	private function generateHandler(bool $isMethod = true): FormHandler
19 21
 	{
20 22
 		$requestStackMock = $this->createMock(RequestStack::class);
21
-		
23
+
22 24
 		$request = $this->createMock(Request::class);
23 25
 		$request->method('isMethod')->willReturn($isMethod);
24
-		
26
+
25 27
 		$requestStackMock->method('getCurrentRequest')->willReturn($request);
26
-		
28
+
27 29
 		$trnaslatorMock = $this->createMock(TranslatorInterface::class);
28
-		
29
-		return new FormHandler($requestStackMock,$trnaslatorMock);
30
+		$factoryMock = $this->createMock(FormFactoryInterface::class);
30 31
 
32
+		return new FormHandler($requestStackMock, $trnaslatorMock, $factoryMock);
31 33
 	}
32
-    public function testGetFormFieldError()
33
-    {
34
+	public function testGetFormFieldError()
35
+	{
34 36
 		$handler = $this->generateHandler();
35 37
 
36 38
 		$form = $this->factory->createBuilder(FormType::class)
37 39
 			->add('task', TextType::class)
38 40
 			->getForm();
39 41
 
40
-		$newError = new FormError('','');
42
+		$newError = new FormError('', '');
41 43
 		$taskField = $form->get('task');
42 44
 		// soumettre le formulaire sinon la validation ne se fait pas
43
-		$form->submit(array('task' => 'Fabien'),false);
45
+		$form->submit(array('task' => 'Fabien'), false);
44 46
 		$taskField->addError($newError);
45 47
 
46 48
 		$errors = $handler->getFormFieldError($form);
@@ -57,7 +59,7 @@ class FormHandlerTest extends TypeTestCase
57 59
 			$form
58 60
 		);
59 61
 	}
60
-	
62
+
61 63
 	/**
62 64
 	 * @expectedException \Exception
63 65
 	 *
@@ -68,13 +70,13 @@ class FormHandlerTest extends TypeTestCase
68 70
 		$handler = $this->generateHandler();
69 71
 
70 72
 		$form = $this->factory->createBuilder(FormType::class)
71
-		->add('task', TextType::class)
72
-		->getForm();
73
+			->add('task', TextType::class)
74
+			->getForm();
73 75
 
74
-		$newError = new FormError('','');
76
+		$newError = new FormError('', '');
75 77
 		$taskField = $form->get('task');
76 78
 		// soumettre le formulaire sinon la validation ne se fait pas
77
-		$form->submit(array('task' => 'Fabien'),false);
79
+		$form->submit(array('task' => 'Fabien'), false);
78 80
 		$taskField->addError($newError);
79 81
 
80 82
 		$handler->validForm($form);
@@ -94,4 +96,4 @@ class FormHandlerTest extends TypeTestCase
94 96
 
95 97
 		$handler->validate($form);
96 98
 	}
97
-}
99
+}

+ 1
- 1
tests/Phoenix/Tools/Tree/TreeWalkerTest.php View File

@@ -1,5 +1,5 @@
1 1
 <?php
2
-namespace Logipro\Phoenix\Tests\Tools\Tree;
2
+namespace Logipro\Phoenix\tests\Phoenix\Tools\Tree;
3 3
 
4 4
 use PHPUnit\Framework\TestCase;
5 5
 use Logipro\Phoenix\Tools\Tree\TreeNode;

+ 22
- 0
tests/PhxWebTestCase.php View File

@@ -0,0 +1,22 @@
1
+<?php
2
+
3
+namespace Logipro\Phoenix\tests;
4
+
5
+use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
7
+
8
+class PhxWebTestCase extends WebTestCase
9
+{
10
+    protected function getRoutePath(string $path): string
11
+    {
12
+        self::bootKernel();
13
+
14
+        $container = self::$kernel->getContainer();
15
+
16
+        $route = $container->get('router')->getRouteCollection()->get($path);
17
+        if (!$route) {
18
+            throw new NotFoundHttpException();
19
+        }
20
+        return $route->getPath();
21
+    }
22
+}

+ 27
- 0
translations/messages.fr.xlf View File

@@ -713,6 +713,11 @@
713 713
 				<target>Dernière connexion</target>
714 714
 			</trans-unit>
715 715
 
716
+			<trans-unit id="column_monitoring_session_learner_first_activity">
717
+				<source>column_monitoring_session_learner_first_activity</source>
718
+				<target>Première connexion</target>
719
+			</trans-unit>
720
+
716 721
 			<trans-unit id="column_monitoring_quiz_index">
717 722
 				<source>column_monitoring_quiz_index</source>
718 723
 				<target>#</target>
@@ -10084,6 +10089,28 @@ Un indicateur vous permettra de savoir si vous l'avez déjà envoyé à tel ou t
10084 10089
 				<source>clear_button</source>
10085 10090
         		<target>Effacer</target>
10086 10091
 			</trans-unit>
10092
+
10093
+			<trans-unit id="bo_password_expired">
10094
+				<source>bo_password_expired</source>
10095
+        		<target>Le lien pour définir votre mot de passe a expiré. Nous vous invitons à cliquer sur "Mot de passe perdu?" lors de votre prochaine connexion pour en définir un nouveau.</target>
10096
+			</trans-unit>
10097
+			<trans-unit id="ls_password_expired">
10098
+				<source>ls_password_expired</source>
10099
+        		<target>Le lien pour définir votre mot de passe a expiré. Nous vous invitons à cliquer sur "Mot de passe perdu?" lors de votre prochaine connexion à l'espace apprenant pour en définir un nouveau.</target>
10100
+			</trans-unit>
10101
+			<trans-unit id="catalog_password_expired">
10102
+				<source>catalog_password_expired</source>
10103
+        		<target>Le lien pour définir votre mot de passe a expiré. Nous vous invitons à cliquer sur "Mot de passe perdu?" lors de votre prochaine connexion au catalogue pour en définir un nouveau.</target>
10104
+			</trans-unit>
10105
+
10106
+			<trans-unit id="ls_password_return">
10107
+				<source>ls_password_return</source>
10108
+        		<target>retourner sur l'espace apprenant</target>
10109
+			</trans-unit>
10110
+			<trans-unit id="catalog_password_return">
10111
+				<source>catalog_password_return</source>
10112
+        		<target>retourner sur le catalogue</target>
10113
+			</trans-unit>
10087 10114
 		</body>
10088 10115
 	</file>
10089 10116
 </xliff>

Loading…
Cancel
Save