Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

remotes/angel/1.11.x
jmontoyaa 9 years ago
commit 4a413f2739
  1. 159
      app/Resources/public/css/base.css
  2. 1
      main/auth/courses_controller.php
  3. BIN
      main/img/icons/22/drawing-pin.png
  4. BIN
      main/img/icons/32/drawing-pin.png
  5. BIN
      main/img/icons/48/drawing-pin.png
  6. BIN
      main/img/icons/64/drawing-pin.png
  7. 266
      main/img/icons/svg/drawing-pin.svg
  8. 6
      main/inc/lib/auth.lib.php
  9. 591
      main/inc/lib/course.lib.php
  10. 2
      main/inc/lib/course_category.lib.php
  11. 2
      main/inc/lib/display.lib.php
  12. 65
      main/inc/lib/userportal.lib.php
  13. 3
      main/install/configuration.dist.php
  14. 69
      main/template/default/auth/courses_categories.php
  15. 1
      main/template/default/layout/course_navigation.tpl
  16. 5
      main/template/default/layout/header.js.tpl
  17. 73
      main/template/default/layout/hot_course_item.tpl
  18. 4
      main/template/default/layout/hot_courses.tpl
  19. 130
      main/template/default/user_portal/classic_courses.tpl
  20. 131
      main/template/default/user_portal/grid_courses.tpl
  21. 10
      user_portal.php
  22. 0
      web/app_dev.php

