diff --git a/main/auth/catalog_layout.php b/main/auth/catalog_layout.php index 4b564cb660..747bc73289 100644 --- a/main/auth/catalog_layout.php +++ b/main/auth/catalog_layout.php @@ -7,7 +7,7 @@ */ if (api_get_setting('course_catalog_published') !== 'true') { - // Acces rights: anonymous users can't do anything usefull here. + // Access rights: anonymous users can't do anything usefull here. api_block_anonymous_users(); } diff --git a/main/auth/courses.php b/main/auth/courses.php index 9220f27918..10807b4cfd 100755 --- a/main/auth/courses.php +++ b/main/auth/courses.php @@ -144,7 +144,14 @@ if (isset($_POST['create_course_category']) && // search courses if (isset($_REQUEST['search_course'])) { if ($ctok == $_REQUEST['sec_token']) { - $courses_controller->search_courses($_REQUEST['search_term'], null, null, null, $limit, true); + $courses_controller->search_courses( + $_REQUEST['search_term'], + null, + null, + null, + $limit, + true + ); } } @@ -163,7 +170,11 @@ if (isset($_REQUEST['subscribe_course'])) { if (isset($_GET['unsubscribe'])) { $search_term = isset($_GET['search_term']) ? $_GET['search_term'] : null; if ($ctok == $_GET['sec_token']) { - $courses_controller->unsubscribe_user_from_course($_GET['unsubscribe'], $search_term, $categoryCode); + $courses_controller->unsubscribe_user_from_course( + $_GET['unsubscribe'], + $search_term, + $categoryCode + ); } } diff --git a/main/auth/courses_categories.php b/main/auth/courses_categories.php index a220812dd1..42debc2306 100755 --- a/main/auth/courses_categories.php +++ b/main/auth/courses_categories.php @@ -159,14 +159,14 @@ if ($showCourses && $action != 'display_sessions') { continue; } - $userRegisterdInCourse = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); - $userRegisterdInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']); - $userRegisterd = ($userRegisterdInCourse && $userRegisterdInCourseAsTeacher); + $userRegisteredInCourse = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); + $userRegisteredInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']); + $userRegistered = $userRegisteredInCourse && $userRegisteredInCourseAsTeacher; - $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); - $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); - $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED); - $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED); + $course_public = $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD; + $course_open = $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM; + $course_private = $course['visibility'] == COURSE_VISIBILITY_REGISTERED; + $course_closed = $course['visibility'] == COURSE_VISIBILITY_CLOSED; $course_subscribe_allowed = ($course['subscribe'] == 1); $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); @@ -183,7 +183,7 @@ if ($showCourses && $action != 'display_sessions') { } // display thumbnail - $html .= returnThumbnail($course, $userRegisterd); + $html .= returnThumbnail($course, $userRegistered); $separator = '
 
'; $subscribeButton = return_register_button($course, $stok, $code, $search_term); @@ -211,7 +211,7 @@ if ($showCourses && $action != 'display_sessions') { // display course title and button bloc $html .= '
'; - $html .= return_title($course, $userRegisterdInCourse); + $html .= return_title($course, $userRegisteredInCourse); $html .= return_teacher($course); // display button line @@ -222,20 +222,18 @@ if ($showCourses && $action != 'display_sessions') { $html .= '
'; $html .= '
'; // if user registered as student - if ($userRegisterdInCourse) { + if ($userRegisteredInCourse) { $html .= return_already_registered_label('student'); if (!$course_closed) { if ($course_unsubscribe_allowed) { $html .= return_unregister_button($course, $stok, $search_term, $code); } } - } elseif ($userRegisterdInCourseAsTeacher) { + } elseif ($userRegisteredInCourseAsTeacher) { // if user registered as teacher if ($course_unsubscribe_allowed) { $html .= return_unregister_button($course, $stok, $search_term, $code); } - //$html .= return_already_registered_label('teacher'); - } else { // if user not registered in the course if (!$course_closed) { @@ -245,7 +243,6 @@ if ($showCourses && $action != 'display_sessions') { } } } - } $html .= '
'; $html .= '
'; @@ -290,11 +287,17 @@ function returnThumbnail($course, $registeredUser) $course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png'; // redimensioned image 85x85 } else { // without picture - $course_medium_image = Display::return_icon('session_default.png', null, null, null, null, true); + $course_medium_image = Display::return_icon( + 'session_default.png', + null, + null, + null, + null, + true + ); } $html .= '
'; - if (!$registeredUser) { $html .= ' 2) { $html .= ' '.get_lang('UserPicture').''; @@ -342,6 +342,7 @@ function return_teacher($course) } } $html .= '
'; + return $html; } @@ -414,7 +415,11 @@ function return_goto_button($course) $html = Display::url( Display::returnFontAwesomeIcon('share'), api_get_course_url($course['code']), - array('class' => 'btn btn-default btn-sm', 'title' => $title, 'aria-label' => $title) + array( + 'class' => 'btn btn-default btn-sm', + 'title' => $title, + 'aria-label' => $title, + ) ); return $html; } @@ -437,7 +442,12 @@ function return_already_registered_label($in_status) $html = Display::tag( 'span', $icon.' '.$title, - array('id' => 'register', 'class' => 'label-subscribed text-success', 'title' => $title, 'aria-label' => $title) + array( + 'id' => 'register', + 'class' => 'label-subscribed text-success', + 'title' => $title, + 'aria-label' => $title, + ) ); return $html; @@ -482,5 +492,6 @@ function return_unregister_button($course, $stok, $search_term, $code) .'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code, array('class' => 'btn btn-danger btn-sm', 'title' => $title, 'aria-label' => $title) ); + return $html; } diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index f0796143df..49d7d99895 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -614,7 +614,10 @@ class CoursesController return Display::div( $icon, - array('class' => 'btn btn-default btn-sm registered', 'title' => get_lang("AlreadyRegisteredToSession")) + array( + 'class' => 'btn btn-default btn-sm registered', + 'title' => get_lang("AlreadyRegisteredToSession"), + ) ); } @@ -689,13 +692,18 @@ class CoursesController $searchTag = isset($_POST['search_tag']) ? $_POST['search_tag'] : null; $searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d'); $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false; - $courseUrl = CourseCategory::getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe'); + $courseUrl = CourseCategory::getCourseCategoryUrl( + 1, + $limit['length'], + null, + 0, + 'subscribe' + ); $sessions = $this->model->browseSessionsByTags($searchTag, $limit); $sessionsBlocks = $this->getFormattedSessionsBlock($sessions); $tpl = new Template(); - $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); @@ -720,7 +728,13 @@ class CoursesController { $q = isset($_REQUEST['q']) ? Security::remove_XSS($_REQUEST['q']) : null; $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false; - $courseUrl = CourseCategory::getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe'); + $courseUrl = CourseCategory::getCourseCategoryUrl( + 1, + $limit['length'], + null, + 0, + 'subscribe' + ); $searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d'); $sessions = $this->model->browseSessionsBySearch($q, $limit); @@ -807,12 +821,10 @@ class CoursesController ); $hasRequirements = false; - foreach ($sequences['sequences'] as $sequence) { if (count($sequence['requirements']) === 0) { continue; } - $hasRequirements = true; break; } @@ -846,7 +858,7 @@ class CoursesController 'is_subscribed' => SessionManager::isUserSubscribedAsStudent($session->getId(), $userId), 'icon' => $this->getSessionIcon($session->getName()), 'date' => $sessionDates['display'], - 'price' => (!empty($isThisSessionOnSale['html']) ? $isThisSessionOnSale['html'] : ''), + 'price' => !empty($isThisSessionOnSale['html']) ? $isThisSessionOnSale['html'] : '', 'subscribe_button' => isset($isThisSessionOnSale['buy_button']) ? $isThisSessionOnSale['buy_button'] : $this->getRegisteredInSessionButton( $session->getId(), $session->getName(), diff --git a/main/auth/courses_list.php b/main/auth/courses_list.php index 7f022022aa..7802f69630 100755 --- a/main/auth/courses_list.php +++ b/main/auth/courses_list.php @@ -172,7 +172,6 @@ if (!empty($user_course_categories)) { } echo Display::page_subheader(get_lang('NoCourseCategory')); - echo ''; // COURSES WITHOUT CATEGORY if (!empty($courses_without_category)) { @@ -185,9 +184,18 @@ if (!empty($courses_without_category)) {
@@ -209,56 +217,54 @@ if (!empty($courses_without_category)) {
-
- - - - - - - - + + + + + + 0) { ?> - - - + + + - - - + echo Display::display_icon('up_na.png', get_lang('Up'), '', 22); + } + if ($key < $number_of_courses - 1) { ?> + + +
- - -
')) return false;"> - - - -
-
+ ?> + +
')) return false;"> + + + +
+ diff --git a/main/auth/gotocourse.php b/main/auth/gotocourse.php index 37476a2260..b6bace05a5 100755 --- a/main/auth/gotocourse.php +++ b/main/auth/gotocourse.php @@ -50,7 +50,7 @@ if (isset($_GET['firstpage'])) { } $msg .= ''; if (api_is_cas_activated()) { $msg .= ""; diff --git a/main/auth/inscription.php b/main/auth/inscription.php index 253a821be0..726fb46ab6 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -109,7 +109,15 @@ if ($user_already_registered_show_terms === false) { if (api_get_setting('registration', 'email') != 'true') { $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); } - $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); + $form->addRule( + 'email', + sprintf( + get_lang('UsernameMaxXCharacters'), + (string)USERNAME_MAX_LENGTH + ), + 'maxlength', + USERNAME_MAX_LENGTH + ); $form->addRule('email', get_lang('UserTaken'), 'username_available'); } @@ -151,7 +159,15 @@ if ($user_already_registered_show_terms === false) { ); $form->applyFilter('username', 'trim'); $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); - $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); + $form->addRule( + 'username', + sprintf( + get_lang('UsernameMaxXCharacters'), + (string)USERNAME_MAX_LENGTH + ), + 'maxlength', + USERNAME_MAX_LENGTH + ); $form->addRule('username', get_lang('UsernameWrong'), 'username'); $form->addRule('username', get_lang('UserTaken'), 'username_available'); } @@ -253,10 +269,25 @@ if ($user_already_registered_show_terms === false) { ); $form->addElement('static', null, null, get_lang('ClickOnTheImageForANewOne')); - $form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'), array('size' => 40)); - $form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client'); - - $form->addRule('captcha', get_lang('TheTextYouEnteredDoesNotMatchThePicture'), 'CAPTCHA', $captcha_question); + $form->addElement( + 'text', + 'captcha', + get_lang('EnterTheLettersYouSee'), + array('size' => 40) + ); + $form->addRule( + 'captcha', + get_lang('EnterTheCharactersYouReadInTheImage'), + 'required', + null, + 'client' + ); + $form->addRule( + 'captcha', + get_lang('TheTextYouEnteredDoesNotMatchThePicture'), + 'CAPTCHA', + $captcha_question + ); } // EXTENDED FIELDS @@ -570,7 +601,7 @@ if ($form->validate()) { $form ); - //update the extra fields + // Update the extra fields $count_extra_field = count($extras); if ($count_extra_field > 0 && is_integer($user_id)) { foreach ($extras as $key => $value) { diff --git a/main/auth/lostPassword.php b/main/auth/lostPassword.php index 66007525a4..bdc566ab2c 100755 --- a/main/auth/lostPassword.php +++ b/main/auth/lostPassword.php @@ -1,5 +1,6 @@ addHeader($tool_name); -$form->addText('user', [get_lang('LoginOrEmailAddress'), get_lang('EnterEmailUserAndWellSendYouPassword')], true); +$form->addText('user', + [ + get_lang('LoginOrEmailAddress'), + get_lang('EnterEmailUserAndWellSendYouPassword'), + ], + true +); $form->addButtonSend(get_lang('Send')); if ($form->validate()) { diff --git a/main/auth/profile.php b/main/auth/profile.php index bfd3460bad..f7aa5e3c8c 100755 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -230,7 +230,7 @@ if (api_get_setting('profile', 'language') !== 'true') { $form->freeze('language'); } -//THEME +// THEME if (is_profile_editable() && api_get_setting('user_selected_theme') == 'true') { $form->addElement('SelectTheme', 'theme', get_lang('Theme')); if (api_get_setting('profile', 'theme') !== 'true') { diff --git a/main/auth/reset.php b/main/auth/reset.php index e2bf9811ba..2556614b28 100644 --- a/main/auth/reset.php +++ b/main/auth/reset.php @@ -15,7 +15,12 @@ $form = new FormValidator('reset', 'POST', api_get_self().'?token='.$token); $form->addElement('header', get_lang('ResetPassword')); $form->addHidden('token', $token); $form->addElement('password', 'pass1', get_lang('Password')); -$form->addElement('password', 'pass2', get_lang('Confirmation'), array('id' => 'pass2', 'size' => 20, 'autocomplete' => 'off')); +$form->addElement( + 'password', + 'pass2', + get_lang('Confirmation'), + array('id' => 'pass2', 'size' => 20, 'autocomplete' => 'off') +); $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare'); diff --git a/main/auth/set_temp_password.php b/main/auth/set_temp_password.php index 22a23261f5..395f5964ad 100755 --- a/main/auth/set_temp_password.php +++ b/main/auth/set_temp_password.php @@ -28,7 +28,11 @@ $course_info = api_get_course_info_by_id($course_id); $tpl = new Template(null); // Build the form -$form = new FormValidator('set_temp_password', 'POST', api_get_self().'?course_id='.$course_id.'&session_id='.$session_id); +$form = new FormValidator( + 'set_temp_password', + 'POST', + api_get_self().'?course_id='.$course_id.'&session_id='.$session_id +); $form->addElement('header', get_lang('CourseRequiresPassword')); $form->addElement('hidden', 'course_id', $course_id); $form->addElement('hidden', 'session_id', $session_id); diff --git a/main/auth/unsubscribe_account.php b/main/auth/unsubscribe_account.php index 0e19d9a353..fc950a6193 100755 --- a/main/auth/unsubscribe_account.php +++ b/main/auth/unsubscribe_account.php @@ -12,14 +12,28 @@ $tool_name = get_lang('Unsubscribe'); $message = Display::return_message(get_lang('UnsubscribeFromPlatform'), 'warning'); $form = new FormValidator('user_add'); -$form->addElement('button', 'submit', get_lang('Unsubscribe'), array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("UnsubscribeFromPlatformConfirm")))."')) return false;")); -$content = $form->return_form(); +$form->addElement( + 'button', + 'submit', + get_lang('Unsubscribe'), + array( + 'onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("UnsubscribeFromPlatformConfirm")))."')) return false;", + ) +); +$content = $form->returnForm(); if ($form->validate()) { $user_info = api_get_user_info(); $result = UserManager::delete_user($user_info['user_id']); if ($result) { - $message = Display::return_message(sprintf(get_lang('UnsubscribeFromPlatformSuccess', $user_info['username']))); + $message = Display::return_message( + sprintf( + get_lang( + 'UnsubscribeFromPlatformSuccess', + $user_info['username'] + ) + ) + ); $content = null; online_logout($user_info['user_id'], false); api_not_allowed(true, $message);