/** * 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 CLANN * @subpackage CLICAL * @author Claro Team <*****@*****.**> */ function CLANN_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(); } require_once dirname(__FILE__) . '/../lib/announcement.lib.php'; $courseData = claro_get_course_data($courseId); $toolNameList = claro_get_tool_name_list(); $announcementList = announcement_get_item_list($context, 'DESC'); $organizer = (array) array($courseData['titular'], $courseData['email']); $attendees = array(); $categories = array(get_conf('siteName'), $courseData['officialCode'], trim($toolNameList['CLANN'])); foreach ($announcementList as $announcementItem) { if ('SHOW' == $announcementItem['visibility']) { /* $rssList[] = array( 'title' => trim($announcementItem['title']) , 'category' => trim($toolNameList['CLANN']) , 'guid' => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id'] , 'link' => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id'] , 'description' => trim(str_replace('<!-- content: html -->','',$announcementItem['content'])) , 'pubDate' => date('r', stripslashes(strtotime($announcementItem['time']))) //, 'author' => $_course['email'] ); */ $iCal->addJournal(trim($announcementItem['title']), trim(str_replace('<!-- content: html -->', '', $announcementItem['content'])), strtotime($announcementItem['time']), strtotime($announcementItem['time']), time(), 1, 1, $organizer, $attendees, $categories, 5, 10, 1, array(), 0, '', get_path('rootWeb') . get_module_url('CLANN') . '/announcements.php?cidReq=' . $courseId . '&l#ann' . $announcementItem['id'], get_locale('iso639_1_code'), ''); } } return $iCal; }
/** * 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 CLANN * @subpackage CLRSS * @author Claro Team <*****@*****.**> */ function CLANN_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/announcement.lib.php'; $toolNameList = claro_get_tool_name_list(); $announcementList = announcement_get_item_list($context, 'DESC'); $rssList = array(); foreach ($announcementList as $announcementItem) { if ('SHOW' == $announcementItem['visibility']) { $rssList[] = array('title' => trim($announcementItem['title']), 'category' => trim($toolNameList['CLANN']), 'guid' => get_path('rootWeb') . 'claroline/' . 'announcements/announcements.php?cidReq=' . $courseId . '&l#ann' . $announcementItem['id'], 'link' => get_path('rootWeb') . 'claroline/' . 'announcements/announcements.php?cidReq=' . $courseId . '&l#ann' . $announcementItem['id'], 'description' => trim(str_replace('<!-- content: html -->', '', $announcementItem['content'])), 'pubDate' => date('r', stripslashes(strtotime($announcementItem['time']))), 'dc:date' => date('c', stripslashes(strtotime($announcementItem['time'])))); } } return $rssList; }
/** * CLAROLINE * * @version 1.8 $Revision: 13708 $ * * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * * @package CLWRK * * @author Claro Team <*****@*****.**> */ function CLWRK_write_ical($iCal, $context) { if (is_array($context) && count($context) > 0) { $courseCode = array_key_exists(CLARO_CONTEXT_COURSE, $context) ? $context[CLARO_CONTEXT_COURSE] : ($courseCode = claro_get_current_course_id()); $courseData = claro_get_course_data($courseCode); $toolNameList = claro_get_tool_name_list(); $assignmentList = assignmentList($courseCode); $organizer = (array) array($courseData['titular'], $courseData['email']); $attendees = array(); $categories = array(get_conf('siteName'), $courseData['officialCode'], trim($toolNameList['CLWRK'])); foreach ($assignmentList as $thisAssignment) { if ('VISIBLE' == $thisAssignment['visibility']) { $categories[] = $thisAssignment['assignment_type']; $assignmentContent = trim(strip_tags($thisAssignment['description'])); $iCal->addToDo(trim($thisAssignment['title']), $assignmentContent, '', (int) $thisAssignment['start_date_unix'], 3600, (int) $thisAssignment['end_date_unix'], 0, 5, 1, 1, $organizer, $attendees, $categories, time(), 0, 0, 0, 0, array(), 1, '', get_path('rootWeb') . 'work/work_list.php?cidReq=' . $courseCode . '&assigId=' . $thisAssignment['id'], get_locale('iso639_1_code'), ''); } } } return $iCal; }
/** * 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 . '&l#item' . $item['id'], 'link' => get_path('rootWeb') . 'claroline/' . 'calendar/agenda.php?cidReq=' . $courseId . '&l#item' . $item['id'], 'description' => $item['content'], 'pubDate' => $item['pubDate'], 'dc:date' => $item['dc:date']); } } return $itemRssList; }
/** * 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 . '&l#item' . $thisEvent['id'], get_locale('iso639_1_code'), ''); } } } return $iCal; }
* This tool is "groupe_home" + "group_user". * * @version $Revision: 14429 $ * @copyright 2001-2011 Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @see http://www.claroline.net/wiki/index.php/CLGRP * @package CLGRP * @author Claro Team <*****@*****.**> */ $cidNeeded = true; $gidNeeded = true; $tlabelReq = 'CLGRP'; require '../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; require_once dirname(__FILE__) . '/../messaging/lib/permission.lib.php'; $toolNameList = claro_get_tool_name_list(); $toolRepository = get_path('clarolineRepositoryWeb'); $dialogBox = new DialogBox(); if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } // block if !claro_is_in_a_group() // accept if claro_is_group_allowed() if (!claro_is_allowed_to_edit()) { if (!claro_is_in_a_group()) { claro_redirect('group.php'); exit; } elseif (!claro_is_group_allowed() && !(isset($_REQUEST['selfReg']) || isset($_REQUEST['doReg']))) { claro_redirect('group.php'); exit; }
/** * return all info of tool for a course * * @param $cid the id of a course * @return array (array) an associative array containing all info of tool for a course */ function get_course_tool_list($cid) { $toolNameList = claro_get_tool_name_list(); $_course = get_info_course($cid); $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_tool = $tbl_mdb_names['tool']; $courseToolList = array(); if ($cid) { $sql = "SELECT ctl.id id,\n pct.claro_label label,\n ctl.script_name name,\n ctl.visibility visibility,\n pct.icon icon,\n pct.access_manager access_manager,\n\n IF(pct.script_url IS NULL ,\n ctl.script_url,CONCAT('" . get_path('clarolineRepositoryWeb') . "',\n pct.script_url)) url\n\n FROM `" . $_course['dbNameGlu'] . "tool_list` ctl\n\n LEFT JOIN `" . $tbl_tool . "` pct\n ON pct.id = ctl.tool_id\n\n ORDER BY ctl.rank"; $result = claro_sql_query($sql) or die('WARNING !! DB QUERY FAILED ! ' . __LINE__); while ($tlistData = mysql_fetch_array($result)) { $courseToolList[] = $tlistData; } $tmp = array(); foreach ($courseToolList as $courseTool) { if (isset($courseTool['label'])) { $label = $courseTool['label']; $courseTool['name'] = $toolNameList[$label]; } $tmp[] = $courseTool; } $courseToolList = $tmp; unset($tmp); } return $courseToolList; }
/** * Return the name of a given module * * @param mixed $identifier * interger for a module id * string for a claro label * @return string translated tool name; */ function claro_get_module_name($identifier) { static $cachedModuleIdList = null; if (is_numeric($identifier)) { // identifier is a tool_id if (!$cachedModuleIdList) { $tbl = claro_sql_get_main_tbl(); $sql = "SELECT id AS toolId,\n claro_label AS claroLabel\n FROM `" . $tbl['tool'] . "`"; $moduleList = claro_sql_query_fetch_all($sql); foreach ($moduleList as $thisModule) { $toolId = $thisModule['toolId']; $claroLabel = $thisModule['claroLabel']; $cachedModuleIdList[$toolId] = $claroLabel; } } // get tool label of the tool $toolLabel = isset($cachedModuleIdList[$identifier]) ? $cachedModuleIdList[$identifier] : false; } else { // identifier is a tool label $toolLabel = $identifier; } $toolNameList = claro_get_tool_name_list(); if (isset($toolNameList[$toolLabel])) { return get_lang($toolNameList[$toolLabel]); } /* if ( isset($toolNameList[$toolLabel]) ) { $moduleData = get_module_data($toolLabel); if (is_array($moduleData)) { $moduleName = $moduleData['moduleName']; return get_lang($moduleName); } } */ return get_lang('No tool name'); }