@ -1655,39 +1655,24 @@ div.admin_section h4 {
}
.document_preview_container {
-webkit-border-radius: 6px;
-opera-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 2px 5px #C8C8C8;
-opera-box-shadow: 0 2px 5px #C8C8C8;
-moz-box-shadow: 0 2px 5px #C8C8C8;
box-shadow: 0 2px 5px #C8C8C8;
background-color: #F9F9F9;
border-radius: 5px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
background-color: #FFF;
border: 1px solid #DDD;
position: absolute;
z-index: 20;
margin:5px;
padding:5px;
width: 400px;
height:280px;
width: 310px;
height: 200px;
overflow-y: auto;
top: -5px;
left: 25px;
}
#course_settings h3 img {
margin-left: 25px;
}
.document_preview_container {
font-size: 12px !important;
color: #111 ! important;
}
/* Exercise comment*/
#comments {
position:absolute;
@ -4859,6 +4844,130 @@ div#chat-remote-video video {
width: 100px;
height: 100px;
}
/* list courses classic*/
.classic-courses .teachers{
margin: 0;
padding: 0;
display: inline-block;
font-size: 12px;
}
.classic-courses .teachers li{
display: inline-block;
}
/* list my course user*/
.grid-courses .items{
/* position: relative; */
vertical-align: top;
white-space: normal;
margin: 0px 5px 15px 0px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
text-align: left;
background-color: #fff;
min-height: 235px;
border: 1px solid #DFDFDF;
border-radius: 5px;
}
.hot-courses .grid-courses .items{
min-height: 275px;
}
.grid-courses .items .title{
line-height: 1.4;
font-size: 13px;
min-height: 40px;
padding: 0px;
margin: 5px;
}
.grid-courses .items .toolbar{
text-align: right;
}
.grid-courses .items .image{
position: relative;
}
.grid-courses .items .image .pin{
position: absolute;
top: -10px;
right: -10px;
z-index: 2;
}
.grid-courses .items .ranking{
font-size: 10px;
}
.grid-courses .items .image .black-shadow{
top: 0px;
left: 0px;
width: 100%;
height: 100%;
padding-top: 40px;
opacity: 0;
box-sizing: border-box;
position: absolute;
background: rgba(0, 0, 0, 0.7) none repeat scroll 0% 0%;
padding: 10px;
}
.grid-courses .items .image .hovered-course{
opacity: 1;
transition: all 0.3s ease 0s;
}
.grid-courses .items .notifications{
margin-top: 5px;
text-align: center;
}
.grid-courses .items .admin-actions, .grid-courses .items .user-actions{
position: absolute;
bottom: 0px;
left: 0px;
}
.grid-courses .items .admin-actions .btn-sm,.grid-courses .items .user-actions .btn-sm{
border-radius: 0;
border: none;
}
.grid-courses .items .category{
position: absolute;
bottom: 0px;
right: -10px;
background-color: #FD6600;
color: #fff;
padding: 5px 10px;
font-size: 11px;
text-transform: uppercase;
z-index: 2;
}
.grid-courses .items .cribbon{
width: 0;
height: 0;
border-top: 10px solid #FD3414;
border-right: 10px solid transparent;
position: absolute;
bottom: -10px;
right: -10px;
}
.grid-courses .items .description{
padding: 5px 10px;
}
.grid-courses .items .author-card{
display: flex;
margin-top: 5px;
margin-left: 5px;
}
.grid-courses .items .author-card img{
border: 2px solid #fff;
}
.grid-courses .items .author-card .teachers-details{
display: flex;
flex-direction: column;
justify-content: center;
}
.grid-courses .items .author-card .teachers-details h5{
font-size: 10px;
font-weight: bold;
margin: 0px;
margin-left: 10px;
margin-right: 10px;
}
.grid-courses .items .author-card .teachers-details h5 a{
color: #fff;
}
/* Catalog session */
#session-list .col-md-4:nth-child(3n+1) {
clear: left;
@ -5876,6 +5985,10 @@ a.sessionView {
.gallery .canvas-two{
width: 100%;
}
.grid-courses .items{
margin-left: 5%;
margin-right: 5%;
}
}
.elfinder-cwd-filename {

@ -142,6 +142,7 @@ class CoursesController
}
// render to the view
$this->view->set_data($data);
$this->view->set_layout('catalog_layout');
$this->view->set_template('courses_categories');

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -0,0 +1,266 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="drawing-pin.svg">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient4309">
<stop
style="stop-color:#4d4d4d;stop-opacity:1;"
offset="0"
id="stop4311" />
<stop
style="stop-color:#4d4d4d;stop-opacity:0;"
offset="1"
id="stop4313" />
</linearGradient>
<filter
id="filter4036">
<feGaussianBlur
id="feGaussianBlur4158"
stdDeviation=".52662" />
</filter>
<filter
y="-0.21328001"
x="-0.1644"
width="1.3287899"
id="filter3372"
height="1.42656">
<feGaussianBlur
id="feGaussianBlur4161"
stdDeviation="1.24131" />
</filter>
<linearGradient
id="linearGradient3228">
<stop
id="stop4164"
stop-color="#fff"
offset="0" />
<stop
id="stop4166"
stop-opacity="0"
stop-color="#fff"
offset="1" />
</linearGradient>
<radialGradient
r="7.3867898"
id="radialGradient4051"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.66684,0.25023,-0.43535,1.44245,-180.07171,-76.25791)"
cy="12.79813"
cx="278.53354">
<stop
id="stop4169"
stop-opacity=".99107"
offset="0" />
<stop
id="stop4171"
stop-opacity=".61607"
offset=".51389" />
<stop
id="stop4173"
stop-opacity="0"
stop-color="#8d8d8d"
offset="1" />
</radialGradient>
<radialGradient
r="8.9205999"
id="radialGradient4053"
gradientUnits="userSpaceOnUse"
cy="4.6950598"
cx="305.97662">
<stop
id="stop4176"
stop-color="#f60000"
offset="0" />
<stop
id="stop4178"
stop-color="#b30000"
offset="1" />
</radialGradient>
<radialGradient
r="8.9205999"
id="radialGradient4057"
gradientUnits="userSpaceOnUse"
cy="4.6950598"
cx="302.83102">
<stop
id="stop4181"
stop-color="#7f0000"
offset="0" />
<stop
id="stop4183"
stop-opacity=".49804"
stop-color="#840000"
offset=".66667" />
<stop
id="stop4185"
stop-opacity="0"
offset="1" />
</radialGradient>
<radialGradient
r="8.9205999"
id="radialGradient4061"
gradientUnits="userSpaceOnUse"
cy="4.6950598"
cx="302.83102">
<stop
id="stop4188"
stop-color="#d43500"
offset="0" />
<stop
id="stop4190"
stop-color="#d42400"
offset=".48052" />
<stop
id="stop4192"
stop-color="#d40000"
offset=".73611" />
<stop
id="stop4194"
stop-color="#b20000"
offset="1" />
</radialGradient>
<radialGradient
xlink:href="#linearGradient3228"
r="0.74646002"
id="radialGradient4059"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.78797,0.51073,-2.04519,-3.15542,1235.7385,709.11104)"
cy="228.65007"
cx="537.7536" />
<radialGradient
xlink:href="#linearGradient3228"
r="0.74646002"
id="radialGradient4063"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.6289,-1.24734,4.99492,6.52288,-1652.775,-572.89743)"
cy="228.65007"
cx="537.7536" />
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter4305"
x="-0.083999999"
width="1.168"
y="-0.083999999"
height="1.168">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.90508747"
id="feGaussianBlur4307" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4309"
id="linearGradient4315"
x1="258.66284"
y1="123.92178"
x2="235.82256"
y2="138.06694"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.5387056"
inkscape:cx="75.613549"
inkscape:cy="72.320353"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1873"
inkscape:window-height="1056"
inkscape:window-x="1413"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-924.36219)">
<g
id="g4326"
transform="matrix(2.6666667,0,0,2.6666667,-638.27483,680.85161)"
inkscape:export-filename="/var/www/chamilo11/main/img/icons/22/drawing-pin.png"
inkscape:export-xdpi="15.46875"
inkscape:export-ydpi="15.46875">
<rect
y="91.316467"
x="239.35306"
height="48"
width="48"
id="rect4324"
style="opacity:1;fill:#ffccaa;fill-opacity:0;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<g
transform="matrix(1.2119436,0,0,1.2119436,-35.373348,-39.484458)"
id="g4317">
<circle
cy="128.24391"
cx="247.83208"
id="circle4271"
style="opacity:1;fill:url(#linearGradient4315);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter4305)"
transform="matrix(1.0815771,0,0,1.0433462,-24.103035,-4.7111206)"
r="12.929821" />
<circle
style="opacity:1;fill:#c70000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4147"
cx="249.66891"
cy="125.70061"
r="12.082053" />
<circle
r="9.4878988"
cy="122.89603"
cx="252.67332"
id="circle4149"
style="opacity:1;fill:#840000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<circle
style="opacity:1;fill:#bb0000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle4151"
cx="255.87045"
cy="120.09853"
r="9.4878988" />
<circle
r="7.4878988"
cy="119.49907"
cx="256.66974"
id="circle4269"
style="opacity:1;fill:#d40b00;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.1 KiB

