Beispiel #1
0
/**
 * Return course informations in <dt> and <dd> html tags.
 * Use it in a <dl> tag (description list).
 *
 * @param $course
 * @param $hot
 * @param $displayIconAccess
 * @return string
 * @deprecated use UserCourseList and CourseTreeView instead
 */
function render_course_in_dl_list($course, $hot = false, $displayIconAccess = true)
{
    $out = '';
    $classItem = $hot ? 'hot' : '';
    $langNameOfLang = get_locale('langNameOfLang');
    // Display a manager icon if the user is manager of the course
    $userStatusImg = isset($course['isCourseManager']) && $course['isCourseManager'] == 1 ? '&nbsp;&nbsp;<img class="qtip role" src="' . get_icon_url('manager') . '" alt="' . get_lang('You are manager of this course') . '" />' : '';
    // Show course language if not the same of the platform
    if (get_conf('platformLanguage') != $course['language'] || get_conf('showAlwaysLanguageInCourseList', false)) {
        $courseLanguageTxt = !empty($langNameOfLang[$course['language']]) ? ' &ndash; ' . claro_htmlspecialchars(ucfirst($langNameOfLang[$course['language']])) : ' &ndash; ' . claro_htmlspecialchars(ucfirst($course['language']));
    } else {
        $courseLanguageTxt = '';
    }
    // Display the course title following the platform configuration requirements
    $courseTitle = get_conf('course_order_by') == 'official_code' ? $course['officialCode'] . ' - ' . $course['title'] : $course['title'] . ' (' . $course['officialCode'] . ')';
    $url = get_path('url') . '/claroline/course/index.php?cid=' . claro_htmlspecialchars($course['sysCode']);
    // Display an icon following the course's access settings
    $iconUrl = $displayIconAccess ? get_course_access_icon($course['access']) : get_icon_url('course');
    // Display course's manager email
    $managerString = isset($course['email']) && claro_is_user_authenticated() ? '<a href="mailto:' . $course['email'] . '">' . $course['titular'] . '</a>' : $course['titular'] . $courseLanguageTxt;
    // Don't give a link to the course if the user is in pending state
    $isUserPending = isset($course['isPending']) && $course['isPending'] == 1 ? true : false;
    $courseLink = '<a href="' . claro_htmlspecialchars($url) . '">' . claro_htmlspecialchars($courseTitle) . '</a>' . $userStatusImg . "\n";
    if ($isUserPending) {
        $courseLink .= ' [' . get_lang('Pending registration') . ']' . "\n";
    }
    // Make a nice explicit sentence about the course's access
    if ($course['access'] == 'public') {
        $courseAccess = get_lang('Access allowed to anybody (even without login)');
    } elseif ($course['access'] == 'platform') {
        $courseAccess = get_lang('Access allowed only to platform members (user registered to the platform)');
    } elseif ($course['access'] == 'private') {
        $courseAccess = get_lang('Access allowed only to course members (people on the course user list)');
    } else {
        $courseAccess = $course['access'];
    }
    $out .= '<dt>' . "\n" . '<img class="qtip iconDefinitionList" src="' . $iconUrl . '" alt="' . $courseAccess . '" /> ' . '<span' . (!empty($classItem) ? ' class="' . $classItem . '"' : '') . '>' . $courseLink . '</span>' . "\n" . '</dt>' . "\n" . '<dd>' . "\n" . '<span class="managerString">' . $managerString . "</span>\n";
    if (!empty($course['sessionCourses'])) {
        $out .= '<dl>' . "\n";
        foreach ($course['sessionCourses'] as $sessionCourse) {
            $out .= render_course_in_dl_list($sessionCourse, $sessionCourse['hot']) . "\n";
        }
        $out .= '</dl>' . "\n";
    }
    $out .= '</dd>' . "\n\n";
    return $out;
}
Beispiel #2
0
}
?>

<?php 
if (count($this->coursesList) > 0) {
    ?>
    <h4><?php 
    echo get_lang('Courses in this category');
    ?>
</h4>
    <dl class="userCourseList">
        <?php 
    foreach ($this->coursesList as $course) {
        ?>
            <?php 
        echo render_course_in_dl_list($course, false);
        ?>
        <?php 
    }
    ?>
    </dl>
<?php 
} else {
    ?>
    <?php 
    if (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] = 'search')) {
        ?>
        <p>
            <?php 
        echo get_lang('Your search did not match any courses');
        ?>