Add $_configuration['user_portal_tpl'] tpl see BT#11017

ofaj
jmontoyaa 9 years ago
parent 57747782b9
commit 75344b9529
  1. 46
      main/inc/lib/userportal.lib.php
  2. 2
      main/install/configuration.dist.php
  3. 3
      main/template/default/user_portal/index.tpl
  4. 5
      main/template/default/user_portal/index_grid.tpl
  5. 130
      main/template/default/user_portal/session.tpl
  6. 14
      user_portal.php

@ -1045,6 +1045,7 @@ class IndexManager
$sessionCount = 0;
$courseCount = 0;
$items = [];
// If we're not in the history view...
if (!isset($_GET['history'])) {
// Display special courses.
@ -1059,6 +1060,7 @@ class IndexManager
$this->load_directories_preview
);
$courses_html .= $courses['html'];
$items = $courses['items'];
$courseCount = $specialCourses['course_count'] + $courses['course_count'];
}
@ -1203,10 +1205,12 @@ class IndexManager
$this->tpl->assign('session', $params);
$this->tpl->assign('gamification_mode', $gamificationModeIsActive);
$sessions_with_no_category .= $this->tpl->fetch(
$item = $this->tpl->fetch(
$this->tpl->get_template('/user_portal/session.tpl')
);
$sessions_with_no_category .= $item;
$items[] = $item;
$sessionCount++;
}
}
@ -1288,9 +1292,7 @@ class IndexManager
$sessionParams['id'] = $session_id;
$sessionParams['show_link_to_session'] = !api_is_drh() && $sessionTitleLink;
$sessionParams['title'] = $session_box['title'];
$sessionParams['subtitle'] = (!empty($session_box['coach'])
? $session_box['coach'] . ' | '
: '') . $session_box['dates'];
$sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
$sessionParams['show_actions'] = api_is_platform_admin();
$sessionParams['courses'] = $html_courses_session;
$sessionParams['show_simple_session_info'] = false;
@ -1303,10 +1305,14 @@ class IndexManager
}
$this->tpl->assign('session', $sessionParams);
$html_sessions .= $this->tpl->fetch(
$item = $this->tpl->fetch(
$this->tpl->get_template('user_portal/session.tpl')
);
$html_sessions .= $item;
$items[] = $item;
$sessionCount++;
}
}
@ -1352,16 +1358,19 @@ class IndexManager
}
$this->tpl->assign('session_category', $categoryParams);
$sessions_with_category .= $this->tpl->fetch(
"{$this->tpl->templateFolder}/user_portal/session_category.tpl"
);
$item = $this->tpl->fetch("{$this->tpl->templateFolder}/user_portal/session_category.tpl");
$sessions_with_category .= $item;
$items[] = $item;
}
}
}
}
$items = array_reverse($items);
return [
'html' => $sessions_with_category.$sessions_with_no_category.$courses_html.$special_courses,
'items' => $items,
'session_count' => $sessionCount,
'course_count' => $courseCount
];
@ -1421,7 +1430,7 @@ class IndexManager
if ($load_history) {
$html .= Display::page_subheader(get_lang('HistoryTrainingSession'));
if (empty($session_categories)) {
$html .= get_lang('YouDoNotHaveAnySessionInItsHistory');
$html .= get_lang('YouDoNotHaveAnySessionInItsHistory');
}
}
@ -1473,7 +1482,7 @@ class IndexManager
$listUserCategories[0] = '';
$html = '<div class="session-view-block">';
$items = [];
foreach ($listUserCategories as $userCategoryId => $userCatTitle) {
// add user category
$userCategoryHtml = '';
@ -1529,7 +1538,7 @@ class IndexManager
}
$htmlSessionCategory .= '</div>'; // end session cat block
$htmlCategory .= $htmlSessionCategory .'</div>' ;
$htmlCategory .= ''; // end course block
$items[] = $htmlSessionCategory;
}
$userCategoryHtml .= $htmlCategory;
}
@ -1538,32 +1547,35 @@ class IndexManager
// if course not already added
$htmlCategory = '';
foreach ($listCoursesInfo as $i => $listCourse) {
$item = '';
if ($listCourse['userCatId'] == $userCategoryId && !isset($listCoursesAlreadyDisplayed[$listCourse['id']])) {
if ($userCategoryId != 0) {
$htmlCategory .= '<div class="session-view-row" >';
$item .= '<div class="session-view-row" >';
} else {
$htmlCategory .= '<div class="session-view-well well">';
$item .= '<div class="session-view-well well">';
}
$htmlCategory .= self::getHtmlForCourse(
$item .= self::getHtmlForCourse(
$listCourse['course'],
$userCategoryId,
0,
$loadDirs
);
$htmlCategory .= '</div>';
$item .= '</div>';
$htmlCategory .= $item;
$items[] = $item;
}
}
$htmlCategory .= '';
$userCategoryHtml .= $htmlCategory; // end user cat block
if ($userCategoryId != 0) {
$userCategoryHtml .= '</div>';
}
$html .= $userCategoryHtml; //
$html .= $userCategoryHtml;
}
$html .= '</div>';
return [
'html' => $html.$specialCourses,
'items' => $items,
'session_count' => $sessionCount,
'course_count' => $courseCount
];

