|
|
@ -1,14 +1,18 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controller for pages presentation in general |
|
|
|
* Controller for pages presentation in general |
|
|
|
* @license see /license.txt |
|
|
|
* @license see /license.txt |
|
|
|
* @package chamilo.page.controller |
|
|
|
* @package chamilo.page.controller |
|
|
|
* @author Julio Montoya <gugli100@gmail.com> |
|
|
|
* @author Julio Montoya <gugli100@gmail.com> |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Page controller |
|
|
|
* Page controller |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class PageController { |
|
|
|
class PageController |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an HTML block with the user picture (as a link in a <div>) |
|
|
|
* Returns an HTML block with the user picture (as a link in a <div>) |
|
|
|
* @param int User ID (if not provided, will use the user ID from session) |
|
|
|
* @param int User ID (if not provided, will use the user ID from session) |
|
|
@ -40,9 +44,10 @@ class PageController { |
|
|
|
$profile_content .='<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].'></a>'; |
|
|
|
$profile_content .='<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].'></a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$html = self::show_right_block(null, $profile_content, 'user_image_block', array('style' => 'text-align:center;')); |
|
|
|
|
|
|
|
return $html; |
|
|
|
self::show_right_block(null, null, 'user_image_block', array('content' => $profile_content)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return a block with course-related links. The resulting HTML block's |
|
|
|
* Return a block with course-related links. The resulting HTML block's |
|
|
|
* contents are only based on the user defined by the active session. |
|
|
|
* contents are only based on the user defined by the active session. |
|
|
@ -50,8 +55,6 @@ class PageController { |
|
|
|
* @assert () != '' |
|
|
|
* @assert () != '' |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function return_course_block() { |
|
|
|
static function return_course_block() { |
|
|
|
$html = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$show_create_link = false; |
|
|
|
$show_create_link = false; |
|
|
|
$show_course_link = false; |
|
|
|
$show_course_link = false; |
|
|
|
|
|
|
|
|
|
|
@ -75,39 +78,33 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// My account section |
|
|
|
// My account section |
|
|
|
$my_account_content = '<ul class="nav nav-list">'; |
|
|
|
$my_account_content = array(); |
|
|
|
|
|
|
|
|
|
|
|
if ($show_create_link) { |
|
|
|
if ($show_create_link) { |
|
|
|
$my_account_content .= '<li><a href="main/create_course/add_course.php" class="add course">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
|
|
$my_account_content[] = array('href' => 'main/create_course/add_course.php', 'title' => api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Sort courses |
|
|
|
//Sort courses |
|
|
|
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses'; |
|
|
|
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses'; |
|
|
|
$my_account_content .= '<li>'.Display::url(get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>'; |
|
|
|
$my_account_content[] = array('href' => $url, 'title' => get_lang('SortMyCourses')); |
|
|
|
|
|
|
|
|
|
|
|
//Course management |
|
|
|
//Course management |
|
|
|
if ($show_course_link) { |
|
|
|
if ($show_course_link) { |
|
|
|
if (!api_is_drh()) { |
|
|
|
if (!api_is_drh()) { |
|
|
|
$my_account_content .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseCatalog').'</a></li>'; |
|
|
|
$my_account_content[] = array('href' => 'main/auth/courses.php', 'title' => get_lang('CourseCatalog')); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['history']) && intval($_GET['history']) == 1) { |
|
|
|
if (isset($_GET['history']) && intval($_GET['history']) == 1) { |
|
|
|
$my_account_content .= '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>'; |
|
|
|
$my_account_content [] = array('href' => 'user_portal.php', 'title' => get_lang('DisplayTrainingList')); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$my_account_content .= '<li><a href="user_portal.php?history=1" class="history course">'.get_lang('HistoryTrainingSessions').'</a></li>'; |
|
|
|
$my_account_content [] = array('href' => 'user_portal.php?history=1', 'title' => get_lang('HistoryTrainingSessions')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
|
|
$my_account_content .= array('href' => 'main/dashboard/index.php', 'title' => get_lang('Dashboard')); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
self::show_right_block(get_lang('Courses'), $my_account_content, 'course_block'); |
|
|
|
$my_account_content .= '</ul>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($my_account_content)) { |
|
|
|
|
|
|
|
$html = self::show_right_block(get_lang('Courses'), $my_account_content, 'course_block'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the profile block, showing links to the messaging and social |
|
|
|
* Returns the profile block, showing links to the messaging and social |
|
|
|
* network tools. The user ID is taken from the active session |
|
|
|
* network tools. The user ID is taken from the active session |
|
|
@ -120,8 +117,7 @@ class PageController { |
|
|
|
if (empty($user_id)) { |
|
|
|
if (empty($user_id)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$profile_content = array(); |
|
|
|
$profile_content = '<ul class="nav nav-list">'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @todo Add a platform setting to add the user image. |
|
|
|
// @todo Add a platform setting to add the user image. |
|
|
|
if (api_get_setting('allow_message_tool') == 'true') { |
|
|
|
if (api_get_setting('allow_message_tool') == 'true') { |
|
|
@ -142,19 +138,18 @@ class PageController { |
|
|
|
if (api_get_setting('allow_social_tool') == 'true') { |
|
|
|
if (api_get_setting('allow_social_tool') == 'true') { |
|
|
|
$link = '?f=social'; |
|
|
|
$link = '?f=social'; |
|
|
|
} |
|
|
|
} |
|
|
|
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>'; |
|
|
|
$profile_content[] = array('href' => api_get_path(WEB_PATH).'main/messages/inbox.php'.$link, 'title' => get_lang('Inbox').$cant_msg); |
|
|
|
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>'; |
|
|
|
$profile_content[] = array('href' => api_get_path(WEB_PATH).'main/messages/new_message.php'.$link, 'title' => get_lang('Compose')); |
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('allow_social_tool') == 'true') { |
|
|
|
if (api_get_setting('allow_social_tool') == 'true') { |
|
|
|
$total_invitations = Display::badge($total_invitations); |
|
|
|
$total_invitations = Display::badge($total_invitations); |
|
|
|
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>'; |
|
|
|
$profile_content[] = array('href' => api_get_path(WEB_PATH).'main/social/invitations.php', 'title' => get_lang('PendingInvitations').$total_invitations); |
|
|
|
} |
|
|
|
} |
|
|
|
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></li>'; |
|
|
|
$profile_content[] = array('href' => api_get_path(WEB_PATH).'main/auth/profile.php', 'title' => get_lang('PendingInvitations').$total_invitations); |
|
|
|
} |
|
|
|
} |
|
|
|
$profile_content .= '</ul>'; |
|
|
|
self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block'); |
|
|
|
$html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block'); |
|
|
|
|
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns a list of the most popular courses of the moment (also called |
|
|
|
* Returns a list of the most popular courses of the moment (also called |
|
|
|
* "hot courses"). |
|
|
|
* "hot courses"). |
|
|
@ -165,6 +160,7 @@ class PageController { |
|
|
|
static function return_hot_courses() { |
|
|
|
static function return_hot_courses() { |
|
|
|
return CourseManager::return_hot_courses(); |
|
|
|
return CourseManager::return_hot_courses(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an online help block read from the home/home_menu_[lang].html |
|
|
|
* Returns an online help block read from the home/home_menu_[lang].html |
|
|
|
* file |
|
|
|
* file |
|
|
@ -177,43 +173,35 @@ class PageController { |
|
|
|
$sys_path = api_get_path(SYS_PATH); |
|
|
|
$sys_path = api_get_path(SYS_PATH); |
|
|
|
$platformLanguage = api_get_setting('platformLanguage'); |
|
|
|
$platformLanguage = api_get_setting('platformLanguage'); |
|
|
|
|
|
|
|
|
|
|
|
// Help section. |
|
|
|
|
|
|
|
/* Hide right menu "general" and other parts on anonymous right menu. */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($user_selected_language)) { |
|
|
|
if (!isset($user_selected_language)) { |
|
|
|
$user_selected_language = $platformLanguage; |
|
|
|
$user_selected_language = $platformLanguage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$html = null; |
|
|
|
$html = null; |
|
|
|
$home_menu = @(string)file_get_contents($sys_path.$home.'home_menu_'.$user_selected_language.'.html'); |
|
|
|
$home_menu = @(string) file_get_contents($sys_path.$home.'home_menu_'.$user_selected_language.'.html'); |
|
|
|
if (!empty($home_menu)) { |
|
|
|
if (!empty($home_menu)) { |
|
|
|
$home_menu_content = '<ul class="nav nav-list">'; |
|
|
|
$home_menu_content = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); |
|
|
|
$home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); |
|
|
|
self::show_right_block(get_lang('MenuGeneral'), null, 'help_block', array('content' => $home_menu_content)); |
|
|
|
$home_menu_content .= '</ul>'; |
|
|
|
|
|
|
|
$html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an HTML block with links to the skills tools |
|
|
|
* Returns an HTML block with links to the skills tools |
|
|
|
* @return string HTML <div> block |
|
|
|
* @return string HTML <div> block |
|
|
|
* @assert () != '' |
|
|
|
* @assert () != '' |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function return_skills_links() { |
|
|
|
static function return_skills_links() { |
|
|
|
$html = ''; |
|
|
|
|
|
|
|
if (api_get_setting('allow_skills_tool') == 'true') { |
|
|
|
if (api_get_setting('allow_skills_tool') == 'true') { |
|
|
|
$content = '<ul class="nav nav-list">'; |
|
|
|
$content = array(); |
|
|
|
|
|
|
|
$content[]= array('title' => get_lang('MySkills'), 'href' => api_get_path(WEB_CODE_PATH).'social/skills_wheel.php'); |
|
|
|
$content .= Display::tag('li', Display::url(get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/skills_wheel.php')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('allow_hr_skills_management') == 'true' || api_is_platform_admin()) { |
|
|
|
if (api_get_setting('allow_hr_skills_management') == 'true' || api_is_platform_admin()) { |
|
|
|
$content .= Display::tag('li', Display::url(get_lang('ManageSkills'), api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php')); |
|
|
|
$content[]= array('title' => get_lang('ManageSkills'), 'href' => api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'); |
|
|
|
} |
|
|
|
} |
|
|
|
$content .= '</ul>'; |
|
|
|
self::show_right_block(get_lang("Skills"), $content, 'skill_block'); |
|
|
|
$html = self::show_right_block(get_lang("Skills"), $content, 'skill_block'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an HTML block with the notice, as found in the |
|
|
|
* Returns an HTML block with the notice, as found in the |
|
|
|
* home/home_notice_[lang].html file |
|
|
|
* home/home_notice_[lang].html file |
|
|
@ -227,17 +215,16 @@ class PageController { |
|
|
|
|
|
|
|
|
|
|
|
$html = ''; |
|
|
|
$html = ''; |
|
|
|
// Notice |
|
|
|
// Notice |
|
|
|
$home_notice = @(string)file_get_contents($sys_path.$home.'home_notice_'.$user_selected_language.'.html'); |
|
|
|
$home_notice = @(string) file_get_contents($sys_path.$home.'home_notice_'.$user_selected_language.'.html'); |
|
|
|
if (empty($home_notice)) { |
|
|
|
if (empty($home_notice)) { |
|
|
|
$home_notice = @(string)file_get_contents($sys_path.$home.'home_notice.html'); |
|
|
|
$home_notice = @(string) file_get_contents($sys_path.$home.'home_notice.html'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($home_notice)) { |
|
|
|
if (!empty($home_notice)) { |
|
|
|
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice))); |
|
|
|
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice))); |
|
|
|
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice')); |
|
|
|
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice')); |
|
|
|
$html = self::show_right_block(get_lang('Notice'), $home_notice, 'notice_block'); |
|
|
|
self::show_right_block(get_lang('Notice'), null, 'notice_block', array('content' => $home_notice)); |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -251,18 +238,19 @@ class PageController { |
|
|
|
* @assert ('a','') != '' |
|
|
|
* @assert ('a','') != '' |
|
|
|
* @todo use the template system |
|
|
|
* @todo use the template system |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function show_right_block($title, $content, $id = null, $params = null) { |
|
|
|
static function show_right_block($title, $content, $id, $params = null) { |
|
|
|
|
|
|
|
//@todo do not use global |
|
|
|
|
|
|
|
global $app; |
|
|
|
if (!empty($id)) { |
|
|
|
if (!empty($id)) { |
|
|
|
$params['id'] = $id; |
|
|
|
$params['id'] = $id; |
|
|
|
} |
|
|
|
} |
|
|
|
$params['class'] = 'well sidebar-nav'; |
|
|
|
$block_menu = array( |
|
|
|
$html = null; |
|
|
|
'id' => $params['id'], |
|
|
|
if (!empty($title)) { |
|
|
|
'title' => $title, |
|
|
|
$html.= '<h4>'.$title.'</h4>'; |
|
|
|
'elements' => $content, |
|
|
|
} |
|
|
|
'content' => isset($params['content']) ? $params['content'] : null |
|
|
|
$html.= $content; |
|
|
|
); |
|
|
|
$html = Display::div($html, $params); |
|
|
|
$app['template']->assign($id, $block_menu); |
|
|
|
return $html; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -272,13 +260,13 @@ class PageController { |
|
|
|
* @version 1.1 |
|
|
|
* @version 1.1 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function display_login_form() { |
|
|
|
static function display_login_form() { |
|
|
|
$form = new FormValidator('formLogin', 'POST', null, null, array('class'=>'form-vertical')); |
|
|
|
$form = new FormValidator('formLogin', 'POST', null, null, array('class' => 'form-vertical')); |
|
|
|
// 'placeholder'=>get_lang('UserName') |
|
|
|
// 'placeholder'=>get_lang('UserName') |
|
|
|
//'autocomplete'=>"off", |
|
|
|
//'autocomplete'=>"off", |
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('text', 'login', get_lang('UserName'), array('class' => 'span2 autocapitalize_off', 'autofocus' => 'autofocus')); |
|
|
|
$form->addElement('text', 'login', get_lang('UserName'), array('class' => 'span2 autocapitalize_off', 'autofocus' => 'autofocus')); |
|
|
|
$form->addElement('password', 'password', get_lang('Pass'), array('class' => 'span2')); |
|
|
|
$form->addElement('password', 'password', get_lang('Pass'), array('class' => 'span2')); |
|
|
|
$form->addElement('style_submit_button','submitAuth', get_lang('LoginEnter'), array('class' => 'btn')); |
|
|
|
$form->addElement('style_submit_button', 'submitAuth', get_lang('LoginEnter'), array('class' => 'btn')); |
|
|
|
$html = $form->return_form(); |
|
|
|
$html = $form->return_form(); |
|
|
|
if (api_get_setting('openid_authentication') == 'true') { |
|
|
|
if (api_get_setting('openid_authentication') == 'true') { |
|
|
|
include_once 'main/auth/openid/login.php'; |
|
|
|
include_once 'main/auth/openid/login.php'; |
|
|
@ -286,6 +274,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns a content search form in an HTML <div>, pointing at the |
|
|
|
* Returns a content search form in an HTML <div>, pointing at the |
|
|
|
* main/search/ directory. If search_enabled is not set, then it returns |
|
|
|
* main/search/ directory. If search_enabled is not set, then it returns |
|
|
@ -307,6 +296,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns a list of announcements |
|
|
|
* Returns a list of announcements |
|
|
|
* @param int User ID |
|
|
|
* @param int User ID |
|
|
@ -335,6 +325,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
return $announcements; |
|
|
|
return $announcements; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the homepage, including announcements |
|
|
|
* Return the homepage, including announcements |
|
|
|
* @return string The portal's homepage as an HTML string |
|
|
|
* @return string The portal's homepage as an HTML string |
|
|
@ -347,7 +338,7 @@ class PageController { |
|
|
|
$home_top_temp = null; |
|
|
|
$home_top_temp = null; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { |
|
|
|
if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { |
|
|
|
$open = @(string)file_get_contents(api_get_path(SYS_PATH).$home.$_GET['include']); |
|
|
|
$open = @(string) file_get_contents(api_get_path(SYS_PATH).$home.$_GET['include']); |
|
|
|
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
|
|
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!empty($_SESSION['user_language_choice'])) { |
|
|
|
if (!empty($_SESSION['user_language_choice'])) { |
|
|
@ -384,6 +375,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the reservation block (if the reservation tool is enabled) |
|
|
|
* Returns the reservation block (if the reservation tool is enabled) |
|
|
|
* @return string HTML block, or empty string if reservation tool is disabled |
|
|
|
* @return string HTML block, or empty string if reservation tool is disabled |
|
|
@ -399,6 +391,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns an HTML block with classes (if show_groups_to_users is true) |
|
|
|
* Returns an HTML block with classes (if show_groups_to_users is true) |
|
|
|
* @return string A list of links to users classes tools, or an empty string if show_groups_to_users is disabled |
|
|
|
* @return string A list of links to users classes tools, or an empty string if show_groups_to_users is disabled |
|
|
@ -412,22 +405,23 @@ class PageController { |
|
|
|
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); |
|
|
|
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); |
|
|
|
$classes = ''; |
|
|
|
$classes = ''; |
|
|
|
if (!empty($usergroup_list)) { |
|
|
|
if (!empty($usergroup_list)) { |
|
|
|
foreach($usergroup_list as $group_id) { |
|
|
|
foreach ($usergroup_list as $group_id) { |
|
|
|
$data = $usergroup->get($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']); |
|
|
|
$classes .= Display::tag('li', $data['name']); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (api_is_platform_admin()) { |
|
|
|
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')); |
|
|
|
$classes .= Display::tag('li', Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!empty($classes)) { |
|
|
|
if (!empty($classes)) { |
|
|
|
$classes = Display::tag('ul', $classes, array('class'=>'nav nav-list')); |
|
|
|
$classes = Display::tag('ul', $classes, array('class' => 'nav nav-list')); |
|
|
|
$html .= self::show_right_block(get_lang('Classes'), $classes, 'classes_block'); |
|
|
|
$html .= self::show_right_block(get_lang('Classes'), $classes, 'classes_block'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepares a block with all the pending exercises in all courses |
|
|
|
* Prepares a block with all the pending exercises in all courses |
|
|
|
* @param array Array of courses (arrays) of the user |
|
|
|
* @param array Array of courses (arrays) of the user |
|
|
@ -438,13 +432,13 @@ class PageController { |
|
|
|
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; |
|
|
|
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; |
|
|
|
$exercise_list = array(); |
|
|
|
$exercise_list = array(); |
|
|
|
if (!empty($personal_course_list)) { |
|
|
|
if (!empty($personal_course_list)) { |
|
|
|
foreach($personal_course_list as $course_item) { |
|
|
|
foreach ($personal_course_list as $course_item) { |
|
|
|
$course_code = $course_item['c']; |
|
|
|
$course_code = $course_item['c']; |
|
|
|
$session_id = $course_item['id_session']; |
|
|
|
$session_id = $course_item['id_session']; |
|
|
|
|
|
|
|
|
|
|
|
$exercises = get_exercises_to_be_taken($course_code, $session_id); |
|
|
|
$exercises = get_exercises_to_be_taken($course_code, $session_id); |
|
|
|
|
|
|
|
|
|
|
|
foreach($exercises as $exercise_item) { |
|
|
|
foreach ($exercises as $exercise_item) { |
|
|
|
$exercise_item['course_code'] = $course_code; |
|
|
|
$exercise_item['course_code'] = $course_code; |
|
|
|
$exercise_item['session_id'] = $session_id; |
|
|
|
$exercise_item['session_id'] = $session_id; |
|
|
|
$exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
|
|
$exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
|
@ -461,6 +455,7 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns links to teachers tools (create course, etc) based on the user |
|
|
|
* Returns links to teachers tools (create course, etc) based on the user |
|
|
|
* in the active session |
|
|
|
* in the active session |
|
|
@ -496,27 +491,21 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// My Account section |
|
|
|
// My Account section |
|
|
|
|
|
|
|
$elements = array(); |
|
|
|
if ($show_menu) { |
|
|
|
if ($show_menu) { |
|
|
|
$html .= '<ul class="nav nav-list">'; |
|
|
|
|
|
|
|
if ($show_create_link) { |
|
|
|
if ($show_create_link) { |
|
|
|
$html .= '<li><a href="main/create_course/add_course.php" class="add course">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
|
|
$elements[] = array('href' => 'main/create_course/add_course.php', 'title' => (api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate'))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($show_course_link) { |
|
|
|
if ($show_course_link) { |
|
|
|
if (!api_is_drh() && !api_is_session_admin()) { |
|
|
|
if (!api_is_drh() && !api_is_session_admin()) { |
|
|
|
$html .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseCatalog').'</a></li>'; |
|
|
|
$elements[] = array('href' => 'main/auth/courses.php', 'title' => get_lang('CourseCatalog')); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$html .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
|
|
$elements[] = array('href' => 'main/dashboard/index.php', 'title' => get_lang('Dashboard')); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
$html .= '</ul>'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($html)) { |
|
|
|
|
|
|
|
$html = self::show_right_block(get_lang('Courses'), $html, 'teacher_block'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return $html; |
|
|
|
self::show_right_block(get_lang('Courses'), $elements, 'teacher_block'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -586,7 +575,7 @@ class PageController { |
|
|
|
FROM $main_category_table t1 |
|
|
|
FROM $main_category_table t1 |
|
|
|
LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id |
|
|
|
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) |
|
|
|
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"; |
|
|
|
GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -631,8 +620,7 @@ class PageController { |
|
|
|
$htmlListCat .= "</li>"; |
|
|
|
$htmlListCat .= "</li>"; |
|
|
|
$thereIsSubCat = true; |
|
|
|
$thereIsSubCat = true; |
|
|
|
} |
|
|
|
} |
|
|
|
/* End changed code to eliminate the (0 courses) after empty categories. */ |
|
|
|
/* End changed code to eliminate the (0 courses) after empty categories. */ elseif (api_get_setting('show_empty_course_categories') == 'true') { |
|
|
|
elseif (api_get_setting('show_empty_course_categories') == 'true') { |
|
|
|
|
|
|
|
$htmlListCat .= '<li>'; |
|
|
|
$htmlListCat .= '<li>'; |
|
|
|
$htmlListCat .= $catLine['name']; |
|
|
|
$htmlListCat .= $catLine['name']; |
|
|
|
$htmlListCat .= "</li>"; |
|
|
|
$htmlListCat .= "</li>"; |
|
|
@ -661,7 +649,7 @@ class PageController { |
|
|
|
$result .= $htmlListCat; |
|
|
|
$result .= $htmlListCat; |
|
|
|
} |
|
|
|
} |
|
|
|
while ($categoryName = Database::fetch_array($resCats)) { |
|
|
|
while ($categoryName = Database::fetch_array($resCats)) { |
|
|
|
$result .= '<h3>' . $categoryName['name'] . "</h3>\n"; |
|
|
|
$result .= '<h3>'.$categoryName['name']."</h3>\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
$numrows = Database::num_rows($sql_result_courses); |
|
|
|
$numrows = Database::num_rows($sql_result_courses); |
|
|
|
$courses_list_string = ''; |
|
|
|
$courses_list_string = ''; |
|
|
@ -681,7 +669,7 @@ class PageController { |
|
|
|
// If we do not show the closed courses |
|
|
|
// If we do not show the closed courses |
|
|
|
// we only show the courses that are open to the world (to everybody) |
|
|
|
// we only show the courses that are open to the world (to everybody) |
|
|
|
// and the courses that are open to the platform (if the current user is a registered user. |
|
|
|
// and the courses that are open to the platform (if the current user is a registered user. |
|
|
|
if( ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM) || ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD)) { |
|
|
|
if (($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM) || ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD)) { |
|
|
|
$courses_shown++; |
|
|
|
$courses_shown++; |
|
|
|
$courses_list_string .= "<li>\n"; |
|
|
|
$courses_list_string .= "<li>\n"; |
|
|
|
$courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">'.$course['title'].'</a><br />'; |
|
|
|
$courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">'.$course['title'].'</a><br />'; |
|
|
@ -766,7 +754,7 @@ class PageController { |
|
|
|
$result .= $courses_list_string; |
|
|
|
$result .= $courses_list_string; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($category != '') { |
|
|
|
if ($category != '') { |
|
|
|
$result .= '<p><a href="'.api_get_self().'"> ' . Display :: return_icon('back.png', get_lang('BackToHomePage')) . get_lang('BackToHomePage') . '</a></p>'; |
|
|
|
$result .= '<p><a href="'.api_get_self().'"> '.Display :: return_icon('back.png', get_lang('BackToHomePage')).get_lang('BackToHomePage').'</a></p>'; |
|
|
|
} |
|
|
|
} |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
@ -858,7 +846,7 @@ class PageController { |
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { |
|
|
|
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { |
|
|
|
//session name with link |
|
|
|
//session name with link |
|
|
|
$session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)); |
|
|
|
$session_link = Display::tag('a', $session['session_name'], array('href' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)); |
|
|
|
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id; |
|
|
|
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -883,7 +871,6 @@ class PageController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// All sessions included in |
|
|
|
// All sessions included in |
|
|
|
$count_courses_session = 0; |
|
|
|
$count_courses_session = 0; |
|
|
@ -915,7 +902,7 @@ class PageController { |
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { |
|
|
|
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { |
|
|
|
//session name with link |
|
|
|
//session name with link |
|
|
|
$session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)); |
|
|
|
$session_link = Display::tag('a', $session['session_name'], array('href' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)); |
|
|
|
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id; |
|
|
|
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -952,7 +939,7 @@ class PageController { |
|
|
|
$session_category_start_date = $session_category['session_category']['date_start']; |
|
|
|
$session_category_start_date = $session_category['session_category']['date_start']; |
|
|
|
$session_category_end_date = $session_category['session_category']['date_end']; |
|
|
|
$session_category_end_date = $session_category['session_category']['date_end']; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00' && !empty($session_category_end_date) && $session_category_end_date != '0000-00-00' ) { |
|
|
|
if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00' && !empty($session_category_end_date) && $session_category_end_date != '0000-00-00') { |
|
|
|
$params['subtitle'] = sprintf(get_lang('FromDateXToDateY'), $session_category['session_category']['date_start'], $session_category['session_category']['date_end']); |
|
|
|
$params['subtitle'] = sprintf(get_lang('FromDateXToDateY'), $session_category['session_category']['date_start'], $session_category['session_category']['date_end']); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00') { |
|
|
|
if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00') { |
|
|
@ -978,7 +965,9 @@ class PageController { |
|
|
|
* @assert () === false |
|
|
|
* @assert () === false |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function return_welcome_to_course_block($tpl) { |
|
|
|
static function return_welcome_to_course_block($tpl) { |
|
|
|
if (empty($tpl)) { return false; } |
|
|
|
if (empty($tpl)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
$count_courses = CourseManager::count_courses(); |
|
|
|
$count_courses = CourseManager::count_courses(); |
|
|
|
|
|
|
|
|
|
|
|
$course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
|
|
|
$course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
|
|
@ -992,7 +981,7 @@ class PageController { |
|
|
|
$tpl->assign('welcome_to_course_block', 1); |
|
|
|
$tpl->assign('welcome_to_course_block', 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*function run() { |
|
|
|
/* function run() { |
|
|
|
$app = $this->app; |
|
|
|
$app = $this->app; |
|
|
|
$app->get('/', function() use ($app) { |
|
|
|
$app->get('/', function() use ($app) { |
|
|
|
$data = $this->app['twig']->render($app['template_style'].'/'.$app['default_template']); |
|
|
|
$data = $this->app['twig']->render($app['template_style'].'/'.$app['default_template']); |
|
|
@ -1004,5 +993,5 @@ class PageController { |
|
|
|
//Using http cache |
|
|
|
//Using http cache |
|
|
|
$app['http_cache']->run(); |
|
|
|
$app['http_cache']->run(); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} */ |
|
|
|
} |
|
|
|
} |
|
|
|