@ -63,6 +63,7 @@ class Auth
course.unsubscribe unsubscr,
course.title i,
course.tutor_name t,
course.category_code cat,
course.directory dir,
course_rel_user.status status,
course_rel_user.sort sort,
@ -85,12 +86,13 @@ class Auth
'status' => $row['status'],
'tutor' => $row['t'],
'subscribe' => $row['subscr'],
'category' => $row['cat'],
'unsubscribe' => $row['unsubscr'],
'sort' => $row['sort'],
'user_course_category' => $row['user_course_cat']
);
}
return $courses;
}
@ -718,7 +720,7 @@ SQL;
return $count;
}
/**
* Search sessions by the tags in their courses
* @param string $termTag Term for search in tags

@ -1858,6 +1858,53 @@ class CourseManager
return $teachers;
}
/**
* Return user info array of all teacher-users registered in a course
* This only returns the users that are registered in this actual course, not linked courses.
*
* @param string $course_code
* @return array with user id
*/
public static function getTeachersFromCourseByCode($course_code)
{
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
if (empty($courseId)) {
return false;
}
$sql = "SELECT DISTINCT
u.id as user_id,
u.lastname,
u.firstname,
u.email,
u.username,
u.status
FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " cu
INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " u
ON (cu.user_id = u.id)
WHERE
cu.c_id = $courseId AND
cu.status = 1 ";
$rs = Database::query($sql);
$listTeachers = array();
$teachers = array();
while ($teacher = Database::fetch_array($rs)) {
$userPicture = UserManager::getUserPicture($teacher['user_id'], USER_IMAGE_SIZE_SMALL);
$teachers['id'] = $teacher['user_id'];
$teachers['lastname'] = $teacher['lastname'];
$teachers['firstname'] = $teacher['firstname'];
$teachers['email'] = $teacher['email'];
$teachers['username'] = $teacher['username'];
$teachers['status'] = $teacher['status'];
$teachers['avatar'] = $userPicture;
$teachers['url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $teacher['user_id'];
$listTeachers[]=$teachers;
}
return $listTeachers;
}
/**
* Returns a string list of teachers assigned to the given course
* @param string $course_code
@ -2888,6 +2935,24 @@ class CourseManager
$sql = "SELECT * FROM $table_categories WHERE code = '$code';";
return Database::fetch_array(Database::query($sql));
}
/**
* Returns the details of a course category
*
* @param string Category code
* @return array Course category
*/
public static function getCategoriesList()
{
$table_categories = Database::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT * FROM $table_categories";
$result = Database::query($sql);
$category = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$category[$row['code']] = $row['name'];
}
return $category;
}
/**
* Get count rows of a table inside a course database
@ -3271,81 +3336,6 @@ class CourseManager
return $html;
}
/**
* Builds the course block in user_portal.php
* @todo use Twig
* @param array $params
* @param bool|false $is_sub_content
* @return string
*/
public static function course_item_html($params, $is_sub_content = false)
{
$html = '';
$class = "panel panel-default";
if ($is_sub_content) {
$class = "course_item";
}
$html .= '<div class="' . $class . '">';
$html .= '<div class="panel-body">';
$html .= '<div class="course-items">';
$html .= ' <div class="row">';
$html .= '<div class="col-md-2">';
if (!empty($params['link'])) {
$html .= '<a class="thumbnail" href="' . $params['link'] . '">';
$html .= $params['icon'];
$html .= '</a>';
} else {
$html .= '<div class="thumbnail">';
$html .= $params['icon'];
$html .= '</div>';
}
$html .= '</div>';
$notifications = isset($params['notifications']) ? $params['notifications'] : '';
$param_class = isset($params['class']) ? $params['class'] : '';
$params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : '';
$html .= '<div class="col-md-10 ' . $param_class . '">';
$html .= '<div class="pull-right">' . $params['right_actions'] . '</div>';
$html .= '<h4 class="course-items-title">' . $params['title'] . $notifications . '</h4> ';
if (isset($params['show_description'], $params['description']) && $params['show_description'] == 1) {
$html .= '<p class="description-session">' . $params['description'] . '</p>';
}
if (!empty($params['subtitle'])) {
$html .= '<div class="subtitle-session">' . $params['subtitle'] . '</div>';
}
if (!empty($params['teachers'])) {
$html .= '<h5 class="course-items-session">' .
Display::return_icon('teacher.png', get_lang('Teacher'), array(), ICON_SIZE_TINY) .
$params['teachers'] . '</h5>';
}
if (!empty($params['coaches'])) {
$html .= '<h5 class="course-items-session">' .
Display::return_icon('teacher.png', get_lang('Coach'), array(), ICON_SIZE_TINY) .
$params['coaches'] . '</h5>';
}
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
/**
* @param string $main_content
* @param string $sub_content
* @param string $sub_sub_content
* @return string
*/
public static function course_item_parent($main_content, $sub_content, $sub_sub_content = null)
{
return '<div class="panel panel-default">' . $main_content . $sub_content . $sub_sub_content . '</div>';
}
/**
* Display special courses (and only these) as several HTML divs of class userportal-course-item
*
@ -3355,7 +3345,7 @@ class CourseManager
* @param bool Whether to show the document quick-loader or not
* @return string
*/
public static function display_special_courses($user_id, $load_dirs = false)
public static function returnSpecialCourses($user_id, $load_dirs = false)
{
$user_id = intval($user_id);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
@ -3367,8 +3357,8 @@ class CourseManager
if (!empty($special_course_list)) {
$with_special_courses = ' course.code IN ("' . implode('","', $special_course_list) . '")';
}
$html = null;
$courseCount = 0;
$courseList = array();
if (!empty($with_special_courses)) {
$sql = "SELECT
course.id,
@ -3386,8 +3376,7 @@ class CourseManager
$rs_special_course = Database::query($sql);
$number_of_courses = Database::num_rows($rs_special_course);
$key = 0;
$showCustomIcon = api_get_setting('course_images_in_courses_list');
if ($number_of_courses > 0) {
while ($course = Database::fetch_array($rs_special_course)) {
@ -3395,7 +3384,7 @@ class CourseManager
if ($course_info['visibility'] == COURSE_VISIBILITY_HIDDEN) {
continue;
}
$courseCount++;
$params = array();
// Get notifications.
$course_info['id_session'] = null;
@ -3406,99 +3395,57 @@ class CourseManager
$course['status'] = STUDENT;
}
$params['icon'] = Display::return_icon(
'blackboard.png',
api_htmlentities($course_info['title']),
array(),
ICON_SIZE_LARGE
);
$params['right_actions'] = '';
$params['edit_actions'] = '';
$params['document'] = '';
if (api_is_platform_admin()) {
$params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'];
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' .
Display::return_icon(
'folder.png',
get_lang('Documents'),
array('align' => 'absmiddle'),
ICON_SIZE_SMALL
).'</a>';
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' .
Display::return_icon(
'edit.png',
get_lang('Edit'),
array('align' => 'absmiddle'),
ICON_SIZE_SMALL
).'</a>';
$params['right_actions'] .= Display::div('', array(
'id' => 'document_result_' . $course['id'] . '_0',
'class' => 'document_preview_container'
));
} else {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' .
Display::return_icon('edit.png',
get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
}
if ($course['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' .
Display::return_icon(
'folder.png',
get_lang('Documents'),
array('align' => 'absmiddle'),
ICON_SIZE_SMALL
).'</a>';
$params['right_actions'] .= Display::div('', array(
'id' => 'document_result_' . $course['id'] . '_0',
'class' => 'document_preview_container'
));
}
}else{
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) {
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
}
}
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title = '<a href="' . $course_info['course_public_url'] . '?id_session=0&autoreg=1">' . $course_info['title'] . '</a>';
} else {
$course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'),
array('class' => 'item_closed'));
}
$params['visibility'] = $course_info['visibility'];
$params['status'] = $course_info['status'];
$params['category'] = $course_info['categoryName'];
$params['icon'] = Display::return_icon('drawing-pin.png',null, null, ICON_SIZE_LARGE, null);
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$course_title .= ' (' . $course_info['visual_code'] . ') ';
$params['code_course'] = '(' . $course_info['visual_code'] . ')';
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string(
$course['code'],
self::USER_SEPARATOR,
true
);
}
$course_title .= '&nbsp;';
$course_title .= Display::return_icon('klipper.png', get_lang('CourseAutoRegister'));
$params['title'] = $course_title;
$params['title'] = $course_info['title'];
$params['link'] = $course_info['course_public_url'].'?id_session=0&autoreg=1';
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$params['teachers'] = CourseManager::getTeachersFromCourseByCode($course['code']);
}
$iconName = basename($course_info['course_image']);
if ($showCustomIcon === 'true' && $iconName != 'course.png') {
$params['thumbnails'] = $course_info['course_image'];
$params['image'] = $course_info['course_image_large'];
}
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
}
$html .= self::course_item_html($params, false);
$key++;
$courseList[] = $params;
}
}
}
return [
'html' => $html,
'course_count' => $courseCount
];
}
return $courseList;
}
/**
* Display courses (without special courses) as several HTML divs
* of course categories, as class userportal-catalog-item.
@ -3507,7 +3454,7 @@ class CourseManager
* @param bool Whether to show the document quick-loader or not
* @return string
*/
public static function display_courses($user_id, $load_dirs = false)
public static function returnCourses($user_id, $load_dirs = false)
{
$user_id = intval($user_id);
if (empty($user_id)) {
@ -3520,52 +3467,159 @@ class CourseManager
WHERE user_id = '" . $user_id . "'
ORDER BY sort ASC";
$result = Database::query($sql);
$html = null;
$courseCount = 0;
$items = [];
$listItems = array();
while ($row = Database::fetch_array($result)) {
// We simply display the title of the category.
$params = array(
'icon' => Display::return_icon(
'folder_yellow.png',
api_htmlentities($row['title']), array(), ICON_SIZE_LARGE
),
'title' => $row['title'],
'class' => 'table_user_course_category'
);
$courseInCategory = self:: displayCoursesInCategory(
$courseInCategory = self:: returnCoursesCategories(
$row['id'],
$load_dirs
);
$item = self::course_item_parent(
self::course_item_html($params, true),
$courseInCategory['html']
if(empty($courseInCategory)){
$courseInCategory = null;
}
$params = array(
'id_category' => $row ['id'],
'title_category' => $row['title'],
'courses' => $courseInCategory
);
//$courseCount += $courseInCategory['course_count'];
$courseCount ++;
$listItems['in_category'][$courseCount] = $params;
}
// Step 2: We display the course without a user category.
$courseInCategory = self::returnCoursesWithoutCategories(0, $load_dirs);
$listItems['not_category'] = $courseInCategory;
$html .= $item;
//$courseCount += $courseInCategory['course_count'];
$items[] = $item;
$courseCount += $courseInCategory['course_count'];
return $listItems;
}
/**
* Display courses inside a category (without special courses) as HTML dics of
* class userportal-course-item.
* @param int User category id
* @param bool Whether to show the document quick-loader or not
* @return string
*/
public static function returnCoursesCategories($user_category_id, $load_dirs = false)
{
$user_id = api_get_user_id();
// Table definitions
$TABLECOURS = Database:: get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id();
// Step 2: We display the course without a user category.
$courseInCategory = self::displayCoursesInCategory(0, $load_dirs);
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$html .= $courseInCategory['html'];
$without_special_courses = '';
if (!empty($special_course_list)) {
$without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
}
if (!empty($courseInCategory['items'])) {
$items = array_merge($items, $courseInCategory['items']);
//AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
$sql = "SELECT
course.id,
course.title,
course.code,
course.subscribe subscr,
course.unsubscribe unsubscr,
course_rel_user.status status,
course_rel_user.sort sort,
course_rel_user.user_course_cat user_course_cat
FROM $TABLECOURS course,
$TABLECOURSUSER course_rel_user,
$TABLE_ACCESS_URL_REL_COURSE url
WHERE
course.id = course_rel_user.c_id AND
url.c_id = course.id AND
course_rel_user.user_id = '" . $user_id . "' AND
course_rel_user.user_course_cat = '" . $user_category_id . "'
$without_special_courses ";
// If multiple URL access mode is enabled, only fetch courses
// corresponding to the current URL.
if (api_get_multiple_access_url() && $current_url_id != -1) {
$sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'";
}
// Use user's classification for courses (if any).
$sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$courseCount += $courseInCategory['course_count'];
$result = Database::query($sql);
return [
'html' => $html,
'items' => $items,
'course_count' => $courseCount
];
$courseList = array();
$showCustomIcon = api_get_setting('course_images_in_courses_list');
// Browse through all courses.
while ($course = Database::fetch_array($result)) {
$course_info = api_get_course_info($course['code']);
if (isset($course_info['visibility']) &&
$course_info['visibility'] == COURSE_VISIBILITY_HIDDEN
) {
continue;
}
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$showNotification = Display::show_notification($course_info);
$iconName = basename($course_info['course_image']);
if ($showCustomIcon === 'true' && $iconName != 'course.png') {
$params['thumbnails'] = $course_info['course_image'];
$params['image'] = $course_info['course_image_large'];
}
$params = array();
$params['course_id'] = $course['id'];
$params['actions'] = '';
if (api_is_platform_admin()) {
$params['actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'];
}
$courseUrl = '';
$courseUrl = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0';
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$teachers = CourseManager::getTeachersFromCourseByCode($course['code']);
}
$params['status'] = $course['status'];
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$params['code_course'] = '(' . $course_info['visual_code'] . ') ';
}
$params['visibility'] = $course_info['visibility'];
$params['link'] = $courseUrl;
$params['title'] = $course_info['title'] . $visualCode;
$params['teachers'] = $teachers;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $showNotification;
}
$isSubContent = true;
if (empty($user_category_id)) {
$isSubContent = false;
}
$courseList[] = $params;
}
return $courseList;
}
/**
@ -3575,7 +3629,7 @@ class CourseManager
* @param bool Whether to show the document quick-loader or not
* @return string
*/
public static function displayCoursesInCategory($user_category_id, $load_dirs = false)
public static function returnCoursesWithoutCategories($user_category_id, $load_dirs = false)
{
$user_id = api_get_user_id();
// Table definitions
@ -3619,14 +3673,9 @@ class CourseManager
}
// Use user's classification for courses (if any).
$sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$result = Database::query($sql);
$html = '';
$items = [];
$course_list = array();
$showCustomIcon = api_get_setting('course_images_in_courses_list');
$courseCount = 0;
// Browse through all courses.
while ($course = Database::fetch_array($result)) {
$course_info = api_get_course_info($course['code']);
@ -3638,121 +3687,75 @@ class CourseManager
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
//In order to avoid doubles
if (in_array($course_info['real_id'], $course_list)) {
continue;
} else {
$course_list[] = $course_info['real_id'];
}
$courseCount++;
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display::show_notification($course_info);
$status_icon = Display::return_icon(
'blackboard.png',
api_htmlentities($course_info['title']),
array(),
ICON_SIZE_LARGE
);
$showNotification = Display::show_notification($course_info);
$thumbnails = null;
$image = null;
$iconName = basename($course_info['course_image']);
if ($showCustomIcon === 'true' && $iconName != 'course.png') {
$status_icon = Display::img(
$course_info['course_image'],
api_htmlentities($course_info['title']),
array()
);
$thumbnails = $course_info['course_image'];
$image = $course_info['course_image_large'];
}else{
$image = Display::return_icon('session_default.png', null, null, null,null, true);
}
$params = array();
$params['right_actions'] = '';
$params['edit_actions'] = '';
$params['document'] = '';
if (api_is_platform_admin()) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png',
get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array(
'id' => 'document_result_' . $course_info['real_id'] . '_0',
'class' => 'document_preview_container'
));
} else {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
if ($course_info['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
$params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'];
if($load_dirs){
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
}
} else {
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png',
get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array(
'id' => 'document_result_' . $course_info['real_id'] . '_0',
'class' => 'document_preview_container'
));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
}
}
}
$course_title_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'),
array('class' => 'item_closed'));
}
// Start displaying the course block itself
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$course_title .= ' (' . $course_info['visual_code'] . ') ';
if ($load_dirs) {
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
}
$course_title_url = '';
$course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0';
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$teachers = CourseManager::get_teacher_list_from_course_code_to_string(
$course['code'],
self::USER_SEPARATOR,
true
);
$teachers = CourseManager::getTeachersFromCourseByCode($course['code']);
}
$params['status'] = $course['status'];
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$params['code_course'] = '(' . $course_info['visual_code'] . ') ';
}
$params['visibility'] = $course_info['visibility'];
$params['link'] = $course_title_url;
$params['icon'] = $status_icon;
$params['title'] = $course_title;
$params['thumbnails'] = $thumbnails;
$params['image'] = $image;
$params['title'] = $course_info['title'];
$params['category'] = $course_info['categoryName'];
$params['teachers'] = $teachers;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
$params['notifications'] = $showNotification;
}
$isSubContent = true;
if (empty($user_category_id)) {
$isSubContent = false;
}
$item = self::course_item_html($params, $isSubContent);
$html .= $item;
$items[] = $item;
$courseList[] = $params;
}
return [
'html' => $html,
'items' => $items,
'course_count' => $courseCount
];
return $courseList;
}
/**
* Retrieves the user defined course categories
* @param string $userId
@ -4562,7 +4565,7 @@ class CourseManager
* @param int $limit number of hottest courses
* @return array
*/
public static function return_hot_courses($days = 30, $limit = 5)
public static function return_hot_courses($days = 30, $limit = 6)
{
if (api_is_invitee()) {
return array();
@ -4614,7 +4617,7 @@ class CourseManager
$courses = Database::store_result($result, 'ASSOC');
$courses = self::process_hot_course_item($courses, $my_course_code_list);
}
return $courses;
}
@ -4635,9 +4638,9 @@ class CourseManager
$course_info = api_get_course_info_by_id($courseId['c_id']);
$courseCode = $course_info['code'];
$categoryCode = !empty($course_info['categoryCode']) ? $course_info['categoryCode'] : "";
$my_course['extra_info'] = $course_info;
$my_course['extra_info']['go_to_course_button'] = '';
$my_course['extra_info']['register_button'] = '';
$my_course = $course_info;
$my_course['go_to_course_button'] = '';
$my_course['register_button'] = '';
$access_link = self::get_access_link_by_user(
api_get_user_id(),
@ -4647,7 +4650,7 @@ class CourseManager
//Course visibility
if ($access_link && in_array('register', $access_link)) {
$my_course['extra_info']['register_button'] = Display::url(
$my_course['register_button'] = Display::url(
Display::returnFontAwesomeIcon('sign-in'),
api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?action=subscribe&sec_token=' . $stok,
array('class' => 'btn btn-success btn-sm', 'title' => get_lang('Subscribe')));
@ -4656,25 +4659,25 @@ class CourseManager
if ($access_link && in_array('enter',
$access_link) || $course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
) {
$my_course['extra_info']['go_to_course_button'] = Display::url(
$my_course['go_to_course_button'] = Display::url(
Display::returnFontAwesomeIcon('share'),
api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php',
array('class' => 'btn btn-default btn-sm', 'title' => get_lang('GoToCourse')));
}
if ($access_link && in_array('unsubscribe', $access_link)) {
$my_course['extra_info']['unsubscribe_button'] = Display::url(
$my_course['unsubscribe_button'] = Display::url(
Display::returnFontAwesomeIcon('sign-out'),
api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=unsubscribe&unsubscribe=' . $courseCode . '&sec_token=' . $stok . '&category_code=' . $categoryCode,
array('class' => 'btn btn-danger btn-sm', 'title' => get_lang('Unreg')));
}
//Description
$my_course['extra_info']['description_button'] = '';
$my_course['description_button'] = '';
/* if ($course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || in_array($course_info['real_id'],
$my_course_code_list)
) { */
$my_course['extra_info']['description_button'] = Display::url(
$my_course['description_button'] = Display::url(
Display::returnFontAwesomeIcon('info-circle'),
api_get_path(WEB_AJAX_PATH) . 'course_home.ajax.php?a=show_course_information&code=' . $course_info['code'],
[
@ -4685,9 +4688,9 @@ class CourseManager
);
//}
/* get_lang('Description') */
$my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
$my_course['teachers'] = CourseManager::getTeachersFromCourseByCode($course_info['code']);
$point_info = self::get_course_ranking($course_info['real_id'], 0);
$my_course['extra_info']['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'],
$my_course['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'],
$ajax_url . '&course_id=' . $course_info['real_id'], $point_info);
$hotCourses[] = $my_course;

@ -796,11 +796,11 @@ class CourseCategory
'registration_code' => $row['registration_code'],
'creation_date' => $row['creation_date'],
'visibility' => $row['visibility'],
'category' => $row['category_code'],
'count_users' => $count_users,
'count_connections' => $count_connections_last_month
);
}
return $courses;
}

@ -2484,4 +2484,4 @@ HTML;
}
return $html;
}
}
}

