1 | <?php |
||
2 | |||
3 | /* For licensing terms, see /license.txt */ |
||
4 | |||
5 | use Chamilo\CoreBundle\Entity\Course; |
||
0 ignored issues
–
show
|
|||
6 | use Chamilo\CoreBundle\Entity\Repository\SequenceResourceRepository; |
||
7 | use Chamilo\CoreBundle\Entity\Repository\SessionRepository; |
||
8 | use Chamilo\CoreBundle\Entity\SequenceResource; |
||
9 | use Chamilo\CoreBundle\Entity\Session; |
||
10 | use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser; |
||
11 | use ChamiloSession as PHPSession; |
||
12 | |||
13 | /** |
||
14 | * @author Bart Mollet, Julio Montoya lot of fixes |
||
15 | */ |
||
16 | $cidReset = true; |
||
17 | require_once __DIR__.'/../inc/global.inc.php'; |
||
18 | |||
19 | // setting the section (for the tabs) |
||
20 | $this_section = SECTION_PLATFORM_ADMIN; |
||
21 | |||
22 | $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : null; |
||
23 | |||
24 | if (empty($sessionId)) { |
||
25 | api_not_allowed(true); |
||
26 | } |
||
27 | PHPSession::write('id_session', $sessionId); |
||
28 | SessionManager::protectSession($sessionId); |
||
29 | $codePath = api_get_path(WEB_CODE_PATH); |
||
30 | |||
31 | $tool_name = get_lang('SessionOverview'); |
||
32 | $interbreadcrumb[] = [ |
||
33 | 'url' => 'session_list.php', |
||
34 | 'name' => get_lang('SessionList'), |
||
35 | ]; |
||
36 | |||
37 | $orig_param = '&origin=resume_session'; |
||
38 | |||
39 | $allowSkills = api_get_configuration_value('allow_skill_rel_items'); |
||
40 | if ($allowSkills) { |
||
41 | $htmlContentExtraClass[] = 'feature-item-user-skill-on'; |
||
42 | } |
||
43 | |||
44 | // Database Table Definitions |
||
45 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
||
46 | $tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); |
||
47 | |||
48 | $em = Database::getManager(); |
||
49 | $sessionInfo = api_get_session_info($sessionId); |
||
50 | /** @var SessionRepository $sessionRepository */ |
||
51 | $sessionRepository = $em->getRepository('ChamiloCoreBundle:Session'); |
||
52 | /** @var Session $session */ |
||
53 | $session = $sessionRepository->find($sessionId); |
||
54 | $sessionCategory = $session->getCategory(); |
||
55 | |||
56 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
||
57 | $url_id = api_get_current_access_url_id(); |
||
58 | |||
59 | switch ($action) { |
||
60 | case 'export_certified_course_users': |
||
61 | $courseCode = $_GET['course_code'] ?? null; |
||
62 | if (!empty($courseCode)) { |
||
63 | SessionManager::exportCourseSessionReport($sessionId, $courseCode); |
||
64 | } |
||
65 | break; |
||
66 | case 'move_up': |
||
67 | SessionManager::moveUp($sessionId, $_GET['course_id']); |
||
68 | header('Location: resume_session.php?id_session='.$sessionId); |
||
69 | exit; |
||
70 | break; |
||
71 | case 'move_down': |
||
72 | SessionManager::moveDown($sessionId, $_GET['course_id']); |
||
73 | header('Location: resume_session.php?id_session='.$sessionId); |
||
74 | exit; |
||
75 | break; |
||
76 | case 'add_user_to_url': |
||
77 | $user_id = $_REQUEST['user_id']; |
||
78 | $result = UrlManager::add_user_to_url($user_id, $url_id); |
||
79 | $user_info = api_get_user_info($user_id); |
||
80 | if ($result) { |
||
81 | Display::addFlash( |
||
82 | Display::return_message( |
||
83 | get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), |
||
84 | 'confirm' |
||
85 | ) |
||
86 | ); |
||
87 | } |
||
88 | break; |
||
89 | case 'delete': |
||
90 | // Delete course from session. |
||
91 | $idChecked = isset($_GET['idChecked']) ? $_GET['idChecked'] : null; |
||
92 | $message = get_lang('TokenExpiredActionAlreadyRealized'); |
||
93 | if (is_array($idChecked)) { |
||
94 | $usersToDelete = []; |
||
95 | $check = Security::check_token('get'); |
||
96 | if ($check) { |
||
97 | foreach ($idChecked as $courseCode) { |
||
98 | // forcing the escape_string |
||
99 | $courseInfo = api_get_course_info($courseCode); |
||
100 | SessionManager::unsubscribe_course_from_session( |
||
101 | $sessionId, |
||
102 | $courseInfo['real_id'] |
||
103 | ); |
||
104 | } |
||
105 | $message = get_lang('Updated'); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | if (!empty($_GET['class'])) { |
||
110 | $class = (int) $_GET['class']; |
||
111 | $result = Database::query( |
||
112 | "DELETE FROM $tbl_session_rel_class |
||
113 | WHERE session_id = $sessionId |
||
114 | AND class_id = $class" |
||
115 | ); |
||
116 | $nbr_affected_rows = Database::affected_rows($result); |
||
117 | Database::query( |
||
118 | "UPDATE $tbl_session |
||
119 | SET nbr_classes = nbr_classes - $nbr_affected_rows |
||
120 | WHERE id = $sessionId"); |
||
121 | $message = get_lang('Updated'); |
||
122 | } |
||
123 | |||
124 | if (!empty($_GET['user'])) { |
||
125 | $check = Security::check_token('get'); |
||
126 | if ($check) { |
||
127 | SessionManager::unsubscribe_user_from_session( |
||
128 | $sessionId, |
||
129 | $_GET['user'] |
||
130 | ); |
||
131 | $message = get_lang('Updated'); |
||
132 | } |
||
133 | Security::clear_token(); |
||
134 | } |
||
135 | |||
136 | Display::addFlash(Display::return_message($message)); |
||
137 | break; |
||
138 | } |
||
139 | |||
140 | $sessionHeader = Display::page_header( |
||
141 | Display::return_icon('session.png', get_lang('Session')).' '.$session->getName(), |
||
142 | null, |
||
143 | 'h3' |
||
144 | ); |
||
145 | |||
146 | $url = Display::url( |
||
147 | Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), |
||
148 | "session_edit.php?page=resume_session.php&id=$sessionId" |
||
149 | ); |
||
150 | |||
151 | $sessionTitle = Display::page_subheader(get_lang('GeneralProperties').$url); |
||
152 | $generalCoach = api_get_user_info($sessionInfo['id_coach']); |
||
153 | |||
154 | $sessionField = new ExtraField('session'); |
||
155 | $extraFieldData = $sessionField->getDataAndFormattedValues($sessionId); |
||
156 | |||
157 | $multiple_url_is_on = api_get_multiple_access_url(); |
||
158 | $urlList = []; |
||
159 | if ($multiple_url_is_on) { |
||
160 | $urlList = UrlManager::get_access_url_from_session($sessionId); |
||
161 | } |
||
162 | |||
163 | $url = Display::url( |
||
164 | Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), |
||
165 | "add_courses_to_session.php?page=resume_session.php&id_session=$sessionId" |
||
166 | ); |
||
167 | $courseListToShow = Display::page_subheader(get_lang('CourseList').$url); |
||
168 | |||
169 | $courseListToShow .= '<table id="session-list-course" class="table table-hover table-striped data_table"> |
||
170 | <tr> |
||
171 | <th width="35%">'.get_lang('CourseTitle').'</th> |
||
172 | <th width="30%">'.get_lang('CourseCoach').'</th> |
||
173 | <th width="10%">'.get_lang('UsersNumber').'</th> |
||
174 | <th width="25%">'.get_lang('Actions').'</th> |
||
175 | </tr>'; |
||
176 | |||
177 | if ($session->getNbrCourses() === 0) { |
||
178 | $courseListToShow .= '<tr> |
||
179 | <td colspan="4">'.get_lang('NoCoursesForThisSession').'</td> |
||
180 | </tr>'; |
||
181 | } else { |
||
182 | $secToken = Security::get_token(); |
||
183 | $count = 0; |
||
184 | $courseItem = ''; |
||
185 | //$courses = $sessionRepository->getCoursesOrderedByPosition($session); |
||
186 | |||
187 | $courses = $session->getCourses(); |
||
188 | $iterator = $courses->getIterator(); |
||
189 | // define ordering closure, using preferred comparison method/field |
||
190 | $iterator->uasort(function ($first, $second) { |
||
191 | return (int) $first->getPosition() > (int) $second->getPosition() ? 1 : -1; |
||
192 | }); |
||
193 | $courseList = []; |
||
194 | $positionList = []; |
||
195 | $courseListByCode = []; |
||
196 | /** @var \Chamilo\CoreBundle\Entity\SessionRelCourse $sessionRelCourse */ |
||
197 | foreach ($iterator as $sessionRelCourse) { |
||
198 | $courseList[] = $sessionRelCourse->getCourse(); |
||
199 | $courseListByCode[$sessionRelCourse->getCourse()->getCode()] = $sessionRelCourse->getCourse(); |
||
200 | $positionList[] = $sessionRelCourse->getPosition(); |
||
201 | } |
||
202 | |||
203 | $checkPosition = array_filter($positionList); |
||
204 | if (empty($checkPosition)) { |
||
205 | // The session course list doesn't have any position, |
||
206 | // then order the course list by course code. |
||
207 | $orderByCode = array_keys($courseListByCode); |
||
208 | sort($orderByCode, SORT_NATURAL); |
||
209 | $newCourseList = []; |
||
210 | foreach ($orderByCode as $code) { |
||
211 | $newCourseList[] = $courseListByCode[$code]; |
||
212 | } |
||
213 | $courseList = $newCourseList; |
||
214 | } |
||
215 | |||
216 | /** @var Course $course */ |
||
217 | foreach ($courseList as $course) { |
||
218 | // Select the number of users |
||
219 | $numberOfUsers = SessionManager::getCountUsersInCourseSession($course, $session); |
||
220 | |||
221 | // Get coachs of the courses in session |
||
222 | $namesOfCoaches = []; |
||
223 | $coachSubscriptions = $session->getUserCourseSubscriptionsByStatus($course, Session::COACH); |
||
224 | |||
225 | if ($coachSubscriptions) { |
||
226 | /** @var SessionRelCourseRelUser $subscription */ |
||
227 | foreach ($coachSubscriptions as $subscription) { |
||
228 | $namesOfCoaches[] = $subscription->getUser()->getCompleteNameWithUserName(); |
||
229 | } |
||
230 | } |
||
231 | |||
232 | $orderButtons = ''; |
||
233 | if (SessionManager::orderCourseIsEnabled()) { |
||
234 | $orderButtons = Display::url( |
||
235 | Display::return_icon( |
||
236 | !$count ? 'up_na.png' : 'up.png', |
||
237 | get_lang('MoveUp') |
||
238 | ), |
||
239 | !$count |
||
240 | ? '#' |
||
241 | : api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_up' |
||
242 | ); |
||
243 | |||
244 | $orderButtons .= Display::url( |
||
245 | Display::return_icon( |
||
246 | $count + 1 == count($courses) ? 'down_na.png' : 'down.png', |
||
247 | get_lang('MoveDown') |
||
248 | ), |
||
249 | $count + 1 == count($courses) |
||
250 | ? '#' |
||
251 | : api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_down' |
||
252 | ); |
||
253 | } |
||
254 | |||
255 | $courseUrl = api_get_course_url($course->getCode(), $sessionId); |
||
256 | $courseBaseUrl = api_get_course_url($course->getCode()); |
||
257 | |||
258 | // hide_course_breadcrumb the parameter has been added to hide the name |
||
259 | // of the course, that appeared in the default $interbreadcrumb |
||
260 | $courseItem .= '<tr> |
||
261 | <td class="title">' |
||
262 | .Display::url( |
||
263 | $course->getTitle().' ('.$course->getVisualCode().')', |
||
264 | $courseUrl |
||
265 | ) |
||
266 | .'</td>'; |
||
267 | $courseItem .= '<td>'.($namesOfCoaches ? implode('<br>', $namesOfCoaches) : get_lang('None')).'</td>'; |
||
268 | $courseItem .= '<td>'.$numberOfUsers.'</td>'; |
||
269 | $courseItem .= '<td>'; |
||
270 | $courseItem .= Display::url(Display::return_icon('course_home.gif', get_lang('CourseInSession')), $courseUrl); |
||
271 | |||
272 | $courseItem .= Display::url( |
||
273 | Display::return_icon('settings.png', get_lang('Course')), |
||
274 | $courseBaseUrl, |
||
275 | ['target' => '_blank'] |
||
276 | ); |
||
277 | |||
278 | if ($allowSkills) { |
||
279 | $courseItem .= Display::url( |
||
280 | Display::return_icon('skill-badges.png', get_lang('Skills')), |
||
281 | $codePath.'admin/skill_rel_course.php?session_id='.$sessionId.'&course_id='.$course->getId() |
||
282 | ); |
||
283 | } |
||
284 | $courseItem .= $orderButtons; |
||
285 | |||
286 | $courseItem .= Display::url( |
||
287 | Display::return_icon('new_user.png', get_lang('AddUsers')), |
||
288 | $codePath."session/add_users_to_session_course.php?id_session=$sessionId&course_id=".$course->getId() |
||
289 | ); |
||
290 | $courseItem .= Display::url( |
||
291 | Display::return_icon('user.png', get_lang('Users')), |
||
292 | $codePath."session/session_course_user_list.php?id_session=$sessionId&course_code=".$course->getCode() |
||
293 | ); |
||
294 | $courseItem .= Display::url( |
||
295 | Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse')), |
||
296 | $codePath."user/user_import.php?action=import&cidReq={$course->getCode()}&id_session=$sessionId" |
||
297 | ); |
||
298 | $courseItem .= Display::url( |
||
299 | Display::return_icon('export_csv.png', get_lang('ExportUsersOfACourse')), |
||
300 | $codePath."user/user_export.php?file_type=csv&course_session={$course->getCode()}:$sessionId&addcsvheader=1" |
||
301 | ); |
||
302 | |||
303 | $config = api_get_configuration_value('session_course_excel_export'); |
||
304 | if (!empty($config)) { |
||
305 | $courseItem .= Display::url( |
||
306 | Display::return_icon('excel.png', get_lang('ExportCertifiedUsersExcel')), |
||
307 | api_get_self()."?id_session=$sessionId&action=export_certified_course_users&course_code=".$course->getCode() |
||
308 | ); |
||
309 | } |
||
310 | |||
311 | $courseItem .= Display::url( |
||
312 | Display::return_icon('statistics.gif', get_lang('Tracking')), |
||
313 | $codePath."tracking/courseLog.php?id_session=$sessionId&cidReq={$course->getCode()}$orig_param&hide_course_breadcrumb=1" |
||
314 | ); |
||
315 | $courseItem .= Display::url( |
||
316 | Display::return_icon('teacher.png', get_lang('ModifyCoach')), |
||
317 | $codePath."session/session_course_edit.php?id_session=$sessionId&page=resume_session.php&course_code={$course->getCode()}$orig_param" |
||
318 | ); |
||
319 | $courseItem .= Display::url( |
||
320 | Display::return_icon('folder_document.png', get_lang('UploadFile')), |
||
321 | '#', |
||
322 | [ |
||
323 | 'class' => 'session-upload-file-btn', |
||
324 | 'data-session' => $sessionId, |
||
325 | 'data-course' => $course->getId(), |
||
326 | ] |
||
327 | ); |
||
328 | $courseItem .= Display::url( |
||
329 | Display::return_icon('delete.png', get_lang('Delete')), |
||
330 | api_get_self()."?id_session=$sessionId&action=delete&idChecked[]={$course->getCode()}&sec_token=".Security::getTokenFromSession(), |
||
331 | [ |
||
332 | 'onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;", |
||
333 | ] |
||
334 | ); |
||
335 | |||
336 | $courseItem .= '</td></tr>'; |
||
337 | $count++; |
||
338 | } |
||
339 | $courseListToShow .= $courseItem; |
||
340 | } |
||
341 | $courseListToShow .= '</table><br />'; |
||
342 | |||
343 | $url = ' '.Display::url( |
||
344 | Display::return_icon('user_subscribe_session.png', get_lang('Add')), |
||
345 | $codePath."session/add_users_to_session.php?page=resume_session.php&id_session=$sessionId" |
||
346 | ); |
||
347 | $url .= Display::url( |
||
348 | Display::return_icon('import_csv.png', get_lang('ImportUsers')), |
||
349 | $codePath."session/session_user_import.php?id_session=$sessionId" |
||
350 | ); |
||
351 | $url .= Display::url( |
||
352 | Display::return_icon('export_csv.png', get_lang('ExportUsers')), |
||
353 | $codePath."user/user_export.php?file_type=csv&session=$sessionId&addcsvheader=1" |
||
354 | ); |
||
355 | $url .= Display::url( |
||
356 | Display::return_icon('pdf.png', get_lang('CertificateOfAchievement'), [], ICON_SIZE_SMALL), |
||
357 | $codePath.'mySpace/session.php?'.http_build_query( |
||
358 | [ |
||
359 | 'action' => 'export_to_pdf', |
||
360 | 'type' => 'achievement', |
||
361 | 'session_to_export' => $sessionId, |
||
362 | 'all_students' => 1, |
||
363 | ] |
||
364 | ) |
||
365 | ); |
||
366 | |||
367 | $userListToShow = Display::page_subheader(get_lang('UserList').$url); |
||
368 | $userList = SessionManager::get_users_by_session($sessionId); |
||
369 | |||
370 | if (!empty($userList)) { |
||
371 | $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : null; |
||
372 | $sortColumn = isset($_GET['sort']) ? Security::remove_XSS($_GET['sort']) : 'registration_date'; |
||
373 | $sortOrder = isset($_GET['order']) && Security::remove_XSS($_GET['order']) === 'ASC' ? SORT_ASC : SORT_DESC; |
||
374 | |||
375 | $allowedColumns = ['user', 'registration_date']; |
||
376 | if (!in_array($sortColumn, $allowedColumns, true)) { |
||
377 | $sortColumn = 'registration_date'; |
||
378 | } |
||
379 | |||
380 | usort($userList, function ($a, $b) use ($sortColumn, $sortOrder) { |
||
381 | if ($sortColumn === 'user') { |
||
382 | $valueA = strtolower(api_get_user_info($a['user_id'])['complete_name_with_username']); |
||
383 | $valueB = strtolower(api_get_user_info($b['user_id'])['complete_name_with_username']); |
||
384 | } else { |
||
385 | $valueA = strtotime($a['registered_at']); |
||
386 | $valueB = strtotime($b['registered_at']); |
||
387 | } |
||
388 | |||
389 | return $sortOrder === SORT_ASC ? $valueA <=> $valueB : $valueB <=> $valueA; |
||
390 | }); |
||
391 | |||
392 | $table = new HTML_Table( |
||
393 | ['class' => 'table table-hover table-striped data_table', 'id' => 'session-user-list'] |
||
394 | ); |
||
395 | $table->setHeaderContents(0, 0, '<a href="?id_session='.$sessionId.'&sort=user&order='.($sortColumn === 'user' && $sortOrder === SORT_ASC ? 'DESC' : 'ASC').'">'.get_lang('User').'</a>'); |
||
396 | $table->setHeaderContents(0, 1, get_lang('Status')); |
||
397 | $table->setHeaderContents(0, 2, '<a href="?id_session='.$sessionId.'&sort=registration_date&order='.($sortColumn === 'registration_date' && $sortOrder === SORT_ASC ? 'DESC' : 'ASC').'">'.get_lang('RegistrationDate').'</a>'); |
||
398 | $table->setHeaderContents(0, 3, get_lang('Actions')); |
||
399 | |||
400 | $row = 1; |
||
401 | foreach ($userList as $user) { |
||
402 | $userId = $user['user_id']; |
||
403 | $userInfo = api_get_user_info($userId); |
||
404 | |||
405 | $userLink = '<a href="'.$codePath.'admin/user_information.php?user_id='.$userId.'">'. |
||
406 | api_htmlentities($userInfo['complete_name_with_username']).'</a>'; |
||
407 | |||
408 | $reportingLink = Display::url( |
||
409 | Display::return_icon('statistics.gif', get_lang('Reporting')), |
||
410 | $codePath.'mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param.'&id_session=' |
||
411 | .$sessionId |
||
412 | ); |
||
413 | |||
414 | $courseUserLink = Display::url( |
||
415 | Display::return_icon('course.png', get_lang('BlockCoursesForThisUser')), |
||
416 | $codePath.'session/session_course_user.php?id_user='.$user['user_id'].'&id_session=' |
||
417 | .$sessionId |
||
418 | ); |
||
419 | |||
420 | $removeLink = Display::url( |
||
421 | Display::return_icon('delete.png', get_lang('Delete')), |
||
422 | api_get_self().'?id_session='.$sessionId.'&action=delete&user='.$user['user_id'].'&sec_token='.Security::getTokenFromSession(), |
||
423 | ['onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;"] |
||
424 | ); |
||
425 | |||
426 | $addUserToUrlLink = ''; |
||
427 | if ($multiple_url_is_on) { |
||
428 | if ($user['access_url_id'] != $url_id) { |
||
429 | $userLink .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL')); |
||
430 | $add = Display::return_icon('add.png', get_lang('AddUsersToURL')); |
||
431 | $addUserToUrlLink = '<a href="resume_session.php?action=add_user_to_url&id_session='.$sessionId |
||
432 | .'&user_id='.$user['user_id'].'">'.$add.'</a>'; |
||
433 | } |
||
434 | } |
||
435 | |||
436 | $editUrl = null; |
||
437 | /* |
||
438 | if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) { |
||
439 | $editUrl = $codePath . 'session/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId; |
||
440 | $editUrl = Display::url( |
||
441 | Display::return_icon('agenda.png', get_lang('SessionDurationEdit')), |
||
442 | $editUrl |
||
443 | ); |
||
444 | }*/ |
||
445 | |||
446 | $table->setCellContents($row, 0, $userLink); |
||
447 | $link = $reportingLink.$courseUserLink.$removeLink.$addUserToUrlLink.$editUrl; |
||
448 | switch ($user['relation_type']) { |
||
449 | case 1: |
||
450 | $status = get_lang('Drh'); |
||
451 | $link = Display::url( |
||
452 | Display::return_icon('edit.png', get_lang('Edit')), |
||
453 | $codePath.'admin/dashboard_add_sessions_to_user.php?user='.$userId |
||
454 | ); |
||
455 | break; |
||
456 | default: |
||
457 | $status = get_lang('Student'); |
||
458 | } |
||
459 | |||
460 | $registered = !empty($user['registered_at']) ? Display::dateToStringAgoAndLongDate($user['registered_at']) : ''; |
||
461 | |||
462 | $table->setCellContents($row, 1, $status); |
||
463 | $table->setCellContents($row, 2, $registered); |
||
464 | $table->setCellContents($row, 3, $link); |
||
465 | $row++; |
||
466 | } |
||
467 | $userListToShow .= $table->toHtml(); |
||
468 | } |
||
469 | |||
470 | /** @var SequenceResourceRepository $repo */ |
||
471 | $repo = $em->getRepository('ChamiloCoreBundle:SequenceResource'); |
||
472 | $requirementAndDependencies = $repo->getRequirementAndDependencies( |
||
473 | $sessionId, |
||
474 | SequenceResource::SESSION_TYPE |
||
475 | ); |
||
476 | |||
477 | $requirements = ''; |
||
478 | if (!empty($requirementAndDependencies['requirements'])) { |
||
479 | $requirements = Display::page_subheader(get_lang('Requirements')); |
||
480 | $requirements .= implode(' + ', array_column($requirementAndDependencies['requirements'], 'admin_link')); |
||
481 | } |
||
482 | $dependencies = ''; |
||
483 | if (!empty($requirementAndDependencies['dependencies'])) { |
||
484 | $dependencies = Display::page_subheader(get_lang('Dependencies')); |
||
485 | $dependencies .= implode(', ', array_column($requirementAndDependencies['dependencies'], 'admin_link')); |
||
486 | } |
||
487 | |||
488 | $promotion = null; |
||
489 | if (!empty($sessionInfo['promotion_id'])) { |
||
490 | $promotion = $em->getRepository('ChamiloCoreBundle:Promotion'); |
||
491 | $promotion = $promotion->find($sessionInfo['promotion_id']); |
||
492 | } |
||
493 | |||
494 | $programmedAnnouncement = new ScheduledAnnouncement(); |
||
495 | $programmedAnnouncement = $programmedAnnouncement->allowed(); |
||
496 | |||
497 | $htmlHeadXtra[] = api_get_jquery_libraries_js(['jquery-ui', 'jquery-upload']); |
||
498 | |||
499 | $tpl = new Template($tool_name); |
||
500 | $tpl->assign('session_header', $sessionHeader); |
||
501 | $tpl->assign('title', $sessionTitle); |
||
502 | $tpl->assign('general_coach', $generalCoach); |
||
503 | $tpl->assign('session_admin', api_get_user_info($session->getSessionAdminId())); |
||
504 | $tpl->assign('session', $sessionInfo); |
||
505 | $tpl->assign('programmed_announcement', $programmedAnnouncement); |
||
506 | $tpl->assign('session_category', is_null($sessionCategory) ? null : $sessionCategory->getName()); |
||
507 | $tpl->assign('session_dates', SessionManager::parseSessionDates($sessionInfo, true)); |
||
508 | $tpl->assign('session_visibility', SessionManager::getSessionVisibility($sessionInfo)); |
||
509 | $tpl->assign('promotion', $promotion); |
||
510 | $tpl->assign('url_list', $urlList); |
||
511 | $tpl->assign('extra_fields', $extraFieldData); |
||
512 | $tpl->assign('course_list', $courseListToShow); |
||
513 | $tpl->assign('user_list', $userListToShow); |
||
514 | $tpl->assign('dependencies', $dependencies); |
||
515 | $tpl->assign('requirements', $requirements); |
||
516 | |||
517 | $layout = $tpl->get_template('session/resume_session.tpl'); |
||
518 | $tpl->display($layout); |
||
519 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: