diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php
index f51a0da060..34d5f6200f 100755
--- a/main/inc/lib/userportal.lib.php
+++ b/main/inc/lib/userportal.lib.php
@@ -73,9 +73,9 @@ class IndexManager
);
foreach ($exercises as $exercise_item) {
- $exercise_item['course_code'] = $course_code;
- $exercise_item['session_id'] = $session_id;
- $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
+ $exercise_item['course_code'] = $course_code;
+ $exercise_item['session_id'] = $session_id;
+ $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
$exercise_list[] = $exercise_item;
}
@@ -88,7 +88,10 @@ class IndexManager
api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']
);
$this->tpl->assign('exercise_url', $url);
- $this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT));
+ $this->tpl->assign(
+ 'exercise_end_date',
+ api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT)
+ );
}
}
}
@@ -140,7 +143,7 @@ class IndexManager
/**
* Alias for the online_logout() function
- * @param bool $redirect Whether to ask online_logout to redirect to index.php or not
+ * @param bool $redirect Whether to ask online_logout to redirect to index.php or not
*/
public function logout($redirect = true)
{
@@ -156,7 +159,7 @@ class IndexManager
public function category_has_open_courses($category)
{
$setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true';
- $main_course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
+ $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$category = Database::escape_string($category);
$sql_query = "SELECT * FROM $main_course_table WHERE category_code='$category'";
$sql_result = Database::query($sql_query);
@@ -215,16 +218,20 @@ class IndexManager
if ($show_menu) {
$html .= '
';
@@ -283,15 +290,15 @@ class IndexManager
$home_top_temp = file_get_contents($this->home.'home_top.html');
} else {
if (file_exists($this->default_home.'home_top.html')) {
- $home_top_temp = file_get_contents($this->default_home . 'home_top.html');
+ $home_top_temp = file_get_contents($this->default_home.'home_top.html');
}
}
}
if (trim($home_top_temp) == '' && api_is_platform_admin()) {
- $home_top_temp = '' . get_lang('PortalHomepageDefaultIntroduction') . '
';
+ $home_top_temp = ''.get_lang('PortalHomepageDefaultIntroduction').'
';
} else {
- $home_top_temp = '' . $home_top_temp . '
';
+ $home_top_temp = ''.$home_top_temp.'
';
}
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@@ -335,7 +342,7 @@ class IndexManager
public function return_help()
{
$user_selected_language = api_get_interface_language();
- $platformLanguage = api_get_setting('platformLanguage');
+ $platformLanguage = api_get_setting('platformLanguage');
// Help section.
/* Hide right menu "general" and other parts on anonymous right menu. */
@@ -358,6 +365,7 @@ class IndexManager
'helpsCollapse'
);
}
+
return $html;
}
@@ -375,13 +383,7 @@ class IndexManager
$certificatesItem = Display::tag(
'li',
Display::url(
- Display::return_icon(
- 'graduation.png',
- get_lang('MyCertificates'),
- null,
- ICON_SIZE_SMALL
- ).
- get_lang('MyCertificates'),
+ Display::return_icon('graduation.png', get_lang('MyCertificates')).get_lang('MyCertificates'),
api_get_path(WEB_CODE_PATH)."gradebook/my_certificates.php"
)
);
@@ -393,14 +395,8 @@ class IndexManager
$searchItem = Display::tag(
'li',
Display::url(
- Display::return_icon(
- 'search_graduation.png',
- get_lang('Search'),
- null,
- ICON_SIZE_SMALL
- ).
- get_lang('Search'),
- api_get_path(WEB_CODE_PATH) . "gradebook/search.php"
+ Display::return_icon('search_graduation.png', get_lang('Search')).get_lang('Search'),
+ api_get_path(WEB_CODE_PATH)."gradebook/search.php"
)
);
}
@@ -416,12 +412,7 @@ class IndexManager
$content .= Display::tag(
'li',
Display::url(
- Display::return_icon(
- 'skill-badges.png',
- get_lang('MySkills'),
- null,
- ICON_SIZE_SMALL
- ).get_lang('MySkills'),
+ Display::return_icon('skill-badges.png', get_lang('MySkills')).get_lang('MySkills'),
api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'
)
);
@@ -430,13 +421,8 @@ class IndexManager
$content .= Display::tag(
'li',
Display::url(
- Display::return_icon(
- 'edit-skill.png',
- get_lang('MySkills'),
- null,
- ICON_SIZE_SMALL
- ) . get_lang('ManageSkills'),
- api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php'
+ Display::return_icon('edit-skill.png', get_lang('MySkills')).get_lang('ManageSkills'),
+ api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'
)
);
}
@@ -491,7 +477,7 @@ class IndexManager
// Get list of courses in category $category.
$sql = "SELECT * FROM $main_course_table cours
- WHERE category_code = '" . $category . "'
+ WHERE category_code = '".$category."'
ORDER BY title, UPPER(visual_code)";
// Showing only the courses of the current access_url_id.
@@ -537,7 +523,7 @@ class IndexManager
FROM $main_category_table t1
LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id
LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)
- WHERE t1.parent_id ". (empty($category) ? "IS NULL" : "='$category'")."
+ WHERE t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."
GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count
ORDER BY t1.tree_pos, t1.name";
@@ -594,7 +580,7 @@ class IndexManager
$thereIsSubCat = true;
} elseif (api_get_setting('show_empty_course_categories') == 'true') {
/* End changed code to eliminate the (0 courses) after empty categories. */
- $htmlListCat .= '';
+ $htmlListCat .= '';
$htmlListCat .= $catLine['name'];
$htmlListCat .= "";
$thereIsSubCat = true;
@@ -612,10 +598,10 @@ class IndexManager
}
$result .= $htmlTitre;
if ($thereIsSubCat) {
- $result .= $htmlListCat;
+ $result .= $htmlListCat;
}
while ($categoryName = Database::fetch_array($resCats)) {
- $result .= '' . $categoryName['name'] . "
\n";
+ $result .= ''.$categoryName['name']."
\n";
}
$numrows = Database::num_rows($sql_result_courses);
$courses_list_string = '';
@@ -677,8 +663,9 @@ class IndexManager
|| ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
|| ($user_identified && array_key_exists($course['code'], $courses_of_user)
&& $course['visibility'] != COURSE_VISIBILITY_CLOSED)
- || $courses_of_user[$course['code']]['status'] == '1'
- || api_is_platform_admin()) {
+ || $courses_of_user[$course['code']]['status'] == '1'
+ || api_is_platform_admin()
+ ) {
$courses_list_string .= '
';
}
$course_details = array();
@@ -715,24 +702,24 @@ class IndexManager
}
if ($courses_shown > 0) {
// Only display the list of courses and categories if there was more than
- // 0 courses visible to the world (we're in the anonymous list here).
- $result .= $courses_list_string;
+ // 0 courses visible to the world (we're in the anonymous list here).
+ $result .= $courses_list_string;
}
if ($category != '') {
- $result .= ' ' .
- Display :: return_icon('back.png', get_lang('BackToHomePage')).
- get_lang('BackToHomePage') . '
';
+ $result .= ''
+ .Display:: return_icon('back.png', get_lang('BackToHomePage'))
+ .get_lang('BackToHomePage').'
';
}
return $result;
}
/**
- * retrieves all the courses that the user has already subscribed to
- * @author Patrick Cool , Ghent University, Belgium
- * @param int $user_id: the id of the user
- * @return array an array containing all the information of the courses of the given user
- */
+ * retrieves all the courses that the user has already subscribed to
+ * @author Patrick Cool , Ghent University, Belgium
+ * @param int $user_id : the id of the user
+ * @return array an array containing all the information of the courses of the given user
+ */
public function get_courses_of_user($user_id)
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
@@ -776,6 +763,7 @@ class IndexManager
'user_course_category' => $row['user_course_cat']
);
}
+
return $courses;
}
@@ -817,7 +805,7 @@ class IndexManager
if (!empty($title)) {
$html .= ''.$title.'
';
}
- $html.= ''.$content.'
';
+ $html .= ''.$content.'
';
$html = Display::div($html, $params);
}
@@ -864,23 +852,27 @@ class IndexManager
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
$classes = '';
if (!empty($usergroup_list)) {
- foreach($usergroup_list as $group_id) {
+ foreach ($usergroup_list as $group_id) {
$data = $usergroup->get($group_id);
- $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']);
+ $data['name'] = Display::url(
+ $data['name'],
+ api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']
+ );
$classes .= Display::tag('li', $data['name']);
}
}
if (api_is_platform_admin()) {
$classes .= Display::tag(
'li',
- Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
+ Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
);
}
if (!empty($classes)) {
- $classes = Display::tag('ul', $classes, array('class'=>'nav nav-pills nav-stacked'));
+ $classes = Display::tag('ul', $classes, array('class' => 'nav nav-pills nav-stacked'));
$html .= self::show_right_block(get_lang('Classes'), $classes, 'classes_block');
}
}
+
return $html;
}
@@ -895,11 +887,11 @@ class IndexManager
$content = null;
if (api_get_setting('allow_social_tool') == 'true') {
- $content .= '
-
';
+ $content .= '
+
';
} else {
- $content .= '
-
';
+ $content .= '
+
';
}
$html = self::show_right_block(
@@ -951,20 +943,24 @@ class IndexManager
if (api_get_setting('allow_social_tool') == 'true') {
$link = '?f=social';
}
- $profile_content .= ''.
- Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' ';
- $profile_content .= ''.
- Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' ';
+ $profile_content .= ''
+ .Display::return_icon('inbox.png', get_lang('Inbox'))
+ .get_lang('Inbox').$cant_msg.' ';
+ $profile_content .= ''
+ .Display::return_icon('new-message.png', get_lang('Compose'))
+ .get_lang('Compose').' ';
if (api_get_setting('allow_social_tool') == 'true') {
$total_invitations = Display::badge($total_invitations);
- $profile_content .= ''.
- Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'';
+ $profile_content .= ''
+ .Display::return_icon('invitations.png', get_lang('PendingInvitations'))
+ .get_lang('PendingInvitations').$total_invitations.'';
}
if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
- $myFiles = ''.
- Display::return_icon('sn-files.png',get_lang('Files'),null,ICON_SIZE_SMALL).get_lang('MyFiles').'';
+ $myFiles = ''
+ .Display::return_icon('sn-files.png', get_lang('Files'))
+ .get_lang('MyFiles').'';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
@@ -976,14 +972,9 @@ class IndexManager
$editProfileUrl = Display::getProfileEditionLink($user_id);
- $profile_content .= ''.
- Display::return_icon(
- 'edit-profile.png',
- get_lang('EditProfile'),
- null,
- ICON_SIZE_SMALL
- ).
- get_lang('EditProfile').'';
+ $profile_content .= ''
+ .Display::return_icon('edit-profile.png', get_lang('EditProfile'))
+ .get_lang('EditProfile').'';
$profile_content .= '';
$html = self::show_right_block(
@@ -1071,17 +1062,17 @@ class IndexManager
if ($show_create_link) {
$my_account_content .= '';
if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) {
- $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL);
+ $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'));
$my_account_content .= get_lang('CreateCourseRequest');
} else {
- $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL);
+ $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'));
$my_account_content .= get_lang('CourseCreate');
}
$my_account_content .= '';
if (SessionManager::allowToManageSessions()) {
$my_account_content .= '';
- $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL);
+ $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'));
$my_account_content .= get_lang('AddSession');
$my_account_content .= '';
}
@@ -1089,20 +1080,27 @@ class IndexManager
//Sort courses
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
- $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL);
- $my_account_content .= ''.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'';
+ $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'));
+ $my_account_content .= ''.Display::url($img_order.get_lang('SortMyCourses'), $url,
+ array('class' => 'sort course')).'';
// Session history
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
- $my_account_content .= ''.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'';
+ $my_account_content .= ''
+ .Display::return_icon('history-course.png', get_lang('DisplayTrainingList'))
+ .get_lang('DisplayTrainingList').'';
} else {
- $my_account_content .= ''.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'';
+ $my_account_content .= ''
+ .Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'))
+ .get_lang('HistoryTrainingSessions').'';
}
// Course catalog
if ($show_course_link) {
if (!api_is_drh()) {
- $my_account_content .= ''.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'';
+ $my_account_content .= ''
+ .Display::return_icon('catalog-course.png', get_lang('CourseCatalog'))
+ .get_lang('CourseCatalog').'';
} else {
$my_account_content .= ''.get_lang('Dashboard').'';
}
@@ -1304,7 +1302,7 @@ class IndexManager
'id' => $session_id
);
$session_box = Display::get_session_title_box($session_id);
- $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id;
+ $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id;
$coachId = $session_box['id_coach'];
$extraFieldValue = new ExtraFieldValue('session');
$imageField = $extraFieldValue->get_values_by_handler_and_field_variable(
@@ -1315,7 +1313,7 @@ class IndexManager
$params['category_id'] = $session_box['category_id'];
$params['title'] = $session_box['title'];
$params['id_coach'] = $coachId;
- $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId;
+ $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId;
$params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
$params['coach_avatar'] = UserManager::getUserPicture(
$coachId,
@@ -1323,7 +1321,7 @@ class IndexManager
);
$params['date'] = $session_box['dates'];
$params['image'] = isset($imageField['value']) ? $imageField['value'] : null;
- $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null;
+ $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
$params['edit_actions'] = $actions;
$params['show_description'] = $session_box['show_description'];
$params['description'] = $session_box['description'];
@@ -1340,7 +1338,8 @@ class IndexManager
if ($gameModeIsActive) {
$params['stars'] = GamificationUtils::getSessionStars($params['id'], $this->user_id);
- $params['progress'] = GamificationUtils::getSessionProgress($params['id'], $this->user_id);
+ $params['progress'] = GamificationUtils::getSessionProgress($params['id'],
+ $this->user_id);
$params['points'] = GamificationUtils::getSessionPoints($params['id'], $this->user_id);
}
$listSession[] = $params;
@@ -1427,7 +1426,7 @@ class IndexManager
$sessionParams[0]['date'] = $session_box['dates'];
$sessionParams[0]['course_list_session_style'] = $coursesListSessionStyle;
$sessionParams[0]['title'] = $session_box['title'];
- $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
+ $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates'];
$sessionParams[0]['show_actions'] = api_is_platform_admin();
$sessionParams[0]['courses'] = $html_courses_session;
$sessionParams[0]['show_simple_session_info'] = false;
@@ -1476,15 +1475,15 @@ class IndexManager
);
} else {
if (
- !empty($session_category_start_date)
+ !empty($session_category_start_date)
) {
- $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date;
+ $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date;
}
if (
- !empty($session_category_end_date)
+ !empty($session_category_end_date)
) {
- $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date;
+ $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date;
}
}
@@ -1509,7 +1508,7 @@ class IndexManager
$this->tpl->assign('all_courses', $allCoursesInSessions);
$this->tpl->assign('session', $listSession);
- $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
+ $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
$this->tpl->assign('gamification_mode', $gameModeIsActive);
if (api_get_configuration_value('view_grid_courses')) {
@@ -1524,7 +1523,7 @@ class IndexManager
}
return [
- 'html' => $specialCourseList . $sessions_with_category.$sessions_with_no_category.$listCourse,
+ 'html' => $specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse,
'session_count' => $sessionCount,
'course_count' => $courseCount
];
@@ -1658,7 +1657,7 @@ class IndexManager
$htmlCategory .= '';
}
$htmlCategory .= '
';
- $coursesInfo = $listCourse['course'];
+ $coursesInfo = $listCourse['course'];
$htmlCategory .= self::getHtmlForCourse(
$coursesInfo,
@@ -1692,7 +1691,7 @@ class IndexManager
$htmlSessionCategory .= $htmlSession;
}
$htmlSessionCategory .= '
'; // end session cat block
- $htmlCategory .= $htmlSessionCategory .'
' ;
+ $htmlCategory .= $htmlSessionCategory.'';
$htmlCategory .= ''; // end course block
}
$userCategoryHtml .= $htmlCategory;
@@ -1897,16 +1896,20 @@ class IndexManager
if ($listA['userCatTitle'] == $listB['userCatTitle']) {
if ($listA['title'] == $listB['title']) {
return 0;
- } else if($listA['title'] > $listB['title']) {
+ }
+
+ if ($listA['title'] > $listB['title']) {
return 1;
- } else {
- return -1;
}
- } else if ($listA['userCatTitle'] > $listB['userCatTitle']) {
- return 1;
- } else {
+
return -1;
}
+
+ if ($listA['userCatTitle'] > $listB['userCatTitle']) {
+ return 1;
+ }
+
+ return -1;
}
/**
@@ -1918,11 +1921,13 @@ class IndexManager
{
if ($listA['title'] == $listB['title']) {
return 0;
- } else if($listA['title'] > $listB['title']) {
+ }
+
+ if ($listA['title'] > $listB['title']) {
return 1;
- } else {
- return -1;
}
+
+ return -1;
}
/**