Fix icons and URLs see #7619

1.10.x
Julio Montoya 10 years ago
parent a92829660c
commit f50e730961
  1. 25
      main/inc/lib/sessionmanager.lib.php
  2. 64
      main/inc/lib/userportal.lib.php

@ -7338,7 +7338,8 @@ class SessionManager
$listOneCourse = array();
$listOneCourse['courseId'] = $courseId;
$listOneCourse['title'] = $courseInfo['title'];
$listOneCourse['courseCode'] = $courseInfo['code'];
//$listOneCourse['courseCode'] = $courseInfo['code'];
$listOneCourse['course'] = $courseInfo;
$listOneCourse['sessionCatList'] = array();
$listCat = array();
foreach ($listSessionId as $i => $sessionId) {
@ -7474,17 +7475,18 @@ class SessionManager
$htmlRes = '';
$listInfo = self::getNamedSessionCourseForCoach($userId);
foreach($listInfo as $i => $listCoursesInfo) {
$courseCode = $listCoursesInfo['courseCode'];
$courseTitle = $listCoursesInfo['title'];
foreach ($listInfo as $i => $listCoursesInfo) {
$courseInfo = $listCoursesInfo['course'];
$courseCode = $listCoursesInfo['course']['code'];
$listParamsCourse = array();
$listParamsCourse['icon'] = '<div style="float:left">
<input style="border:none;" type="button" onclick="$(\'#course-'.$courseCode.'\').toggle(\'fast\')" value="+" /></div>'.
Display::return_icon('blackboard.png', $listCoursesInfo['title'], array(), ICON_SIZE_LARGE);
Display::return_icon('blackboard.png', $courseInfo['title'], array(), ICON_SIZE_LARGE);
$listParamsCourse['link'] = '';
$listParamsCourse['title'] = Display::tag(
'a',
$listCoursesInfo['title'],
$courseInfo['title'],
array('href' => $listParamsCourse['link'])
);
$htmlCourse = '<div class="well" style="border-color:#27587D">'.
@ -7517,10 +7519,11 @@ class SessionManager
$listParamsSession['icon'] = Display::return_icon('blackboard_blue.png', $sessionName, array(), ICON_SIZE_LARGE);
$listParamsSession['link'] = '';
$linkToCourseSession = api_get_path(WEB_PATH).'courses/'.$courseCode.'/?id_session='.$sessionId;
$listParamsSession['title'] = $sessionName.'<div style="font-weight:normal; font-style:italic">
<a href="'.$linkToCourseSession.'">
'.get_lang('GoToCourseInsideSession').'</a></div>';
$linkToCourseSession = $courseInfo['course_public_url'].'?id_session='.$sessionId;
$listParamsSession['title'] =
$sessionName.'<div style="font-weight:normal; font-style:italic">
<a href="'.$linkToCourseSession.'">'.get_lang('GoToCourseInsideSession').'</a>
</div>';
$htmlSession .= '<div style="margin-left:'.$marginShift.'px;">'.
CourseManager::course_item_html($listParamsSession, true).'</div>';
}
@ -7531,6 +7534,4 @@ class SessionManager
return $htmlRes;
}
}

