/** * Returns a single resquested announce. * @param array $args must contain 'resID' key with the resource identifier of the requested resource * @throws InvalidArgumentException if one of the paramaters is missing * @webservice{/module/MOBILE/CLANN/getSingleResource/cidReq/resId} * @ws_arg{Method,getSingleResource} * @ws_arg{cidReq,SYSCODE of requested cours} * @ws_arg{resID,Resource Id of requested resource} * @return announce object (can be null if not visible for the current user) */ function getSingleResource($args) { $resourceId = isset($args['resID']) ? $args['resID'] : null; $cid = claro_get_current_course_id(); if ($cid == null || $resourceId == null) { throw new InvalidArgumentException('Missing cid or resourceId argument!'); } $claroNotification = Claroline::getInstance()->notification; $date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id()); $d = new DateTime($date); $d->sub(new DateInterval('PT1M')); From::Module('CLANN')->uses('announcement.lib'); if ($announce = $this->announcement_get_item($resourceId, $cid)) { $notified = $claroNotification->isANotifiedRessource($cid, $date, claro_get_current_user_id(), claro_get_current_group_id(), get_tool_id_from_module_label('CLANN'), $announce['id'], false); $announce['visibility'] = $announce['visibility'] != 'HIDE'; $announce['content'] = trim(strip_tags($announce['content'])); $announce['cours']['sysCode'] = $cid; $announce['resourceId'] = $announce['id']; $announce['date'] = $announce['time']; $announce['notifiedDate'] = $notified ? $date : $announce['time']; $announce['seenDate'] = $d->format('Y-m-d H:i'); unset($announce['id']); return claro_is_allowed_to_edit() || $announce['visibility'] ? $announce : null; } else { throw new RuntimeException('Resource not found', 404); } }
/** * Returns all the descriptions of a course. * @throws InvalidArgumentException if the $cid in not provided. * @webservice{/module/MOBILE/GEN/getResourcesList/cidReq} * @ws_arg{method,getResourcesList} * @ws_arg{cidReq,SYSCODE of requested cours} * @return array of Descriptions object */ function getResourcesList($args) { $module = isset($args['module']) ? $args['module'] : null; $cid = claro_get_current_course_id(); if ($cid == null || $module == null) { throw new InvalidArgumentException('Missing cid argument!'); } $list = array(); FromKernel::uses('core/linker.lib'); ResourceLinker::init(); $locator = new ClarolineResourceLocator($cid, $module, null, claro_get_current_group_id()); if (ResourceLinker::$Navigator->isNavigable($locator)) { $resourceList = ResourceLinker::$Navigator->getResourceList($locator); foreach ($resourceList as $lnk) { $inLocator = $lnk->getLocator(); $item['title'] = $lnk->getName(); $item['visibility'] = $lnk->isVisible(); $item['url'] = str_replace(get_path('url'), "", get_path('rootWeb')) . ResourceLinker::$Resolver->resolve($inLocator); if ($inLocator->hasResourceId()) { $item['resourceId'] = $inLocator->getResourceId(); } else { $item['resourceId'] = $item['url']; } if (claro_is_allowed_to_edit() || $item['visibility']) { $list[] = $item; } } } return $list; }
/** * 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; }
/** * Returns a single resquested decsription. * @param array $args must contain 'resID' key with the resource identifier of the requested resource * @throws InvalidArgumentException if one of the paramaters is missing * @webservice{/module/MOBILE/CLANN/getSingleResource/cidReq/resId} * @ws_arg{Method,getSingleResource} * @ws_arg{cidReq,SYSCODE of requested cours} * @ws_arg{resID,Resource Id of requested resource} * @return announce object (can be null if not visible for the current user) */ function getSingleResource($args) { $resourceId = isset($args['resID']) ? $args['resID'] : null; $cid = claro_get_current_course_id(); if ($cid == null || $resourceId == null) { throw new InvalidArgumentException('Missing cid or resourceId argument!'); } From::Module('CLDSC')->uses('courseDescription.lib', 'courseDescription.class'); $result; foreach (course_description_get_item_list($cid) as $item) { if (claro_is_allowed_to_edit() || $item['visibility'] != 'HIDE') { if ($item['id'] == $resourceId) { $result = $item; break; } } } if ($result != null) { $result['content'] = trim(strip_tags($result['content'])); $result['visibility'] = $result['visibility'] != 'HIDE'; $result['resourceId'] = $result['id']; unset($result['id']); return $result; } else { throw new RuntimeException('Resource not found', 404); } }
public function __construct($userId = null, $courseId = null, $database = null) { $this->userId = $userId ? $userId : claro_get_current_user_id(); $this->courseId = $courseId ? $courseId : claro_get_current_course_id(); $this->database = $database ? $database : Claroline::getDatabase(); $this->tbl = array_merge(get_module_main_tbl(array('rel_course_user')), get_module_course_tbl(array('group_team', 'group_rel_team_user'))); }
public function __construct($assignement, $courseId = null, $database = null) { $this->database = $database ? $database : Claroline::getDatabase(); $this->assignement = $assignement; $this->courseId = $courseId ? $courseId : claro_get_current_course_id(); $this->tbl = array_merge(get_module_main_tbl(array('rel_course_user', 'user')), get_module_course_tbl(array('wrk_submission', 'group_team'), $this->courseId)); $this->submissionTitleList = array(); }
public function renderContent() { $output = ''; $course = claro_get_current_course_data(); $course['db'] = $course['dbName']; $toolId = get_tool_id_from_module_label('CLANN'); if (is_module_installed_in_course('CLANN', claro_get_current_course_id()) && is_tool_activated_in_course($toolId, claro_get_current_course_id()) && claro_is_tool_visible($toolId, claro_get_current_course_id())) { $announcementList = announcement_get_course_item_list_portlet($course); // Manage announcement's datas if ($announcementList) { $output .= '<dl id="portletAnnouncements">' . "\n"; $i = 0; foreach ($announcementList as $announcementItem) { // Generate announcement URL $announcementItem['url'] = get_path('url') . '/claroline/announcements/announcements.php?cidReq=' . $course['sysCode']; // Generate announcement title and content $announcementItem['title'] = trim(strip_tags($announcementItem['title'])); if ($announcementItem['title'] == '') { $announcementItem['title'] = substr($announcementItem['title'], 0, 60) . (strlen($announcementItem['title']) > 60 ? ' (...)' : ''); } $announcementItem['content'] = trim(strip_tags($announcementItem['content'])); if ($announcementItem['content'] == '') { $announcementItem['content'] = substr($announcementItem['content'], 0, 60) . (strlen($announcementItem['content']) > 60 ? ' (...)' : ''); } // Don't display 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; // Prepare the render $displayChar = 250; if (strlen($announcementItem['content']) > $displayChar) { $content = substr($announcementItem['content'], 0, $displayChar) . '... <a href="' . claro_htmlspecialchars(Url::Contextualize($announcementItem['url'])) . '">' . '<b>' . get_lang('Read more »') . '</b></a>'; } else { $content = $announcementItem['content']; } if ($isVisible && !$isOffDeadline) { $output .= '<dt>' . "\n" . '<h2> ' . '<a href="' . $announcementItem['url'] . '#item' . $announcementItem['id'] . '">' . (!empty($announcementItem['title']) ? $announcementItem['title'] : get_lang('No title')) . '</a></h2>' . "\n" . '</dt>' . "\n" . '<dd' . ($i == count($announcementList) - 1 ? ' class="last"' : '') . '>' . "\n" . $content . "\n" . (claro_is_allowed_to_edit() ? '<div class="manageTools"><a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLANN') . '/announcements.php?cmd=rqEdit&id=' . $announcementItem['id'])) . '" title="' . get_lang('Edit this item') . '"> <img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" /> </a> <a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLANN') . '/announcements.php?cmd=exDelete&id=' . $announcementItem['id'])) . '" title="' . get_lang('Delete this item') . '"> <img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" /> </a></div>' : '') . '</dd>' . "\n"; } $i++; } $output .= '</dl>'; } else { $output .= "\n" . '<dl>' . "\n" . '<dt></dt>' . "\n" . '<dd class="last">' . ' ' . get_lang('No announcement') . "\n" . '</dd>' . "\n" . '</dl>' . "\n\n"; } } return $output; }
/** * Add a message to the log. The message will be associated with the current * course_code, user_id, tool_id, date and IP address of the client * @param string $type * @param string $data * @return boolean */ public function log($type, $data) { $cid = claro_get_current_course_id(); $tid = claro_get_current_tool_id(); $uid = claro_get_current_user_id(); $date = claro_date("Y-m-d H:i:s"); $ip = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; $data = serialize($data); $sql = "INSERT INTO `" . $this->tbl_log . "`\n SET `course_code` = " . (is_null($cid) ? "NULL" : "'" . claro_sql_escape($cid) . "'") . ",\n `tool_id` = " . (is_null($tid) ? "NULL" : "'" . claro_sql_escape($tid) . "'") . ",\n `user_id` = " . (is_null($uid) ? "NULL" : "'" . claro_sql_escape($uid) . "'") . ",\n `ip` = " . (is_null($ip) ? "NULL" : "'" . claro_sql_escape($ip) . "'") . ",\n `date` = '" . $date . "',\n `type` = '" . claro_sql_escape($type) . "',\n `data` = '" . claro_sql_escape($data) . "'"; return claro_sql_query($sql); }
public function __construct() { $this->courseCode = claro_get_current_course_id(); $this->courseId = ClaroCourse::getIdFromCode($this->courseCode); $this->userId = claro_get_current_user_id(); $this->profileId = claro_get_current_user_profile_id_in_course(); $this->viewMode = claro_get_tool_view_mode(); $this->courseObject = new ClaroCourse(); $this->courseObject->load($this->courseCode); $this->currentCourseContext = Claro_Context::getUrlContext(array(CLARO_CONTEXT_COURSE => $this->courseCode)); $this->template = new CoreTemplate('coursetoollist.tpl.php'); }
/** * * @param AuthProfile $userAuthProfile profile of the user we want to enrol to the cours * @param Claro_Course $course kernel object representing the course * @param type $givenCourseKey optionnal given registration key (default null) * @param type $categoryId optionnal given categoryId (default null) */ public function __construct(AuthProfile $userAuthProfile, Claro_Course $course, $givenCourseKey = null, $categoryId = null) { $this->userAuthProfile = $userAuthProfile; $this->course = $course; $this->givenCourseKey = $givenCourseKey; $this->categoryId = $categoryId; // is the user doing the registration a super user ? if (claro_is_in_a_course() && claro_get_current_course_id() == $this->course->courseId) { $this->isSuperUser = claro_is_platform_admin() || claro_is_course_manager() || claro_is_allowed_tool_edit(get_module_data('CLUSER', 'id')); } else { $this->isSuperUser = claro_is_platform_admin(); } }
/** * 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; }
private function change_img_url_for_pdf($str) { $pattern = '/(.*?)<img (.*?)src=(\'|")(.*?)url=(.*?)=&(.*?)(\'|")(.*?)>(.*?)/is'; if (!preg_match($pattern, urldecode($str), $matches)) { return $str; } if (count($matches) != 10) { return $str; } if (is_download_url_encoded($matches[5])) { $matches[5] = download_url_decode($matches[5]); } $matches[5] = get_conf('rootWeb') . 'courses/' . claro_get_current_course_id() . '/document' . $matches[5]; //$replace = strip_tags( $matches[1] ) . '<img ' . /*$matches[2] .*/ ' src="' . $matches[5] .'" ' . /*$matches[8] .*/ '>' . strip_tags( $matches[9] ); $replace = strip_tags($matches[1]) . '<img src="' . $matches[5] . '" >' . strip_tags($matches[9]); return $replace; }
/** * 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; }
/** * Get the current execution context * @return array */ public static function getCurrentContext() { $context = array(); if (claro_is_in_a_course()) { $context[CLARO_CONTEXT_COURSE] = claro_get_current_course_id(); } if (claro_is_in_a_group()) { $context[CLARO_CONTEXT_GROUP] = claro_get_current_group_id(); } if (claro_is_in_a_tool()) { if (isset($GLOBALS['tlabelReq']) && $GLOBALS['tlabelReq']) { $context[CLARO_CONTEXT_TOOLLABEL] = $GLOBALS['tlabelReq']; } if (claro_get_current_tool_id()) { $context[CLARO_CONTEXT_TOOLINSTANCE] = claro_get_current_tool_id(); } } if (get_current_module_label()) { $context[CLARO_CONTEXT_MODULE] = get_current_module_label(); } return $context; }
/** * return the autorisation of the current user to send a message to the user in parameter * * @param int $userId user id of the recipient * @return bool true if the current user is autorised do send a message to the user in parameter * flase if the current user is not autorised do send a message to the user in parameter */ function current_user_is_allowed_to_send_message_to_user($userId) { if (claro_is_platform_admin()) { return true; } if (claro_is_in_a_group()) { if (claro_is_group_tutor() || claro_is_course_manager()) { $userList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id()); for ($count = 0; $count < count($userList); $count++) { if ($userList[$count]['id'] == $userId) { return true; } } } return false; } elseif (claro_is_in_a_course()) { if (claro_is_course_manager()) { $userList = claro_get_course_user_list(); for ($count = 0; $count < count($userList); $count++) { if ($userList[$count]['user_id'] == $userId) { return true; } } } return false; } else { // can answerd to a user $tableName = get_module_main_tbl(array('im_message', 'im_recipient')); $select = "SELECT count(*)\n" . " FROM `" . $tableName['im_message'] . "` as M\n" . " INNER JOIN `" . $tableName['im_recipient'] . "` as R ON R.message_id = M.message_id\n" . " WHERE (R.user_id = " . (int) claro_get_current_user_id() . " OR R.user_id = 0)\n" . " AND M.sender = " . (int) $userId; $nbMessage = claro_sql_query_fetch_single_value($select); if ($nbMessage > 0) { return true; } elseif (get_conf('userCanSendMessage')) { } return true; return false; } }
/** * 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; }
/** * Return the breadcrumb to display in the header * * @global string $nameTools * @global array $interbredcrump * @global boolean $noPHP_SELF * @global boolean $noQUERY_STRING * * @return string html content */ function claro_html_breadcrumb() { // dirty global to keep value (waiting a refactoring) global $nameTools, $interbredcrump, $noPHP_SELF, $noQUERY_STRING; /****************************************************************************** BREADCRUMB LINE ******************************************************************************/ $htmlBC = ''; if (claro_is_in_a_course() || isset($nameTools) || isset($interbredcrump) && is_array($interbredcrump)) { $htmlBC .= '<div id="breadcrumbLine">' . "\n\n" . '<hr />' . "\n"; $breadcrumbUrlList = array(); $breadcrumbNameList = array(); $breadcrumbUrlList[] = get_path('url') . '/index.php'; $breadcrumbNameList[] = get_conf('siteName'); if (claro_is_in_a_course()) { $breadcrumbUrlList[] = get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars(claro_get_current_course_id()); $breadcrumbNameList[] = claro_get_current_course_data('officialCode'); } if (claro_is_in_a_group()) { $breadcrumbUrlList[] = get_module_url('CLGRP') . '/index.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()); $breadcrumbNameList[] = get_lang('Groups'); $breadcrumbUrlList[] = get_module_url('CLGRP') . '/group_space.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()) . '&gidReq=' . (int) claro_get_current_group_id(); $breadcrumbNameList[] = claro_get_current_group_data('name'); } if (isset($interbredcrump) && is_array($interbredcrump)) { while (list(, $bredcrumpStep) = each($interbredcrump)) { $breadcrumbUrlList[] = $bredcrumpStep['url']; $breadcrumbNameList[] = $bredcrumpStep['name']; } } if (isset($nameTools)) { $breadcrumbNameList[] = $nameTools; if (isset($noPHP_SELF) && $noPHP_SELF) { $breadcrumbUrlList[] = null; } elseif (isset($noQUERY_STRING) && $noQUERY_STRING) { $breadcrumbUrlList[] = $_SERVER['PHP_SELF']; } else { // set Query string to empty if not exists if (!isset($_SERVER['QUERY_STRING'])) { $_SERVER['QUERY_STRING'] = ''; } $breadcrumbUrlList[] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; } } $htmlBC .= claro_html_breadcrumbtrail($breadcrumbNameList, $breadcrumbUrlList, ' > ', get_icon_url('home')); if (!claro_is_user_authenticated()) { $htmlBC .= "\n" . '<div id="toolViewOption" style="padding-right:10px">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/login.php' . '?sourceUrl=' . urlencode(base64_encode((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) . '" target="_top">' . get_lang('Login') . '</a>' . '</div>' . "\n"; } elseif (claro_is_in_a_course() && !claro_is_course_member() && claro_get_current_course_data('registrationAllowed') && !claro_is_platform_admin()) { $htmlBC .= '<div id="toolViewOption">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>' . '</div>' . "\n"; } elseif (claro_is_display_mode_available()) { $htmlBC .= "\n" . '<div id="toolViewOption">' . "\n"; if (isset($_REQUEST['View mode'])) { $htmlBC .= claro_html_tool_view_option($_REQUEST['View mode']); } else { $htmlBC .= claro_html_tool_view_option(); } if (claro_is_platform_admin() && !claro_is_course_member()) { $htmlBC .= ' | <a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">'; $htmlBC .= '<img src="' . get_icon_url('enroll') . '" alt="" /> '; $htmlBC .= '<b>' . get_lang('Enrolment') . '</b>'; $htmlBC .= '</a>'; } $htmlBC .= "\n" . '</div>' . "\n"; } $htmlBC .= '<div class="spacer"></div>' . "\n" . '<hr />' . "\n" . '</div>' . "\n"; } else { // $htmlBC .= '<div style="height:1em"></div>'; } return $htmlBC; }
$feedbackConditionList[] = "`fb`.`original_id` = " . (int) claro_get_current_user_id(); } } $submissionFilterSql = implode(' OR ', $submissionConditionList); if (!empty($submissionFilterSql)) { $submissionFilterSql = ' AND (' . $submissionFilterSql . ') '; } $feedbackFilterSql = implode(' OR ', $feedbackConditionList); if (!empty($feedbackFilterSql)) { $feedbackFilterSql = ' AND (' . $feedbackFilterSql . ')'; } if ($assignment->getAssignmentType() == 'INDIVIDUAL') { if (!$is_allowedToEditAll) { $showOnlyVisibleCondition = " HAVING `submissionCount` > 0"; } $sql = "SELECT `u`.`user_id` AS `authId`,\n CONCAT(`u`.`nom`, ' ', `u`.`prenom`) AS `name`,\n `s`.`title`,\n COUNT(DISTINCT(`s`.`id`)) AS `submissionCount`,\n COUNT(DISTINCT(`fb`.`id`)) AS `feedbackCount`,\n MAX(`fb`.`score`) AS `maxScore`,\n MAX(`s`.`last_edit_date`) AS `last_edit_date`\n\n #GET USER LIST\n FROM `" . $tbl_user . "` AS `u`\n\n #ONLY FROM COURSE\n INNER JOIN `" . $tbl_rel_course_user . "` AS `cu`\n ON `u`.`user_id` = `cu`.`user_id`\n AND `cu`.`code_cours` = '" . claro_sql_escape(claro_get_current_course_id()) . "'\n\n # SEARCH ON SUBMISSIONS\n LEFT JOIN `" . $tbl_wrk_submission . "` AS `s`\n ON ( `s`.`assignment_id` = " . (int) $req['assignmentId'] . " OR `s`.`assignment_id` IS NULL)\n AND `s`.`user_id` = `u`.`user_id`\n AND `s`.`original_id` IS NULL\n " . $submissionFilterSql . "\n\n # SEARCH ON FEEDBACKS\n LEFT JOIN `" . $tbl_wrk_submission . "` as `fb`\n ON `fb`.`parent_id` = `s`.`id`\n " . $feedbackFilterSql . "\n\n GROUP BY `u`.`user_id`,\n `s`.`original_id`\n " . $showOnlyVisibleCondition; if (isset($_GET['sort']) && isset($_GET['dir'])) { $sortKeyList[$_GET['sort']] = $_GET['dir']; } elseif (isset($_GET['sort']) && isset($_GET['dir'])) { $sortKeyList[$_GET['sort']] = SORT_ASC; } if (!isset($sortKeyList['submissionCount'])) { $sortKeyList['submissionCount'] = SORT_DESC; } $sortKeyList['s.last_edit_date'] = SORT_DESC; $sortKeyList['fb.last_edit_date'] = SORT_DESC; $sortKeyList['cu.isCourseManager'] = SORT_ASC; $sortKeyList['cu.tutor'] = SORT_DESC; $sortKeyList['u.nom'] = SORT_ASC; $sortKeyList['u.prenom'] = SORT_ASC; // get last submission titles
$tlabelReq = 'CLLNP'; require '../../inc/claro_init_global.inc.php'; if (claro_is_user_authenticated()) { echo 'User is authenticated'; $spentTime = isset($_GET['spentTime']) ? $_GET['spentTime'] : null; $userModuleProgressId = isset($_GET['userModuleProgressId']) ? (int) $_GET['userModuleProgressId'] : null; $previousTotalTime = isset($_GET['previousTotalTime']) ? $_GET['previousTotalTime'] : null; $date = isset($_GET['date']) ? $_GET['date'] : null; $userId = isset($_GET['userId']) ? (int) $_GET['userId'] : null; $courseCode = isset($_GET['courseCode']) ? $_GET['courseCode'] : null; $learnPathId = isset($_GET['learnPathId']) ? (int) $_GET['learnPathId'] : null; $moduleId = isset($_GET['moduleId']) ? (int) $_GET['moduleId'] : null; if (!is_null($spentTime) && !is_null($userModuleProgressId) && !is_null($previousTotalTime) && !is_null($date) && !is_null($userId) && !is_null($courseCode) && !is_null($learnPathId) && !is_null($moduleId)) { echo 'No null param'; if (claro_get_current_user_id() == $userId && claro_get_current_course_id() == $courseCode) { echo 'user & course : OK'; $sessionTimeHour = (int) ($spentTime / 60); $sessionTimeMin = $spentTime % 60; $sessionTime = ''; if ($sessionTimeHour > 9999) { $sessionTime = '9999:59:59'; } else { if ($sessionTimeHour < 10) { $sessionTime .= 0; } $sessionTime .= $sessionTimeHour . ':'; if ($sessionTimeMin < 10) { $sessionTime .= 0; } $sessionTime .= $sessionTimeMin . ':00';
GET GROUP MEMBER LIST ----------------------------------------------------------------------------*/ $groupMemberList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id()); /*---------------------------------------------------------------------------- GET TUTOR(S) DATA ----------------------------------------------------------------------------*/ $sql = "SELECT user_id AS id, nom AS lastName, prenom AS firstName, email\n FROM `" . $tbl_user . "` user\n WHERE user.user_id='" . claro_get_current_group_data('tutorId') . "'"; $tutorDataList = claro_sql_query_fetch_all($sql); /*---------------------------------------------------------------------------- GET FORUM POINTER ----------------------------------------------------------------------------*/ $forumId = claro_get_current_group_data('forumId'); $toolList = get_group_tool_list(); if (claro_is_in_a_course()) { $date = $claro_notifier->get_notification_date(claro_get_current_user_id()); $modified_tools = $claro_notifier->get_notified_tools(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id()); } else { $modified_tools = array(); } $toolLinkList = array(); foreach ($toolList as $thisTool) { if (!array_key_exists($thisTool['label'], $_groupProperties['tools'])) { continue; } // special case when display mode is student and tool invisible doesn't display it if (!claro_is_allowed_to_edit()) { if (!$_groupProperties['tools'][$thisTool['label']]) { continue; } } if (!empty($thisTool['label'])) {
function clann_get_max_and_min_rank($course_id = null) { $course_id = is_null($course_id) ? claro_get_current_course_id() : $course_id; $tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id)); return Claroline::getDatabase()->query("\n SELECT \n MAX(ordre) AS maxRank,\n MIN(ordre) AS minRank\n FROM `" . $tbl['announcement'] . "`")->fetch(); }
if ($topicSettingList) { // get post and use pager if (!$viewall) { $postLister = new postLister($topicId, $start, get_conf('posts_per_page')); } else { $postLister = new postLister($topicId, $start, get_total_posts($topicId, 'topic')); $incrementViewCount = false; } // get post and use pager $postList = $postLister->get_post_list(); $totalPosts = $postLister->sqlPager->get_total_item_count(); $pagerUrl = claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?topic=' . $topicId)); //increment topic view count if required if ($incrementViewCount) { increase_topic_view_count($topicId); $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $forumId . "-" . $topicId); //$claroline->notifier->event( 'forum_read_topic', array( 'data' => array( 'topic_id' => $topicId ) ) ); } if ($is_postAllowed) { $cmdList = get_forum_toolbar_array('viewtopic', $forumSettingList['forum_id'], $forumSettingList['cat_id'], $topicId); if (count($postList) > 2) { $start_last_message = (ceil($totalPosts / get_conf('posts_per_page')) - 1) * get_conf('posts_per_page'); $lastMsgUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $forumSettingList['forum_id'] . '&topic=' . $topicId . '&start=' . $start_last_message . '#post' . $topicSettingList['topic_last_post_id']); $cmdList[] = array('name' => get_lang('Last message'), 'url' => claro_htmlspecialchars(Url::Contextualize($lastMsgUrl))); if (!$viewall) { $viewallUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $forumSettingList['forum_id'] . '&topic=' . $topicId . '&viewall=1'); $cmdList[] = array('name' => get_lang('Full review'), 'url' => claro_htmlspecialchars(Url::Contextualize($viewallUrl))); } } } $out .= $postLister->disp_pager_tool_bar($pagerUrl);
break; case 2: $anonymity = 'default'; break; default: $anonymity = 'forbidden'; break; } if (get_conf('clfrm_anonymity_enabled', true)) { if ('allowed' == $anonymity) { $displayName .= ' (' . get_lang('anonymity allowed') . ')'; } elseif ('default' == $anonymity) { $displayName .= ' (' . get_lang('anonymous forum') . ')'; } } $itemClass = claro_is_user_authenticated() && $this->claro_notifier->is_a_notified_forum(claro_get_current_course_id(), $this->claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisForum['forum_id']) ? 'item hot' : 'item'; ?> <tr align="left" valign="top"> <td> <span class="<?php echo $itemClass; ?> "> <img src="<?php echo get_icon_url('forum', 'CLFRM'); ?> " alt="" /> <?php if (!is_null($thisForum['group_id'])) { ?> <?php
/** * * @param string $cid id(code) of the course * @param mixed $database Database_Connection instance or null, if null, the default database connection will be used */ public function __construct($cid = null, $database = null) { $this->cid = is_null($cid) ? claro_get_current_course_id() : $cid; $this->database = is_null($database) ? Claroline::getDatabase() : $database; $this->course = new Claro_course($cid); $this->course->load(); $this->tables = claro_sql_get_main_tbl(); }
/** * @param string $template name of the template */ public function __construct($template) { $template = secure_file_path($template); $customTemplatePath = get_path('rootSys') . '/platform/templates/' . $template; $defaultTemplatePath = get_path('includePath') . '/templates/' . $template; if (file_exists($customTemplatePath)) { parent::__construct($customTemplatePath); } elseif (file_exists($defaultTemplatePath)) { parent::__construct($defaultTemplatePath); } else { throw new Exception("Template not found {$template} " . "at custom location {$customTemplatePath} " . "or default location {$defaultTemplatePath} !"); } if (claro_is_in_a_course()) { $this->course = claro_get_current_course_data(); require_once dirname(__FILE__) . '/../claroCourse.class.php'; $this->courseObject = new ClaroCourse(); $this->courseObject->load(claro_get_current_course_id()); // Fetch related courses $this->relatedCourses = $this->courseObject->getRelatedCourses(); // $this->relatedUserCourses = $this->courseObject->getRelatedUserCourses(claro_get_current_user_id()); if (claro_is_in_a_group()) { $this->group = claro_get_current_group_data(); } } if (claro_is_user_authenticated()) { $this->user = claro_get_current_user_data(); } }
if (claro_is_user_authenticated()) { $date = $claro_notifier->get_notification_date(claro_get_current_user_id()); } $preparedAnnList = array(); $lastPostDate = ''; foreach ($announcementList as $thisAnn) { // Hide hidden and out of deadline elements $isVisible = (bool) ($thisAnn['visibility'] == 'SHOW') ? 1 : 0; $isOffDeadline = (bool) (isset($thisAnn['visibleFrom']) && strtotime($thisAnn['visibleFrom']) > time() || isset($thisAnn['visibleUntil']) && time() > strtotime($thisAnn['visibleUntil']) + 86400) ? 1 : 0; if (!$isVisible || $isOffDeadline) { $thisAnn['visible'] = false; } else { $thisAnn['visible'] = true; } // Flag hot items if (claro_is_user_authenticated() && $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisAnn['id'])) { $thisAnn['hot'] = true; } else { $thisAnn['hot'] = false; } $thisAnn['content'] = make_clickable($thisAnn['content']); // Post time format in MySQL date format $lastPostDate = isset($thisAnn['visibleFrom']) ? $thisAnn['visibleFrom'] : $thisAnn['time']; // Set the current locator $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => $thisAnn['id'])); $thisAnn['currentLocator'] = $currentLocator; if ($is_allowedToEdit || $isVisible && !$isOffDeadline) { $preparedAnnList[] = $thisAnn; } } $maxMinRanks = clann_get_max_and_min_rank();
// poses problems on PHP 4.1, when the array contains only // a single element $dspFileName = claro_htmlspecialchars(basename($thisFile['path'])); $cmdFileName = download_url_encode($thisFile['path']); if ($thisFile['visibility'] == 'i') { if ($is_allowedToEdit) { $style = 'invisible '; } else { continue; // skip the display of this file } } else { $style = ''; } //modify style if the file is recently added since last login if (claro_is_user_authenticated() && $claro_notifier->is_a_notified_document(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisFile)) { $classItem = ' hot'; } else { $classItem = ''; } if ($thisFile['type'] == A_FILE) { $image = choose_image($thisFile['path']); $size = format_file_size($thisFile['size']); $date = format_date($thisFile['date']); $urlFileName = claro_htmlspecialchars(claro_get_file_download_url($thisFile['path'])); //$urlFileName = "goto/?doc_url=".rawurlencode($cmdFileName); //format_url($baseServUrl.$courseDir.$curDirPath."/".$fileName)); $target = get_conf('openNewWindowForDoc') ? 'target="_blank"' : ''; } elseif ($thisFile['type'] == A_DIRECTORY) { $image = 'folder'; $size = ' ';
exit; } require_once '../lib/add_missing_table.lib.php'; init_qwz_questions_categories(); // tool libraries include_once '../lib/exercise.class.php'; include_once '../lib/question.class.php'; include_once '../lib/exercise.lib.php'; // claroline libraries include_once get_path('incRepositorySys') . '/lib/form.lib.php'; include_once get_path('incRepositorySys') . '/lib/pager.lib.php'; include_once get_path('incRepositorySys') . '/lib/fileManage.lib.php'; /* * DB tables definition for list query */ $tbl_cdb_names = get_module_course_tbl(array('qwz_exercise', 'qwz_question', 'qwz_rel_exercise_question'), claro_get_current_course_id()); $tbl_quiz_exercise = $tbl_cdb_names['qwz_exercise']; $tbl_quiz_question = $tbl_cdb_names['qwz_question']; $tbl_quiz_rel_exercise_question = $tbl_cdb_names['qwz_rel_exercise_question']; /* * Init request vars */ if (isset($_REQUEST['cmd'])) { $cmd = $_REQUEST['cmd']; } else { $cmd = ''; } if (isset($_REQUEST['exId']) && is_numeric($_REQUEST['exId'])) { $exId = (int) $_REQUEST['exId']; } else { $exId = null;
if (claro_is_allowed_to_edit()) { if ($thisCourse->status == 'pending') { $dialogBox->warning(get_lang('This course is deactivated: you can reactive it from your course list')); } elseif ($thisCourse->status == 'date') { if (!empty($thisCourse->publicationDate) && $thisCourse->publicationDate > claro_mktime()) { $dialogBox->warning(get_lang('This course will be enabled on the %date', array('%date' => claro_date('d/m/Y', $thisCourse->publicationDate)))); } if (!empty($thisCourse->expirationDate) && $thisCourse->expirationDate > claro_mktime()) { $dialogBox->warning(get_lang('This course will be disable on the %date', array('%date' => claro_date('d/m/Y', $thisCourse->expirationDate)))); } } if ($thisCourse->userLimit > 0) { $dialogBox->warning(get_lang('This course is limited to %userLimit users', array('%userLimit' => $thisCourse->userLimit))); } if ($thisCourse->registration == 'validation') { $courseUserList = new Claro_CourseUserList(claro_get_current_course_id()); if ($courseUserList->has_registrationPending()) { $usersPanelUrl = claro_htmlspecialchars(Url::Contextualize($toolRepository . 'user/user.php')); $dialogBox->warning(get_lang('You have to validate users to give them access to this course through the <a href="%url">course user list</a>', array('%url' => $usersPanelUrl))); } } } // Get the portlets buttons $activablePortlets = claro_is_course_manager() ? CourseHomePagePortlet::getActivablePortlets() : array(); // Display $template = new CoreTemplate('course_index.tpl.php'); $template->assign('dialogBox', $dialogBox); $template->assign('activablePortlets', $activablePortlets); $template->assign('portletIterator', $portletiterator); $claroline->display->body->setContent($template->render()); echo $claroline->display->render();