@ -1039,29 +1039,36 @@ class IndexManager
$html .= get_lang('YouDoNotHaveAnySessionInItsHistory');
}
}
$courses_html = '';
$special_courses = '';
$sessionCount = 0;
$courseCount = 0;
$items = [];
// If we're not in the history view...
if (!isset($_GET['history'])) {
// Display special courses.
$specialCourses = CourseManager::display_special_courses(
$specialCourses = CourseManager::returnSpecialCourses(
$user_id,
$this->load_directories_preview
);
$special_courses = $specialCourses['html'];
// Display courses.
$courses = CourseManager::display_courses(
$courses = CourseManager::returnCourses(
$user_id,
$this->load_directories_preview
);
$courses_html .= $courses['html'];
$items = $courses['items'];
$this->tpl->assign('special_courses', $specialCourses);
$this->tpl->assign('courses', $courses);
if($_configuration['view_grid_courses']==true){
$listCourse = $this->tpl->fetch(
$this->tpl->get_template('/user_portal/grid_courses.tpl'));
} else {
$listCourse = $this->tpl->fetch(
$this->tpl->get_template('/user_portal/classic_courses.tpl'));
}
$courseCount = $specialCourses['course_count'] + $courses['course_count'];
}
$sessions_with_category = '';
@ -1205,12 +1212,10 @@ class IndexManager
$this->tpl->assign('session', $params);
$this->tpl->assign('gamification_mode', $gamificationModeIsActive);
$item = $this->tpl->fetch(
$sessions_with_no_category .= $this->tpl->fetch(
$this->tpl->get_template('/user_portal/session.tpl')
);
$sessions_with_no_category .= $item;
$items[] = $item;
$sessionCount++;
}
}
@ -1305,14 +1310,10 @@ class IndexManager
}
$this->tpl->assign('session', $sessionParams);
$item = $this->tpl->fetch(
$html_sessions .= $this->tpl->fetch(
$this->tpl->get_template('user_portal/session.tpl')
);
$html_sessions .= $item;
$items[] = $item;
$sessionCount++;
}
}
@ -1358,19 +1359,16 @@ class IndexManager
}
$this->tpl->assign('session_category', $categoryParams);
$item = $this->tpl->fetch("{$this->tpl->templateFolder}/user_portal/session_category.tpl");
$sessions_with_category .= $item;
$items[] = $item;
$sessions_with_category .= $this->tpl->fetch(
"{$this->tpl->templateFolder}/user_portal/session_category.tpl"
);
}
}
}
}
$items = array_reverse($items);
return [
'html' => $sessions_with_category.$sessions_with_no_category.$courses_html.$special_courses,
'items' => $items,
'html' => $sessions_with_category.$sessions_with_no_category.$listCourse.$special_courses,
'session_count' => $sessionCount,
'course_count' => $courseCount
];
@ -1482,7 +1480,7 @@ class IndexManager
$listUserCategories[0] = '';
$html = '<div class="session-view-block">';
$items = [];
foreach ($listUserCategories as $userCategoryId => $userCatTitle) {
// add user category
$userCategoryHtml = '';
@ -1538,7 +1536,7 @@ class IndexManager
}
$htmlSessionCategory .= '</div>'; // end session cat block
$htmlCategory .= $htmlSessionCategory .'</div>' ;
$items[] = $htmlSessionCategory;
$htmlCategory .= ''; // end course block
}
$userCategoryHtml .= $htmlCategory;
}
@ -1547,35 +1545,32 @@ 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) {
$item .= '<div class="session-view-row" >';
$htmlCategory .= '<div class="session-view-row" >';
} else {
$item .= '<div class="session-view-well well">';
$htmlCategory .= '<div class="session-view-well well">';
}
$item .= self::getHtmlForCourse(
$htmlCategory .= self::getHtmlForCourse(
$listCourse['course'],
$userCategoryId,
0,
$loadDirs
);
$item .= '</div>';
$htmlCategory .= $item;
$items[] = $item;
$htmlCategory .= '</div>';
}
}
$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,5 +238,4 @@ $_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/user_portal
//$_configuration['user_portal_tpl'] = 'index_grid.tpl';
//$_configuration['view_grid_courses'] = true (new grid view courses);