@ -1363,8 +1363,7 @@ class IndexManager
}
}
$special_courses = '';
$specialCourses = '';
$loadDirs = $this->load_directories_preview;
// If we're not in the history view...
@ -1387,6 +1386,7 @@ class IndexManager
);
$listCourse = api_get_course_info_by_id($listCourseCodeId['real_id']);
$listCoursesInfo[] = array(
'course' => $listCourse,
'code' => $listCourseCodeId['code'],
'id' => $listCourseCodeId['real_id'],
'title' => $listCourse['title'],
@ -1432,17 +1432,16 @@ class IndexManager
} else {
$htmlCategory .= '<div class="session-view-row" >';
}
$coursesInfo = $listCourse['course'];
$htmlCategory .= self::getHtmlForCourse(
$listCourse['courseId'],
$listCourse['title'],
$listCourse['courseCode'],
$coursesInfo,
$userCategoryId,
1,
$loadDirs
);
// list of session category
$htmlSessionCategory = '<div class="session-view-row" style="display:none;" id="courseblock-'.$listCourse['courseId'].'">';
$htmlSessionCategory = '<div class="session-view-row" style="display:none;" id="courseblock-'.$coursesInfo['real_id'].'">';
foreach ($listCourse['sessionCatList'] as $j => $listCategorySession) {
// add session category
$htmlSessionCategory .= self::getHtmlSessionCategory(
@ -1458,7 +1457,7 @@ class IndexManager
$listSession['sessionId'],
$listSession['sessionName'],
$listCategorySession['catSessionId'],
$listCourse['courseCode']
$coursesInfo
);
$htmlSession .= '</div>';
$sessionCount++;
@ -1484,9 +1483,7 @@ class IndexManager
$htmlCategory .= '<div class="session-view-well well">';
}
$htmlCategory .= self::getHtmlForCourse(
$listCourse['id'],
$listCourse['title'],
$listCourse['code'],
$listCourse['course'],
$userCategoryId,
0,
$loadDirs
@ -1524,7 +1521,7 @@ class IndexManager
$icon = Display::return_icon(
'folder_yellow.png',
$title,
array('class' => 'sessionView', 'width' => 24),
array('class' => 'sessionView'),
ICON_SIZE_LARGE
);
return "<div class='session-view-user-category'>$icon<span>$title</span></div>";
@ -1532,16 +1529,26 @@ class IndexManager
/**
* return HTML code for course display in session view
* @param $id
* @param $title
* @param $code
* @param array $courseInfo
* @param $userCategoryId
* @param bool $displayButton
* @param $loadDirs
* @return string
*/
private static function getHtmlForCourse($id, $title, $code, $userCategoryId, $displayButton = false, $loadDirs)
{
private static function getHtmlForCourse(
$courseInfo,
$userCategoryId,
$displayButton = false,
$loadDirs
) {
if (empty($courseInfo)) {
return '';
}
$id = $courseInfo['real_id'];
$title = $courseInfo['title'];
$code = $courseInfo['code'];
$class = 'session-view-lvl-6';
if ($userCategoryId != 0 && !$displayButton) {
$class = 'session-view-lvl-7';
@ -1560,11 +1567,11 @@ class IndexManager
$icon = Display::return_icon(
'blackboard.png',
$title,
array('class' => 'sessionView', 'width' => 24),
array('class' => 'sessionView'),
ICON_SIZE_LARGE
);
$courseLink = api_get_path(WEB_COURSE_PATH).$code.'/index.php?id_session=0';
$courseLink = $courseInfo['course_public_url'].'?id_session=0';
// get html course params
// ['right_actions'] ['teachers'] ['notifications']
@ -1603,7 +1610,7 @@ class IndexManager
$icon = Display::return_icon(
'folder_blue.png',
$title,
array('class' => 'sessionView', 'width' => 24),
array('class' => 'sessionView'),
ICON_SIZE_LARGE
);
@ -1617,17 +1624,18 @@ class IndexManager
/**
* return HTML code for session
* @param $id
* @param $title
* @param $categotySessionId
* @param $courseCode
* @param int $id session id
* @param string $title session title
* @param int $categorySessionId
* @param array $courseInfo
*
* @return string
*/
private static function getHtmlForSession($id, $title, $categotySessionId, $courseCode)
private static function getHtmlForSession($id, $title, $categorySessionId, $courseInfo)
{
$html = '';
if ($categotySessionId == 0) {
if ($categorySessionId == 0) {
$class1 = 'session-view-lvl-2'; // session
$class2 = 'session-view-lvl-4'; // got to course in session link
} else {
@ -1638,14 +1646,14 @@ class IndexManager
$icon = Display::return_icon(
'blackboard_blue.png',
$title,
array('class' => 'sessionView', 'width' => 24),
array('class' => 'sessionView'),
ICON_SIZE_LARGE
);
$courseLink = api_get_path(WEB_COURSE_PATH).$courseCode.'/index.php?id_session='.intval($id);
$courseLink = $courseInfo['course_public_url'].'?id_session='.intval($id);
$html .= "<span class='$class1 session-view-session'>$icon$title</span>";
$html .= '<div class="'.$class2.' session-view-session-go-to-course-in-session">
<a class="" href="'.$courseLink.'">'.get_lang('GoToCourseInsideSession').'</a></div>';
<a class="" href="'.$courseLink.'">'.get_lang('GoToCourseInsideSession').'</a></div>';
return '<div>'.$html.'</div>';
}

Loading…
Cancel
Save