fix home welcome

pull/2475/head
Alex Aragón 8 years ago
parent b99aaa338a
commit af344efda7
  1. 7
      app/Resources/public/css/base.css
  2. 2
      app/Resources/public/css/themes/chamilo/default.css
  3. 4
      index.php
  4. 75
      main/inc/lib/userportal.lib.php
  5. 6
      main/template/default/layout/layout_2_col.tpl

@ -5206,7 +5206,7 @@ div#chat-remote-video video {
position: absolute;
bottom: 0px;
right: -10px;
background-color: #9ec6d0a8;
background-color: #fd6600;
color: #fff;
padding: 5px 10px;
font-size: 10px;
@ -5223,7 +5223,7 @@ div#chat-remote-video video {
.grid-courses .items .cribbon{
width: 0;
height: 0;
border-top: 10px solid #337AB7;
border-top: 10px solid #333333;
border-right: 10px solid transparent;
position: absolute;
bottom: -10px;
@ -6526,9 +6526,10 @@ ul#toolnavbox-two li a.btn{
margin-right: 10px;
vertical-align: middle;
}
#homepage-home, .welcome-home-top-temp{
#home-welcome{
display: block;
width: 100%;
margin-bottom: 20px;
}
.label-subscribed{
font-size: 12px;

@ -35,7 +35,7 @@ body {
}
a {
color: #0099FF;
color: #337AB7;
text-decoration: none;
}
a:hover,

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
@ -24,6 +25,7 @@ $header_title = null;
if (!api_is_anonymous()) {
$header_title = ' ';
}
$controller = new IndexManager($header_title);
//Actions
$loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
@ -141,7 +143,7 @@ if (api_get_configuration_value('show_hot_sessions') === true) {
}
$controller->tpl->assign('hot_courses', $hotCourses);
$controller->tpl->assign('announcements_block', $announcements_block);
$controller->tpl->assign('home_page_block', $controller->return_home_page());
$controller->tpl->assign('home_welcome', $controller->return_home_page());
$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
$controller->tpl->assign('notice_block', $controller->return_notice());
//$controller->tpl->assign('main_navigation_block', $controller->return_navigation_links());

@ -87,7 +87,9 @@ class IndexManager
$my_exercise = $exercise_list[0];
$url = Display::url(
$my_exercise['title'],
api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']
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(
@ -228,7 +230,9 @@ class IndexManager
if ($show_create_link) {
$html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'
.Display::return_icon('new-course.png', get_lang('CourseCreate'))
.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate'))
.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang(
'CourseCreate'
))
.'</a></li>';
}
@ -239,7 +243,9 @@ class IndexManager
.get_lang('CourseCatalog')
.'</a></li>';
} else {
$html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
$html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang(
'Dashboard'
).'</a></li>';
}
}
$html .= '</ul>';
@ -270,7 +276,7 @@ class IndexManager
// Including the page for the news
$html = '';
if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) {
$open = @(string) file_get_contents($this->home.$_GET['include']);
$open = @(string)file_get_contents($this->home.$_GET['include']);
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
} else {
// Hiding home top when user not connected.
@ -305,9 +311,9 @@ class IndexManager
}
if (trim($home_top_temp) == '' && api_is_platform_admin()) {
$home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>';
$home_top_temp = get_lang('PortalHomepageDefaultIntroduction');
} else {
$home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>';
$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)));
@ -324,9 +330,9 @@ class IndexManager
$user_selected_language = api_get_interface_language();
$html = '';
// Notice
$home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
$home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
if (empty($home_notice)) {
$home_notice = @(string) file_get_contents($this->home.'home_notice.html');
$home_notice = @(string)file_get_contents($this->home.'home_notice.html');
}
if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
@ -358,7 +364,7 @@ class IndexManager
}
$html = '';
$home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
$home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
if (!empty($home_menu)) {
$home_menu_content = '<ul class="nav nav-pills nav-stacked">';
$home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
@ -568,7 +574,8 @@ class IndexManager
if ($category_has_open_courses) {
// The category contains courses accessible to anonymous visitors.
$htmlListCat .= '<li>';
$htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
$htmlListCat .= '<a href="'.api_get_self(
).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
if (api_get_setting('show_number_of_courses') == 'true') {
$htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
}
@ -577,7 +584,8 @@ class IndexManager
} elseif ($catLine['children_count'] > 0) {
// The category has children, subcategories.
$htmlListCat .= '<li>';
$htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
$htmlListCat .= '<a href="'.api_get_self(
).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
$htmlListCat .= "</li>";
$thereIsSubCat = true;
} elseif (api_get_setting('show_empty_course_categories') == 'true') {
@ -696,7 +704,9 @@ class IndexManager
// 2.
if ($user_identified && !array_key_exists($course['code'], $courses_of_user)) {
if ($course['subscribe'] == '1') {
$courses_list_string .= '&nbsp;<a class="btn btn-primary" href="main/auth/courses.php?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&category_code='.Security::remove_XSS($_GET['category']).'">'.get_lang('Subscribe').'</a><br />';
$courses_list_string .= '&nbsp;<a class="btn btn-primary" href="main/auth/courses.php?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&category_code='.Security::remove_XSS(
$_GET['category']
).'">'.get_lang('Subscribe').'</a><br />';
} else {
$courses_list_string .= '<br />'.get_lang('SubscribingNotAllowed');
}
@ -1302,9 +1312,13 @@ class IndexManager
if (isset($category[0])) {
if ($viewGrid) {
if ($isCertificateAvailable) {
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang('Yes');
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang(
'Yes'
);
} else {
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang('No');
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang(
'No'
);
}
} else {
if ($isCertificateAvailable) {
@ -1577,9 +1591,14 @@ class IndexManager
$course_session['student_info']['certificate'] = null;
if (isset($category[0])) {
if ($category[0]->is_certificate_available($user_id)) {
$course_session['student_info']['certificate'] = Display::label(get_lang('Yes'), 'success');
$course_session['student_info']['certificate'] = Display::label(
get_lang('Yes'),
'success'
);
} else {
$course_session['student_info']['certificate'] = Display::label(get_lang('No'));
$course_session['student_info']['certificate'] = Display::label(
get_lang('No')
);
}
}
}
@ -1603,7 +1622,9 @@ 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(
@ -1614,7 +1635,9 @@ 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,
@ -2248,8 +2271,7 @@ class IndexManager
$userFinished =
$countDependenciesPassed >= $gradeBooksToValidateInDependence &&
$countCoursesPassedNoDependency >= $minToValidate
;
$countCoursesPassedNoDependency >= $minToValidate;
if ($userFinished) {
$badgeList[$id]['finished'] = true;
@ -2365,7 +2387,11 @@ class IndexManager
$button = '';
if ($displayButton) {
$button = '<input id="session-view-button-'.intval($id).'" class="btn btn-default btn-sm" type="button" onclick="hideUnhide(\'courseblock-'.intval($id).'\', \'session-view-button-'.intval($id).'\', \'+\', \'-\')" value="+" />';
$button = '<input id="session-view-button-'.intval(
$id
).'" class="btn btn-default btn-sm" type="button" onclick="hideUnhide(\'courseblock-'.intval(
$id
).'\', \'session-view-button-'.intval($id).'\', \'+\', \'-\')" value="+" />';
}
$icon = Display::return_icon(
@ -2529,7 +2555,9 @@ class IndexManager
*/
private static function filterByCategory($courseList, $categoryCode)
{
return array_filter($courseList, function ($courseInfo) use ($categoryCode) {
return array_filter(
$courseList,
function ($courseInfo) use ($categoryCode) {
if (isset($courseInfo['category_code']) &&
$courseInfo['category_code'] === $categoryCode
) {
@ -2537,6 +2565,7 @@ class IndexManager
}
return false;
});
}
);
}
}

@ -19,9 +19,9 @@
{{ sniff_notification }}
{% if home_page_block %}
<article id="homepage-home">
{{ home_page_block }}
{% if home_welcome %}
<article id="home-welcome">
{{ home_welcome }}
</article>
{% endif %}

Loading…
Cancel
Save