@ -238,3 +238,5 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['messaging_gdc_project_number'] = '';
//Api Key in the Google Developer Console
//$_configuration['messaging_gdc_api_key'] = '';
// Userportal template located in main/template/default/layout/user_portal
//$_configuration['user_portal_tpl'] = 'index_grid.tpl';

@ -0,0 +1,3 @@
{% for item in items %}
{{ item }}
{% endfor %}

@ -0,0 +1,5 @@
{% for item in items %}
<div class="well">
{{ item }}
</div>
{% endfor %}

@ -21,83 +21,83 @@
{% endif %}
<div class="sessions panel-body">
{% if session.show_simple_session_info %}
<div class="row">
<div class="col-md-7">
<h3>
{{ session.title ~ session.notifications }}
</h3>
{% if session.show_simple_session_info %}
<div class="row">
<div class="col-md-7">
<h3>
{{ session.title ~ session.notifications }}
</h3>
{% if session.show_description %}
<div>
{{ session.description }}
</div>
{% endif %}
{% if session.show_description %}
<div>
{{ session.description }}
</div>
{% endif %}
{% if session.subtitle %}
<small>{{ session.subtitle }}</small>
{% endif %}
{% if session.subtitle %}
<small>{{ session.subtitle }}</small>
{% endif %}
{% if session.teachers %}
<h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.teachers }}</h5>
{% endif %}
{% if session.teachers %}
<h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.teachers }}</h5>
{% endif %}
{% if session.coaches %}
<h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.coaches }}</h5>
{% endif %}
</div>
{% if session.coaches %}
<h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.coaches }}</h5>
{% endif %}
</div>
{% if session.show_actions %}
<div class="col-md-5 text-right">
<a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}">
<img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}">
</a>
{% if session.show_actions %}
<div class="col-md-5 text-right">
<a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}">
<img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}">
</a>
</div>
{% endif %}
</div>
{% else %}
<div class="row">
<div class="col-md-12">
{% if session.subtitle %}
<div class="subtitle-session">
<em class="fa fa-clock-o"></em> {{ session.subtitle }}
</div>
{% endif %}
</div>
{% else %}
<div class="row">
<div class="col-md-12">
{% if session.subtitle %}
<div class="subtitle-session">
<em class="fa fa-clock-o"></em> {{ session.subtitle }}
</div>
{% endif %}
{% if session.show_description %}
<div class="description-session">
{{ session.description }}
</div>
{% endif %}
<div class="sessions-items">
{% for item in session.courses %}
<div class="row">
<div class="col-md-2">
{% if item.link %}
<a href="{{ item.link }}" class="thumbnail">{{ item.icon }}</a>
{% else %}
{{ item.icon }}
{% endif %}
</div>
<div class="col-md-10">
{{ item.title }}
{% if session.show_description %}
<div class="description-session">
{{ session.description }}
</div>
{% endif %}
<div class="sessions-items">
{% for item in session.courses %}
<div class="row">
<div class="col-md-2">
{% if item.link %}
<a href="{{ item.link }}" class="thumbnail">{{ item.icon }}</a>
{% else %}
{{ item.icon }}
{% endif %}
</div>
<div class="col-md-10">
{{ item.title }}
{% if item.coaches|length > 0 %}
<img src="{{ 'teacher.png'|icon(16) }}" width="16" height="16">
{% if item.coaches|length > 0 %}
<img src="{{ 'teacher.png'|icon(16) }}" width="16" height="16">
{% for coach in item.coaches %}
{{ loop.index > 1 ? ' | ' }}
{% for coach in item.coaches %}
{{ loop.index > 1 ? ' | ' }}
<a href="{{ _p.web_ajax ~ 'user_manager.ajax.php?' ~ {'a': 'get_user_popup', 'user_id': coach.user_id}|url_encode() }}" data-title="{{ coach.full_name }}" class="ajax">
{{ coach.full_name }}
</a>
{% endfor %}
{% endif %}
</div>
<a href="{{ _p.web_ajax ~ 'user_manager.ajax.php?' ~ {'a': 'get_user_popup', 'user_id': coach.user_id}|url_encode() }}" data-title="{{ coach.full_name }}" class="ajax">
{{ coach.full_name }}
</a>
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>

@ -185,13 +185,21 @@ if (api_get_setting('go_to_course_after_login') == 'true') {
}
}
//Show the chamilo mascot
// Show the chamilo mascot
if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
$controller->tpl->assign('welcome_to_course_block', $controller->return_welcome_to_course_block());
}
$controller->tpl->assign('content', $courseAndSessions['html']);
$template = api_get_configuration_value('user_portal_tpl');
if (empty($template)) {
$controller->tpl->assign('content', $courseAndSessions['html']);
} else {
$controller->tpl->assign('items', $courseAndSessions['items']);
$userPortalTemplate = $controller->tpl->get_template('user_portal/'.$template);
$content = $controller->tpl->fetch($userPortalTemplate);
}
$controller->tpl->assign('content', $content);
if (api_get_setting('allow_browser_sniffer') == 'true') {
if (isset($_SESSION['sniff_navigator']) && $_SESSION['sniff_navigator'] != "checked") {

Loading…
Cancel
Save