@ -171,6 +171,7 @@ $code = isset($code) ? $code : null;
<?php } ?>
</div>
<?php } ?>
<div class="grid-courses">
<div class="row">
<?php
if ($showCourses && $action != 'display_sessions') {
@ -189,10 +190,11 @@ if ($showCourses && $action != 'display_sessions') {
if (!empty($search_term)) {
echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
}
$listCategory = CourseManager::getCategoriesList();
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
$course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN);
@ -213,17 +215,17 @@ if ($showCourses && $action != 'display_sessions') {
$course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'],0,10);
$icon_title = null;
$html = null;
// display the course bloc
$html .= '<div class="col-xs-6 col-sm-6 col-md-3"><div class="items-course">';
$html .= '<div class="col-xs-6 col-sm-6 col-md-3"><div class="items">';
// display thumbnail
$html .= return_thumbnail($course, $icon_title);
$html .= returnThumbnail($course, $listCategory[$course['category']]);
// display course title and button bloc
$html .= '<div class="items-course-info">';
$html .= '<div class="description">';
$html .= return_title($course);
// display button line
$html .= '<div class="toolbar">';
@ -242,7 +244,7 @@ if ($showCourses && $action != 'display_sessions') {
}
} elseif ($user_registerd_in_course_as_teacher) {
// if user registered as teacher
$html .= return_goto_button($course);
if ($course_unsubscribe_allowed) {
$html .= return_unregister_button($course, $stok, $search_term, $code);
@ -253,7 +255,7 @@ if ($showCourses && $action != 'display_sessions') {
// if user not registered in the course
if (!$course_closed) {
if (!$course_private) {
$html .= return_goto_button($course);
if ($course_subscribe_allowed) {
$html .= return_register_button($course, $stok, $code, $search_term);
}
@ -279,16 +281,18 @@ if ($showCourses && $action != 'display_sessions') {
}
?>
</div>
</div>
<?php
echo $cataloguePagination;
/**
* Display the course catalog image of a course
* @param $course
* @param $icon_title
* @param array $course
* @param string $categoryTitle
* @return string HTML string
*/
function return_thumbnail($course, $icon_title)
function returnThumbnail($course, $categoryTitle=null)
{
$html = '';
$title = cut($course['title'], 70);
@ -301,22 +305,43 @@ function return_thumbnail($course, $icon_title)
// without picture
$course_medium_image = Display::returnIconPath('session_default.png');
}
// course image
$html .= '<div class="items-course-image">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
$html .= '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.$icon_title.'" rel="gb_page_center[778]">';
$html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'" />';
$html .= '</a>';
} else {
$html .= '<div class="image">';
$html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
}
if (!empty($categoryTitle)) {
$html .= '<span class="category">'. $categoryTitle.'</span>';
$html .= '<div class="cribbon"></div>';
}
$teachers = CourseManager::getTeachersFromCourseByCode($course['code']);
$html .= '<div class="black-shadow">';
$html .= '<div class="author-card">';
$count = 0;
foreach ($teachers as $value) {
if($count>2){
break;
}
$name = $value['firstname'].' ' . $value['lastname'];
$html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">';
$html .= '<img src="'.$value['avatar'].'"/>';
$html .= '</a>';
$html .= '<div class="teachers-details">';
$html .= '<h5>';
$html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">';
$html .= $name;
$html .= '</a>';
$html .= '</h5>';
$html .= '</div>';
$count ++;
}
$html .= '</div>';
$html .= '</div>';
// }
$html .= '</div>';
return $html;
}
/**
* Display the title of a course in course catalog
* @param $course
@ -327,10 +352,8 @@ function return_title($course)
$linkCourse = api_get_course_url($course['code']);
$title = cut($course['title'], 70);
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
$rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']);
$html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
$html .= '<div class="teachers">'.$teachers.'</div>';
$html .= '<div class="ranking">'. $rating . '</div>';
return $html;

@ -3,6 +3,7 @@
{% if show_course_shortcut is not null %}
<div class="col-md-12">
{{ show_course_shortcut }}
</div>
{% endif %}

@ -211,6 +211,11 @@ $(document).ready(function(){
});
});
};
$(".black-shadow").mouseenter(function() {
$(this).addClass('hovered-course');
}).mouseleave(function() {
$(this).removeClass('hovered-course');
});
});
$(window).resize(function() {

@ -1,27 +1,50 @@
{% for hot_course in hot_courses %}
{% if hot_course.extra_info.title %}
<div class="col-md-4">
<div class="items-course">
<div class="items-course-image">
<a href="{{ hot_course.extra_info.course_public_url }}"><img class="img-responsive" src="{{ hot_course.extra_info.course_image_large }}" alt="{{ hot_course.extra_info.title|e }}"/></a>
</div>
<div class="items-course-info">
<h4 class="title">
<a title="{{ hot_course.extra_info.title}}" href="{{ hot_course.extra_info.course_public_url }}">{{ hot_course.extra_info.title}}</a>
</h4>
<div class="teachers">{{ hot_course.extra_info.teachers }}</div>
<div class="ranking">
{{ hot_course.extra_info.rating_html }}
</div>
<div class="toolbar">
<div class="btn-group" role="group">
{{ hot_course.extra_info.description_button }}
{{ hot_course.extra_info.register_button }}
{{ hot_course.extra_info.unsubscribe_button }}
</div>
</div>
</div>
</div>
{% for item in hot_courses %}
{% if item.title %}
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="items">
<div class="image">
<img src="{{ item.course_image_large }}" class="img-responsive">
{% if item.categoryName != '' %}
<span class="category">{{ item.categoryName }}</span>
<div class="cribbon"></div>
{% endif %}
<div class="black-shadow">
<div class="author-card">
{% for teacher in item.teachers %}
{% set counter = counter + 1 %}
{% if counter <= 3 %}
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
<img src="{{ teacher.avatar }}"/>
</a>
<div class="teachers-details">
<h5>
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
{{ teacher.firstname }} {{ teacher.lastname }}
</a>
</h5>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
<div class="user-actions">{{ item.description_button }}</div>
</div>
<div class="description">
<h4 class="title">
<a title="{{ item.title}}" href="{{ item.course_public_url }}">{{ item.title}}</a>
</h4>
<div class="ranking">
{{ item.rating_html }}
</div>
<div class="toolbar">
<div class="btn-group" role="group">
{{ item.register_button }}
{{ item.unsubscribe_button }}
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}

@ -20,7 +20,7 @@ $(document).ready( function() {
});
});
</script>
<section id="hot_courses">
<section class="hot-courses">
<div class="hot-course-head">
<h4 class="hot-course-title">
{{ "HottestCourses"|get_lang}}
@ -33,7 +33,7 @@ $(document).ready( function() {
{% endif %}
</h4>
</div>
<div id="hot-course">
<div class="grid-courses">
<div class="row">
{% include template ~ '/layout/hot_course_item.tpl' %}
</div>

@ -0,0 +1,130 @@
<!-- view classic list special course -->
<div class="classic-courses">
{% for item in special_courses %}
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<a class="thumbnail">
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}" alt="{{ item.title }}"/>
{% else %}
{{ 'blackboard.png' | img(48, item.title ) }}
{% endif %}
</a>
</div>
<div class="col-md-10">
{% if item.edit_actions != '' %}
<div class="pull-right">
{% if item.document == '' %}
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% else %}
<div class="btn-group" role="group">
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{{ item.document }}
</div>
{% endif %}
</div>
{% endif %}
<h4 class="course-items-title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">
{{ item.title }} {{ item.code_course }}
</a>
{{ item.notifications }}
{{ 'klipper.png' | img(22, 'CourseAutoRegister'|get_lang ) }}
{% endif %}
</h4>
<div class="course-items-session">
{{ 'teacher.png' | img(16, 'Professor'|get_lang ) }}
<ul class="teachers">
{% for teacher in item.teachers %}
<li>
{% set counter = counter + 1 %}
{% if counter > 1 %} | {% endif %}
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
{{ teacher.firstname }} {{ teacher.lastname }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<!-- view classic list course -->
{% for course in courses %}
<div class="classic-courses">
{% for item in course %}
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<a class="thumbnail">
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}" alt="{{ item.title }}"/>
{% else %}
{{ 'blackboard.png' | img(48, item.title ) }}
{% endif %}
</a>
</div>
<div class="col-md-10">
{% if item.edit_actions != '' %}
<div class="pull-right">
{% if item.document == '' %}
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% else %}
<div class="btn-group" role="group">
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{{ item.document }}
</div>
{% endif %}
</div>
{% endif %}
<h4 class="course-items-title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">
{{ item.title }} {{ item.code_course }}
</a>
{{ item.notifications }}
{% endif %}
</h4>
<div class="course-items-session">
{{ 'teacher.png' | img(16, 'Professor'|get_lang ) }}
<ul class="teachers">
{% for teacher in item.teachers %}
<li>
{% set counter = counter + 1 %}
{% if counter > 1 %} | {% endif %}
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
{{ teacher.firstname }} {{ teacher.lastname }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}

@ -0,0 +1,131 @@
<!-- new view course special -->
<div class="grid-courses">
<div class="row">
{% for item in special_courses %}
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="items">
<div class="image">
<div class="pin">{{ item.icon }}</div>
<img src="{{ item.image }}" class="img-responsive">
{% if item.category != '' %}
<span class="category">{{ item.category }}</span>
<div class="cribbon"></div>
{% endif %}
<div class="black-shadow">
<div class="author-card">
{% for teacher in item.teachers %}
{% set counter = counter + 1 %}
{% if counter <= 3 %}
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
<img src="{{ teacher.avatar }}"/>
</a>
<div class="teachers-details">
<h5>
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
{{ teacher.firstname }} {{ teacher.lastname }}
</a>
</h5>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% if item.edit_actions != '' %}
<div class="admin-actions">
{% if item.document == '' %}
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% else %}
<div class="btn-group" role="group">
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{{ item.document }}
</div>
{% endif %}
</div>
{% endif %}
</div>
<div class="description">
<h4 class="title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">{{ item.title }} {{ item.code_course }}</a>
{% endif %}
</h4>
<div class="notifications">{{ item.notifications }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<!-- new view course list -->
{% for course in courses %}
<div class="grid-courses">
<div class="row">
{% for item in course %}
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="items">
<div class="image">
<img src="{{ item.image }}" class="img-responsive">
{% if item.category != '' %}
<span class="category">{{ item.category }}</span>
<div class="cribbon"></div>
{% endif %}
<div class="black-shadow">
<div class="author-card">
{% for teacher in item.teachers %}
{% set counter = counter + 1 %}
{% if counter <= 3 %}
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
<img src="{{ teacher.avatar }}"/>
</a>
<div class="teachers-details">
<h5>
<a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
{{ teacher.firstname }} {{ teacher.lastname }}
</a>
</h5>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% if item.edit_actions != '' %}
<div class="admin-actions">
{% if item.document == '' %}
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% else %}
<div class="btn-group" role="group">
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{{ item.document }}
</div>
{% endif %}
</div>
{% endif %}
</div>
<div class="description">
<h4 class="title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">{{ item.title }} {{ item.code_course }}</a>
{% endif %}
</h4>
<div class="notifications">{{ item.notifications }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}

@ -190,15 +190,7 @@ if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
$controller->tpl->assign('welcome_to_course_block', $controller->return_welcome_to_course_block());
}
$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);
}
$controller->tpl->assign('content', $courseAndSessions['html']);
if (api_get_setting('allow_browser_sniffer') == 'true') {
if (isset($_SESSION['sniff_navigator']) && $_SESSION['sniff_navigator'] != "checked") {

Loading…
Cancel
Save