@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => '��������������� � ������������', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => '���������� � ����������� CAS!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => '���������� � ���������� ��� CAS!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => '� ����������� CAS �������!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => '��������������� � ������������', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => '���������� � ����������� CAS!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => '���������� � ���������� ��� CAS!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => '� ����������� CAS �������!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
28 | 28 | \ No newline at end of file |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'utilisant le serveur', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'Authentication CAS n�cessaire !', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'D�connexion demand�e !', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => 'Authentification CAS infructueuse !', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'utilisant le serveur', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => 'Authentication CAS n�cessaire !', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => 'D�connexion demand�e !', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => 'Authentification CAS infructueuse !', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)' |
|
25 | 25 | |
26 | 26 | ); |
27 | 27 |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'usando servidor', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => '¡Autentificación CAS necesaria!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => '¡Salida CAS necesaria!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => '¡Autentificación CAS fallida!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'usando servidor', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => '¡Autentificación CAS necesaria!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => '¡Salida CAS necesaria!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => '¡Autentificación CAS fallida!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $message confirmation message(optional) |
62 | 62 | * @param string $error error message(optional) |
63 | 63 | */ |
64 | - public function categories_list($action, $message='', $error='') |
|
64 | + public function categories_list($action, $message = '', $error = '') |
|
65 | 65 | { |
66 | 66 | $data = array(); |
67 | 67 | $data['user_course_categories'] = $this->model->get_user_course_categories(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // we need only the course codes as these will be used to match against the courses of the category |
118 | 118 | if ($user_courses != '') { |
119 | - foreach($user_courses as $key => $value) { |
|
119 | + foreach ($user_courses as $key => $value) { |
|
120 | 120 | $user_coursecodes[] = $value['code']; |
121 | 121 | } |
122 | 122 | } |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $html .= '</strong>'; |
386 | 386 | } else { |
387 | 387 | if (!empty($categoryCourses)) { |
388 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
388 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
389 | 389 | 1, |
390 | 390 | $limit['length'], |
391 | 391 | $categoryCode, |
392 | 392 | $hiddenLinks, |
393 | 393 | $action |
394 | - ) . '">'; |
|
394 | + ).'">'; |
|
395 | 395 | $html .= "$categoryName ($categoryCourses)"; |
396 | 396 | $html .= '</a>'; |
397 | 397 | } else { |
@@ -412,13 +412,13 @@ discard block |
||
412 | 412 | if ($code == $subCategory1Code) { |
413 | 413 | $html .= "<strong>$subCategory1Name ($subCategory1Courses)</strong>"; |
414 | 414 | } else { |
415 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
415 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
416 | 416 | 1, |
417 | 417 | $limit['length'], |
418 | 418 | $categoryCode, |
419 | 419 | $hiddenLinks, |
420 | 420 | $action |
421 | - ) . '">'; |
|
421 | + ).'">'; |
|
422 | 422 | $html .= "$subCategory1Name ($subCategory1Courses)"; |
423 | 423 | $html .= '</a>'; |
424 | 424 | } |
@@ -436,13 +436,13 @@ discard block |
||
436 | 436 | if ($code == $subCategory2Code) { |
437 | 437 | $html .= "<strong>$subCategory2Name ($subCategory2Courses)</strong>"; |
438 | 438 | } else { |
439 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
439 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
440 | 440 | 1, |
441 | 441 | $limit['length'], |
442 | 442 | $categoryCode, |
443 | 443 | $hiddenLinks, |
444 | 444 | $action |
445 | - ) . '">'; |
|
445 | + ).'">'; |
|
446 | 446 | $html .= "$subCategory2Name ($subCategory2Courses)"; |
447 | 447 | $html .= '</a>'; |
448 | 448 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | if ($code == $subCategory3Code) { |
461 | 461 | $html .= "<strong>$subCategory3Name ($subCategory3Courses)</strong>"; |
462 | 462 | } else { |
463 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
463 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
464 | 464 | 1, |
465 | 465 | $limit['length'], |
466 | 466 | $categoryCode, |
467 | 467 | $hiddenLinks, |
468 | 468 | $action |
469 | - ) . '">'; |
|
469 | + ).'">'; |
|
470 | 470 | $html .= "$subCategory3Name ($subCategory3Courses)"; |
471 | 471 | $html .= '</a>'; |
472 | 472 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $icon = '<em class="fa fa-smile-o"></em>'; |
594 | 594 | |
595 | 595 | return Display::div( |
596 | - $icon . ' ' . get_lang("AlreadyRegisteredToSession"), |
|
596 | + $icon.' '.get_lang("AlreadyRegisteredToSession"), |
|
597 | 597 | array('class' => 'info-catalog') |
598 | 598 | ); |
599 | 599 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function getSessionIcon($sessionName) |
607 | 607 | { |
608 | - return Display::return_icon('window_list.png', $sessionName, null,ICON_SIZE_MEDIUM); |
|
608 | + return Display::return_icon('window_list.png', $sessionName, null, ICON_SIZE_MEDIUM); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -626,8 +626,7 @@ discard block |
||
626 | 626 | $pageTotal = intval(ceil(intval($countSessions) / $limit['length'])); |
627 | 627 | // Do NOT show pagination if only one page or less |
628 | 628 | $cataloguePagination = $pageTotal > 1 ? |
629 | - getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : |
|
630 | - ''; |
|
629 | + getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : ''; |
|
631 | 630 | $sessionsBlocks = $this->getFormatedSessionsBlock($sessions); |
632 | 631 | |
633 | 632 | // Get session list catalogue URL |
@@ -638,13 +637,13 @@ discard block |
||
638 | 637 | $tpl = new Template(); |
639 | 638 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
640 | 639 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
641 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
640 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
642 | 641 | $tpl->assign('course_url', $courseUrl); |
643 | 642 | $tpl->assign('catalog_pagination', $cataloguePagination); |
644 | 643 | $tpl->assign('hidden_links', $hiddenLinks); |
645 | 644 | $tpl->assign('search_token', Security::get_token()); |
646 | 645 | $tpl->assign('search_date', $date); |
647 | - $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php'); |
|
646 | + $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH).'course.ajax.php'); |
|
648 | 647 | $tpl->assign('sessions', $sessionsBlocks); |
649 | 648 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
650 | 649 | |
@@ -671,7 +670,7 @@ discard block |
||
671 | 670 | |
672 | 671 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
673 | 672 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
674 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
673 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
675 | 674 | $tpl->assign('course_url', $courseUrl); |
676 | 675 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
677 | 676 | $tpl->assign('hidden_links', $hiddenLinks); |
@@ -702,7 +701,7 @@ discard block |
||
702 | 701 | $tpl = new Template(); |
703 | 702 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
704 | 703 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
705 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
704 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
706 | 705 | $tpl->assign('course_url', $courseUrl); |
707 | 706 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
708 | 707 | $tpl->assign('hidden_links', $hiddenLinks); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $limit |
204 | 204 | ); |
205 | 205 | } else { |
206 | - header('Location: ' . api_get_self()); |
|
206 | + header('Location: '.api_get_self()); |
|
207 | 207 | } |
208 | 208 | break; |
209 | 209 | case 'display_random_courses': |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
279 | 279 | |
280 | 280 | if (!$continueWithSubscription) { |
281 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | + header('Location: '.api_get_path(WEB_CODE_PATH).'auth/courses.php'); |
|
282 | 282 | exit; |
283 | 283 | } |
284 | 284 | } |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | |
297 | 297 | if ($count <= 0) { |
298 | 298 | // no course in session -> return to catalog |
299 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | + $url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
|
300 | 300 | } elseif ($count == 1) { |
301 | 301 | // only one course, so redirect directly to this course |
302 | 302 | foreach ($coursesList as $course) { |
303 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
303 | + $url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.intval($_GET['session_id']); |
|
304 | 304 | } |
305 | 305 | } else { |
306 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
306 | + $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.intval($_GET['session_id']); |
|
307 | 307 | } |
308 | - header('Location: ' . $url); |
|
308 | + header('Location: '.$url); |
|
309 | 309 | exit; |
310 | 310 | } |
311 | 311 | //else show error message? |
@@ -171,28 +171,52 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | switch ($action) { |
174 | - case 'subscribe_user_with_password': |
|
175 | - $courses_controller->subscribe_user( |
|
176 | - isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | - isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | - isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | - ); |
|
180 | - break; |
|
181 | - case 'createcoursecategory': |
|
182 | - $courses_controller->categories_list($action); |
|
183 | - break; |
|
184 | - case 'deletecoursecategory': |
|
185 | - $courses_controller->courses_list($action); |
|
186 | - break; |
|
187 | - case 'sortmycourses': |
|
188 | - $courses_controller->courses_list($action); |
|
189 | - break; |
|
190 | - case 'subscribe': |
|
191 | - if (!$user_can_view_page) { |
|
192 | - api_not_allowed(true); |
|
193 | - } |
|
194 | - |
|
195 | - if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
174 | + case 'subscribe_user_with_password': |
|
175 | + $courses_controller->subscribe_user( |
|
176 | + isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | + isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | + isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | + ); |
|
180 | + break; |
|
181 | + case 'createcoursecategory': |
|
182 | + $courses_controller->categories_list($action); |
|
183 | + break; |
|
184 | + case 'deletecoursecategory': |
|
185 | + $courses_controller->courses_list($action); |
|
186 | + break; |
|
187 | + case 'sortmycourses': |
|
188 | + $courses_controller->courses_list($action); |
|
189 | + break; |
|
190 | + case 'subscribe': |
|
191 | + if (!$user_can_view_page) { |
|
192 | + api_not_allowed(true); |
|
193 | + } |
|
194 | + |
|
195 | + if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
196 | + $courses_controller->courses_categories( |
|
197 | + $action, |
|
198 | + $categoryCode, |
|
199 | + null, |
|
200 | + null, |
|
201 | + null, |
|
202 | + $limit |
|
203 | + ); |
|
204 | + } else { |
|
205 | + header('Location: ' . api_get_self()); |
|
206 | + } |
|
207 | + break; |
|
208 | + case 'display_random_courses': |
|
209 | + if (!$user_can_view_page) { |
|
210 | + api_not_allowed(true); |
|
211 | + } |
|
212 | + |
|
213 | + $courses_controller->courses_categories($action); |
|
214 | + break; |
|
215 | + case 'display_courses': |
|
216 | + if (!$user_can_view_page) { |
|
217 | + api_not_allowed(true); |
|
218 | + } |
|
219 | + |
|
196 | 220 | $courses_controller->courses_categories( |
197 | 221 | $action, |
198 | 222 | $categoryCode, |
@@ -201,126 +225,102 @@ discard block |
||
201 | 225 | null, |
202 | 226 | $limit |
203 | 227 | ); |
204 | - } else { |
|
205 | - header('Location: ' . api_get_self()); |
|
206 | - } |
|
207 | - break; |
|
208 | - case 'display_random_courses': |
|
209 | - if (!$user_can_view_page) { |
|
210 | - api_not_allowed(true); |
|
211 | - } |
|
212 | - |
|
213 | - $courses_controller->courses_categories($action); |
|
214 | - break; |
|
215 | - case 'display_courses': |
|
216 | - if (!$user_can_view_page) { |
|
217 | - api_not_allowed(true); |
|
218 | - } |
|
219 | - |
|
220 | - $courses_controller->courses_categories( |
|
221 | - $action, |
|
222 | - $categoryCode, |
|
223 | - null, |
|
224 | - null, |
|
225 | - null, |
|
226 | - $limit |
|
227 | - ); |
|
228 | - break; |
|
229 | - case 'display_sessions': |
|
230 | - if (!$user_can_view_page) { |
|
231 | - api_not_allowed(true); |
|
232 | - } |
|
233 | - |
|
234 | - $courses_controller->sessionsList($action, $nameTools, $limit); |
|
235 | - break; |
|
236 | - case 'subscribe_to_session': |
|
237 | - if (!$user_can_view_page) { |
|
238 | - api_not_allowed(true); |
|
239 | - } |
|
240 | - |
|
241 | - $userId = api_get_user_id(); |
|
242 | - $confirmed = isset($_GET['confirm']); |
|
243 | - $sessionId = intval($_GET['session_id']); |
|
244 | - |
|
245 | - if (empty($userId)) { |
|
246 | - api_not_allowed(); |
|
247 | - exit; |
|
248 | - } |
|
249 | - |
|
250 | - if (!$confirmed) { |
|
251 | - $template = new Template(null, false, false, false, false, false); |
|
252 | - $template->assign('session_id', $sessionId); |
|
253 | - |
|
254 | - $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
255 | - |
|
256 | - echo $template->fetch($layout); |
|
257 | - exit; |
|
258 | - } |
|
259 | - |
|
260 | - $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
261 | - if ($registrationAllowed === 'true') { |
|
262 | - $entityManager = Database::getManager(); |
|
263 | - $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
264 | - |
|
265 | - $sequences = $repository->getRequirements( |
|
266 | - $sessionId, |
|
267 | - SequenceResource::SESSION_TYPE |
|
268 | - ); |
|
228 | + break; |
|
229 | + case 'display_sessions': |
|
230 | + if (!$user_can_view_page) { |
|
231 | + api_not_allowed(true); |
|
232 | + } |
|
233 | + |
|
234 | + $courses_controller->sessionsList($action, $nameTools, $limit); |
|
235 | + break; |
|
236 | + case 'subscribe_to_session': |
|
237 | + if (!$user_can_view_page) { |
|
238 | + api_not_allowed(true); |
|
239 | + } |
|
240 | + |
|
241 | + $userId = api_get_user_id(); |
|
242 | + $confirmed = isset($_GET['confirm']); |
|
243 | + $sessionId = intval($_GET['session_id']); |
|
269 | 244 | |
270 | - if (count($sequences) > 0) { |
|
271 | - $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
272 | - $sequences, |
|
273 | - SequenceResource::SESSION_TYPE, |
|
274 | - $userId |
|
245 | + if (empty($userId)) { |
|
246 | + api_not_allowed(); |
|
247 | + exit; |
|
248 | + } |
|
249 | + |
|
250 | + if (!$confirmed) { |
|
251 | + $template = new Template(null, false, false, false, false, false); |
|
252 | + $template->assign('session_id', $sessionId); |
|
253 | + |
|
254 | + $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
255 | + |
|
256 | + echo $template->fetch($layout); |
|
257 | + exit; |
|
258 | + } |
|
259 | + |
|
260 | + $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
261 | + if ($registrationAllowed === 'true') { |
|
262 | + $entityManager = Database::getManager(); |
|
263 | + $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
264 | + |
|
265 | + $sequences = $repository->getRequirements( |
|
266 | + $sessionId, |
|
267 | + SequenceResource::SESSION_TYPE |
|
275 | 268 | ); |
276 | 269 | |
277 | - $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
270 | + if (count($sequences) > 0) { |
|
271 | + $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
272 | + $sequences, |
|
273 | + SequenceResource::SESSION_TYPE, |
|
274 | + $userId |
|
275 | + ); |
|
276 | + |
|
277 | + $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
278 | 278 | |
279 | - if (!$continueWithSubscription) { |
|
280 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | - exit; |
|
279 | + if (!$continueWithSubscription) { |
|
280 | + header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | + exit; |
|
282 | + } |
|
282 | 283 | } |
283 | - } |
|
284 | 284 | |
285 | - SessionManager::suscribe_users_to_session( |
|
286 | - $_GET['session_id'], |
|
287 | - array($userId), |
|
288 | - SESSION_VISIBLE_READ_ONLY, |
|
289 | - false |
|
290 | - ); |
|
285 | + SessionManager::suscribe_users_to_session( |
|
286 | + $_GET['session_id'], |
|
287 | + array($userId), |
|
288 | + SESSION_VISIBLE_READ_ONLY, |
|
289 | + false |
|
290 | + ); |
|
291 | 291 | |
292 | - $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
293 | - $count = count($coursesList); |
|
294 | - $url = ''; |
|
295 | - |
|
296 | - if ($count <= 0) { |
|
297 | - // no course in session -> return to catalog |
|
298 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | - } elseif ($count == 1) { |
|
300 | - // only one course, so redirect directly to this course |
|
301 | - foreach ($coursesList as $course) { |
|
302 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
292 | + $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
293 | + $count = count($coursesList); |
|
294 | + $url = ''; |
|
295 | + |
|
296 | + if ($count <= 0) { |
|
297 | + // no course in session -> return to catalog |
|
298 | + $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | + } elseif ($count == 1) { |
|
300 | + // only one course, so redirect directly to this course |
|
301 | + foreach ($coursesList as $course) { |
|
302 | + $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
303 | + } |
|
304 | + } else { |
|
305 | + $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
303 | 306 | } |
304 | - } else { |
|
305 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
307 | + header('Location: ' . $url); |
|
308 | + exit; |
|
306 | 309 | } |
307 | - header('Location: ' . $url); |
|
308 | - exit; |
|
309 | - } |
|
310 | - //else show error message? |
|
311 | - break; |
|
312 | - case 'search_tag': |
|
313 | - if (!$user_can_view_page) { |
|
314 | - api_not_allowed(true); |
|
315 | - } |
|
316 | - |
|
317 | - $courses_controller->sessionsListByCoursesTag($limit); |
|
318 | - break; |
|
319 | - case 'search_session': |
|
320 | - if (!$user_can_view_page) { |
|
321 | - api_not_allowed(true); |
|
322 | - } |
|
323 | - |
|
324 | - $courses_controller->sessionListBySearch($limit); |
|
325 | - break; |
|
310 | + //else show error message? |
|
311 | + break; |
|
312 | + case 'search_tag': |
|
313 | + if (!$user_can_view_page) { |
|
314 | + api_not_allowed(true); |
|
315 | + } |
|
316 | + |
|
317 | + $courses_controller->sessionsListByCoursesTag($limit); |
|
318 | + break; |
|
319 | + case 'search_session': |
|
320 | + if (!$user_can_view_page) { |
|
321 | + api_not_allowed(true); |
|
322 | + } |
|
323 | + |
|
324 | + $courses_controller->sessionListBySearch($limit); |
|
325 | + break; |
|
326 | 326 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | $msg .= '<div class="well_login">'; |
43 | 43 | $msg .= $form->return_form(); |
44 | - $msg .='</div>'; |
|
44 | + $msg .= '</div>'; |
|
45 | 45 | if (api_is_cas_activated()) { |
46 | 46 | $msg .= "</div>"; |
47 | 47 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
6 | 6 | |
7 | 7 | if (! isset($_SESSION['conditional_login']['uid'])) |
8 | - die("Not Authorised"); |
|
8 | + die("Not Authorised"); |
|
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
11 | 11 | <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"> |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
5 | -$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
5 | +$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
6 | 6 | |
7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
7 | +if (!isset($_SESSION['conditional_login']['uid'])) |
|
8 | 8 | die("Not Authorised"); |
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | </body> |
21 | 21 | </html> |
22 | 22 | <?php |
23 | -if (isset($_POST['submit'])){ |
|
23 | +if (isset($_POST['submit'])) { |
|
24 | 24 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
25 | 25 | $u['phone'] = $_POST['phone_number']; |
26 | 26 | $password = null; // we don't want to change the password |
@@ -4,8 +4,9 @@ |
||
4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
5 | 5 | $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
6 | 6 | |
7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
7 | +if (! isset($_SESSION['conditional_login']['uid'])) { |
|
8 | 8 | die("Not Authorised"); |
9 | +} |
|
9 | 10 | ?> |
10 | 11 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
11 | 12 | <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"> |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | } |
55 | 55 | $course_info = api_get_course_info_by_id($result['c_id']); |
56 | 56 | $course_image = '<img src="'.$course_info['course_image_large'].'">'; |
57 | - $dates .= '<li><a href="#'.$login.'">' . api_convert_and_format_date($login, DATE_FORMAT_SHORT) . '</a></li>'; |
|
57 | + $dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>'; |
|
58 | 58 | $issues .= '<li id ="'.$login.'">'; |
59 | 59 | $issues .= '<div class="img-course">'.$course_image.'</div>'; |
60 | 60 | |
61 | 61 | $issues .= '<div class="text-course">'; |
62 | - $issues .= '<p>' . sprintf( |
|
62 | + $issues .= '<p>'.sprintf( |
|
63 | 63 | get_lang('YouHaveEnteredTheCourseXInY'), |
64 | - '" '. $courseInfo['name'] .' "', |
|
64 | + '" '.$courseInfo['name'].' "', |
|
65 | 65 | api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG) |
66 | - ) . '</p>'; |
|
66 | + ).'</p>'; |
|
67 | 67 | $issues .= '</div>'; |
68 | 68 | $issues .= '</li>'; |
69 | 69 | $count++; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $content .= '<div class="row">'; |
83 | 83 | $content .= '<div class="col-md-12">'; |
84 | 84 | $content .= '<div id="my_timeline">'; |
85 | - $content .= '<ul id="dates">' . $dates . '</ul>'; |
|
86 | - $content .= '<ul id="issues">' . $issues . '</ul>'; |
|
85 | + $content .= '<ul id="dates">'.$dates.'</ul>'; |
|
86 | + $content .= '<ul id="issues">'.$issues.'</ul>'; |
|
87 | 87 | $content .= '<div id="grad_left"></div>'; |
88 | 88 | $content .= '<div id="grad_right"></div>'; |
89 | 89 | $content .= '<a href="#" id="prev"></a>'; |
@@ -32,135 +32,135 @@ |
||
32 | 32 | abstract class FacebookSignedRequestFromInputHelper |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
36 | - * @var \Facebook\Entities\SignedRequest|null |
|
37 | - */ |
|
38 | - protected $signedRequest; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var string the app id |
|
42 | - */ |
|
43 | - protected $appId; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var string the app secret |
|
47 | - */ |
|
48 | - protected $appSecret; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string|null Random string to prevent CSRF. |
|
52 | - */ |
|
53 | - public $state = null; |
|
54 | - |
|
55 | - /** |
|
56 | - * Initialize the helper and process available signed request data. |
|
57 | - * |
|
58 | - * @param string|null $appId |
|
59 | - * @param string|null $appSecret |
|
60 | - */ |
|
61 | - public function __construct($appId = null, $appSecret = null) |
|
62 | - { |
|
35 | + /** |
|
36 | + * @var \Facebook\Entities\SignedRequest|null |
|
37 | + */ |
|
38 | + protected $signedRequest; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var string the app id |
|
42 | + */ |
|
43 | + protected $appId; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var string the app secret |
|
47 | + */ |
|
48 | + protected $appSecret; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string|null Random string to prevent CSRF. |
|
52 | + */ |
|
53 | + public $state = null; |
|
54 | + |
|
55 | + /** |
|
56 | + * Initialize the helper and process available signed request data. |
|
57 | + * |
|
58 | + * @param string|null $appId |
|
59 | + * @param string|null $appSecret |
|
60 | + */ |
|
61 | + public function __construct($appId = null, $appSecret = null) |
|
62 | + { |
|
63 | 63 | $this->appId = FacebookSession::_getTargetAppId($appId); |
64 | 64 | $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret); |
65 | 65 | |
66 | 66 | $this->instantiateSignedRequest(); |
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Instantiates a new SignedRequest entity. |
|
71 | - * |
|
72 | - * @param string|null |
|
73 | - */ |
|
74 | - public function instantiateSignedRequest($rawSignedRequest = null) |
|
75 | - { |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Instantiates a new SignedRequest entity. |
|
71 | + * |
|
72 | + * @param string|null |
|
73 | + */ |
|
74 | + public function instantiateSignedRequest($rawSignedRequest = null) |
|
75 | + { |
|
76 | 76 | $rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest(); |
77 | 77 | |
78 | 78 | if (!$rawSignedRequest) { |
79 | - return; |
|
79 | + return; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $this->signedRequest = new SignedRequest($rawSignedRequest, $this->state, $this->appSecret); |
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Instantiates a FacebookSession from the signed request from input. |
|
87 | - * |
|
88 | - * @return FacebookSession|null |
|
89 | - */ |
|
90 | - public function getSession() |
|
91 | - { |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Instantiates a FacebookSession from the signed request from input. |
|
87 | + * |
|
88 | + * @return FacebookSession|null |
|
89 | + */ |
|
90 | + public function getSession() |
|
91 | + { |
|
92 | 92 | if ($this->signedRequest && $this->signedRequest->hasOAuthData()) { |
93 | - return FacebookSession::newSessionFromSignedRequest($this->signedRequest); |
|
93 | + return FacebookSession::newSessionFromSignedRequest($this->signedRequest); |
|
94 | 94 | } |
95 | 95 | return null; |
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Returns the SignedRequest entity. |
|
100 | - * |
|
101 | - * @return \Facebook\Entities\SignedRequest|null |
|
102 | - */ |
|
103 | - public function getSignedRequest() |
|
104 | - { |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Returns the SignedRequest entity. |
|
100 | + * |
|
101 | + * @return \Facebook\Entities\SignedRequest|null |
|
102 | + */ |
|
103 | + public function getSignedRequest() |
|
104 | + { |
|
105 | 105 | return $this->signedRequest; |
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Returns the user_id if available. |
|
110 | - * |
|
111 | - * @return string|null |
|
112 | - */ |
|
113 | - public function getUserId() |
|
114 | - { |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * Returns the user_id if available. |
|
110 | + * |
|
111 | + * @return string|null |
|
112 | + */ |
|
113 | + public function getUserId() |
|
114 | + { |
|
115 | 115 | return $this->signedRequest ? $this->signedRequest->getUserId() : null; |
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Get raw signed request from input. |
|
120 | - * |
|
121 | - * @return string|null |
|
122 | - */ |
|
123 | - abstract public function getRawSignedRequest(); |
|
124 | - |
|
125 | - /** |
|
126 | - * Get raw signed request from GET input. |
|
127 | - * |
|
128 | - * @return string|null |
|
129 | - */ |
|
130 | - public function getRawSignedRequestFromGet() |
|
131 | - { |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Get raw signed request from input. |
|
120 | + * |
|
121 | + * @return string|null |
|
122 | + */ |
|
123 | + abstract public function getRawSignedRequest(); |
|
124 | + |
|
125 | + /** |
|
126 | + * Get raw signed request from GET input. |
|
127 | + * |
|
128 | + * @return string|null |
|
129 | + */ |
|
130 | + public function getRawSignedRequestFromGet() |
|
131 | + { |
|
132 | 132 | if (isset($_GET['signed_request'])) { |
133 | - return $_GET['signed_request']; |
|
133 | + return $_GET['signed_request']; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return null; |
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Get raw signed request from POST input. |
|
141 | - * |
|
142 | - * @return string|null |
|
143 | - */ |
|
144 | - public function getRawSignedRequestFromPost() |
|
145 | - { |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Get raw signed request from POST input. |
|
141 | + * |
|
142 | + * @return string|null |
|
143 | + */ |
|
144 | + public function getRawSignedRequestFromPost() |
|
145 | + { |
|
146 | 146 | if (isset($_POST['signed_request'])) { |
147 | - return $_POST['signed_request']; |
|
147 | + return $_POST['signed_request']; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return null; |
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Get raw signed request from cookie set from the Javascript SDK. |
|
155 | - * |
|
156 | - * @return string|null |
|
157 | - */ |
|
158 | - public function getRawSignedRequestFromCookie() |
|
159 | - { |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Get raw signed request from cookie set from the Javascript SDK. |
|
155 | + * |
|
156 | + * @return string|null |
|
157 | + */ |
|
158 | + public function getRawSignedRequestFromCookie() |
|
159 | + { |
|
160 | 160 | if (isset($_COOKIE['fbsr_' . $this->appId])) { |
161 | - return $_COOKIE['fbsr_' . $this->appId]; |
|
161 | + return $_COOKIE['fbsr_' . $this->appId]; |
|
162 | 162 | } |
163 | 163 | return null; |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | 166 | } |
@@ -157,8 +157,8 @@ |
||
157 | 157 | */ |
158 | 158 | public function getRawSignedRequestFromCookie() |
159 | 159 | { |
160 | - if (isset($_COOKIE['fbsr_' . $this->appId])) { |
|
161 | - return $_COOKIE['fbsr_' . $this->appId]; |
|
160 | + if (isset($_COOKIE['fbsr_'.$this->appId])) { |
|
161 | + return $_COOKIE['fbsr_'.$this->appId]; |
|
162 | 162 | } |
163 | 163 | return null; |
164 | 164 | } |