/**
  * Returns all the descriptions of a course.
  * @throws InvalidArgumentException if the $cid in not provided.
  * @webservice{/module/MOBILE/CLANN/getResourcesList/cidReq}
  * @ws_arg{Method,getResourcesList}
  * @ws_arg{cidReq,SYSCODE of requested cours}
  * @return array of Descriptions object
  */
 function getResourcesList()
 {
     $cid = claro_get_current_course_id();
     if ($cid == null) {
         throw new InvalidArgumentException('Missing cid argument!');
     }
     From::Module('CLCAL')->uses('agenda.lib');
     $claroNotification = Claroline::getInstance()->notification;
     $date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id());
     $list = array();
     $d = new DateTime($date);
     $d->sub(new DateInterval('P1D'));
     foreach (agenda_get_item_list(array('course' => $cid)) as $item) {
         $notified = $claroNotification->isANotifiedRessource($cid, $date, claro_get_current_user_id(), claro_get_current_group_id(), get_tool_id_from_module_label('CLCAL'), $item['id'], false);
         if ($notified) {
             $item['notifiedDate'] = $date;
         }
         $item['content'] = trim(strip_tags($item['content']));
         $item['visibility'] = $item['visibility'] != 'HIDE';
         $item['date'] = $item['day'] . ' ' . $item['hour'];
         $item['seenDate'] = $d->format('Y-m-d');
         $item['resourceId'] = $item['id'];
         unset($item['id']);
         if (claro_is_allowed_to_edit() || $item['visibility']) {
             $list[] = $item;
         }
     }
     return $list;
 }
Exemple #2
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 13708 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     CLCAL
 * @package     CLRSS
 * @author      Claro Team <*****@*****.**>
 */
function CLCAL_write_rss($context)
{
    if (is_array($context) && count($context) > 0) {
        $courseId = array_key_exists(CLARO_CONTEXT_COURSE, $context) ? $context[CLARO_CONTEXT_COURSE] : claro_get_current_course_id();
    }
    require_once dirname(__FILE__) . '/../lib/agenda.lib.php';
    $eventList = agenda_get_item_list($context, 'ASC');
    $toolNameList = claro_get_tool_name_list();
    $itemRssList = array();
    foreach ($eventList as $item) {
        if ('SHOW' == $item['visibility']) {
            $item['timestamp'] = strtotime($item['day'] . ' ' . $item['hour']);
            $item['pubDate'] = date('r', $item['timestamp']);
            $item['dc:date'] = date('c', $item['timestamp']);
            //prepare values
            //c ISO 8601 date (added in PHP 5) 2004-02-12T15:19:21+00:00
            $item['dc:date'] = 'c' == $item['dc:date'] ? date('Y-m-d\\TH:i:sO', $item['timestamp']) : $item['dc:date'];
            $item['content'] = (isset($item['speakers']) ? get_lang('Speakers') . ': ' . $item['speakers'] . '<br/>' : '') . trim(str_replace('<!-- content: html -->', '', $item['content']));
            $itemRssList[] = array('title' => $item['title'], 'category' => trim($toolNameList['CLCAL']), 'guid' => get_path('rootWeb') . 'claroline/' . 'calendar/agenda.php?cidReq=' . $courseId . '&amp;l#item' . $item['id'], 'link' => get_path('rootWeb') . 'claroline/' . 'calendar/agenda.php?cidReq=' . $courseId . '&amp;l#item' . $item['id'], 'description' => $item['content'], 'pubDate' => $item['pubDate'], 'dc:date' => $item['dc:date']);
        }
    }
    return $itemRssList;
}
Exemple #3
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 13708 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     CLCAL
 * @subpackage  CLRSS
 * @author      Claro Team <*****@*****.**>
 */
function CLCAL_write_ical($iCal, $context)
{
    if (is_array($context) && count($context) > 0) {
        $courseId = array_key_exists(CLARO_CONTEXT_COURSE, $context) ? $context[CLARO_CONTEXT_COURSE] : claro_get_current_course_id();
    }
    if (false !== ($courseData = claro_get_course_data($courseId))) {
        $toolNameList = claro_get_tool_name_list();
        require_once dirname(__FILE__) . '/../lib/agenda.lib.php';
        $eventList = agenda_get_item_list($context, 'ASC');
        $organizer = (array) array($courseData['titular'], $courseData['email']);
        $attendees = array();
        $categories = array(get_conf('siteName'), $courseData['officialCode'], trim($toolNameList['CLCAL']));
        foreach ($eventList as $thisEvent) {
            if ('SHOW' == $thisEvent['visibility']) {
                $eventDuration = isset($thisEvent['duration']) ? $thisEvent['duration'] : get_conf('defaultEventDuration', '60');
                $startDate = strtotime($thisEvent['day'] . ' ' . $thisEvent['hour']);
                // Start Time (timestamp; for an allday event the startdate has to start at YYYY-mm-dd 00:00:00)
                $endDate = $startDate + $eventDuration;
                $iCal->addEvent($organizer, $startDate, $endDate, '', 0, $categories, trim(str_replace('<!-- content: html -->', '', $thisEvent['content'])), trim($thisEvent['title']), 1, $attendees, 5, 0, 0, 0, array(), 1, '', 0, 1, get_path('rootWeb') . get_module_url('CLCAL') . '/agenda.php?cidReq=' . $courseId . '&amp;l#item' . $thisEvent['id'], get_locale('iso639_1_code'), '');
            }
        }
    }
    return $iCal;
}
Exemple #4
0
        }
        $display_form = true;
    }
    // end if cmd == 'rqEdit' && cmd == 'rqAdd'
    if ($autoExportRefresh) {
        // ical update
        if (get_conf('enableICalInCourse', 1)) {
            require_once get_path('incRepositorySys') . '/lib/ical.write.lib.php';
            buildICal(array(CLARO_CONTEXT_COURSE => claro_get_current_course_id()));
        }
    }
}
// end id is_allowed to edit
// Display
$noQUERY_STRING = true;
$eventList = agenda_get_item_list($currentContext, $orderDirection);
// Command list
$cmdList = array();
$cmdList[] = array('name' => get_lang('Today'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '#today')));
if (count($eventList) > 0) {
    if (get_conf('enableICalInCourse')) {
        $cmdList[] = array('img' => 'calendar', 'name' => get_lang('Download'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('url') . '/claroline/backends/ical.php')));
    }
    if ($orderDirection == 'DESC') {
        $cmdList[] = array('img' => 'reverse', 'name' => get_lang('Oldest first'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?order=asc')));
    } else {
        $cmdList[] = array('img' => 'reverse', 'name' => get_lang('Newest first'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?order=desc')));
    }
}
if (claro_is_allowed_to_edit()) {
    $cmdList[] = array('img' => 'agenda_new', 'name' => get_lang('Add an event'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqAdd')));