Browse Source

merge hotfix

raphael 3 years ago
parent
commit
106a5f30de
100 changed files with 2426 additions and 2373 deletions
  1. 1
    1
      .gitignore
  2. 0
    18
      assets/exclusive/js/back-office/init_back_office.js
  3. 5
    11
      assets/exclusive/js/back-office/learning_path/learning_path_editor.js
  4. 59
    7
      assets/exclusive/js/back-office/utilities/utility.js
  5. 22
    6
      assets/exclusive/js/init_activity-player.js
  6. 24
    129
      assets/shared/js/init/init.js
  7. 13
    18
      assets/shared/js/init/init_create-from-library.js
  8. 1
    0
      assets/shared/scss/theme-phx/back-office/global.scss
  9. 3
    1
      assets/shared/scss/theme-phx/learning-space/activity-page.scss
  10. 1
    1
      assets/shared/scss/theme-phx/learning-space/forum.scss
  11. 8
    4
      assets/shared/scss/theme-phx/learning-space/session-page.scss
  12. 5
    4
      config/packages/security.yaml
  13. 13
    13
      config/routes.yaml
  14. 1
    0
      public/build/activity-player.112dcdc3.js
  15. 1
    0
      public/build/back-office/back_office.1c71879f.js
  16. 1
    0
      public/build/back-office/back_office_person_create.3b6fbee3.js
  17. 1
    0
      public/build/back-office/back_office_session_create.792c720d.js
  18. 1
    0
      public/build/back-office/back_office_society_create.4c1b0821.js
  19. 1
    1
      public/build/back-office/diary.5dd787ee.js
  20. 8
    0
      public/build/back-office/learning_path/editor.dfc61bbf.js
  21. 1
    0
      public/build/back-office/menu/trainer.25d9e1aa.js
  22. 1
    1
      public/build/back-office/person/edit.a90251e1.js
  23. 1
    0
      public/build/back-office/session/edit.726a9266.js
  24. 1
    1
      public/build/back-office/setting/learningSpace.78ad121f.js
  25. 1
    0
      public/build/back-office/setting/user/create.405332d1.js
  26. 1
    0
      public/build/back-office/society/edit.7d5be66b.js
  27. 1
    1
      public/build/back-office/trainer/edit.10f75240.js
  28. 1
    1
      public/build/catalog_setting.f0f17ea1.js
  29. 1
    1
      public/build/learning_space.690d18db.js
  30. 1
    1
      public/build/learning_space_session_page.8d3b8386.js
  31. 1
    1
      public/build/learning_space_setting.8671646c.js
  32. 1
    1
      public/build/learning_space_setting_mod_scss.a642f5f1.js
  33. 58
    0
      public/build/manifest.json
  34. 1
    0
      public/build/shared-back-office.25fd9fb9.js
  35. 1
    0
      public/build/shared-back-office.b07b7461.css
  36. 1
    0
      public/build/shared-catalog.3f1883a0.js
  37. 1
    0
      public/build/shared-global-back-office.988e14a3.js
  38. 1
    0
      public/build/shared-global-catalog.d429a8a8.js
  39. 1
    0
      public/build/shared-learning-space.81b95faf.css
  40. 1
    0
      public/build/shared-learning-space.d1e28642.js
  41. 222
    0
      public/build/shared.dd9675ff.js
  42. 20
    32
      src/Phoenix/Command/BBBGetRecordCommand.php
  43. 4
    2
      src/Phoenix/Component/BBB/PhxBigBlueButton.php
  44. 79
    72
      src/Phoenix/Controller/AppController.php
  45. 9
    4
      src/Phoenix/Controller/Catalog/LoginController.php
  46. 1
    1
      src/Phoenix/Controller/Catalog/OfferController.php
  47. 80
    76
      src/Phoenix/Controller/LearningSpace/LoginController.php
  48. 201
    309
      src/Phoenix/Controller/NewBackOffice/Admin/LearningPathController.php
  49. 18
    11
      src/Phoenix/Controller/NewBackOffice/Admin/LoginController.php
  50. 84
    122
      src/Phoenix/Controller/NewBackOffice/Admin/NoticeController.php
  51. 147
    324
      src/Phoenix/Controller/NewBackOffice/Admin/OfferController.php
  52. 25
    46
      src/Phoenix/Controller/NewBackOffice/Admin/PersonController.php
  53. 3
    5
      src/Phoenix/Controller/NewBackOffice/Admin/SequenceItem/ActivityPackageController.php
  54. 197
    468
      src/Phoenix/Controller/NewBackOffice/Admin/Session/Create/SessionController.php
  55. 65
    151
      src/Phoenix/Controller/NewBackOffice/Admin/Session/Follow/SessionFixedController.php
  56. 103
    114
      src/Phoenix/Controller/NewBackOffice/Admin/Settings/PreviewEmailController.php
  57. 12
    2
      src/Phoenix/Controller/NewBackOffice/Admin/SocietyController.php
  58. 33
    24
      src/Phoenix/Controller/NewBackOffice/Owner/LearningPathController.php
  59. 3
    2
      src/Phoenix/Entity/Person/Person.php
  60. 154
    168
      src/Phoenix/Entity/Person/Trainer.php
  61. 0
    2
      src/Phoenix/Form/BackOfficeType/Follow/Session/SessionUpdateType.php
  62. 4
    1
      src/Phoenix/Form/BackOfficeType/Follow/SessionSocietyContractType.php
  63. 0
    19
      src/Phoenix/Form/PersonCreateType.php
  64. 0
    19
      src/Phoenix/Form/PersonUpdateType.php
  65. 0
    4
      src/Phoenix/Form/Society/SocietyPersonCreateType.php
  66. 1
    0
      src/Phoenix/Package/Common/PackageTypeDetector.php
  67. 15
    18
      src/Phoenix/Repository/LearningSpace/LearnerAccountRepository.php
  68. 1
    1
      src/Phoenix/Repository/OfferRepository.php
  69. 5
    1
      src/Phoenix/Service/Export/ExportHandler.php
  70. 85
    43
      src/Phoenix/Service/LearningPath/LearningPathExportHandler.php
  71. 30
    36
      src/Phoenix/Service/LearningPath/LearningPathHandler.php
  72. 26
    16
      src/Phoenix/Service/Monitoring/MonitoringExportHandler.php
  73. 11
    0
      src/Phoenix/Service/Monitoring/MonitoringHandler.php
  74. 148
    0
      src/Phoenix/Service/Offer/OfferExportHandler.php
  75. 42
    16
      src/Phoenix/Service/SequenceItem/SequenceItemHandler.php
  76. 199
    0
      src/Phoenix/Service/Session/SessionExportHandler.php
  77. 20
    0
      src/Phoenix/Service/Session/SessionHandler.php
  78. 37
    1
      src/Phoenix/Service/initNoticeView.php
  79. 0
    0
      templates/back-office/admin/learning_path_editor/sequence_item_editor/activity_page/editor--editable-medium.html.twig
  80. 1
    1
      templates/back-office/admin/learning_path_editor/sequence_item_editor/activity_page/editor.html.twig
  81. 1
    1
      templates/back-office/admin/learning_paths/learning_paths_list.html.twig
  82. 2
    1
      templates/back-office/admin/monitoring/learners/explorer/learner_session_activities/explorer_learner_session_activites--list.html.twig
  83. 2
    1
      templates/back-office/admin/monitoring/sessions/explorer/session_activities/explorer_session_activities--list.html.twig
  84. 2
    1
      templates/back-office/admin/monitoring/sessions/explorer/session_learner_activities/explorer_session_learner_activites--list.html.twig
  85. 1
    1
      templates/back-office/admin/monitoring/sessions/single/learner/single_learner.html.twig
  86. 1
    1
      templates/back-office/admin/monitoring/sessions/single/session/single_session--header.html.twig
  87. 1
    1
      templates/back-office/admin/offer/offer_list.html.twig
  88. 1
    1
      templates/back-office/admin/session/create/session_list.html.twig
  89. 1
    1
      templates/back-office/admin/session/follow/tabs/documents/summary/send_error.html.twig
  90. 2
    2
      templates/back-office/admin/session/follow/tabs/notice.html.twig
  91. 17
    16
      templates/back-office/admin/session/follow/tabs/partial/notice-list.html.twig
  92. 1
    1
      templates/back-office/admin/settings/scorm.html.twig
  93. 9
    0
      templates/back-office/owner-space/learning_path_editor/sequence_item_editor/activity_page/editor--editable-medium.html.twig
  94. 33
    0
      templates/back-office/owner-space/learning_path_editor/sequence_item_editor/activity_page/editor.html.twig
  95. 1
    1
      templates/back-office/owner-space/learning_paths/learning_paths_list.html.twig
  96. 7
    0
      templates/bundles/TwigBundle/Exception/definePassword.html.twig
  97. 9
    8
      templates/bundles/TwigBundle/Exception/error404.html.twig
  98. 1
    1
      templates/catalog/pages/contact.html.twig
  99. 3
    2
      templates/emails/back_office/NotifyNewCommentOnForum.html.twig
  100. 0
    0
      templates/emails/back_office/documents/certificateAttendance/manual/learner/CertificateAttendanceForLearner.html.twig

+ 1
- 1
.gitignore View File

@@ -76,7 +76,7 @@ config/bundles.local.php
76 76
 ###< fin dossier command
77 77
 
78 78
 # contenu du dossier templates/temp
