protected function isDocumentDownloadableInCourse($requestedUrl) { if (claro_is_in_a_group()) { $groupContext = true; $courseContext = false; $is_allowedToEdit = claro_is_group_member() || claro_is_group_tutor() || claro_is_course_manager(); } else { $groupContext = false; $courseContext = true; $is_allowedToEdit = claro_is_course_manager(); } if ($courseContext) { $courseTblList = claro_sql_get_course_tbl(); $tbl_document = $courseTblList['document']; if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") { $modifier = ''; } else { $modifier = 'BINARY '; } $sql = "SELECT visibility\n FROM `{$tbl_document}`\n WHERE {$modifier} path = '" . claro_sql_escape($requestedUrl) . "'"; $docVisibilityStatus = claro_sql_query_get_single_value($sql); if (!is_null($docVisibilityStatus) && $docVisibilityStatus == 'i' && !$is_allowedToEdit) { return false; } else { return true; } } else { // ???? } }
/** * return the autorisation of the current user to send a message to the current course * * @return bool true if the current user is autorised do send a message to the current course * false if the current user is not autorised do send a message to the current course */ function current_user_is_allowed_to_send_message_to_current_course() { if (claro_is_platform_admin()) { return true; } if (claro_is_course_manager()) { return true; } return false; }
/** * * @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(); } }
protected function isModuleAllowed() { $moduleData = get_module_data($this->moduleLabel); if ($moduleData['type'] == 'tool') { $contextList = get_module_context_list($this->moduleLabel); if (claro_is_in_a_course()) { $_mainToolId = get_tool_id_from_module_label($this->moduleLabel); $_profileId = claro_get_current_user_profile_id_in_course(); $_cid = claro_get_current_course_id(); if (claro_is_in_a_group()) { $_groupProperties = claro_get_main_group_properties(claro_get_current_course_id()); $_mainToolId = get_tool_id_from_module_label('CLGRP'); $is_toolAllowed = array_key_exists($this->moduleLabel, $_groupProperties['tools']) && $_groupProperties['tools'][$this->moduleLabel] && claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid); if ($_groupProperties['private']) { $is_toolAllowed = $is_toolAllowed && (claro_is_group_member() || claro_is_group_tutor()); } $is_toolAllowed = $is_toolAllowed || (claro_is_course_manager() || claro_is_platform_admin()); } else { // we ignore course visibility if (!claro_is_allowed_tool_edit($_mainToolId, $_profileId, $_cid) && !claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid)) { $is_toolAllowed = false; } else { $is_toolAllowed = true; } } } else { if (in_array('platform', iterator_to_array($contextList))) { $is_toolAllowed = get_module_data($this->moduleLabel, 'activation') == 'activated'; } else { $is_toolAllowed = false; } } return $is_toolAllowed; } else { // if an applet "tool", return true if activated // and let module manage it's access by itself return $moduleData['activation'] == 'activated'; } }
* * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * * @author claroline Team <*****@*****.**> * * @package RIGHT * */ require '../inc/claro_init_global.inc.php'; $nameTools = get_lang('Course profile list'); $dialogBox = ''; $tidReset = true; if (!claro_is_in_a_course() || !claro_is_user_authenticated()) { claro_disp_auth_form(true); } $is_allowedToEdit = claro_is_course_manager(); if (!$is_allowedToEdit) { claro_die(get_lang('Not allowed')); } require_once get_path('incRepositorySys') . '/lib/right/profile.class.php'; require_once get_path('incRepositorySys') . '/lib/pager.lib.php'; // Main section // Build profile list $itemPerPage = 10; $tbl_mdb_names = claro_sql_get_main_tbl(); $tblProfile = $tbl_mdb_names['right_profile']; $sql = " SELECT profile_id as id, name, description, locked, required\n FROM `" . $tblProfile . "`\n WHERE type = 'COURSE' "; $offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $profilePager = new claro_sql_pager($sql, $offset, $itemPerPage); $profileList = $profilePager->get_result_list(); $out = '';
/** * Get the authentication profile for the given user id * @param int $userId * @return AuthProfile */ public static function getUserAuthProfile($userId) { if ($userId != claro_get_current_user_id()) { $user = new Claro_User($userId); $user->loadFromDatabase(); } else { $user = Claro_CurrentUser::getInstance(); } $authSource = $user->authSource; if (!$authSource) { throw new Exception("Cannot find user authentication source for user {$userId}"); } try { $profileOptions = AuthDriverManager::getDriver($authSource)->getAuthProfileOptions(); } catch (Exception $e) { if (claro_is_platform_admin() || claro_is_in_a_course() && claro_is_course_manager() && $userId != claro_get_current_user_id()) { Console::warning("Cannot find user authentication source for user {$userId}, use claroline default options instead"); $profileOptions = AuthDriverManager::getDriver('claroline')->getAuthProfileOptions(); } else { throw $e; } } $authProfile = new AuthProfile($userId, $authSource); $authProfile->setAuthDriverOptions($profileOptions); if (claro_debug_mode()) { pushClaroMessage(var_export($profileOptions, true), 'debug'); } return $authProfile; }
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @see http://www.claroline.net/wiki/index.php/CLUSR * @author Claro Team <*****@*****.**> * @package CLUSR */ /*===================================================================== Init Section =====================================================================*/ $tlabelReq = 'CLUSR'; $gidReset = true; require '../inc/claro_init_global.inc.php'; // Security check if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $can_add_single_user = (bool) (claro_is_course_manager() && get_conf('is_coursemanager_allowed_to_enroll_single_user')) || claro_is_platform_admin(); if (!$can_add_single_user) { claro_die(get_lang('Not allowed')); } // include configuration file include claro_get_conf_repository() . 'user_profile.conf.php'; // include libraries require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/course_user.lib.php'; require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php'; From::module('CLUSR')->uses('profileselector.lib'); // Initialise variables $nameTools = get_lang('Add a user'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Users'), 'user.php'); $dialogBox = new DialogBox(); $platformRegSucceed = false;
* GNU GENERAL PUBLIC LICENSE version 2 or later * @package CLFRM */ $tlabelReq = 'CLFRM'; //load claroline kernel require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php'; //security check if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } //load required libraries require_once get_path('incRepositorySys') . '/lib/forum.lib.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; //init general purpose vars claro_set_display_mode_available(true); $is_allowedToEdit = claro_is_allowed_to_edit() || claro_is_group_tutor() && !claro_is_course_manager(); $dialogBox = new DialogBox(); //handle user input and possible associated exceptions try { $userInput = Claro_UserInput::getInstance(); if ($is_allowedToEdit) { $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqPost', 'exSavePost', 'exDelete', 'show', 'exNotify', 'exdoNotNotify'))); $userInput->setValidator('mode', new Claro_Validator_AllowedList(array('add', 'edit', 'reply', 'quote'))); $userInput->setValidator('mode', new Claro_Validator_NotEmpty()); } else { $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqPost', 'exSavePost', 'show', 'exNotify', 'exdoNotNotify'))); $userInput->setValidator('mode', new Claro_Validator_AllowedList(array('add', 'reply', 'quote'))); $userInput->setValidator('mode', new Claro_Validator_NotEmpty()); } $userInput->setValidator('forum', new Claro_Validator_ValueType('numeric')); $userInput->setValidator('forum', new Claro_Validator_NotEmpty());
protected function renderContent() { if (isset($_REQUEST['exId']) && is_numeric($_REQUEST['exId'])) { $exId = (int) $_REQUEST['exId']; } else { $exId = null; } $exerciseResults = $this->prepareContent(); $jsloader = JavascriptLoader::getInstance(); $jsloader->load('jquery'); $context = array('cidReq' => $this->courseId, 'cidReset' => true, 'userId' => $this->userId); $html = '<script language="javascript" type="text/javascript">' . "\n" . ' $(document).ready(function() {' . ' $(\'.exerciseDetails\').hide();' . ' $(\'.exerciseDetailsToggle\').click( function()' . ' {' . ' $(this).next(".exerciseDetails").toggle();' . ' return false;' . ' });' . ' });' . '</script>' . "\n\n"; $html .= '<table class="claroTable emphaseLine" cellpadding="2" cellspacing="1" border="0" align="center" style="width: 99%;">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Exercises') . '</th>' . "\n" . '<th>' . get_lang('Worst score') . '</th>' . "\n" . '<th>' . get_lang('Best score') . '</th>' . "\n" . '<th>' . get_lang('Average score') . '</th>' . "\n" . '<th>' . get_lang('Average Time') . '</th>' . "\n" . '<th>' . get_lang('Attempts') . '</th>' . "\n" . '<th>' . get_lang('Last attempt') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n"; if (!empty($exerciseResults) && is_array($exerciseResults)) { $html .= '<tbody>' . "\n"; foreach ($exerciseResults as $result) { $html .= '<tr class="exerciseDetailsToggle">' . "\n" . '<td><a href="#">' . claro_htmlspecialchars($result['title']) . '</td>' . "\n" . '<td>' . (int) $result['minimum'] . '</td>' . "\n" . '<td>' . (int) $result['maximum'] . '</td>' . "\n" . '<td>' . round($result['average'] * 10) / 10 . '</td>' . "\n" . '<td>' . claro_html_duration(floor($result['avgTime'])) . '</td>' . "\n" . '<td>' . (int) $result['attempts'] . '</td>' . "\n" . '<td>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), strtotime($result['lastAttempt'])) . "</td> \n"; $html .= '</tr>' . "\n"; // details $exerciseDetails = $this->getUserExerciceDetails($result['id']); if (is_array($exerciseDetails) && !empty($exerciseDetails)) { $html .= '<tr class="exerciseDetails" >'; if (claro_is_course_manager()) { $html .= '<td><a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLQWZ') . '/track_exercise_reset.php?cmd=resetAllAttemptsForUser&exId=' . $result['id'], $context)) . '">' . get_lang('delete all') . '</a></td>'; } else { $html .= '<td> </td>' . "\n"; } $html .= '<td colspan="6" class="noHover">' . "\n" . '<table class="claroTable emphaseLine" cellspacing="1" cellpadding="2" border="0" width="100%" style="width: 99%;">' . "\n" . '<thead>' . "\n"; $html .= '' . '<tr>' . "\n" . '<th><small>' . get_lang('Date') . '</small></th>' . "\n" . '<th><small>' . get_lang('Score') . '</small></th>' . "\n" . '<th><small>' . get_lang('Time') . '</small></th>' . "\n" . '<th><small>' . get_lang('Delete') . '</small></th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n"; foreach ($exerciseDetails as $details) { $html .= '<tr>' . "\n" . '<td><small>' . "\n" . '<a href="' . get_module_url('CLQWZ') . '/track_exercise_details.php?trackedExId=' . $details['id'] . '">' . claro_html_localised_date(get_locale('dateTimeFormatLong'), strtotime($details['date'])) . '</a></small></td>' . "\n" . '<td><small>' . $details['result'] . '/' . $details['weighting'] . '</small></td>' . "\n" . '<td><small>' . claro_html_duration($details['time']) . '</small></td>' . "\n"; if (claro_is_course_manager()) { $html .= '<td><small><a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLQWZ') . '/track_exercise_reset.php?cmd=resetAttemptForUser&trackId=' . $details['id'], $context)) . '">' . get_lang('delete') . '</a></small></td>' . "\n"; } else { $html .= '<td><small>-</small></td>'; } $html .= '</tr>' . "\n"; } $html .= '</tbody>' . "\n" . '</table>' . "\n\n" . '</td>' . "\n" . '</tr>' . "\n"; } } $html .= '</tbody>' . "\n"; } else { $html .= '<tbody>' . "\n" . '<tr>' . "\n" . '<td colspan="7" align="center">' . get_lang('No result') . '</td>' . "\n" . '</tr>' . "\n" . '</tbody>' . "\n"; } $html .= '</table>' . "\n\n"; return $html; }
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();
* * @copyright (c) 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/CLCHT * * @package CLCHT * * @author Claro Team <*****@*****.**> * @author Christophe Gesché <*****@*****.**> * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * */ require '../inc/claro_init_global.inc.php'; $is_allowedToManage = claro_is_course_manager() || claro_is_in_a_group() && claro_is_group_tutor(); // header $htmlHeadXtra[] = ' <script type="text/javascript"> function prepare_message() { document.chatForm.chatLine.value=document.chatForm.msg.value; document.chatForm.msg.value = ""; document.chatForm.msg.focus(); return true; } </script>'; $cmdMenu = array(); if ($is_allowedToManage) { $cmdMenu[] = claro_html_cmd_link('messageList.php?cmd=reset' . claro_url_relay_context('&'), get_lang('Reset'), array('target' => "messageList")); $cmdMenu[] = claro_html_cmd_link('messageList.php?cmd=store' . claro_url_relay_context('&'), get_lang('Store Chat'), array('target' => "messageList"));
if ($cmd == 'exEnable') { if (!claro_is_course_manager() && !claro_is_platform_admin()) { claro_die(get_lang("Not allowed")); exit; } if (($course->status == 'disable' || $course->status == 'trash') && !claro_is_platform_admin()) { claro_die(get_lang("Not allowed")); exit; } elseif (($course->status == 'disable' || $course->status == 'trash') && claro_is_platform_admin()) { $course->status = 'enable'; if ($course->save()) { $dialogBox->success(get_lang('This course has been activated and is now available on this platform')); } else { $dialogBox->error(get_lang('Unable to reactivate this course')); } } elseif ($course->status == 'pending' && claro_is_in_a_course() && claro_is_course_manager()) { $course->status = 'enable'; if ($course->save()) { $dialogBox->success(get_lang('This course has been activated and is now available on this platform')); } else { $dialogBox->error(get_lang('Unable to reactivate this course')); } } else { $dialogBox->error(get_lang('This course is already activated')); } } if ($cmd == 'exEdit') { $course->handleForm(); if ($course->validate()) { if ($course->save()) { $dialogBox->success(get_lang('The information have been modified'));
} else { $period = 'month'; } if (!empty($_REQUEST['reqdate'])) { $reqdate = (int) $_REQUEST['reqdate']; } else { $reqdate = time(); } /* * Permissions */ $userData = user_get_properties($userId); if (is_null($userId) || empty($userData)) { claro_die(get_lang('User not found')); } if (!claro_is_platform_admin() && !claro_is_course_manager() && $userId != claro_get_current_user_id()) { claro_die(get_lang('Not allowed')); } /* * Prepare output */ $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($courseId)); $tbl_course_tracking_event = $tbl_cdb_names['tracking_event']; // FIXME use userCard if ($period == 'week') { $sqlAccessDates = "SELECT `date`\n FROM `" . $tbl_course_tracking_event . "`\n WHERE `user_id` = " . (int) $userId . "\n AND `type` = 'course_access'\n AND WEEK(`date`) = WEEK( FROM_UNIXTIME('" . $reqdate . "') )\n AND YEAR(`date`) = YEAR( FROM_UNIXTIME(" . $reqdate . ") )\n ORDER BY `date` ASC "; // used in links to move from one week to another $previousReqDate = $reqdate - 7 * 86400; // 86400=24*60*60 $nextReqDate = $reqdate + 7 * 86400; // prepare displayed date
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php'; include claro_get_conf_repository() . 'CLMSG.conf.php'; require_once dirname(__FILE__) . '/lib/message/messagetosend.lib.php'; require_once dirname(__FILE__) . '/lib/recipient/userlistrecipient.lib.php'; require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/class.lib.php'; require_once get_path('incRepositorySys') . '/lib/course_user.lib.php'; claro_set_display_mode_available(true); // move to kernel $claroline = Claroline::getInstance(); // ------------- Business Logic --------------------------- require_once 'lib/messagebox/inbox.lib.php'; if (!claro_is_user_authenticated()) { claro_disp_auth_form(true); } if (!claro_is_in_a_course() || !claro_is_course_manager() && !claro_is_platform_admin()) { claro_die(get_lang("Not allowed")); } $displayForm = FALSE; $content = ""; $from = isset($_REQUEST['from']) ? get_module_entry_url(strtoupper($_REQUEST['from'])) : $_SERVER['PHP_SELF']; //commande $acceptedCmdList = array('exSendMessage'); if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) { if ($_REQUEST['cmd'] == 'exSendMessage') { /* * Explode the values of incorreo in groups and users */ $userIdList = array(); $groupIdList = array(); $classIdList = array();
$out .= get_lang('File (file required, description text optional)'); } $out .= '<br />' . "\n" . '<b>' . get_lang('Submission visibility') . '</b> : ' . "\n" . ($assignment->getDefaultSubmissionVisibility() == 'VISIBLE' ? get_lang('Visible for all users') : get_lang('Only visible for teacher(s) and submitter(s)')) . '<br />' . "\n" . '<b>' . get_lang('Assignment type') . '</b> : ' . "\n" . ($assignment->getAssignmentType() == 'INDIVIDUAL' ? get_lang('Individual') : get_lang('Groups')) . '<br />' . "\n" . '<b>' . get_lang('Allow late upload') . '</b> : ' . "\n" . ($assignment->getAllowLateUpload() == 'YES' ? get_lang('Users can submit after end date') : get_lang('Users can not submit after end date')) . '</small>' . "\n" . '</p>' . "\n"; // description of assignment if (trim($assignment->getDescription()) != '') { $out .= '<b><small>' . get_lang('Description') . '</small></b><br />' . "\n" . '<blockquote>' . "\n" . '<small>' . "\n" . claro_parse_user_text($assignment->getDescription()) . '</small>' . "\n" . '</blockquote>' . "\n" . '<br />' . "\n"; } $out .= '<h4>' . $txtForFormTitle . '</h4>' . "\n" . '<p><a class="backLink" href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['SCRIPT_NAME'] . '?authId=' . $_REQUEST['authId'] . '&assigId=' . $assignmentId)) . '">' . get_lang('Back') . '</a></p>' . "\n" . '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?assigId=' . $assignmentId . '&authId=' . $_REQUEST['authId'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="' . $cmdToSend . '" />' . "\n" . claro_form_relay_context(); if (isset($_REQUEST['wrkId'])) { $out .= '<input type="hidden" name="wrkId" value="' . $_REQUEST['wrkId'] . '" />' . "\n"; } elseif (isset($_REQUEST['gradedWrkId'])) { $out .= '<input type="hidden" name="gradedWrkId" value="' . $_REQUEST['gradedWrkId'] . '" />' . "\n"; } $out .= '<fieldset>' . "\n" . '<dl>' . "\n" . '<dt><label for="wrkTitle">' . get_lang('Title') . ' <span class="required">*</span></label></dt>' . "\n" . '<dd><input type="text" name="wrkTitle" id="wrkTitle" size="50" maxlength="200" value="' . claro_htmlspecialchars($form['wrkTitle']) . '" /></dd>' . "\n" . '<dt><label for="wrkAuthors">' . get_lang('Author(s)') . ' <span class="required">*</span></label></dt>' . "\n" . '<dd><input type="text" name="wrkAuthors" id="wrkAuthors" size="50" maxlength="200" value="' . claro_htmlspecialchars($form['wrkAuthors']) . '" /></dd>' . "\n"; // display the list of groups of the user if ($assignment->getAssignmentType() == "GROUP" && !empty($userGroupList) || claro_is_course_manager() && claro_is_in_a_group()) { $out .= '<dt><label for="wrkGroup">' . get_lang('Group') . '</label></dt>' . "\n"; if (claro_is_in_a_group()) { $out .= '<dd>' . "\n" . '<input type="hidden" name="wrkGroup" value="' . claro_get_current_group_id() . '" />' . claro_get_current_group_data('name') . '</dd>' . "\n"; } elseif (isset($_REQUEST['authId'])) { $out .= '<dd>' . "\n" . '<input type="hidden" name="wrkGroup" value="' . $_REQUEST['authId'] . '" />' . $userGroupList[$_REQUEST['authId']]['name'] . '</dd>' . "\n"; } else { // this part is mainly for courseadmin as he have a link in the workList to submit a work $out .= '<dd>' . "\n" . '<select name="wrkGroup" id="wrkGroup">' . "\n"; foreach ($userGroupList as $group) { $out .= '<option value="' . $group['id'] . '"'; if (isset($form['wrkGroup']) && $form['wrkGroup'] == $group['id'] || $_REQUEST['authId'] == $group['id']) { $out .= 'selected="selected"'; } $out .= '>' . $group['name'] . '</option>' . "\n"; }
$tbl_lp_asset = $tbl_cdb_names['lp_asset']; // table names $TABLELEARNPATH = $tbl_lp_learnPath; $TABLEMODULE = $tbl_lp_module; $TABLELEARNPATHMODULE = $tbl_lp_rel_learnPath_module; $TABLEASSET = $tbl_lp_asset; $TABLEUSERMODULEPROGRESS = $tbl_lp_user_module_progress; $TABLECOURSUSER = $tbl_rel_course_user; $TABLEUSER = $tbl_user; require_once get_path('incRepositorySys') . "/lib/statsUtils.lib.inc.php"; // lib of learning path tool require_once get_path('incRepositorySys') . "/lib/learnPath.lib.inc.php"; //lib of document tool require_once get_path('incRepositorySys') . "/lib/fileDisplay.lib.php"; // only the course administrator or the student himself can view the tracking $is_allowedToTrack = claro_is_course_manager(); if (isset($uInfo) && claro_is_user_authenticated()) { $is_allowedToTrack = $is_allowedToTrack || $uInfo == claro_get_current_user_id(); } // get infos about the user $sql = "SELECT `nom` AS `lastname`, `prenom` as `firstname`, `email`\n FROM `" . $TABLEUSER . "`\n WHERE `user_id` = " . (int) $_REQUEST['uInfo']; $uDetails = claro_sql_query_get_single_row($sql); // get infos about the learningPath $sql = "SELECT `name`\n FROM `" . $TABLELEARNPATH . "`\n WHERE `learnPath_id` = " . (int) $_REQUEST['path_id']; $lpDetails = claro_sql_query_get_single_row($sql); //////////////////// ////// OUTPUT ////// //////////////////// $interbredcrump[] = array("url" => "../learnPath/learningPathList.php", "name" => get_lang('Learning path list')); $interbredcrump[] = array("url" => "learnPath_details.php?path_id=" . $_REQUEST['path_id'], "name" => get_lang('Statistics')); $nameTools = get_lang('Modules');
/** * Return if course status is enable */ function claro_is_course_enable() { $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_course = $tbl_mdb_names['course']; $courseId = claro_get_current_course_id(); $curdate = claro_mktime(); if (claro_is_course_manager()) { $sql = " SELECT c.`code`\n FROM `" . $tbl_course . "` c\n WHERE (c.`status` != 'trash')\n AND c.`code` = '" . $courseId . "';"; } else { $sql = " SELECT c.`code`\n FROM `" . $tbl_course . "` c\n WHERE (c.`status` = 'enable'\n OR (c.`status` = 'date'\n AND (UNIX_TIMESTAMP(`creationDate`) <= '" . $curdate . "'\n OR `creationDate` IS NULL OR UNIX_TIMESTAMP(`creationDate`) = 0\n )\n AND ('" . $curdate . "' <= UNIX_TIMESTAMP(`expirationDate`)\n OR `expirationDate` IS NULL\n )\n )\n )\n AND c.`code` = '" . $courseId . "';"; } $result = claro_sql_query_get_single_value($sql); if (isset($result) or claro_is_platform_admin()) { $return = true; } else { $return = false; } return $return; }
function printInit($selection = "*") { global $uidReset, $cidReset, $gidReset, $tidReset, $uidReq, $cidReq, $gidReq, $tidReq, $tlabelReq, $_user, $_course, $_groupUser, $_courseTool, $_SESSION, $_claro_local_run; if ($_claro_local_run) { echo "local init runned"; } else { echo '<font color="red"> local init never runned during this script </font>'; } echo ' <table width="100%" border="1" cellspacing="4" cellpadding="1" bordercolor="#808080" bgcolor="#C0C0C0" lang="en"> <TR>'; if ($selection == "*" or strstr($selection, "u")) { echo ' <TD valign="top" > <strong>User</strong> : (_uid) : ' . var_export(claro_get_current_user_id(), 1) . ' | (session[_uid]) : ' . var_export($_SESSION["_uid"], 1) . ' <br /> reset = ' . var_export($uidReset, 1) . ' | req = ' . var_export($uidReq, 1) . '<br /> _user : <pre>' . var_export($_user, 1) . '</pre> <br />is_platformAdmin :' . var_export(claro_is_platform_admin(), 1) . ' <br />is_allowedCreateCourse :' . var_export(claro_is_allowed_to_create_course(), 1) . ' </TD>'; } if ($selection == "*" or strstr($selection, "c")) { echo "\n <TD valign=\"top\" >\n <strong>Course</strong> : (_cid)" . var_export(claro_get_current_course_id(), 1) . "\n <br />\n reset = " . var_export($cidReset, 1) . " | req = " . var_export($cidReq, 1) . "\n <br />\n _course : <pre>" . var_export($_course, 1) . "</pre>\n <br />\n _groupProperties :\n <PRE>\n " . var_export(claro_get_current_group_properties_data(), 1) . "\n </PRE>\n </TD>"; } echo ' </TR> <TR>'; if ($selection == "*" or strstr($selection, "g")) { echo '<TD valign="top" ><strong>Group</strong> : (_gid) ' . var_export(claro_get_current_group_id(), 1) . '<br /> reset = ' . var_export($GLOBALS['gidReset'], 1) . ' | req = ' . var_export($gidReq, 1) . "<br />\n _group :<pre>" . var_export(claro_get_current_group_data(), 1) . "</pre></TD>"; } if ($selection == "*" or strstr($selection, "t")) { echo '<TD valign="top" ><strong>Tool</strong> : (_tid)' . var_export(claro_get_current_tool_id(), 1) . '<br /> reset = ' . var_export($tidReset, 1) . ' | req = ' . var_export($tidReq, 1) . '| req = ' . var_export($tlabelReq, 1) . ' <br /> _tool :' . var_export(get_init('_tool'), 1) . "</TD>"; } echo "</TR>"; if ($selection == "*" or strstr($selection, "u") && strstr($selection, "c")) { echo '<TR><TD valign="top" colspan="2"><strong>Course-User</strong>'; if (claro_is_user_authenticated()) { echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1); } if (claro_is_in_a_course()) { echo ' in ' . var_export(claro_get_current_course_id(), 1) . '<br />'; } if (claro_is_user_authenticated() && claro_get_current_course_id()) { echo '_courseUser : <pre>' . var_export(getInit('_courseUser'), 1) . '</pre>'; } echo '<br />is_courseMember : ' . var_export(claro_is_course_member(), 1); echo '<br />is_courseAdmin : ' . var_export(claro_is_course_manager(), 1); echo '<br />is_courseAllowed : ' . var_export(claro_is_course_allowed(), 1); echo '<br />is_courseTutor : ' . var_export(claro_is_course_tutor(), 1); echo '</TD></TR>'; } echo ""; if ($selection == "*" or strstr($selection, "u") && strstr($selection, "g")) { echo '<TR><TD valign="top" colspan="2">' . '<strong>Course-Group-User</strong>'; if (claro_is_user_authenticated()) { echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1); } if (claro_is_in_a_group()) { echo ' in ' . var_export(claro_get_current_group_id(), 1); } if (claro_is_in_a_group()) { echo '<br />_groupUser:'******'_groupUser'), 1); } echo '<br />is_groupMember:' . var_export(claro_is_group_member(), 1) . '<br />is_groupTutor: ' . var_export(claro_is_group_tutor(), 1) . '<br />is_groupAllowed:' . var_export(claro_is_group_allowed(), 1) . '</TD>' . '</tr>'; } if ($selection == "*" or strstr($selection, "c") && strstr($selection, "t")) { echo '<tr> <TD valign="top" colspan="2" ><strong>Course-Tool</strong><br />'; if (claro_get_current_tool_id()) { echo 'Tool :' . claro_get_current_tool_id(); } if (claro_is_in_a_course()) { echo ' in ' . claro_get_current_course_id() . '<br />'; } if (claro_get_current_tool_id()) { echo "_courseTool : <pre>" . var_export($_courseTool, 1) . '</pre><br />'; } echo 'is_toolAllowed : ' . var_export(claro_is_tool_allowed(), 1); echo "</TD>"; } echo "</TR></TABLE>"; }
/** * Function that removes the need to directly use is_courseAdmin global in * tool scripts. It returns true or false depending on the user's rights in * this particular course. * * @version 1.1, February 2004 * @return boolean true: the user has the rights to edit, false: he does not * @author Roan Embrechts * @author Patrick Cool */ function claro_is_allowed_to_edit() { if (claro_is_course_manager()) { $isAllowedToEdit = true; } else { if (claro_is_in_a_tool()) { $isAllowedToEdit = claro_is_allowed_tool_edit(); } else { $isAllowedToEdit = false; } } if (claro_is_display_mode_available()) { return $isAllowedToEdit && claro_get_tool_view_mode() != 'STUDENT'; } else { return $isAllowedToEdit; } }
require '../inc/claro_init_global.inc.php'; if (!claro_is_in_a_course() || !claro_is_course_allowed() && !claro_is_user_authenticated()) { die('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<title>' . get_lang('Chat') . '</title>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . "\n" . '<a href="./chat.php" >click</a>' . "\n" . '</body>' . "\n" . "\n"); } /*============================================================================ CONNECTION BLOC ============================================================================*/ $coursePath = get_path('coursesRepositorySys') . claro_get_course_path(); $courseId = claro_get_current_course_id(); $groupId = claro_get_current_group_id(); $_user = claro_get_current_user_data(); $_course = claro_get_current_course_data(); $_group = claro_get_current_group_data(); $is_allowedToManage = claro_is_course_manager(); $is_allowedToStore = claro_is_course_manager(); $is_allowedToReset = claro_is_course_manager(); if ($_user['firstName'] == '' && $_user['lastName'] == '') { $nick = get_lang('Anonymous'); } else { $nick = $_user['firstName'] . ' ' . $_user['lastName']; if (strlen($nick) > get_conf('max_nick_length')) { $nick = $_user['firstName'] . ' ' . $_user['lastName'][0] . '.'; } } // theses line prevent missing config file $refresh_display_rate = get_conf('refresh_display_rate', 10); /*============================================================================ CHAT INIT ============================================================================*/ // THE CHAT NEEDS A TEMP FILE TO RECORD CONVERSATIONS. // THIS FILE IS STORED IN THE COURSE DIRECTORY
* * @version 1.11 $Revision: 14516 $ * @copyright (c) 2001-2012, 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/CLUSR * @author Claro Team <*****@*****.**> * @package CLUSR */ $tlabelReq = 'CLUSR'; $gidReset = true; require '../inc/claro_init_global.inc.php'; $dialogBox = new DialogBox(); if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $can_import_user_class = (bool) (claro_is_course_manager() && get_conf('is_coursemanager_allowed_to_import_user_class')) || claro_is_platform_admin(); // TODO replace calro_die by best usage. if (!$can_import_user_class) { claro_die(get_lang('Not allowed')); } require_once get_path('incRepositorySys') . '/lib/admin.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/class.lib.php'; require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php'; /*---------------------------------------------------------------------*/ /*----------------------EXECUTE COMMAND SECTION------------------------*/ /*---------------------------------------------------------------------*/ $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $form_data['class_id'] = isset($_REQUEST['class_id']) ? $_REQUEST['class_id'] : 0; $form_data['class_name'] = isset($_REQUEST['class_name']) ? trim($_REQUEST['class_name']) : ''; switch ($cmd) {
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ $baseServDir = get_path('coursesRepositorySys'); $baseServUrl = get_path('url') . '/'; $dialogBox = new DialogBox(); /* * The following variables depends on the use context * The document tool can be used at course or group level * (one document area for each group) */ if (claro_is_in_a_group() && claro_is_group_allowed()) { $_group = claro_get_current_group_data(); $groupContext = true; $courseContext = false; $maxFilledSpace = get_conf('maxFilledSpace_for_groups'); $courseDir = claro_get_course_path() . '/group/' . claro_get_current_group_data('directory'); $is_allowedToEdit = claro_is_group_member() || claro_is_group_tutor() || claro_is_course_manager(); $is_allowedToUnzip = false; if (!claro_is_group_allowed()) { die('<center>You are not allowed to see this group\'s documents!!!</center>'); } } else { $groupContext = false; $courseContext = true; $courseDir = claro_get_course_path() . '/document'; // initialise view mode tool claro_set_display_mode_available(true); $is_allowedToEdit = claro_is_allowed_to_edit(); $is_allowedToUnzip = claro_is_allowed_to_edit(); $maxFilledSpace = get_conf('maxFilledSpace_for_course'); // table names for learning path (needed to check integrity) /*
require_once get_path('incRepositorySys') . '/lib/admin.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/class.lib.php'; require_once get_path('incRepositorySys') . '/lib/course_user.lib.php'; require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/password.lib.php'; require_once get_path('incRepositorySys') . '/lib/utils/validator.lib.php'; require_once get_path('incRepositorySys') . '/lib/utils/input.lib.php'; require_once get_path('incRepositorySys') . '/lib/thirdparty/parsecsv/parsecsv.lib.php'; require_once './csvimport.class.php'; include claro_get_conf_repository() . 'user_profile.conf.php'; load_module_config('CLUSR'); if (!$is_courseAllowed) { claro_disp_auth_form(true); } $is_courseManager = claro_is_course_manager(); $is_platformAdmin = claro_is_platform_admin(); $is_allowedToEnroll = $is_courseManager && get_conf('is_coursemanager_allowed_to_enroll_single_user') || $is_platformAdmin; $is_allowedToImport = $is_courseManager && get_conf('is_coursemanager_allowed_to_import_user_list') || $is_platformAdmin; $is_allowedToCreate = $is_courseManager && get_conf('is_coursemanager_allowed_to_register_single_user') || $is_platformAdmin; if (!$is_allowedToImport) { claro_die(get_lang('Not allowed')); } $courseId = claro_get_current_course_id(); $userInput = Claro_UserInput::getInstance(); $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqCSV', 'rqChangeFormat', 'exChangeFormat', 'rqLoadDefaultFormat', 'exLoadDefaultFormat'))); $userInput->setValidator('fieldSeparator', new Claro_Validator_allowedList(array(',', ';', ' '))); $userInput->setValidator('enclosedBy', new Claro_Validator_allowedList(array('dbquote', '.', 'none'))); $userInput->setValidator('firstLineFormat', new Claro_Validator_allowedList(array('YES', 'NO'))); $cmd = $userInput->get('cmd'); $step = (int) $userInput->get('step', 0);
} // end if is_allowedToEdit // Prepare displays if ($displayList) { // list $announcementList = announcement_get_item_list($context); $bottomAnnouncement = $announcementQty = count($announcementList); } $displayButtonLine = (bool) $is_allowedToEdit && (empty($cmd) || $cmd != 'rqEdit' || $cmd != 'rqCreate'); // Command list $cmdList = array(); if ($displayButtonLine) { if ($cmd != 'rqEdit' && $cmd != 'rqCreate') { $cmdList[] = array('img' => 'announcement_new', 'name' => get_lang('Add announcement'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqCreate'))); } if (claro_is_course_manager()) { $cmdList[] = array('img' => 'mail_close', 'name' => get_lang('Messages to selected users'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'messaging/messagescourse.php?from=clann'))); } if ($announcementQty > 0) { $cmdList[] = array('img' => 'delete', 'name' => get_lang('Clear up list of announcements'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDeleteAll')), 'params' => array('onclick' => 'return CLANN.confirmationDelAll()')); } } /** * DISPLAY SECTION */ $nameTools = get_lang('Announcements'); $noQUERY_STRING = true; // Javascript confirm pop up declaration for header JavascriptLanguage::getInstance()->addLangVar('Are you sure you want to delete all the announcements ?'); JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?'); JavascriptLoader::getInstance()->load('announcements');
/** * Get the list of tools with notified event in the given course since the given * date for the given user and the optional given group * @param string $course_id * @param string $date * @param int $user_id * @param int $group_id (default 0 meaning no group) * @return array(`tool_id`) */ public function getNotifiedTools($course_id, $date, $user_id, $group_id = '0') { $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_notify = $tbl_mdb_names['notify']; //if user is course admin, he is notified of event concerning all user in the course if (claro_is_course_manager()) { $toadd = ""; } else { $toadd = "AND (N.`user_id` = '0' OR N.`user_id` = '" . (int) $user_id . "')"; } $tools = array(); // 1 - Find the tool list of the given course that contains some event newer than the date '$date' // - FOR A STUDENT : where the events concerned everybody (uid = 0) or the user himself (uid) // - FOR A TEACHER : every events of a course must be reported (this take much sense in the work tool, with submissions) if (!isset($_SESSION['firstLogin']) || !$_SESSION['firstLogin']) { // A- retrieve new item since last login in the notify table $sql = "SELECT `tool_id`, `date`, `group_id`, `course_code`, `ressource_id`\n FROM `" . $tbl_notify . "` AS N\n WHERE N.`course_code` = '" . claro_sql_escape($course_id) . "'\n AND N.`date` > '" . $date . "'\n " . $toadd . "\n AND (N.`group_id` = '" . $group_id . "')\n "; $toolList = claro_sql_query_fetch_all($sql); if (is_array($toolList)) { // B- from result in the notify table, we mustn't take the ressources already consulted, saved in session $size = count($toolList); } for ($i = 0; $i < $size; $i++) { if ($toolList[$i]['group_id'] == 0) { $toolList[$i]['group_id'] = ""; } if (isset($_SESSION['ConsultedRessourceList']) && isset($_SESSION['ConsultedRessourceList'][$toolList[$i]['course_code'] . ":" . $toolList[$i]['tool_id'] . ":" . $toolList[$i]['group_id'] . ":" . $toolList[$i]['ressource_id'] . ":" . $toolList[$i]['date']])) { unset($toolList[$i]); // the ressource is already seen, we retrieve it from the results } else { $tools[] = $toolList[$i]['tool_id']; // there is a ressource not consulted yet, we add tht tool_id in results } } } // 2- return an array with the tools id with recent unknow event until the date '$date' return $tools; }
} else { $searchResultList = array(); } $pagetype = 'viewsearch'; ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); CssLoader::getInstance()->load('clfrm', 'screen'); $noPHP_SELF = true; $out = ''; $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? get_help_page_url('blockForumsHelp', 'CLFRM') : false); $out .= claro_html_menu_horizontal(disp_forum_toolbar($pagetype, null)) . disp_forum_breadcrumb($pagetype, null, null, null) . '<h4>' . get_lang('Search result') . ' : ' . (isset($_REQUEST['searchPattern']) ? claro_htmlspecialchars($_REQUEST['searchPattern']) : '') . '</h4>' . "\n"; if (count($searchResultList) < 1) { $out .= '<p>' . get_lang('No result') . '</p>'; } else { foreach ($searchResultList as $thisPost) { // PREVENT USER TO CONSULT POST FROM A GROUP THEY ARE NOT ALLOWED if (!is_null($thisPost['group_id']) && $is_groupPrivate && !(in_array($thisPost['group_id'], $userGroupList) || in_array($thisPost['group_id'], $tutorGroupList) || claro_is_course_manager())) { continue; } else { // notify if is new message $post_time = datetime_to_timestamp($thisPost['post_time']); if ($post_time < $last_visit) { $class = ' class="item"'; } else { $class = ' class="item hot"'; } // get user picture $userData = user_get_properties($thisPost['poster_id']); $picturePath = user_get_picture_path($userData); if ($picturePath && file_exists($picturePath)) { $pictureUrl = user_get_picture_url($userData); } else {
/** * This dirty function is a blackbox to provide normalised output of tool list for a group * like get_course_tool_list($course_id=NULL) in course_home. * * It's dirty because data structure is dirty. * Tool_list (with clarolabel and tid come from tool tables and group properties and localinit) * @param $course_id * @param boolean $active, if set to true, only activated tools of the platform must be returned * @author Christophe Gesche <*****@*****.**> * @return array */ function get_group_tool_list($course_id = NULL, $active = true) { global $forumId; $_groupProperties = claro_get_current_group_properties_data(); $isAllowedToEdit = claro_is_course_manager() || claro_is_platform_admin(); $tbl = claro_sql_get_main_tbl(array('module', 'course_tool')); $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id)); $tbl['course_tool'] = $tbl_cdb_names['tool']; // This stupid array is an hack to simulate the context // managing by module structure // It's represent tools aivailable to work in a group context. // $aivailable_tool_in_group = array('CLFRM','CLCHT','CLDOC','CLWIKI'); $sql = "\nSELECT tl.id id,\n tl.script_name name,\n tl.visibility visibility,\n tl.rank rank,\n IFNULL(ct.script_url,tl.script_url) url,\n ct.claro_label label,\n ct.icon icon,\n m.activation activation\nFROM `" . $tbl['course_tool'] . "` tl\nLEFT JOIN `" . $tbl['tool'] . "` `ct`\nON ct.id = tl.tool_id\nLEFT JOIN `" . $tbl['module'] . "` `m`\nON m.label = ct.claro_label\nLEFT JOIN `" . $tbl['module_contexts'] . "` `mc`\nON m.id = mc.module_id\nWHERE `mc`.`context` = 'group'\nORDER BY tl.rank\n\n"; $tool_list = claro_sql_query_fetch_all($sql); $group_tool_list = array(); foreach ($tool_list as $tool) { $tool['label'] = trim($tool['label'], '_'); if ($active !== true || 'activated' == $tool['activation']) { switch ($tool['label']) { case 'CLFRM': if (!empty($_groupProperties['tools']['CLFRM']) || $isAllowedToEdit) { $tool['url'] = 'viewforum.php?forum=' . $forumId . claro_url_relay_context('&'); $group_tool_list[] = $tool; } break; default: if (isset($_groupProperties['tools'][$tool['label']]) && $_groupProperties['tools'][$tool['label']] || $isAllowedToEdit) { $tool['url'] .= claro_url_relay_context('?'); $group_tool_list[] = $tool; } break; } } } return $group_tool_list; }
$url = trim(get_module_url($thisTool['label']) . '/' . $thisTool['url']); } elseif (!empty($thisTool['name'])) { $toolName = $thisTool['name']; $url = trim($thisTool['url']); } else { $toolName = '<i>no name</i>'; $url = trim($thisTool['url']); } if (!empty($thisTool['icon'])) { $icon = get_icon_url($thisTool['icon'], $thisTool['label']); } else { $icon = get_icon_url('tool'); } $style = ''; // patchy if (claro_is_platform_admin() || claro_is_course_manager()) { if (!$_groupProperties['tools'][$thisTool['label']]) { $style = 'invisible '; } } // see if tool name must be displayed 'as containing new items' (a red ball by default) or not $classItem = ''; if (in_array($thisTool['id'], $modified_tools)) { $classItem = " hot"; } if (!empty($url)) { $toolLinkList[] = '<a class="' . trim($style . ' item' . $classItem) . '" href="' . claro_htmlspecialchars(Url::Contextualize($url)) . '">' . '<img src="' . $icon . '" alt="" /> ' . $toolName . '</a>' . "\n"; } else { $toolLinkList[] = '<span ' . trim($style) . '>' . '<img src="' . $icon . '" alt="" /> ' . $toolName . '</span>' . "\n"; } }
} if (isset($tlabelReq) && !empty($tlabelReq)) { /*---------------------------------------------------------------------- Check tool access right an block unautorised users ----------------------------------------------------------------------*/ if (claro_is_course_required() && !claro_is_in_a_course()) { claro_disp_auth_form(true); } if (get_module_data($tlabelReq, 'type') == 'admin' && !claro_is_platform_admin()) { if (!claro_is_user_authenticated()) { claro_disp_auth_form(); } else { claro_die(get_lang('Not allowed')); } } if (get_module_data($tlabelReq, 'type') == 'crsmanage' && !(claro_is_course_manager() || claro_is_platform_admin())) { if (!claro_is_user_authenticated()) { claro_disp_auth_form(true); } else { claro_die(get_lang('Not allowed')); } } if ($tlabelReq !== 'CLWRK' && $tlabelReq !== 'CLGRP' && !claro_is_module_allowed() && !(isset($_SESSION['inPathMode']) && $_SESSION['inPathMode'] && ($tlabelReq == 'CLQWZ' || $tlabelReq == 'CLDOC'))) { if (!claro_is_user_authenticated()) { claro_disp_auth_form(true); } else { claro_die(get_lang('Not allowed')); } } if ($tlabelReq !== 'CLGRP' && $tlabelReq !== 'CLWRK' && claro_is_in_a_group() && (!claro_is_group_allowed() || !claro_is_allowed_to_edit() && !is_tool_activated_in_groups($_cid, $tlabelReq))) { claro_die(get_lang('Not allowed'));