Beispiel #1
0
 public function renderContent()
 {
     $personnalCourseList = get_user_course_list(claro_get_current_user_id());
     $announcementEventList = announcement_get_items_portlet($personnalCourseList);
     $output = '';
     if ($announcementEventList) {
         $output .= '<dl id="portletMyAnnouncements">';
         foreach ($announcementEventList as $announcementItem) {
             // Hide hidden and expired elements
             $isVisible = (bool) ($announcementItem['visibility'] == 'SHOW') ? 1 : 0;
             $isOffDeadline = (bool) (isset($announcementItem['visibleFrom']) && strtotime($announcementItem['visibleFrom']) > time() || isset($announcementItem['visibleUntil']) && time() >= strtotime($announcementItem['visibleUntil'])) ? 1 : 0;
             if ($isVisible && !$isOffDeadline) {
                 $output .= '<dt>' . "\n" . '<img class="iconDefinitionList" src="' . get_icon_url('announcement', 'CLANN') . '" alt="" />' . ' <a href="' . $announcementItem['url'] . '">' . $announcementItem['title'] . '</a>' . "\n" . '</dt>' . "\n";
                 foreach ($announcementItem['eventList'] as $announcementEvent) {
                     // Prepare the render
                     $displayChar = 250;
                     if (strlen($announcementEvent['content']) > $displayChar) {
                         $content = substr($announcementEvent['content'], 0, $displayChar) . '... <a href="' . claro_htmlspecialchars(Url::Contextualize($announcementEvent['url'])) . '">' . '<b>' . get_lang('Read more &raquo;') . '</b></a>';
                     } else {
                         $content = $announcementEvent['content'];
                     }
                     $output .= '<dd>' . '<a href="' . $announcementEvent['url'] . '">' . $announcementItem['courseOfficialCode'] . '</a> : ' . "\n" . (!empty($announcementEvent['title']) ? $announcementEvent['title'] : get_lang('No title')) . "\n" . ' - ' . $content . "\n" . '</dd>' . "\n";
                 }
             }
         }
         $output .= '</dl>';
     } else {
         $output .= "\n" . '<dl>' . "\n" . '<dt>' . "\n" . '<img class="iconDefinitionList" src="' . get_icon_url('announcement', 'CLANN') . '" alt="" />' . ' ' . get_lang('No announcement to display') . "\n" . '</dt>' . "\n" . '</dl>' . "\n";
     }
     return $output;
 }
 /**
  * Returns the list of courses followed by the user.
  * @webservice{/module/MOBILE/User/getCourseList}
  * @ws_arg{Method,getCourseList}
  * @return array of course object
  */
 function getCourseList()
 {
     FromKernel::uses('courselist.lib');
     $claroNotification = Claroline::getInstance()->notification;
     $date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id());
     $courseList = array();
     $notifiedCourses = $claroNotification->getNotifiedCourses($date, claro_get_current_user_id());
     foreach (get_user_course_list(claro_get_current_user_id()) as $course) {
         $course_data = claro_get_course_data($course['sysCode']);
         $course['officialEmail'] = $course_data['email'];
         $course['notifiedDate'] = in_array($course['sysCode'], $notifiedCourses);
         $courseList[] = $course;
     }
     return $courseList;
 }
Beispiel #3
0
    $canSwitchCourses = true;
} elseif (claro_is_course_manager()) {
    // if I am course manager I will only be able to see tracking of my course
    $is_allowedToTrack = true;
    $canSwitchCourses = false;
} else {
    // Mr Nobody can see nothing.  Let's get out of here !
    claro_die(get_lang('Not allowed'));
}
/*
 * Init some other vars
 */
// user's course list
if ($canSwitchCourses) {
    // get all
    $userCourseList = get_user_course_list($userId, true);
    if (!is_array($userCourseList)) {
        $userCourseList = array();
    }
}
// user's data
$userData = user_get_properties($userId);
if (!is_array($userData)) {
    claro_die(get_lang('Cannot find user'));
}
// Command list
$cmdList = array();
if ($canSwitchCourses && count($userCourseList)) {
    $cmdList[] = array('name' => get_lang('View platform statistics'), 'url' => claro_htmlspecialchars('userReport.php?cidReset=true&userId=' . (int) $userId));
} else {
    $cmdList[] = array('img' => 'back', 'name' => get_lang('Back to user list'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('url') . '/claroline/user/user.php')));