79
-/templates/temp/
79
+/templates/temp/*
80 80
 # fichier readme pour créer le dossier
81 81
 !/templates/temp/readme
82 82
 

+ 0
- 18
assets/exclusive/js/back-office/init_back_office.js View File

@@ -33,24 +33,6 @@ $(document).ready(function ()
33 33
 	removeOutlineOnClick();
34 34
 });
35 35
 
36
-function initscrollDatepicker(container)
37
-{
38
-	// initialise les datepicker
39
-	var lastScrollTop = 0;
40
-	container.scroll(function (event)
41
-	{
42
-		container.find('[data-airpicker]').each(function()
43
-		{
44
-			let picker = $(this).data('datepicker');
45
-			if (picker)
46
-			{
47
-				picker.hide();
48
-			}
49
-		});
50
-	});
51
-}
52
-
53
-
54 36
 function initscrollDatepicker(container)
55 37
 {
56 38
 	// initialise les datepicker

+ 5
- 11
assets/exclusive/js/back-office/learning_path/learning_path_editor.js View File

@@ -1374,7 +1374,7 @@ function initAirDatePicker(container) {
1374 1374
         let dateEndSession = fieldDate.attr('data-phx-end-session');
1375 1375
         let dataAltField = fieldDate.attr('data-alt-field');
1376 1376
 
1377
-        let myDatepicker = fieldDate.datepicker({
1377
+        let options = {
1378 1378
             minDate: new Date(dateStartSession),
1379 1379
             maxDate: new Date(dateEndSession),
1380 1380
             offset: 0,
@@ -1384,17 +1384,11 @@ function initAirDatePicker(container) {
1384 1384
             position: 'top left',
1385 1385
             classes: 'ali-EditorSequence-datePicker',
1386 1386
             timepicker: true,
1387
-            language: {
1388
-                days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
1389
-                daysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
1390
-                daysMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
1391
-                months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
1392
-                monthsShort: ['Jan', 'Fév', 'Mars', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Dec'],
1393
-                clear: 'Effacer'
1394
-            },
1395 1387
             startDate: start,
1396 1388
             minHours: 0
1397
-        }).data('datepicker');
1389
+        };
1390
+        let utility = require('../utilities/utility');
1391
+        let myDatepicker = utility.initDatepicker(container,options).first().datepicker().data('datepicker');
1398 1392
 
1399 1393
         let valueDate = $(dataAltField).val();
1400 1394
         if (valueDate != '') {
@@ -1405,7 +1399,7 @@ function initAirDatePicker(container) {
1405 1399
         // Si on scroll le calendrier disparait
1406 1400
         // C'est la seule solution rapide trouvé pour régler le problème de calendrier positionné toujours en bas
1407 1401
         var lastScrollTop = 0;
1408
-        $('.ali-EditorContentRightPanelContent').scroll(function (event) {
1402
+        $('.ali-EditorContentRightPanelContent').parent().scroll(function (event) {
1409 1403
             myDatepicker.hide();
1410 1404
         });
1411 1405
     }

+ 59
- 7
assets/exclusive/js/back-office/utilities/utility.js View File

@@ -22,12 +22,62 @@ module.exports = {
22 22
             clearButton: true,
23 23
             autoClose: true,
24 24
             language: {
25
-                days: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
26
-                daysShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
27
-                daysMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
28
-                months: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'],
29
-                monthsShort: ['Jan','Fév','Mars','Avr','Mai','Juin','Juil','Août','Sep','Oct','Nov','Dec'],
30
-                clear: 'Effacer',
25
+                days: [
26
+                    Translator.trans('sunday_long'),
27
+                    Translator.trans('monday_long'),
28
+                    Translator.trans('tuesday_long'),
29
+                    Translator.trans('wednesday_long'),
30
+                    Translator.trans('thursday_long'),
31
+                    Translator.trans('friday_long'),
32
+                    Translator.trans('saturday_long')
33
+                ],
34
+                daysShort: [
35
+                    Translator.trans('sunday_long').substring(0,3),
36
+                    Translator.trans('monday_long').substring(0,3),
37
+                    Translator.trans('tuesday_long').substring(0,3),
38
+                    Translator.trans('wednesday_long').substring(0,3),
39
+                    Translator.trans('thursday_long').substring(0,3),
40
+                    Translator.trans('friday_long').substring(0,3),
41
+                    Translator.trans('saturday_long').substring(0,3)
42
+                ],
43
+                daysMin: [
44
+                    Translator.trans('sunday_long').substring(0,2),
45
+                    Translator.trans('monday_long').substring(0,2),
46
+                    Translator.trans('tuesday_long').substring(0,2),
47
+                    Translator.trans('wednesday_long').substring(0,2),
48
+                    Translator.trans('thursday_long').substring(0,2),
49
+                    Translator.trans('friday_long').substring(0,2),
50
+                    Translator.trans('saturday_long').substring(0,2)
51
+                ],
52
+                months: [
53
+                    Translator.trans('january_long'),
54
+                    Translator.trans('february_long'),
55
+                    Translator.trans('march_long'),
56
+                    Translator.trans('april_long'),
57
+                    Translator.trans('may_long'),
58
+                    Translator.trans('june_long'),
59
+                    Translator.trans('july_long'),
60
+                    Translator.trans('august_long'),
61
+                    Translator.trans('september_long'),
62
+                    Translator.trans('october_long'),
63
+                    Translator.trans('november_long'),
64
+                    Translator.trans('december_long')
65
+                ],
66
+                monthsShort: [
67
+                    Translator.trans('january_long').substring(0,3),
68
+                    Translator.trans('february_long').substring(0,3),
69
+                    Translator.trans('march_long').substring(0,3),
70
+                    Translator.trans('april_long').substring(0,3),
71
+                    Translator.trans('may_long').substring(0,3),
72
+                    Translator.trans('june_long').substring(0,3),
73
+                    Translator.trans('july_long').substring(0,3),
74
+                    Translator.trans('august_long').substring(0,3),
75
+                    Translator.trans('september_long').substring(0,3),
76
+                    Translator.trans('october_long').substring(0,3),
77
+                    Translator.trans('november_long').substring(0,3),
78
+                    Translator.trans('december_long').substring(0,3)
79
+                ],
80
+                clear: Translator.trans('clear_button'),
31 81
             },
32 82
             clearButton: true
33 83
         };
@@ -35,7 +85,8 @@ module.exports = {
35 85
         defaultOptions = $.extend(defaultOptions, options);
36 86
 
37 87
         //Datepicker DATE
38
-        container.find('[data-airpicker="date"]').each(function() {
88
+        console.log( container.find('[data-airpicker]'));
89
+        container.find('[data-airpicker]').each(function() {
39 90
 
40 91
             var myDatepicker = $(this).datepicker(defaultOptions).data('datepicker');
41 92
     
@@ -48,5 +99,6 @@ module.exports = {
48 99
                 $('#'+myDatepicker.el.id+':invalid').css('box-shadow','none','border','0 none','outline','0');
49 100
             }
50 101
         });
102
+        return container.find('[data-airpicker]');
51 103
     }),
52 104
 }

+ 22
- 6
assets/exclusive/js/init_activity-player.js View File

@@ -14,8 +14,8 @@ $(document).ready(function() {
14 14
 
15 15
 function initMenu() {
16 16
 	$(".ali-PlayerNavListe-element").click(function () {
17
-		if (!$(this).hasClass('select')) {
18
-			var elem = $(this);
17
+		var elem = $(this);
18
+		if (!elem.hasClass('select')) {
19 19
 			if ($(".ali-PlayerNavListe-element.select").hasClass('ali-PlayerNavListe-forum')) {
20 20
 				$(".ali-LSForum").removeClass('active');
21 21
 			}
@@ -32,13 +32,18 @@ function initMenu() {
32 32
 				'height': elem.height(),
33 33
 				'width': elem.width()
34 34
 			}, 200);
35
+
36
+			// Garder en mémoire qu'on a fermé le menu
37
+			if (elem.attr('id') == 'ali-PlayerNavListe-menu') {
38
+				sessionStorage.setItem('menuOpen','true');
39
+			}
35 40
 		} 
36 41
 		else
37 42
 		{
38
-			$(this).removeClass('select');
43
+			elem.removeClass('select');
39 44
 
40
-			if ($(this).is('[aria-controls]')) {
41
-				$('#' + $(this).attr('aria-controls')).removeClass('select');
45
+			if (elem.is('[aria-controls]')) {
46
+				$('#' + elem.attr('aria-controls')).removeClass('select');
42 47
 			}
43 48
 
44 49
 			$('.ali-PlayerNavSecondaire').removeClass('active');
@@ -54,9 +59,15 @@ function initMenu() {
54 59
 					'height': 0
55 60
 				}, 200);
56 61
 			}
62
+
63
+			// Garder en mémoire qu'on a ouvert le menu
64
+			if (elem.attr('id') == 'ali-PlayerNavListe-menu') {
65
+				sessionStorage.setItem('menuOpen','false');
66
+			}
57 67
 		}
58 68
 	});
59 69
 
70
+
60 71
 	var doit;
61 72
 	$(window).resize(function(){
62 73
 		clearTimeout(doit);
@@ -76,8 +87,13 @@ function initMenu() {
76 87
 		}
77 88
 	}
78 89
 
90
+	// Si en mémoire le menu est ouvert alors l'ouvrir
91
+	if (sessionStorage.getItem('menuOpen') == 'true') {
92
+		$('#ali-PlayerNavListe-menu:not(.select)').click();
93
+	}
94
+	
79 95
 	// Selectionner l'élément du menu s'il y en a un à selectionner 
80
-	$(".ali-PlayerNavListe-element.autoSelect").click();
96
+	$(".ali-PlayerNavListe-element.autoSelect:not(.select)").click();
81 97
 }
82 98
 
83 99
 class PHXActivityPlayer {

+ 24
- 129
assets/shared/js/init/init.js View File

@@ -50,74 +50,18 @@ console.log('slinky');
50 50
 	});
51 51
 
52 52
 	// Datepicker DATE
53
-	$('[data-airpicker="date"]').each(function() {
54
-		var myDatepicker = $(this).datepicker({
55
-			startDate: start,
56
-			offset: 0,
57
-			firstDay: 1,
58
-			clearButton: true,
59
-			autoClose: true,
60
-			language: {
61
-				days: [
62
-					'Dimanche',
63
-					'Lundi',
64
-					'Mardi',
65
-					'Mercredi',
66
-					'Jeudi',
67
-					'Vendredi',
68
-					'Samedi',
69
-				],
70
-				daysShort: [
71
-					'Dim',
72
-					'Lun',
73
-					'Mar',
74
-					'Mer',
75
-					'Jeu',
76
-					'Ven',
77
-					'Sam',
78
-				],
79
-				daysMin: [
80
-					'Di',
81
-					'Lu',
82
-					'Ma',
83
-					'Me',
84
-					'Je',
85
-					'Ve',
86
-					'Sa',
87
-				],
88
-				months: [
89
-					'Janvier',
90
-					'Février',
91
-					'Mars',
92
-					'Avril',
93
-					'Mai',
94
-					'Juin',
95
-					'Juillet',
96
-					'Août',
97
-					'Septembre',
98
-					'Octobre',
99
-					'Novembre',
100
-					'Decembre',
101
-				],
102
-				monthsShort: [
103
-					'Jan',
104
-					'Fév',
105
-					'Mars',
106
-					'Avr',
107
-					'Mai',
108
-					'Juin',
109
-					'Juil',
110
-					'Août',
111
-					'Sep',
112
-					'Oct',
113
-					'Nov',
114
-					'Dec',
115
-				],
116
-				clear: 'Effacer'
117
-			},
118
-			clearButton: true,
119
-		}).data('datepicker');
120
-
53
+	let utility = require('../../../exclusive/js/back-office/utilities/utility');
54
+	let options = {
55
+		startDate: start,
56
+		offset: 0,
57
+		firstDay: 1,
58
+		clearButton: true,
59
+		autoClose: true,
60
+		clearButton: true,
61
+	};
62
+	utility.initDatepicker($('[data-airpicker="date"]'),options).each(function()
63
+	{
64
+		let myDatepicker = $(this).datepicker().data('datepicker');
121 65
 		var valueDate = myDatepicker.$altField[0].defaultValue;
122 66
 
123 67
 		if (valueDate != '') {
@@ -125,8 +69,7 @@ console.log('slinky');
125 69
 		}
126 70
 	});
127 71
 
128
-	// Datepicker DATE TIME
129
-	$('[data-airpicker="date time"]').datepicker({
72
+	options = {
130 73
 		startDate: start,
131 74
 		offset: 0,
132 75
 		dateFormat: 'DD d MM yyyy',
@@ -135,67 +78,19 @@ console.log('slinky');
135 78
 		timepicker: true,
136 79
 		dateTimeSeparator: ", à ",
137 80
 		timeFormat: 'hh:ii',
138
-		minutesStep: 15,
139
-		language: {
140
-			days: [
141
-				'Dimanche',
142
-				'Lundi',
143
-				'Mardi',
144
-				'Mercredi',
145
-				'Jeudi',
146
-				'Vendredi',
147
-				'Samedi',
148
-			],
149
-			daysShort: [
150
-				'Dim',
151
-				'Lun',
152
-				'Mar',
153
-				'Mer',
154
-				'Jeu',
155
-				'Ven',
156
-				'Sam',
157
-			],
158
-			daysMin: [
159
-				'Di',
160
-				'Lu',
161
-				'Ma',
162
-				'Me',
163
-				'Je',
164
-				'Ve',
165
-				'Sa',
166
-			],
167
-			months: [
168
-				'Janvier',
169
-				'Février',
170
-				'Mars',
171
-				'Avril',
172
-				'Mai',
173
-				'Juin',
174
-				'Juillet',
175
-				'Août',
176
-				'Septembre',
177
-				'Octobre',
178
-				'Novembre',
179
-				'Decembre',
180
-			],
181
-			monthsShort: [
182
-				'Jan',
183
-				'Fév',
184
-				'Mars',
185
-				'Avr',
186
-				'Mai',
187
-				'Juin',
188
-				'Juil',
189
-				'Août',
190
-				'Sep',
191
-				'Oct',
192
-				'Nov',
193
-				'Dec',
194
-			],
195
-			clear: 'Effacer'
196
-		},
81
+		minutesStep: 15
82
+	};
83
+	utility.initDatepicker($('[data-airpicker="date"]'),options).each(function()
84
+	{
85
+		let myDatepicker = $(this).datepicker().data('datepicker');
86
+		var valueDate = myDatepicker.$altField[0].defaultValue;
87
+
88
+		if (valueDate != '') {
89
+			myDatepicker.selectDate(new Date(valueDate));
90
+		}
197 91
 	});
198 92
 
93
+
199 94
 	const Toastr = require('toastr');
200 95
 	/**
201 96
 	 * Feedbacks Toastr

+ 13
- 18
assets/shared/js/init/init_create-from-library.js View File

@@ -106,24 +106,19 @@ function phxSetupAirpicker()
106 106
 	start.setMinutes(0);
107 107
 
108 108
 	//Datepicker DATE
109
-	$('#modalCreateNewElementFromLibrary [data-airpicker="date"]').each(function() {
110
-		var myDatepicker = $(this).datepicker({
111
-			startDate: start,
112
-			offset: 0,
113
-			firstDay: 1,
114
-			clearButton: true,
115
-			autoClose: true,
116
-			language: {
117
-				days: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
118
-				daysShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
119
-				daysMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
120
-				months: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'],
121
-				monthsShort: ['Jan','Fév','Mars','Avr','Mai','Juin','Juil','Août','Sep','Oct','Nov','Dec'],
122
-				clear: 'Effacer',
123
-			},
124
-			clearButton: true
125
-		}).data('datepicker');
126
-
109
+	let options = {
110
+		startDate: start,
111
+		offset: 0,
112
+		firstDay: 1,
113
+		clearButton: true,
114
+		autoClose: true,
115
+		clearButton: true
116
+	};
117
+
118
+	let utility = require('../utilities/utility');
119
+	utility.initDatepicker($('#modalCreateNewElementFromLibrary [data-airpicker="date"]'),options).each(function()
120
+	{
121
+		let myDatepicker = $(this).datepicker().data('datepicker');
127 122
 		var valueDate = myDatepicker.$altField[0].defaultValue;
128 123
 
129 124
 		if (valueDate != '') {

+ 1
- 0
assets/shared/scss/theme-phx/back-office/global.scss View File

@@ -1501,6 +1501,7 @@ img {
1501 1501
     padding: 10px;
1502 1502
     text-align: center;
1503 1503
     width: 90px;
1504
+    max-width: 100%;
1504 1505
 
1505 1506
 @extend .ali-shadow-box;
1506 1507
 

+ 3
- 1
assets/shared/scss/theme-phx/learning-space/activity-page.scss View File

@@ -591,7 +591,9 @@ $case-width: 70px;
591 591
     height: 100%;
592 592
     width: 100%;
593 593
     margin: 0 auto;
594
-    background: $ls-activity-viewer-background;   
594
+    background: $ls-activity-viewer-background;
595
+	overflow: auto;
596
+	-webkit-overflow-scrolling: touch; 
595 597
 }
596 598
 
597 599
 .ali-ViewerScorm iframe {

+ 1
- 1
assets/shared/scss/theme-phx/learning-space/forum.scss View File

@@ -7,7 +7,7 @@
7 7
     right:0;
8 8
     top:0;
9 9
     bottom:0;
10
-    z-index: 3;
10
+    z-index: 57;
11 11
 
12 12
     &.active {
13 13
         width: 70%;

+ 8
- 4
assets/shared/scss/theme-phx/learning-space/session-page.scss View File

@@ -9,10 +9,14 @@
9 9
     display: flex;
10 10
     width: 100%;
11 11
     position: relative;
12
-    padding-right: 50px;
13
-    
14
-    @media #{$ls-break-xl} {
15
-        padding-right: 0px;
12
+
13
+    &.ali-withForum
14
+    {
15
+        padding-right: 50px;
16
+        
17
+        @media #{$ls-break-xl} {
18
+            padding-right: 0px;
19
+        }
16 20
     }
17 21
 }
18 22
 

+ 5
- 4
config/packages/security.yaml View File

@@ -68,23 +68,24 @@ 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] }
80 82
     
81 83
     # Partie commune aux Onwer et Admin
82
-    - { path: ^/learning-path-builder, roles: [ROLE_ADMIN, ROLE_TRAINER_AND_AUTHOR, ROLE_AUTHOR] }
83
-    - { path: ^/users/searchTrainer, roles: [ROLE_ADMIN, ROLE_TRAINER_AND_AUTHOR, ROLE_AUTHOR] }
84
-    - { path: ^/forum, roles: [ROLE_ADMIN, ROLE_TRAINER_AND_AUTHOR, ROLE_TRAINER] }
84
+    - { path: ^/learning-path-builder, roles: [ROLE_ADMIN, ROLE_COWORKER, ROLE_TRAINER_AND_AUTHOR, ROLE_AUTHOR] }
85
+    - { path: ^/users/searchTrainer, roles: [ROLE_ADMIN, ROLE_COWORKER, ROLE_TRAINER_AND_AUTHOR, ROLE_AUTHOR] }
85 86
     
86 87
     # Le reste pour l'admin
87
-    - { path: ^/, roles: [ROLE_ADMIN] }
88
+    - { path: ^/, roles: [ROLE_ADMIN, ROLE_COWORKER] }
88 89
 
89 90
   role_hierarchy:
90 91
     ROLE_AUTHOR : [ROLE_VIEW_HIS_DATA, ROLE_MANAGE_LEARNING_PATH, ROLE_VIEW_HIS_INFORMATION]

+ 13
- 13
config/routes.yaml View File

@@ -538,9 +538,9 @@ nbo_session_list:
538 538
   path: /sessions/
539 539
   controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\Session\Create\SessionController::list  
540 540
 
541
-nbo_session_export_csv:
542
-  path: /sessions/export/csv
543
-  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\Session\Create\SessionController::exportCSV
541
+nbo_session_export_xls:
542
+  path: /sessions/export/xls
543
+  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\Session\Create\SessionController::exportXLS
544 544
 
545 545
 #-------------------------------------------------------------------------------
546 546
 # Parcours d'apprentissage
@@ -635,13 +635,13 @@ nbo_os_learning_path_editor:
635 635
     id: \d+
636 636
     
637 637
 # Admin
638
-nbo_learning_path_export_csv:
639
-  path: learning-paths/export/csv
640
-  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\LearningPathController::exportCSV
638
+nbo_learning_path_export_xls:
639
+  path: learning-paths/export/xls
640
+  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\LearningPathController::exportXLS
641 641
 # Owner
642
-nbo_os_learning_path_export_csv:
643
-  path: /owner-space/learning-paths/export/csv
644
-  controller: Logipro\Phoenix\Controller\NewBackOffice\Owner\LearningPathController::exportCSV
642
+nbo_os_learning_path_export_xls:
643
+  path: /owner-space/learning-paths/export/xls
644
+  controller: Logipro\Phoenix\Controller\NewBackOffice\Owner\LearningPathController::exportXLS
645 645
 
646 646
     
647 647
 nbo_sequence_set_order:
@@ -1043,9 +1043,9 @@ nbo_offer_delete:
1043 1043
   requirements:
1044 1044
     id: \d+ 
1045 1045
     
1046
-nbo_offer_export_csv:
1047
-  path: /offers/export/csv
1048
-  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\OfferController::exportCSV
1046
+nbo_offer_export_xls:
1047
+  path: /offers/export/xls
1048
+  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\OfferController::exportXLS
1049 1049
   
1050 1050
 nbo_offer_create:
1051 1051
   path: /offer/create
@@ -1211,7 +1211,7 @@ nbo_settings_learning_space:
1211 1211
  # scorm (temporaire)
1212 1212
 nbo_settings_scorm:
1213 1213
   path: /settings/scorm
1214
-  controller: Logipro\Phoenix\Controller\NewBackOffice\Settings\SettingsController::manageScorm
1214
+  controller: Logipro\Phoenix\Controller\NewBackOffice\Admin\Settings\SettingsController::manageScorm
1215 1215
 
1216 1216
 
1217 1217
 #-------------------------------------------------------------------------------

+ 1
- 0
public/build/activity-player.112dcdc3.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/back_office.1c71879f.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/back_office_person_create.3b6fbee3.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/back_office_session_create.792c720d.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/back_office_society_create.4c1b0821.js
File diff suppressed because it is too large
View File


+ 1
- 1
public/build/back-office/diary.5dd787ee.js
File diff suppressed because it is too large
View File


+ 8
- 0
public/build/back-office/learning_path/editor.dfc61bbf.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/menu/trainer.25d9e1aa.js
File diff suppressed because it is too large
View File


public/build/back-office/person/edit.a90251e1.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/session/edit.726a9266.js
File diff suppressed because it is too large
View File


public/build/back-office/setting/learningSpace.78ad121f.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/setting/user/create.405332d1.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/back-office/society/edit.7d5be66b.js
File diff suppressed because it is too large
View File


public/build/back-office/trainer/edit.10f75240.js
File diff suppressed because it is too large
View File


public/build/catalog_setting.f0f17ea1.js
File diff suppressed because it is too large
View File


+ 1
- 1
public/build/learning_space.690d18db.js
File diff suppressed because it is too large
View File


+ 1
- 1
public/build/learning_space_session_page.8d3b8386.js
File diff suppressed because it is too large
View File


public/build/learning_space_setting.8671646c.js
File diff suppressed because it is too large
View File


public/build/learning_space_setting_mod_scss.a642f5f1.js
File diff suppressed because it is too large
View File


+ 58
- 0
public/build/manifest.json View File

@@ -1,4 +1,5 @@
1 1
 {
2
+<<<<<<< HEAD
2 3
   "build/shared.js": "/build/shared.ca945a14.js",
3 4
   "build/shared.css": "/build/shared.5bd74975.css",
4 5
   "build/back-office/back_office.js": "/build/back-office/back_office.70bab5a0.js",
@@ -18,11 +19,33 @@
18 19
   "build/back-office/back_office_person_create.js": "/build/back-office/back_office_person_create.f2d002ae.js",
19 20
   "build/back-office/offer/edit.js": "/build/back-office/offer/edit.b9e0c700.js",
20 21
   "build/learning_space_setting_mod_scss.js": "/build/learning_space_setting_mod_scss.317ed27e.js",
22
+=======
23
+  "build/shared.js": "/build/shared.dd9675ff.js",
24
+  "build/shared.css": "/build/shared.5bd74975.css",
25
+  "build/back-office/back_office.js": "/build/back-office/back_office.1c71879f.js",
26
+  "build/learning_space_session_page.js": "/build/learning_space_session_page.8d3b8386.js",
27
+  "build/back-office/learning_path/editor.js": "/build/back-office/learning_path/editor.dfc61bbf.js",
28
+  "build/learning_space.js": "/build/learning_space.690d18db.js",
29
+  "build/back-office/society/edit.js": "/build/back-office/society/edit.7d5be66b.js",
30
+  "build/back-office/trainer/edit.js": "/build/back-office/trainer/edit.10f75240.js",
31
+  "build/back-office/person/edit.js": "/build/back-office/person/edit.a90251e1.js",
32
+  "build/back-office/session/edit.js": "/build/back-office/session/edit.726a9266.js",
33
+  "build/back-office/follow/session/edit.js": "/build/back-office/follow/session/edit.ea3cb143.js",
34
+  "build/back-office/diary.js": "/build/back-office/diary.5dd787ee.js",
35
+  "build/back-office/back_office_session_create.js": "/build/back-office/back_office_session_create.792c720d.js",
36
+  "build/back-office/back_office_society_create.js": "/build/back-office/back_office_society_create.4c1b0821.js",
37
+  "build/back-office/setting/user/create.js": "/build/back-office/setting/user/create.405332d1.js",
38
+  "build/back-office/menu/trainer.js": "/build/back-office/menu/trainer.25d9e1aa.js",
39
+  "build/back-office/back_office_person_create.js": "/build/back-office/back_office_person_create.3b6fbee3.js",
40
+  "build/back-office/offer/edit.js": "/build/back-office/offer/edit.b9e0c700.js",
41
+  "build/learning_space_setting_mod_scss.js": "/build/learning_space_setting_mod_scss.a642f5f1.js",
42
+>>>>>>> hotfix
21 43
   "build/back-office/setting/trainingPlace/form.js": "/build/back-office/setting/trainingPlace/form.36da2776.js",
22 44
   "build/back-office/offer/importSession.js": "/build/back-office/offer/importSession.e9f315d2.js",
23 45
   "build/back-office/offer/importLearningPath.js": "/build/back-office/offer/importLearningPath.684f8431.js",
24 46
   "build/back-office/back_office_offer_create.js": "/build/back-office/back_office_offer_create.d9d8a59f.js",
25 47
   "build/back-office/learning_path/edit.js": "/build/back-office/learning_path/edit.cb46c3b5.js",
48
+<<<<<<< HEAD
26 49
   "build/shared-learning-space.js": "/build/shared-learning-space.d66e9667.js",
27 50
   "build/shared-learning-space.css": "/build/shared-learning-space.4317a0b1.css",
28 51
   "build/shared-global-catalog.js": "/build/shared-global-catalog.7e3b9383.js",
@@ -37,6 +60,22 @@
37 60
   "build/learning_space_forum.js": "/build/learning_space_forum.a4df4701.js",
38 61
   "build/catalog_setting.js": "/build/catalog_setting.508d70aa.js",
39 62
   "build/back-office/setting/learningSpace.js": "/build/back-office/setting/learningSpace.71e58528.js",
63
+=======
64
+  "build/shared-learning-space.js": "/build/shared-learning-space.d1e28642.js",
65
+  "build/shared-learning-space.css": "/build/shared-learning-space.81b95faf.css",
66
+  "build/shared-global-catalog.js": "/build/shared-global-catalog.d429a8a8.js",
67
+  "build/shared-global-catalog.css": "/build/shared-global-catalog.a556272d.css",
68
+  "build/shared-catalog.js": "/build/shared-catalog.3f1883a0.js",
69
+  "build/shared-catalog.css": "/build/shared-catalog.a6cbe981.css",
70
+  "build/shared-global-back-office.js": "/build/shared-global-back-office.988e14a3.js",
71
+  "build/shared-global-back-office.css": "/build/shared-global-back-office.7a2cada2.css",
72
+  "build/shared-back-office.js": "/build/shared-back-office.25fd9fb9.js",
73
+  "build/shared-back-office.css": "/build/shared-back-office.b07b7461.css",
74
+  "build/learning_space_setting.js": "/build/learning_space_setting.8671646c.js",
75
+  "build/learning_space_forum.js": "/build/learning_space_forum.a4df4701.js",
76
+  "build/catalog_setting.js": "/build/catalog_setting.f0f17ea1.js",
77
+  "build/back-office/setting/learningSpace.js": "/build/back-office/setting/learningSpace.78ad121f.js",
78
+>>>>>>> hotfix
40 79
   "build/back-office/session/place.js": "/build/back-office/session/place.5f4e8c69.js",
41 80
   "build/back-office/document/edit.js": "/build/back-office/document/edit.7d4a4e39.js",
42 81
   "build/back-office/setting/catalogThematic/create.js": "/build/back-office/setting/catalogThematic/create.dbb5d812.js",
@@ -45,7 +84,11 @@
45 84
   "build/back-office/back_office_funding_agency_create.js": "/build/back-office/back_office_funding_agency_create.57b26695.js",
46 85
   "build/back-office/funding_agency/edit.js": "/build/back-office/funding_agency/edit.3811b0f8.js",
47 86
   "build/scorm-api.js": "/build/scorm-api.5fdcc8ab.js",
87
+<<<<<<< HEAD
48 88
   "build/activity-player.js": "/build/activity-player.b266b266.js",
89
+=======
90
+  "build/activity-player.js": "/build/activity-player.112dcdc3.js",
91
+>>>>>>> hotfix
49 92
   "build/learning_space_setting_css.js": "/build/learning_space_setting_css.eab9d46f.js",
50 93
   "build/learning_space_setting_css.css": "/build/learning_space_setting_css.0db6cd30.css",
51 94
   "build/offer.js": "/build/offer.1ad175ac.js",
@@ -60,17 +103,28 @@
60 103
   "build/back-office/back_office_forum.js": "/build/back-office/back_office_forum.ea2a5661.js",
61 104
   "build/manifest.js": "/build/manifest.d41d8cd9.js",
62 105
   "build/images/path-icon-virtual-classroom.svg": "/build/images/path-icon-virtual-classroom.c0b9173f.svg",
106
+<<<<<<< HEAD
63 107
   "build/images/socicon.svg?a93r5t": "/build/images/socicon.b6029456.svg",
64 108
   "build/fonts/socicon.eot?a93r5t": "/build/fonts/socicon.23870e1b.eot",
65 109
   "build/images/layers-2x.png": "/build/images/layers-2x.4f0283c6.png",
66 110
   "build/images/marker-icon.png": "/build/images/marker-icon.2273e3d8.png",
111
+=======
112
+  "build/images/layers-2x.png": "/build/images/layers-2x.4f0283c6.png",
113
+  "build/images/layers.png": "/build/images/layers.a6137456.png",
114
+  "build/images/socicon.svg?a93r5t": "/build/images/socicon.b6029456.svg",
115
+  "build/images/entypo.svg?79395234": "/build/images/entypo.42723819.svg",
116
+  "build/fonts/socicon.eot?a93r5t": "/build/fonts/socicon.23870e1b.eot",
117
+>>>>>>> hotfix
67 118
   "build/fonts/entypo.ttf?79395234": "/build/fonts/entypo.8f351fb3.ttf",
68 119
   "build/fonts/entypo.eot?79395234": "/build/fonts/entypo.35e76ec3.eot",
69 120
   "build/fonts/socicon.ttf?a93r5t": "/build/fonts/socicon.2ba13131.ttf",
70 121
   "build/fonts/entypo.woff2?79395234": "/build/fonts/entypo.86fff9d1.woff2",
71 122
   "build/fonts/socicon.woff?a93r5t": "/build/fonts/socicon.cdaa4f04.woff",
72 123
   "build/fonts/entypo.woff?79395234": "/build/fonts/entypo.9719148f.woff",
124
+<<<<<<< HEAD
73 125
   "build/images/layers.png": "/build/images/layers.a6137456.png",
126
+=======
127
+>>>>>>> hotfix
74 128
   "build/images/home-course.svg": "/build/images/home-course.a929900f.svg",
75 129
   "build/images/rapid-learning.png": "/build/images/rapid-learning.c7052d9c.png",
76 130
   "build/images/scorm.svg": "/build/images/scorm.6ec58f07.svg",
@@ -153,7 +207,11 @@
153 207
   "build/images/icon-training-face-to-face.svg": "/build/images/icon-training-face-to-face.c0da0173.svg",
154 208
   "build/images/ico-create.svg": "/build/images/ico-create.ae9bf6ca.svg",
155 209
   "build/images/avatar-corporation.jpg": "/build/images/avatar-corporation.3fb926fe.jpg",
210
+<<<<<<< HEAD
156 211
   "build/images/entypo.svg?79395234": "/build/images/entypo.42723819.svg",
212
+=======
213
+  "build/images/marker-icon.png": "/build/images/marker-icon.2273e3d8.png",
214
+>>>>>>> hotfix
157 215
   "build/images/baseline-photo_library.svg": "/build/images/baseline-photo_library.2af77e1b.svg",
158 216
   "build/images/ico-param-h2.svg": "/build/images/ico-param-h2.e9a319d9.svg",
159 217
   "build/images/activity-completed.svg": "/build/images/activity-completed.7cdce4f0.svg",

+ 1
- 0
public/build/shared-back-office.25fd9fb9.js View File

@@ -0,0 +1 @@
1
+webpackJsonp([27],{IY9H:function(n,o,s){},sbso:function(n,o,s){s("IY9H")}},["sbso"]);

+ 1
- 0
public/build/shared-back-office.b07b7461.css
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/shared-catalog.3f1883a0.js View File

@@ -0,0 +1 @@
1
+webpackJsonp([25],{"3XIY":function(n,u,c){},uA6F:function(n,u,c){c("3XIY")}},["uA6F"]);

+ 1
- 0
public/build/shared-global-back-office.988e14a3.js View File

@@ -0,0 +1 @@
1
+webpackJsonp([26],{FVVP:function(n,V,c){},jlJW:function(n,V,c){c("FVVP")}},["jlJW"]);

+ 1
- 0
public/build/shared-global-catalog.d429a8a8.js View File

@@ -0,0 +1 @@
1
+webpackJsonp([24],{Z2tw:function(n,t,c){c("m6M9")},m6M9:function(n,t,c){}},["Z2tw"]);

+ 1
- 0
public/build/shared-learning-space.81b95faf.css
File diff suppressed because it is too large
View File


+ 1
- 0
public/build/shared-learning-space.d1e28642.js View File

@@ -0,0 +1 @@
1
+webpackJsonp([23],{d4VR:function(n,V,c){c("vNVZ")},vNVZ:function(n,V,c){}},["d4VR"]);

+ 222
- 0
public/build/shared.dd9675ff.js
File diff suppressed because it is too large
View File


+ 20
- 32
src/Phoenix/Command/BBBGetRecordCommand.php View File

@@ -1,24 +1,13 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Command;
3 4
 
4 5
 use Symfony\Component\Console\Input\InputInterface;
5 6
 use Symfony\Component\Console\Output\OutputInterface;
6 7
 use Doctrine\Common\Persistence\ManagerRegistry;
7
-use Logipro\Phoenix\Entity\Package\Package;
8
-use Logipro\Phoenix\Package\Exception\PackageException;
9
-use Logipro\Phoenix\Service\PackageImporter;
10
-use Symfony\Component\Console\Input\InputOption;
11
-use \Logipro\Phoenix\Entity\SequenceItem\EventVirtualClassroom;
12
-
13
-
14 8
 use \Logipro\Phoenix\Entity\VirtualClassroom;
15
-
16 9
 use Logipro\Phoenix\Component\BBB\PhxBigBlueButton;
17
-
18
-use Logipro\Phoenix\Service\FileUploader;
19
-
20 10
 use BigBlueButton\Parameters\GetRecordingsParameters;
21
-use Symfony\Component\Console\Command\Command;
22 11
 
23 12
 /**
24 13
  * Commande d'import d'un package e-learning.
@@ -48,34 +37,36 @@ class BBBGetRecordCommand extends PhxCommand
48 37
 		$defaultBbbUrl = $settingsService->get('bbb_url');
49 38
 
50 39
 		// récupère tous les meetingId
51
-		$manager = $this->getDoctrine()->getManager(); 
40
+		$manager = $this->getDoctrine()->getManager();
52 41
 		$virtualClassroomRepository = $manager->getRepository(VirtualClassroom::class);
53 42
 		$meetingIds = $virtualClassroomRepository->getAllMeetingId();
54 43
 
55 44
 		// récupère toute les classes et les groupes par URL
56
-		$bbbMeetingIds = array();
57
-		foreach ($meetingIds as $bbbMeetingData)
58
-		{
45
+		$bbbMeetingIdsByUrl = array();
46
+		foreach ($meetingIds as $bbbMeetingData) {
59 47
 			$bbbMeetingIdsByUrl[$bbbMeetingData['url']][] = $bbbMeetingData['bbbMeetingId'];
60 48
 		}
61 49
 
62 50
 		// récupère les enregistrements par url
63 51
 		// 1 appel par url
64 52
 		$allRecords = array();
65
-		foreach ($bbbMeetingIdsByUrl as $url => $bbbMeetingIds)
66
-		{
53
+		foreach ($bbbMeetingIdsByUrl as $url => $bbbMeetingIds) {
67 54
 			$bbb = new PhxBigBlueButton($settingsService);
68
-			if ($url != $defaultBbbUrl)
69
-			{
70
-				$bbb->setUrl($url);
55
+			if ($url != $defaultBbbUrl) {
56
+				$isValidURL = $bbb->setUrl($url);
57
+
58
+				// Si l'url n'est pas correcte on stop la procédure
59
+				if (false === $isValidURL) {
60
+					$output->writeln("Enregistrements non importés: URL invalide");
61
+					return 0;
62
+				}
71 63
 			}
72 64
 
73 65
 			// récupère tous les enregistrements
74
-			if (!empty($bbbMeetingIds))
75
-			{
66
+			if (!empty($bbbMeetingIds)) {
76 67
 				$recordingParams = new GetRecordingsParameters();
77
-				
78
-				$recordingParams->setMeetingId(implode(',',$bbbMeetingIds));
68
+
69
+				$recordingParams->setMeetingId(implode(',', $bbbMeetingIds));
79 70
 				$response = $bbb->getRecordings($recordingParams);
80 71
 				if ($response)
81 72
 				{
@@ -85,15 +76,12 @@ class BBBGetRecordCommand extends PhxCommand
85 76
 		}
86 77
 
87 78
 		// parcours les enregistrements
88
-		foreach ($allRecords as $record)
89
-		{
79
+		foreach ($allRecords as $record) {
90 80
 			$meetingId = $record->getMeetingId();
91
-			$key = array_search($meetingId,$bbbMeetingIds);
92
-			if ($key)
93
-			{
81
+			$key = array_search($meetingId, $bbbMeetingIds);
82
+			if ($key) {
94 83
 				$virtualClassRoom = $virtualClassroomRepository->findOneBy(array('bbbMeetingId' => $meetingId));
95
-				if ($virtualClassRoom)
96
-				{
84
+				if ($virtualClassRoom) {
97 85
 					$virtualClassRoom->setBbbRecordId($record->getRecordId());
98 86
 
99 87
 					// supprime l'entrée pour ne pas réimporter d'enregistrement

+ 4
- 2
src/Phoenix/Component/BBB/PhxBigBlueButton.php View File

@@ -32,7 +32,7 @@ class PhxBigBlueButton extends BigBlueButton
32 32
 			$this->bbbServerBaseUrl = null;
33 33
 			$this->urlBuilder = null;
34 34
 
35
-			return;
35
+			return false;
36 36
 		}
37 37
 
38 38
 		// test l'url
@@ -83,11 +83,13 @@ class PhxBigBlueButton extends BigBlueButton
83 83
 			$this->bbbServerBaseUrl = null;
84 84
 			$this->urlBuilder = null;
85 85
 
86
-			return;
86
+			return false;
87 87
 		}
88 88
 
89 89
 		// complète les configuration si tout est ok
90 90
 		$this->bbbServerBaseUrl = $urlEnd;
91 91
 		$this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl);
92
+
93
+		return true;
92 94
 	}
93 95
 }

+ 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
+}

+ 9
- 4
src/Phoenix/Controller/Catalog/LoginController.php View File

@@ -296,11 +296,16 @@ class LoginController extends CatalogController
296 296
 		$token = $request->get('token');
297 297
 
298 298
 		$tokenData = PasswordRecoverNotifyLearner::decrytUrlArg($token);
299
-		if (!$tokenData)
300
-		{
301
-			throw $this->createNotFoundException($this->translate('error_403_message'));
299
+		if (!$tokenData) {
300
+            // token expiré
301
+            $parameters = array(
302
+                'text' => $this->translate('catalog_password_expired'),
303
+                'path' => 'catalog_homepage',
304
+                'go' => $this->translate('catalog_password_return')
305
+            );
306
+            return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters);
302 307
 		}
303
-
308
+		
304 309
 		$respository = $this->getRepository(LearnerAccount::class);
305 310
 		$learnerAccount = $respository->findOneBy(array('learnerAccountId' => $tokenData['learnerAccountId']));
306 311
 		if (!$learnerAccount)

+ 1
- 1
src/Phoenix/Controller/Catalog/OfferController.php View File

@@ -39,7 +39,7 @@ class OfferController extends CatalogController
39 39
 
40 40
 		$currentThematic = null;
41 41
 		$thematic = $filter->getFilterWords('catalogThematicId');
42
-		if ($thematic[0] != '') {
42
+		if (isset($thematic[0]) && $thematic[0] != '') {
43 43
 			$currentThematic = $repositoryThematic->find($thematic[0]);
44 44
 		}
45 45
 

+ 80
- 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,135 @@ 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 121
 		$tokenData = PasswordRecoverNotifyLearner::decrytUrlArg($token);
114
-		if (!$tokenData)
115
-		{
116
-			throw $this->createNotFoundException($this->translate('error_403_message'));
122
+		if (!$tokenData) {
123
+			// token expiré
124
+			$parameters = array(
125
+				'text' => $this->translate('ls_password_expired'),
126
+				'path' => 'ls_homepage',
127
+				'go' => $this->translate('ls_password_return')
128
+			);
129
+			return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters);
117 130
 		}
118 131
 
119 132
 		$respository = $this->getRepository(LearnerAccount::class);
120 133
 		$learnerAccount = $respository->findOneBy(array('learnerAccountId' => $tokenData['learnerAccountId']));
121
-		if (!$learnerAccount)
122
-		{
134
+		if (!$learnerAccount) {
123 135
 			throw $this->createNotFoundException($this->translate('error_403_message'));
124 136
 		}
125
-		$form = $this->createForm(CatalogDefinePasswordType::class,$learnerAccount); 
137
+		$form = $this->createForm(CatalogDefinePasswordType::class, $learnerAccount);
126 138
 
127
-		try
128
-		{
129
-			if ($request->isMethod('POST'))
130
-			{
139
+		try {
140
+			if ($request->isMethod('POST')) {
131 141
 				$form->handleRequest($request);
132 142
 
133 143
 				// test le mot de passe
134 144
 				$plainPasswordField = $form->get('plainPassword')->get('first');
135 145
 				$plainPassword = $plainPasswordField->getData();
136
-				$errorMsg = PasswordValidator::renderError($this->get('translator'),$this->get('phxSettings'),$plainPassword);
137
-				if ($errorMsg != '')
138
-				{
139
-					$this->addFormError($plainPasswordField,$errorMsg);
146
+				$errorMsg = PasswordValidator::renderError($this->get('translator'), $this->get('phxSettings'), $plainPassword);
147
+				if ($errorMsg != '') {
148
+					$this->addFormError($plainPasswordField, $errorMsg);
140 149
 				}
141 150
 
142 151
 				// test le formulaire
143
-				if ($form->isSubmitted() && $form->isValid())
144
-				{
152
+				if ($form->isSubmitted() && $form->isValid()) {
145 153
 					$oldPassword = $learnerAccount->getPassword();
146 154
 					$encoder = $this->get('security.password_encoder');
147
-					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount,$plainPassword));
155
+					$learnerAccount->setPassword($encoder->encodePassword($learnerAccount, $plainPassword));
148 156
 
149 157
 					$manager = $this->getManager();
150 158
 					$manager->flush();
151 159
 
152 160
 					if ($oldPassword == '') {
153 161
 						$this->addFlash('success', $this->translate('password_defined'));
154
-					}
155
-					else {
156
-						$this->addFlash('success',$this->translate('new_password_defined'));
162
+					} else {
163
+						$this->addFlash('success', $this->translate('new_password_defined'));
157 164
 					}
158 165
 
159 166
 					// logue l'utilisateur
160
-                    $loginService->loginLearningSpaceUser($learnerAccount,$plainPassword);
167
+					$loginService->loginLearningSpaceUser($learnerAccount, $plainPassword);
161 168
 
162 169
 					// redirige sur le catalogue
163 170
 					$route = $tokenData['route'];
164
-					if ($route == "")
165
-					{
171
+					if ($route == "") {
166 172
 						$route = 'ls_homepage';
167 173
 					}
168 174
 					return $this->redirectToRoute($route);
169 175
 				}
170 176
 			}
171
-		}
172
-		catch (\Exception $exp)
173
-		{
177
+		} catch (\Exception $exp) {
174 178
 			$error = $exp->getMessage();
175 179
 			$succes = false;
176 180
 		}
177 181
 
178 182
 		// 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);
183
+		$parameters = array('token' => $token, 'form' => $form->createView(), 'learnerAccount' => $learnerAccount);
184
+		return $this->phxRender('learning_space/pages/password/define_password.html.twig', $parameters);
181 185
 	}
182
-}
186
+}

+ 201
- 309
src/Phoenix/Controller/NewBackOffice/Admin/LearningPathController.php
File diff suppressed because it is too large
View File


+ 18
- 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;
@@ -46,7 +47,7 @@ class LoginController extends BackOfficeAdminController
46 47
             'last_username' => $lastUsername,
47 48
             'error'         => $error,
48 49
             'site_name'     => $siteName,
49
-            'site_logo_path'=> $siteLogoPath,
50
+            'site_logo_path' => $siteLogoPath,
50 51
         ));
51 52
     }
52 53
 
@@ -60,7 +61,7 @@ class LoginController extends BackOfficeAdminController
60 61
         if ($this->getUser()) {
61 62
             throw $this->createNotFoundException($this->translate('error_403_message'));
62 63
         }
63
-        
64
+
64 65
         // Formulaire
65 66
         $formBuilder = $this->createFormBuilder();
66 67
         $formBuilder->add('email', EmailType::class);
@@ -80,7 +81,7 @@ class LoginController extends BackOfficeAdminController
80 81
                 if ($user) {
81 82
                     //On déclenche l'event
82 83
                     $event = new GenericEvent($user);
83
-                    $eventDispatcher->dispatch($event,Events::USER_RECOVER_PASSWORD);
84
+                    $eventDispatcher->dispatch($event, Events::USER_RECOVER_PASSWORD);
84 85
 
85 86
                     $this->addFlash('success', $this->get('translator')->trans('success_password_recovery_email_sent'));
86 87
                 } else {
@@ -106,14 +107,14 @@ class LoginController extends BackOfficeAdminController
106 107
         $variables = array(
107 108
             'form' => $form->createView(),
108 109
             'site_name'     => $siteName,
109
-            'site_logo_path'=> $siteLogoPath,
110
+            'site_logo_path' => $siteLogoPath,
110 111
         );
111 112
 
112 113
         return $this->phxRender('back-office/pages/password/password-recover.html.twig', $variables);
113 114
     }
114 115
 
115 116
 
116
-    public function manageDefinePassword(Request $request,LoginService $loginService)
117
+    public function manageDefinePassword(Request $request, LoginService $loginService)
117 118
     {
118 119
         if ($this->getUser()) {
119 120
             throw $this->createNotFoundException($this->translate('error_403_message'));
@@ -122,7 +123,13 @@ class LoginController extends BackOfficeAdminController
122 123
 
123 124
         $tokenData = PasswordRecoverNotifyUser::decrytUrlArg($token);
124 125
         if (!$tokenData) {
125
-            throw $this->createNotFoundException($this->translate('error_403_message'));
126
+            // token expiré
127
+            $parameters = array(
128
+                'text' => $this->translate('bo_password_expired'),
129
+                'path' => 'bo_homepage',
130
+                'go' => $this->translate('back_homepage')
131
+            );
132
+            return $this->phxRender('bundles/TwigBundle/Exception/definePassword.html.twig', $parameters);
126 133
         }
127 134
 
128 135
         $respository = $this->getRepository(User::class);
@@ -143,10 +150,10 @@ class LoginController extends BackOfficeAdminController
143 150
                 if ($errorMsg != '') {
144 151
                     $this->addFormError($plainPasswordField, $errorMsg);
145 152
                 }
146
-                
153
+
147 154
                 // test le formulaire
148 155
                 if ($form->isSubmitted() && $form->isValid()) {
149
-                    $old = $user->getPassword() ;
156
+                    $old = $user->getPassword();
150 157
                     $plainPassword = $form->get('plainPassword')->getData();
151 158
                     $encoder = $this->get('security.password_encoder');
152 159
                     $user->setPassword($encoder->encodePassword($user, $plainPassword));
@@ -167,11 +174,11 @@ class LoginController extends BackOfficeAdminController
167 174
                             'button_text' => false,
168 175
                         );
169 176
                     }
170
-                    
177
+
171 178
                     $this->addToastFlash('success', $parameters);
172 179
 
173 180
                     // logue l'utilisateur
174
-                    $loginService->loginBackOfficeUser($user,$plainPassword);
181
+                    $loginService->loginBackOfficeUser($user, $plainPassword);
175 182
 
176 183
                     $route = $tokenData['route'];
177 184
                     if ($route == "") {
@@ -206,7 +213,7 @@ class LoginController extends BackOfficeAdminController
206 213
             'form' => $form->createView(),
207 214
             'user' => $user,
208 215
             'site_name'     => $siteName,
209
-            'site_logo_path'=> $siteLogoPath,
216
+            'site_logo_path' => $siteLogoPath,
210 217
         );
211 218
         return $this->phxRender('back-office/pages/password/define_password.html.twig', $parameters);
212 219
     }

+ 84
- 122
src/Phoenix/Controller/NewBackOffice/Admin/NoticeController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\NewBackOffice\Admin;
3 4
 
4 5
 use Logipro\Phoenix\Controller\NewBackOffice\Admin\BackOfficeAdminController;
@@ -20,65 +21,57 @@ use Logipro\Phoenix\Service\initNoticeView;
20 21
  */
21 22
 class NoticeController extends BackOfficeAdminController
22 23
 {
23
-	public function addByPerson(Request $request,$personId,FileUploader $uploader,initNoticeView $noticeHandler)
24
+	public function addByPerson(Request $request, $personId, FileUploader $uploader, initNoticeView $noticeHandler)
24 25
 	{
25 26
 		$repository = $this->getRepository(Person::class);
26 27
 		$person = $repository->find($personId);
27 28
 
28 29
 		$notice = new Notice();
29
-		$form = $noticeHandler->initNoticeForm($person,$notice);
30
-		try
31
-		{
32
-			if ($request->isMethod('POST'))
33
-			{
30
+		$form = $noticeHandler->initNoticeForm($person, $notice);
31
+		try {
32
+			if ($request->isMethod('POST')) {
34 33
 				$form->handleRequest($request);
35 34
 
36
-				$this->validateNotice($request,$form,$uploader,$notice);
37
-				
35
+				$this->validateNotice($request, $form, $uploader, $notice);
36
+
38 37
 				$type = 'success';
39 38
 				$succes = true;
40 39
 			}
41
-		}
42
-		catch (\Exception $exp)
43
-		{
44
-			$this->revertFiles($notice,$uploader);
40
+		} catch (\Exception $exp) {
41
+			$this->revertFiles($notice, $uploader);
45 42
 
46 43
 			$succes = false;
47 44
 			$type = 'error';
48
-			
45
+
49 46
 			$errors = $this->getFormFieldError($form);
50 47
 
51 48
 			$response['message'] = $exp->getMessage();
52 49
 			$response['formError'] = array();
53 50
 
54 51
 			// parcours les erreurs
55
-			foreach ($errors as $fieldId => $errorField)
56
-			{
52
+			foreach ($errors as $fieldId => $errorField) {
57 53
 				$message = $this->getFormFieldErrorMessage($errorField);
58
-				if ($message)
59
-				{
54
+				if ($message) {
60 55
 					$response['formError'][$fieldId] = $message;
61 56
 				}
62 57
 			}
63 58
 		}
64
-		
59
+
65 60
 		$response['messageType'] = $type;
66 61
 		$response["succes"] = $succes;
67 62
 
68 63
 		return $this->json($response);
69 64
 	}
70 65
 
71
-	private function validateNotice($request,$form,$uploader,$notice)
66
+	private function validateNotice($request, $form, $uploader, $notice)
72 67
 	{
73 68
 		$this->validForm($form);
74 69
 
75 70
 		// transforme les fichiers en file
76 71
 		$fileRepository = $this->getRepository(File::class);
77 72
 		$fileNames = $request->request->get('file');
78
-		if ($fileNames)
79
-		{
80
-			foreach ($fileNames as $fileData)
81
-			{
73
+		if ($fileNames) {
74
+			foreach ($fileNames as $fileData) {
82 75
 				$tmpName = $fileData['tmp'];
83 76
 				$mimeType = $fileData['type'];
84 77
 				$finalName = $fileData['name'];
@@ -88,15 +81,13 @@ class NoticeController extends BackOfficeAdminController
88 81
 				// test la taille
89 82
 				$size = \filesize($tmpPath);
90 83
 				$maxFileSize = $notice->getUploadMaxFileSize();
91
-				if ($size > $maxFileSize)
92
-				{
84
+				if ($size > $maxFileSize) {
93 85
 					// a ce niveau la, le fichier est uniquemet ignoré car la vérification js a déja eu lieu
94 86
 					continue;
95 87
 				}
96 88
 
97 89
 				// test le type
98
-				if (!in_array($mimeType,$notice->getUploadMimeTypes()))
99
-				{
90
+				if (!in_array($mimeType, $notice->getUploadMimeTypes())) {
100 91
 					// a ce niveau la, le fichier est uniquemet ignoré car la vérification js a déja eu lieu
101 92
 					continue;
102 93
 				}
@@ -112,7 +103,7 @@ class NoticeController extends BackOfficeAdminController
112 103
 				$file->setMimeType($mimeType);
113 104
 
114 105
 				// déplace le fichier temporaire
115
-				\rename($tmpPath,$newPath);
106
+				\rename($tmpPath, $newPath);
116 107
 
117 108
 				// ajoute le fichier à la notification
118 109
 				$notice->addFile($file);
@@ -123,71 +114,64 @@ class NoticeController extends BackOfficeAdminController
123 114
 		$notice->setUser($this->getUser());
124 115
 
125 116
 		$manager = $this->getManager();
126
-		$manager->persist($notice);	
127
-		
117
+		$manager->persist($notice);
118
+
128 119
 		$manager->flush();
129 120
 
130
-		$this->addFlash('success',$this->translate('success_notice_created'));
121
+		$this->addFlash('success', $this->translate('success_notice_created'));
131 122
 	}
132 123
 
133
-	private function revertFiles($notice,$uploader)
124
+	private function revertFiles($notice, $uploader)
134 125
 	{
135 126
 		$files = $notice->getFiles();
136
-		foreach ($files as $file)
137
-		{
127
+		foreach ($files as $file) {
138 128
 			$fileName = basename($file->getPath());
139 129
 
140 130
 			// redéplace dans le dossier temporaire
141 131
 			$tmpPath = $uploader->buildUploadTmpPath($fileName);
142 132
 			$newPath = $uploader->buildUploadPublicPath($fileName);
143 133
 
144
-			\rename($newPath,$tmpPath);
134
+			\rename($newPath, $tmpPath);
145 135
 		}
146 136
 	}
147 137
 
148
-	public function addBySociety(Request $request,$societyId,FileUploader $uploader,initNoticeView $handler)
138
+	public function addBySociety(Request $request, $societyId, FileUploader $uploader, initNoticeView $handler)
149 139
 	{
150 140
 		$repository = $this->getRepository(Society::class);
151 141
 		$society = $repository->find($societyId);
152 142
 
153 143
 		$notice = new Notice();
154
-		$form = $handler->initNoticeFormSociety($society,$notice);
155
-		try
156
-		{
157
-			if ($request->isMethod('POST'))
158
-			{
144
+		$form = $handler->initNoticeFormSociety($society, $notice);
145
+		try {
146
+			if ($request->isMethod('POST')) {
159 147
 				$form->handleRequest($request);
160 148
 
161
-				$this->validateNotice($request,$form,$uploader,$notice);
162
-				
149
+				$this->validateNotice($request, $form, $uploader, $notice);
150
+
163 151
 				$type = 'success';
164 152
 				$succes = true;
165 153
 			}
166
-		}
167
-		catch (\Exception $exp)
168
-		{
169
-			$this->revertFiles($notice,$uploader);
154
+		} catch (\Exception $exp) {
155
+			$this->revertFiles($notice, $uploader);
170 156
 
171 157
 
172 158
 			$succes = false;
173 159
 			$type = 'error';
174
-			
160
+
175 161
 			$errors = $this->getFormFieldError($form);
176 162
 
177 163
 			$response['message'] = $exp->getMessage();
178 164
 			$response['formError'] = array();
179 165
 
180 166
 			// parcours les erreurs
181
-			foreach ($errors as $fieldId => $errorField)
182
-			{
167
+			foreach ($errors as $fieldId => $errorField) {
183 168
 				$message = $this->getFormFieldErrorMessage($errorField);
184
-				if ($message)
185
-				{
169
+				if ($message) {
186 170
 					$response['formError'][$fieldId] = $message;
187 171
 				}
188 172
 			}
189 173
 		}
190
-		
174
+
191 175
 		$response['messageType'] = $type;
192 176
 		$response["succes"] = $succes;
193 177
 
@@ -195,96 +179,85 @@ class NoticeController extends BackOfficeAdminController
195 179
 	}
196 180
 
197 181
 
198
-	public function addBySession(Request $request,$sessionId,FileUploader $uploader,initNoticeView $handler)
182
+	public function addBySession(Request $request, $sessionId, FileUploader $uploader, initNoticeView $handler)
199 183
 	{
200 184
 		$repository = $this->getRepository(Session::class);
201 185
 		$session = $repository->find($sessionId);
202 186
 
203 187
 		$notice = new Notice();
204
-		$form = $handler->initNoticeFormForSession($session,$notice);
205
-		try
206
-		{
207
-			if ($request->isMethod('POST'))
208
-			{
188
+		$form = $handler->initNoticeFormForSession($session, $notice);
189
+		try {
190
+			if ($request->isMethod('POST')) {
209 191
 				$form->handleRequest($request);
210 192
 
211
-				$this->validateNotice($request,$form,$uploader,$notice);
212
-				
193
+				$this->validateNotice($request, $form, $uploader, $notice);
194
+
213 195
 				$type = 'success';
214 196
 				$succes = true;
215 197
 			}
216
-		}
217
-		catch (\Exception $exp)
218
-		{
219
-			$this->revertFiles($notice,$uploader);
198
+		} catch (\Exception $exp) {
199
+			$this->revertFiles($notice, $uploader);
220 200
 
221 201
 
222 202
 			$succes = false;
223 203
 			$type = 'error';
224
-			
204
+
225 205
 			$errors = $this->getFormFieldError($form);
226 206
 
227 207
 			$response['message'] = $exp->getMessage();
228 208
 			$response['formError'] = array();
229 209
 
230 210
 			// parcours les erreurs
231
-			foreach ($errors as $fieldId => $errorField)
232
-			{
211
+			foreach ($errors as $fieldId => $errorField) {
233 212
 				$message = $this->getFormFieldErrorMessage($errorField);
234
-				if ($message)
235
-				{
213
+				if ($message) {
236 214
 					$response['formError'][$fieldId] = $message;
237 215
 				}
238 216
 			}
239 217
 		}
240
-		
218
+
241 219
 		$response['messageType'] = $type;
242 220
 		$response["succes"] = $succes;
243 221
 
244 222
 		return $this->json($response);
245 223
 	}
246 224
 
247
-	public function resendDocumentNotification(Request $request,$noticeId)
225
+	public function resendDocumentNotification(Request $request, $noticeId)
248 226
 	{
249 227
 		// récupère la notification
250 228
 		$repository = $this->getRepository(Notice::class);
251 229
 		$notice = $repository->find($noticeId);
252 230
 
253
-		if (!$notice)
254
-		{
231
+		if (!$notice) {
255 232
 			throw $this->createNotFoundException();
256 233
 		}
257 234
 
258 235
 		// test si la notification est en echec
259
-		if ($notice->getStatus() != EnumNoticeStatusType::STATUS_WAITING_SENDING)
260
-		{
236
+		if ($notice->getStatus() != EnumNoticeStatusType::STATUS_WAITING_SENDING) {
261 237
 			throw $this->createNotFoundException();
262 238
 		}
263 239
 
264 240
 		// récupère le document
265 241
 		$document = $notice->getDocument();
266
-		if (!$document)
267
-		{
242
+		if (!$document) {
268 243
 			return $this->createNotFoundException();
269 244
 		}
270 245
 
271 246
 		$session = $notice->getSession();
272 247
 
273 248
 		// lance l'événement d'envoi
274
-		$documentController = $this->get('Logipro\Phoenix\Controller\NewBackOffice\File\Document\DocumentController');
249
+		$documentController = $this->get('Logipro\Phoenix\Controller\NewBackOffice\Admin\File\Document\DocumentController');
275 250
 		$controller = $documentController->getControllerByDocument($document);
276
-		switch ($document->getType())
277
-		{
251
+		switch ($document->getType()) {
278 252
 			case EnumDocumentType::TYPE_PROGRAMME:
279 253
 				// test si on peut l'envoyer
280
-				if (!$controller->canSendAutomatic($session))
281
-				{
254
+				if (!$controller->canSendAutomatic($session)) {
282 255
 					throw $this->createNotFoundException();
283 256
 				}
284 257
 
285 258
 				// renvoi la notification
286
-				$controller->dispatchEvent($document,$session,$notice->getTo());
287
-				
259
+				$controller->dispatchEvent($document, $session, $notice->getTo());
260
+
288 261
 				// marque la notification comme renvoyé
289 262
 				$manager = $this->getManager();
290 263
 				$manager->remove($notice);
@@ -296,26 +269,22 @@ class NoticeController extends BackOfficeAdminController
296 269
 
297 270
 			case EnumDocumentType::TYPE_FORMER_CONTRACT:
298 271
 				// test si on peut l'envoyer
299
-				if (!$controller->canSendAutomatic($session))
300
-				{
272
+				if (!$controller->canSendAutomatic($session)) {
301 273
 					throw $this->createNotFoundException();
302 274
 				}
303 275
 				$trainer = $notice->getTo();
304 276
 				// filtre les items du formateur
305 277
 				$items = $session->getSequenceItems();
306 278
 				$itemsFiltered = array();
307
-				foreach ($items as $item)
308
-				{
309
-					if (method_exists($sequenceItem,'getTrainer'))
310
-					{
311
-						if ($item->getTrainer() == $trainer)
312
-						{
279
+				foreach ($items as $item) {
280
+					if (method_exists($sequenceItem, 'getTrainer')) {
281
+						if ($item->getTrainer() == $trainer) {
313 282
 							$itemsFiltered[] = $item;
314 283
 						}
315 284
 					}
316 285
 				}
317
-				$controller->dispatchMailEvent($document,$session,$trainer,$itemsFiltered);
318
-				
286
+				$controller->dispatchMailEvent($document, $session, $trainer, $itemsFiltered);
287
+
319 288
 				// marque la notification comme renvoyé
320 289
 				$manager = $this->getManager();
321 290
 				$manager->remove($notice);
@@ -327,12 +296,11 @@ class NoticeController extends BackOfficeAdminController
327 296
 
328 297
 			case EnumDocumentType::TYPE_CONVOCATION:
329 298
 				// test si on peut l'envoyer
330
-				if (!$controller->canSendAutomatic($session,$notice->getSociety()))
331
-				{
299
+				if (!$controller->canSendAutomatic($session, $notice->getSociety())) {
332 300
 					throw $this->createNotFoundException();
333 301
 				}
334
-				$controller->dispatchEventForLearner($document,$session,$notice->getTo());
335
-				
302
+				$controller->dispatchEventForLearner($document, $session, $notice->getTo());
303
+
336 304
 				// marque la notification comme renvoyé
337 305
 				$manager = $this->getManager();
338 306
 				$manager->remove($notice);
@@ -342,7 +310,7 @@ class NoticeController extends BackOfficeAdminController
342 310
 
343 311
 				break;
344 312
 
345
-			/*case EnumDocumentType::TYPE_CONVENTION:
313
+				/*case EnumDocumentType::TYPE_CONVENTION:
346 314
 				// test si on peut l'envoyer
347 315
 				if (!$controller->canSendAutomatic($session,$society))
348 316
 				{
@@ -360,26 +328,22 @@ class NoticeController extends BackOfficeAdminController
360 328
 				break;*/
361 329
 
362 330
 			case EnumDocumentType::TYPE_REGISTRATION_SHEET:
363
-				if (!$controller->canSendAutomatic($session))
364
-				{
331
+				if (!$controller->canSendAutomatic($session)) {
365 332
 					throw $this->createNotFoundException();
366 333
 				}
367 334
 				$trainer = $notice->getTo();
368 335
 				// filtre les items du formateur
369 336
 				$items = $session->getSequenceItems();
370 337
 				$itemsFiltered = array();
371
-				foreach ($items as $item)
372
-				{
373
-					if (method_exists($sequenceItem,'getTrainer'))
374
-					{
375
-						if ($item->getTrainer() == $trainer)
376
-						{
338
+				foreach ($items as $item) {
339
+					if (method_exists($sequenceItem, 'getTrainer')) {
340
+						if ($item->getTrainer() == $trainer) {
377 341
 							$itemsFiltered[] = $item;
378 342
 						}
379 343
 					}
380 344
 				}
381
-				$controller->dispatchMailEvent($document,$session,$notice->getSociety(),$trainer,$itemsFiltered);
382
-				
345
+				$controller->dispatchMailEvent($document, $session, $notice->getSociety(), $trainer, $itemsFiltered);
346
+
383 347
 				// marque la notification comme renvoyé
384 348
 				$manager = $this->getManager();
385 349
 				$manager->remove($notice);
@@ -388,15 +352,14 @@ class NoticeController extends BackOfficeAdminController
388 352
 				$manager->flush();
389 353
 
390 354
 				break;
391
-			
355
+
392 356
 			case EnumDocumentType::TYPE_END_TRAINING_CERTIFICATE:
393 357
 				// test si on peut l'envoyer
394
-				if (!$controller->canSendAutomatic($session,$notice->getSociety()))
395
-				{
358
+				if (!$controller->canSendAutomatic($session, $notice->getSociety())) {
396 359
 					throw $this->createNotFoundException();
397 360
 				}
398
-				$controller->dispatchEmailEvent($document,$session,$notice->getTo());
399
-				
361
+				$controller->dispatchEmailEvent($document, $session, $notice->getTo());
362
+
400 363
 				// marque la notification comme renvoyé
401 364
 				$manager = $this->getManager();
402 365
 				$manager->remove($notice);
@@ -408,17 +371,16 @@ class NoticeController extends BackOfficeAdminController
408 371
 
409 372
 			case EnumDocumentType::TYPE_END_PRESENCE_CERTIFICATE:
410 373
 				// test si on peut l'envoyer
411
-				if (!$controller->canSendAutomatic($session,$notice->getSociety()))
412
-				{
374
+				if (!$controller->canSendAutomatic($session, $notice->getSociety())) {
413 375
 					throw $this->createNotFoundException();
414 376
 				}
415 377
 
416
-				$controller->dispatchMailEvent($document,$session,$notice->getTo());
417
-				
378
+				$controller->dispatchMailEvent($document, $session, $notice->getTo());
379
+
418 380
 				// marque la notification comme renvoyé
419 381
 				$manager = $this->getManager();
420 382
 				$manager->remove($notice);
421
-				
383
+
422 384
 				// mise à jour
423 385
 				$manager->flush();
424 386
 
@@ -431,6 +393,6 @@ class NoticeController extends BackOfficeAdminController
431 393
 		$this->addFlash('success', "Notification renvoyée");
432 394
 
433 395
 		// redirige
434
-		return $this->redirectToRoute('nbo_follow_session_view',array('sessionId' => $session->getSessionId(),'currentTab' => 'documents','documentTab' => DocumentController::DOCUMENT_TAB_PROGRAMME,'_fragment' => 'notice'));
396
+		return $this->redirectToRoute('nbo_follow_session_view', array('sessionId' => $session->getSessionId(), 'currentTab' => 'documents', 'documentTab' => DocumentController::DOCUMENT_TAB_PROGRAMME, '_fragment' => 'notice'));
435 397
 	}
436
-}
398
+}

+ 147
- 324
src/Phoenix/Controller/NewBackOffice/Admin/OfferController.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 namespace Logipro\Phoenix\Controller\NewBackOffice\Admin;
3 4
 
4 5
 use Logipro\Phoenix\Controller\NewBackOffice\Admin\BackOfficeAdminController;
@@ -24,6 +25,7 @@ use Logipro\Phoenix\Entity\Type\EnumProgramTypeFieldType;
24 25
 use Symfony\Component\Validator\Validator\ValidatorInterface;
25 26
 
26 27
 use Doctrine\Common\Collections\ArrayCollection;
28
+use Logipro\Phoenix\Service\Offer\OfferExportHandler;
27 29
 
28 30
 class OfferController extends BackOfficeAdminController
29 31
 {
@@ -101,7 +103,7 @@ class OfferController extends BackOfficeAdminController
101 103
 	public function createOfferFromSession(Request $request)
102 104
 	{
103 105
 		$this->denyAccessUnlessGranted('ROLE_MANAGE_OFFER');
104
-		
106
+
105 107
 		$offer = new Offer();
106 108
 		$formCreate = $this->createForm(OfferCreateType::class, $offer);
107 109
 
@@ -109,57 +111,46 @@ class OfferController extends BackOfficeAdminController
109 111
 		$research = '';
110 112
 		$response = array();
111 113
 
112
-		try
113
-		{
114
-			if ($request->isMethod('POST'))
115
-			{
114
+		try {
115
+			if ($request->isMethod('POST')) {
116 116
 				$formCreate->handleRequest($request);
117 117
 
118
-				if ($formCreate->isSubmitted())
119
-				{
118
+				if ($formCreate->isSubmitted()) {
120 119
 					$files = $request->files->get('nbo_offer_create_from_session');
121
-					
122
-					if (!empty($files))
123
-					{
124
-						$this->canUploadImage($formCreate->get('imageFile')->get('file'),$files, $offer);
120
+
121
+					if (!empty($files)) {
122
+						$this->canUploadImage($formCreate->get('imageFile')->get('file'), $files, $offer);
125 123
 					}
126
-					
127 124
 
128
-					if ($formCreate->isValid())
129
-					{
125
+
126
+					if ($formCreate->isValid()) {
130 127
 						// enregistre l'offre
131 128
 						$manager = $this->getManager();
132
-						$manager->persist($offer);					
129
+						$manager->persist($offer);
133 130
 						$manager->flush();
134 131
 
135 132
 						$research = $offer->getTitle();
136 133
 						$succes = true;
137 134
 						$type = 'succes';
138
-					}
139
-					else
140
-					{
135
+					} else {
141 136
 						$errors = $this->getFormFieldError($formCreate);
142 137
 						throw $this->createNotFoundException($this->serializeFormFieldError($errors));
143 138
 					}
144 139
 				}
145 140
 			}
146
-		}
147
-		catch (\Exception $exp)
148
-		{
141
+		} catch (\Exception $exp) {
149 142
 			$succes = false;
150 143
 			$type = 'error';
151
-			
144
+
152 145
 			$errors = $this->getFormFieldError($formCreate);
153 146
 
154 147
 			$response['message'] = $exp->getMessage();
155 148
 			$response['formError'] = array();
156 149
 
157 150
 			// parcours les erreurs
158
-			foreach ($errors as $fieldId => $errorField)
159
-			{
151
+			foreach ($errors as $fieldId => $errorField) {
160 152
 				$message = $this->getFormFieldErrorMessage($errorField);
161
-				if ($message)
162
-				{
153
+				if ($message) {
163 154
 					$response['formError'][$fieldId] = $message;
164 155
 				}
165 156
 			}
@@ -172,115 +163,16 @@ class OfferController extends BackOfficeAdminController
172 163
 	}
173 164
 
174 165
 	/**
175
-	 * Export CSV de la liste des offres
166
+	 * Export XLS de la liste des offres
176 167
 	 *
177 168
 	 * @param Request $request
178 169
 	 * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
179 170
 	 */
180
-	public function exportCSV(Request $request)
171
+	public function exportXLS(Request $request, OfferExportHandler $offerExportHandler)
181 172
 	{
182 173
 		$this->denyAccessUnlessGranted('ROLE_MANAGE_OFFER');
183 174
 
184
-		// Traitement des données pour l'export
185
-		$manager = $this->getDoctrine()->getManager();
186
-		$repository = $manager->getRepository(Offer::class);
187
-
188
-		// Paramétrage du filtre
189
-		$filter = new Filter();
190
-		$filter->setRouteName('offer_export_csvv');
191
-		$filter->addFilter('term');
192
-		
193
-		// Colonnes de tri
194
-		$filter->addSortKey('title')->setCurrentSort('title');
195
-		$filter->addSortKey('duration');
196
-		$filter->addSortKey('offerId');
197
-		$filter->addSortKey('catalogs');
198
-		$filter->addSortKey('selling');
199
-
200
-		$filter->setFromRequest($request);
201
-
202
-		$offers = $repository->findOffersByFilter($filter, false);
203
-
204
-		$csvRows = array();
205
-		$columnsNames = array(
206
-				$this->get('translator')->trans('label_internal_code'),
207
-				$this->get('translator')->trans('label_title'),
208
-				$this->get('translator')->trans('label_catchphrase'),
209
-				$this->get('translator')->trans('label_duration'),
210
-				$this->get('translator')->trans('label_creation_date'),
211
-				$this->get('translator')->trans('label_update_date'),
212
-				$this->get('translator')->trans('label_catalogs'),
213
-				$this->get('translator')->trans('label_selling'),
214
-		);
215
-		$csvRows[] = $columnsNames;
216
-
217
-		foreach ($offers as $offer)
218
-		{
219
-			$col = array();
220
-
221
-			// Respecter l'ordre des colonnes défini au dessus
222
-			$col[] = $offer->getCode();
223
-			$col[] = $offer->getTitle();
224
-			$col[] = $offer->getCatchphrase();			
225
-			// formatage durée
226
-			$formatedDuration = null;
227
-			$duration = $offer->getDuration();
228
-			if ($duration)
229
-			{
230
-				$formatedDuration = $duration->format('%Hh %Im');
231
-			}
232
-			$col[] = $formatedDuration;
233
-			// formatage date
234
-			$formatedCreationDate = null;
235
-			$creationDate = $offer->getCreationDate();
236
-			if ($creationDate) {
237
-				$formatedCreationDate = $creationDate->format('d/m/Y H:i:s');
238
-			}
239
-			$col[] = $formatedCreationDate;
240
-			// formatage date
241
-			$formatedUpdateDate = null;
242
-			$updateDate = $offer->getUpdateDate();
243
-			if ($updateDate) {
244
-				$formatedUpdateDate = $updateDate->format('d/m/Y H:i:s');
245
-			}
246
-			$col[] = $formatedUpdateDate;
247
-
248
-
249
-			$col[] = ($offer->getCatalogs())?$this->get('translator')->trans('statut_yes'):$this->get('translator')->trans('statut_no');
250
-			$col[] = ($offer->getSelling())?$this->get('translator')->trans('statut_yes'):$this->get('translator')->trans('statut_no');
251
-
252
-			// Remplacement des valeurs nulles
253
-			foreach ($col as $key => $data)
254
-			{
255
-				if (empty($data)) {
256
-					$col[$key] = 'N/A';
257
-				}
258
-			}
259
-
260
-			$csvRows[] = $col;
261
-		}
262
-
263
-		// Construction de la feuille csv
264
-		$spreadsheet = new Spreadsheet();
265
-
266
-		$title = $this->get('translator')->trans('tab_offers');
267
-
268
-		$sheet = $spreadsheet->getActiveSheet();
269
-		$sheet->setTitle($title);
270
-		$sheet->fromArray($csvRows);
271
-
272
-		$writer = new Csv($spreadsheet);
273
-
274
-		// Create a Temporary file in the system
275
-		$nowDate = new \DateTime();
276
-		$fileName = $title . $nowDate->format(' Ymd-Hi') . '.csv';
277
-		$temp_file = tempnam(sys_get_temp_dir(), $fileName);
278
-
279
-		// Create the excel file in the tmp directory of the system
280
-		$writer->save($temp_file);
281
-
282
-		// Return the excel file as an attachment
283
-		return $this->file($temp_file, $fileName, ResponseHeaderBag::DISPOSITION_ATTACHMENT);
175
+		return $offerExportHandler->xlsExportList($request);
284 176
 	}
285 177
 
286 178
 	/**
@@ -296,15 +188,12 @@ class OfferController extends BackOfficeAdminController
296 188
 
297 189
 		$offer = $this->requireOffer($id);
298 190
 
299
-		try
300
-		{
191
+		try {
301 192
 			$manager->remove($offer);
302 193
 			$manager->flush();
303 194
 
304 195
 			$this->addFlash('success', $this->get('translator')->trans('success_offer_removed'));
305
-		}
306
-		catch (PhoenixException $e)
307
-		{
196
+		} catch (PhoenixException $e) {
308 197
 			$this->addFlash('error', $this->get('translator')->trans('error_deletion_failed_reason', array('%message%' => $e->getMessage())));
309 198
 		}
310 199
 
@@ -327,8 +216,7 @@ class OfferController extends BackOfficeAdminController
327 216
 		// Traitement du POST :
328 217
 		// Création de l'élément et réponse en AJAX.
329 218
 
330
-		if ($request->isMethod('POST'))
331
-		{
219
+		if ($request->isMethod('POST')) {
332 220
 			return $this->createOffer($request);
333 221
 		}
334 222
 
@@ -337,8 +225,8 @@ class OfferController extends BackOfficeAdminController
337 225
 		);
338 226
 
339 227
 		// affiche le contenu de la popup
340
-		return $this->renderBlock('modal_content',$this->viewPath . 'modals/create.html.twig', $variables);		
341
-	}	
228
+		return $this->renderBlock('modal_content', $this->viewPath . 'modals/create.html.twig', $variables);
229
+	}
342 230
 
343 231
 
344 232
 	/**
@@ -355,25 +243,21 @@ class OfferController extends BackOfficeAdminController
355 243
 		//$response['urlRedirect'] = null;
356 244
 		$offer = null;
357 245
 
358
-		$manager = $this->getDoctrine()->getManager();		
246
+		$manager = $this->getDoctrine()->getManager();
359 247
 
360 248
 		// Traitement du POST
361
-		if ($request->isMethod('POST'))
362
-		{
249
+		if ($request->isMethod('POST')) {
363 250
 			$offer = new Offer();
364 251
 			$form = $this->createForm(OfferCreateType::class, $offer);
365 252
 
366 253
 			$form->handleRequest($request);
367 254
 
368
-			if ($form->isSubmitted())
369
-			{
370
-				try
371
-				{
372
-					$this->canUploadImage($form->get('imageFile')->get('file'),$request->files->get('offer_create'),$offer);
255
+			if ($form->isSubmitted()) {
256
+				try {
257
+					$this->canUploadImage($form->get('imageFile')->get('file'), $request->files->get('offer_create'), $offer);
373 258
 
374 259
 					// -- test si le formulaire n'a pas d'erreur
375
-					if ($form->isValid())
376
-					{
260
+					if ($form->isValid()) {
377 261
 
378 262
 						//$this->addFormError($field,$this->translate('js_dropzone_dictInvalidFileType'));
379 263
 						//dd($form->get('isInter'));
@@ -394,16 +278,12 @@ class OfferController extends BackOfficeAdminController
394 278
 							'button_url' => null,
395 279
 							'button_text' => null
396 280
 						);
397
-					}
398
-					else
399
-					{																											
281
+					} else {
400 282
 						// créé le message d'erreur
401 283
 						$errors = $this->getFormFieldError($form);
402
-						throw $this->createNotFoundException($this->serializeFormFieldError($errors));	
284
+						throw $this->createNotFoundException($this->serializeFormFieldError($errors));
403 285
 					}
404
-				}
405
-				catch (\Exception $exp)
406
-				{