Beispiel #4
0
 public function render()
 {
     $userCourseList = get_user_course_list(claro_get_current_user_id());
     $agendaItemList = get_agenda_items_compact_mode($userCourseList, $this->month, $this->year);
     $output = '';
     $output .= '<div class="details">' . "\n" . '<dl class="calendarDetails">' . "\n";
     if ($agendaItemList) {
         foreach ($agendaItemList as $agendaItem) {
             $output .= '<dt>' . "\n" . '<img class="iconDefinitionList" src="' . get_icon_url('agenda', 'CLCAL') . '" alt="Calendar" />&nbsp;' . claro_html_localised_date(get_locale('dateFormatLong'), strtotime($agendaItem['date'])) . '</dt>' . "\n";
             foreach ($agendaItem['eventList'] as $agendaEvent) {
                 $output .= '<dd>' . '<a href="' . $agendaEvent['url'] . '">' . $agendaEvent['courseOfficialCode'] . '</a> : ' . "\n" . $agendaEvent['content'] . "\n" . '</dd>' . "\n";
             }
         }
     } else {
         $output .= '<dt>' . "\n" . '<img class="iconDefinitionList" src="' . get_icon_url('agenda', 'CLCAL') . '" alt="" />&nbsp;' . get_lang('No event to display') . "\n" . '</dt>' . "\n";
     }
     $output .= '' . '</dl>' . "\n" . '</div>' . "\n";
     // $output .= '<div class="calendar">'.$this->ajaxMiniCalendar($agendaItemList).'</div>';
     return $output;
 }
Beispiel #5
0
// Cache_lite setting & init
$cache_options = array('cacheDir' => get_path('rootSys') . 'tmp/cache/CLCALdigest/', 'lifeTime' => get_conf('cache_lifeTime', 10), 'automaticCleaningFactor' => get_conf('cache_automaticCleaningFactor', 50));
if (claro_debug_mode()) {
    $cache_options['pearErrorMode'] = CACHE_LITE_ERROR_DIE;
}
if (claro_debug_mode()) {
    $cache_options['lifeTime'] = 120;
}
if (!file_exists($cache_options['cacheDir'])) {
    include_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
    claro_mkdir($cache_options['cacheDir'], CLARO_FILE_PERMISSIONS, true);
}
$Cache_LiteCLCALDIGEST = new Cache_Lite($cache_options);
$courseDigestList = array('courseSysCode' => array(), 'courseOfficialCode' => array(), 'toolLabel' => array(), 'date' => array(), 'content' => array());
if (false === ($htmlCLCALDIGEST = $Cache_LiteCLCALDIGEST->get('CALDIGEST' . claro_get_current_user_id()))) {
    $personnalCourseList = get_user_course_list(claro_get_current_user_id());
    foreach ($personnalCourseList as $thisCourse) {
        /*
         * ANNOUNCEMENTS : get announcements of this course since last user loggin
         */
        if (is_tool_activated_in_course(get_tool_id_from_module_label('CLANN'), $thisCourse['sysCode'])) {
            $tableAnn = get_conf('courseTablePrefix') . $thisCourse['db'] . get_conf('dbGlu') . 'announcement';
            $sql = "SELECT '" . claro_sql_escape($thisCourse['sysCode']) . "' AS `courseSysCode`,\n                       '" . claro_sql_escape($thisCourse['officialCode']) . "' AS `courseOfficialCode`,\n                       'CLANN'                                          AS `toolLabel`,\n                       CONCAT(`temps`, ' ', '00:00:00')                 AS `date`,\n                       CONCAT(`title`,' - ',`contenu`)                  AS `content`\n    \n                FROM `" . $tableAnn . "`\n                WHERE CONCAT(`title`, `contenu`) != ''\n                  AND DATE_FORMAT( `temps`, '%Y %m %d') >= '" . date('Y m d', claro_get_current_user_data('lastLogin')) . "'\n                  AND visibility = 'SHOW'\n                ORDER BY `date` DESC\n                LIMIT 1";
            $resultList = claro_sql_query_fetch_all_cols($sql);
            foreach ($resultList as $colName => $colValue) {
                if (count($colValue) == 0) {
                    break;
                }
                $courseDigestList[$colName] = array_merge($courseDigestList[$colName], $colValue);
            }
        }