/** * 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; }
/** * 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); } }
/** * 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); } }
public function renderTitle() { $output = '<img ' . 'src="' . get_icon_url('headline', 'CLTI') . '"' . 'alt="' . get_lang('Headline') . '" /> ' . get_lang('Headlines'); if (claro_is_allowed_to_edit()) { $output .= ' <span class="separator">|</span> <a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php')) . '">' . '<img src="' . get_icon_url('settings') . '" alt="' . get_lang('Settings') . '" /> ' . get_lang('Manage') . '</a>'; } return $output; }
public function renderTitle() { $output = '<img ' . 'src="' . get_icon_url('announcement', 'CLANN') . '" ' . 'alt="Announcement icon" /> ' . get_lang('Latest announcements'); if (claro_is_allowed_to_edit()) { $output .= ' <span class="separator">|</span> <a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLANN') . '/announcements.php')) . '">' . '<img src="' . get_icon_url('settings') . '" alt="' . get_lang('Settings') . '" /> ' . get_lang('Manage') . '</a>'; } return $output; }
/*============================================================================ Group Publish Option ============================================================================*/ // redirect to the submission form prefilled with a .url document targetting the published document /** * @todo $_REQUEST['submitGroupWorkUrl'] must be treated in filter process */ if (isset($_REQUEST['submitGroupWorkUrl']) && !empty($_REQUEST['submitGroupWorkUrl']) && claro_is_in_a_group()) { claro_redirect(Url::Contextualize('user_work.php?authId=' . claro_get_current_group_id() . '&cmd=rqSubWrk' . '&assigId=' . $req['assignmentId'] . '&submitGroupWorkUrl=' . urlencode($_REQUEST['submitGroupWorkUrl']))); exit; } /*============================================================================ Permissions ============================================================================*/ $assignmentIsVisible = (bool) ($assignment->getVisibility() == 'VISIBLE'); $is_allowedToEditAll = (bool) claro_is_allowed_to_edit(); if (!$assignmentIsVisible && !$is_allowedToEditAll) { // if assignment is not visible and user is not course admin or upper claro_redirect(Url::Contextualize('work.php')); exit; } // upload or update is allowed between start and end date or after end date if late upload is allowed $uploadDateIsOk = $assignment->isUploadDateOk(); if ($assignment->getAssignmentType() == 'INDIVIDUAL') { // user is authed and allowed $userCanPost = (bool) (claro_is_user_authenticated() && claro_is_course_allowed() && claro_is_course_member()); } else { $userGroupList = get_user_group_list(claro_get_current_user_id()); // check if user is member of at least one group $userCanPost = (bool) (!empty($userGroupList)); }
} //load required js and css files JavaScriptLoader::getInstance()->load('forum'); CssLoader::getInstance()->load('clfrm', 'screen'); // Javascript confirm pop up declaration for header JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?'); JavascriptLanguage::getInstance()->addLangVar('Do you really want to sign your contribution ?'); JavascriptLoader::getInstance()->load('forum'); // Prepare display $out = ''; // Command list $cmdList = array(); $nameTools = get_lang('Forums'); $pagetype = !empty($editMode) ? $editMode : 'viewtopic'; // The title is put in the $out var at the end of this script if (claro_is_allowed_to_edit() && $topicId) { $out .= '<div style="float: right;">' . "\n" . '<img src=' . get_icon_url('html') . '" alt="" /> <a href="' . claro_htmlspecialchars(Url::Contextualize('export.php?type=HTML&topic=' . $topicId)) . '" target="_blank">' . get_lang('Export to HTML') . '</a>' . "\n" . '<img src="' . get_icon_url('mime/pdf') . '" alt="" /> <a href="' . claro_htmlspecialchars(Url::Contextualize('export.php?type=PDF&topic=' . $topicId)) . '" target="_blank">' . get_lang('Export to PDF') . '</a>' . "\n" . '</div>'; } if ($topicSettingList) { $out .= disp_forum_breadcrumb($pagetype, $forumSettingList['forum_id'], $forumSettingList['forum_name'], $topicSettingList['topic_id'], $topicSettingList['topic_title']); } else { $out .= disp_forum_breadcrumb($pagetype, $forumSettingList['forum_id'], $forumSettingList['forum_name']); } if ('show' != $cmd) { if ('default' == $anonymityStatus) { $info = '<tr valign="top">' . "\n" . '<td> </td>' . '<td><strong>' . get_lang('Contributions to this forum are anonymous by default!<br/>') . get_lang('If you want to sign your post all the same, uncheck the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2"> </td></tr>'; } elseif ('allowed' == $anonymityStatus) { $info = '<tr valign="top">' . "\n" . '<td> </td>' . '<td><strong>' . get_lang('This forum allows anonymous contributions!<br/>') . get_lang('If you do not want to sign your post, check the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2"> </td></tr>'; } if (!empty($info)) { $dialogBox->info($info);
?> "> <?php echo get_lang('Add a new portlet'); ?> : <?php echo get_lang($portlet['name']); ?> </a> </li> <?php } ?> </ul> <?php } ?> <?php if (count($this->portletIterator) > 0) { foreach ($this->portletIterator as $portlet) { if ($portlet->getVisible() || !$portlet->getVisible() && claro_is_allowed_to_edit()) { echo $portlet->render(); } } } elseif (count($this->portletIterator) == 0 && claro_is_allowed_to_edit()) { echo get_block('blockIntroCourse'); } ?> </div>
* @package Wiki */ $tlabelReq = 'CLWIKI'; require_once "../inc/claro_init_global.inc.php"; if (!claro_is_tool_allowed()) { if (!claro_is_in_a_course()) { claro_disp_auth_form(true); } else { claro_die(get_lang("Not allowed")); } } // display mode claro_set_display_mode_available(TRUE); // check and set user access level for the tool // set admin mode and groupId $is_allowedToAdmin = claro_is_allowed_to_edit(); if (claro_is_in_a_group() && claro_is_group_allowed()) { // group context $groupId = (int) claro_get_current_group_id(); } elseif (claro_is_in_a_group() && !claro_is_group_allowed()) { claro_die(get_lang("Not allowed")); } elseif (claro_is_course_allowed()) { // course context $groupId = 0; } else { claro_disp_auth_form(); } // require wiki files require_once "lib/class.wiki.php"; require_once "lib/class.wikistore.php"; require_once "lib/class.wikipage.php";
public function getAdvancedJs() { // ok, it's not cool to use global for that but it has to be shared between instances // TODO find a cool way to do that global $_isAdvancedJsLoaded; $html = ''; if (claro_is_allowed_to_edit()) { $configFile = 'advanced'; } else { $configFile = 'advanced_users'; } if (!isset($_isAdvancedJsLoaded)) { /*if( get_conf('useTinyMCECompressor') ) { $html .= '<script language="javascript" type="text/javascript" src="'.$this->webPath.'/'.$configFile.'_gzip.conf.js"></script>'."\n"; }*/ $html .= '<script language="javascript" type="text/javascript" src="' . $this->webPath . '/' . $configFile . '.conf.js"></script>' . "\n"; $_isAdvancedJsLoaded = true; } return $html; }
$tbl_lp_learnPath = $tbl_cdb_names['lp_learnPath']; $tbl_lp_rel_learnPath_module = $tbl_cdb_names['lp_rel_learnPath_module']; $tbl_lp_user_module_progress = $tbl_cdb_names['lp_user_module_progress']; $tbl_lp_module = $tbl_cdb_names['lp_module']; $tbl_lp_asset = $tbl_cdb_names['lp_asset']; $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'; require_once get_path('incRepositorySys') . '/lib/learnPath.lib.inc.php'; $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : ''; if (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit()) { switch ($cmd) { case "resetLearnPath": $learnPath_id = isset($_GET['path_id']) ? $_GET['path_id'] : ''; $user_id = isset($_GET['user_id']) ? $_GET['user_id'] : ''; if (!empty($learnPath_id) && !empty($user_id)) { $dialogBox = new DialogBox(); if (resetModuleProgressionByPathId($user_id, $learnPath_id)) { $dialogBox->success(get_lang('Learning path reset successful')); } else { $dialogBox->error(get_lang('An error occured while resetting learning path ') . $learnPath_id); } } unset($learnPath_id); unset($user_id); break;
function get_access_mode_to_group_forum($forum) { if (claro_is_user_authenticated()) { $userGroupList = get_user_group_list(claro_get_current_user_id()); $userGroupList = array_keys($userGroupList); $tutorGroupList = get_tutor_group_list(claro_get_current_user_id()); } else { $userGroupList = array(); $tutorGroupList = array(); } $is_groupPrivate = claro_get_current_group_properties_data('private'); $group_id = is_null($forum['group_id']) ? null : (int) $forum['group_id']; if (!is_null($group_id)) { if (in_array($group_id, $userGroupList) || in_array($group_id, $tutorGroupList) || !$is_groupPrivate || claro_is_allowed_to_edit()) { if (is_array($tutorGroupList) && in_array($group_id, $tutorGroupList)) { $accessMode = 'tutor'; } elseif (is_array($userGroupList) && in_array($group_id, $userGroupList)) { $accessMode = 'member'; } else { $accessMode = 'visitor'; } } else { $accessMode = 'private'; } return $accessMode; } return false; }
// display flags $dispWrkLst = true; } else { // ask prepare form $cmd = "rqSubWrk"; } } /*----------------------------------- STEP 1 : prepare form -------------------------------------*/ if ($cmd == "rqSubWrk") { // prepare fields if (!isset($_REQUEST['submitWrk']) || !$_REQUEST['submitWrk']) { // prefill som fields of the form $form['wrkTitle'] = ""; if (claro_is_allowed_to_edit() && $authName) { $form['wrkAuthors'] = $authName; } else { $form['wrkAuthors'] = $currentUserLastName . " " . $currentUserFirstName; } $form['wrkGroup'] = ""; $form['wrkTxt'] = ""; } else { // there was an error in the form so display it with already modified values $form['wrkTitle'] = !empty($_REQUEST['wrkTitle']) ? $_REQUEST['wrkTitle'] : ''; $form['wrkAuthors'] = !empty($_REQUEST['wrkAuthors']) ? $_REQUEST['wrkAuthors'] : ''; $form['wrkGroup'] = !empty($_REQUEST['wrkGroup']) ? $_REQUEST['wrkGroup'] : ''; $form['wrkTxt'] = !empty($_REQUEST['wrkTxt']) ? $_REQUEST['wrkTxt'] : ''; } // request the form with correct cmd $cmdToSend = "exSubWrk";
*/ if (isset($_REQUEST['uInfo'])) { $userIdViewed = (int) $_REQUEST['uInfo']; } else { $userIdViewed = 0; } /*-------------------------------------------------------- Connection API between Claroline and the current script --------------------------------------------------------*/ $userIdViewer = claro_get_current_user_id(); // id fo the user currently online //$userIdViewed = $_GET['userIdViewed']; // Id of the user we want to view $allowedToEditContent = $userIdViewer == $userIdViewed || claro_is_allowed_to_edit(); $allowedToEditDef = claro_is_allowed_to_edit(); $is_allowedToTrack = (claro_is_allowed_to_edit() || $userIdViewer == $userIdViewed) && get_conf('is_trackingEnabled'); if (!claro_is_allowed_to_edit() && !get_conf('linkToUserInfo')) { claro_die(get_lang('Not allowed')); } // clean field submited by the user if ($_POST) { foreach ($_POST as $key => $value) { ${$key} = replace_dangerous_char($value); } } /*====================================== COMMANDS SECTION ======================================*/ $displayMode = "viewContentList"; $cmdList = array('submitDef', 'removeDef', 'editDef', 'addDef', 'moveUpDef', 'moveDownDef', 'viewDefList', 'editMainUserInfo', 'exUpdateCourseUserProperties'); $cmd = isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $cmdList) ? $_REQUEST['cmd'] : null; $do = null;
* @copyright (c) 2001-2008 Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * * @package CLINTRO * * @author Claro Team <*****@*****.**> */ global $introId; $GLOBALS['moduleId'] = -1; $output = ''; set_current_module_label('CLINTRO'); FromKernel::uses('core/linker.lib'); ResourceLinker::init(); $tbl_cdb_names = claro_sql_get_course_tbl(); $TBL_INTRODUCTION = $tbl_cdb_names['tool_intro']; $intro_editAllowed = claro_is_allowed_to_edit(); if (isset($_REQUEST['introCmd']) && $intro_editAllowed) { $introCmd = $_REQUEST['introCmd']; if (isset($_REQUEST['introId'])) { $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['introId'])); ResourceLinker::setCurrentLocator($currentLocator); } } else { $introCmd = false; } $intro_exDel = false; /*========================================================= INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) ========================================================*/ if ($intro_editAllowed) { /* Replace command */
$prevNextString .= '<a href="' . claro_htmlspecialchars(Url::Contextualize('startModule.php?viewModule_id=' . $previousModule)) . '" target="mainFrame">' . get_lang('Previous') . '</a>'; } else { $prevNextString .= get_lang('Previous'); } $prevNextString .= ' | '; if ($nextModule != '') { $prevNextString .= '<a href="' . claro_htmlspecialchars(Url::Contextualize('startModule.php?viewModule_id=' . $nextModule)) . '" target="mainFrame">' . get_lang('Next') . '</a>'; } else { $prevNextString .= get_lang('Next'); } $prevNextString .= '</small><br /><br />' . "\n"; $out .= $prevNextString; } // set redirection link if (!empty($_SESSION['returnToTrackingUserId'])) { $returl = Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/lp_modules_details.php?uInfo=' . (int) $_SESSION['returnToTrackingUserId'] . '&path_id=' . (int) $_SESSION['path_id']); } elseif (claro_is_allowed_to_edit() && (!isset($_SESSION['asStudent']) || $_SESSION['asStudent'] == 0)) { $returl = Url::Contextualize('../learningPathAdmin.php'); } else { $returl = Url::Contextualize('../learningPath.php'); } $out .= '<form action="' . claro_htmlspecialchars($returl) . '" method="post" target="_top"> <input type="submit" value="' . get_lang('Back to list') . '" /> </form> </center>'; // footer $hide_footer = TRUE; $claroline->setDisplayType(Claroline::FRAME); $claroline->display->body->appendContent($out); echo $claroline->display->render();
$out .= '<td>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=export&path_id=' . $list['learnPath_id'])) . '" >' . '<img src="' . get_icon_url('export') . '" alt="' . get_lang('Export') . '" />' . '</a>' . "\n" . '</td>' . "\n"; if (get_conf('is_trackingEnabled')) { // statistics links $out .= '<td>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/learnPath_details.php?path_id=' . $list['learnPath_id'])) . '">' . "\n" . '<img src="' . get_icon_url('statistics') . '" alt="' . get_lang('Tracking') . '" />' . '</a>' . "\n" . '</td>' . "\n"; } } elseif ($lpUid) { // % progress $prog = get_learnPath_progress($list['learnPath_id'], $lpUid); if (!isset($globalprog)) { $globalprog = 0; } if ($prog >= 0) { $globalprog += $prog; } $out .= '<td align="right">' . claro_html_progress_bar($prog, 1) . '</td>' . "\n" . '<td align="left">' . '<small>' . $prog . '% </small>' . '</td>'; } $out .= '</tr>' . "\n"; $iterator++; } // end while $out .= '</tbody>' . "\n" . '<tfoot>'; if ($iterator == 1) { $out .= '<tr>' . "\n" . '<td align="center" colspan="8">' . "\n" . get_lang('No learning path') . '</td>' . "\n" . '</tr>'; } elseif (!claro_is_allowed_to_edit() && $iterator != 1 && $lpUid) { // add a blank line between module progression and global progression $total = round($globalprog / ($iterator - 1)); $out .= '<tr>' . "\n" . '<td colspan="3">' . "\n" . ' ' . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '<tr>' . "\n" . '<td align ="right">' . "\n" . get_lang('Course progression') . "\n" . ' :' . "\n" . '</td>' . "\n" . '<td align="right" >' . "\n" . claro_html_progress_bar($total, 1) . '</td>' . "\n" . '<td align="left">' . "\n" . '<small>' . $total . '%' . "\n" . '</small>' . "\n" . '</td>' . "\n" . '</tr>' . "\n"; } $out .= '</tfoot>' . "\n" . '</table>' . "\n"; $claroline->display->body->appendContent($out); echo $claroline->display->render();
public function render() { // Portlet's management commands if (claro_is_allowed_to_edit()) { $commands = '<span style="float: right;">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=moveUp&portletLabel=' . $this->label . '&portletId=' . $this->id)) . '">' . '<img src="' . get_icon_url('go_up') . '" alt="' . get_lang('Move up') . '" />' . '</a> <a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=moveDown&portletLabel=' . $this->label . '&portletId=' . $this->id)) . '">' . '<img src="' . get_icon_url('go_down') . '" alt="' . get_lang('Move down') . '" />' . '</a> <a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=' . ($this->visible ? 'makeInvisible' : 'makeVisible') . '&portletLabel=' . $this->label . '&portletId=' . $this->id)) . '" title="' . ($this->visible ? get_lang('Hide this item') : get_lang('Show this item')) . '">' . '<img src="' . ($this->visible ? get_icon_url('visible') : get_icon_url('invisible')) . '" alt="' . get_lang('Swap visibility') . '" />' . '</a> <a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=delete&portletLabel=' . $this->label . '&portletId=' . $this->id)) . '">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a> ' . '</span>'; } else { $commands = ''; } if ($this->visible) { $out = '<div class="portlet">' . "\n" . '<h1>' . "\n" . $this->renderTitle() . $commands . "\n" . '</h1>' . "\n" . '<div class="content">' . "\n" . $this->renderContent() . '</div>' . "\n" . '</div>' . "\n\n"; } else { // If not visible, only render the title bar $out = '<div class="portlet hidden">' . "\n" . '<h1>' . "\n" . $this->renderTitle() . $commands . "\n" . '</h1>' . "\n" . '</div>' . "\n\n"; } return $out; }
/** * Returns the tool list for each cours of the user. * @throws InvalidArgumentException if the cid in not provided. * @webservice{/module/MOBILE/User/getCoursToolList/cidReq} * @ws_arg{method,getCoursToolList} * @ws_arg{cidReq,SYSCODE of requested cours} * @return array of course object with only the syscode and tool-related fields filled. */ function getToolList() { $cid = claro_get_current_course_id(); if ($cid == null) { throw new InvalidArgumentException('Missing cid argument!'); } FromKernel::uses('courselist.lib'); $tools = array(); foreach (claro_get_course_tool_list($cid, claro_get_current_user_profile_id_in_course($cid)) as $tool) { if (isset($tool['label']) && $tool['installed'] && $tool['activated'] && ($tool['visibility'] || claro_is_allowed_to_edit())) { unset($tool['id']); unset($tool['tool_id']); unset($tool['external_name']); unset($tool['external']); unset($tool['icon']); unset($tool['activation']); unset($tool['url']); unset($tool['activated']); unset($tool['installed']); $tool['name'] = get_lang($tool['name']); $tool['visibility'] = $tool['visibility'] == true; // Force the boolean representation in JSON $tools[] = $tool; } } return $tools; }
if (isset($_REQUEST['subject'])) { $subject = $_REQUEST['subject']; } else { $subject = ''; } // XSS $subject = strip_tags($subject); if (isset($_REQUEST['message'])) { $message = $_REQUEST['message']; } else { $message = ''; } // XSS $message = preg_replace('/<script[^\\>]*>|<\\/script>|(onabort|onblur|onchange|onclick|ondbclick|onerror|onfocus|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onresize|onselect|onsubmit|onunload)\\s*=\\s*"[^"]+"/i', '', $message); $forumSettingList = get_forum_settings($forum_id); $is_allowedToEdit = claro_is_allowed_to_edit() || claro_is_group_tutor() && !claro_is_course_manager(); // ( claro_is_group_tutor() // is added to give admin status to tutor // && !claro_is_course_manager()) // is added to let course admin, tutor of current group, use student mode if (!claro_is_user_authenticated() || !claro_is_in_a_course()) { claro_disp_auth_form(true); } elseif ($forumSettingList) { $forum_name = stripslashes($forumSettingList['forum_name']); $forum_post_allowed = $forumSettingList['forum_access'] != 0 ? true : false; $forum_type = $forumSettingList['forum_type']; $forum_groupId = $forumSettingList['idGroup']; $forum_cat_id = $forumSettingList['cat_id']; /* * Check if the topic isn't attached to a group, or -- if it is attached --, * check the user is allowed to see the current group forum.
require_once '../inc/claro_init_global.inc.php'; if (!claro_is_tool_allowed()) { if (!claro_is_in_a_course()) { claro_die(get_lang("Not allowed")); } else { claro_disp_auth_form(true); } } // check and set user access level for the tool if (!isset($_REQUEST['wikiId'])) { claro_redirect(Url::Contextualize("wiki.php")); exit; } // set admin mode and groupId claro_set_display_mode_available(TRUE); $is_allowedToAdmin = claro_is_allowed_to_edit() || claro_is_in_a_group() && claro_is_group_tutor(); if (claro_is_in_a_group() && claro_is_group_allowed()) { // group context $groupId = (int) claro_get_current_group_id(); } elseif (claro_is_in_a_group() && !claro_is_group_allowed()) { claro_die(get_lang("Not allowed")); } elseif (claro_is_course_allowed()) { // course context $groupId = 0; } else { claro_disp_auth_form(); } // Wiki specific classes and libraries require_once "lib/class.wiki2xhtmlrenderer.php"; require_once "lib/class.wikipage.php"; require_once "lib/class.wikistore.php";
// Command list $cmdList = array(); /* * if the $curDirName is empty, we're in the root point * and we can't go to a parent dir */ if ($curDirName || $cmd == 'exSearch') { $cmdList[] = array('img' => 'parent', 'name' => get_lang('Up'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChDir&file=' . download_url_encode($parentDir)))); } $cmdList[] = array('img' => 'search', 'name' => get_lang('Search'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqSearch&cwd=' . $cmdCurDirPath))); if (trim($searchPattern) != '') { $downloadArgument = 'searchPattern=' . rawurlencode($searchPattern); } else { $downloadArgument = 'file=' . download_url_encode($curDirPath); } if (claro_is_user_authenticated() && (claro_is_allowed_to_edit() || get_conf('cldoc_allowNonManagersToDownloadFolder', true)) || get_conf('cldoc_allowNonManagersToDownloadFolder', true) && get_conf('cldoc_allowAnonymousToDownloadFolder', true)) { if (isset($fileList) && count($fileList) > 0) { // Download current folder $cmdList[] = array('img' => 'save', 'name' => get_lang('Download current directory'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDownload&' . $downloadArgument))); } } if ($is_allowedToEdit) { // Create directory, document, hyperlink or upload file $cmdList[] = array('img' => 'upload', 'name' => get_lang('Upload file'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqUpload&cwd=' . $cmdCurDirPath))); $cmdList[] = array('img' => 'folder', 'name' => get_lang('Create directory'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMkDir&cwd=' . $cmdCurDirPath))); $cmdList[] = array('img' => 'link', 'name' => get_lang('Create hyperlink'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMkUrl&cwd=' . $cmdCurDirPath))); $cmdList[] = array('img' => 'html', 'name' => get_lang('Create Document'), 'url' => claro_htmlspecialchars(Url::Contextualize('rqmkhtml.php?cmd=rqMkHtml&cwd=' . $cmdCurDirPath))); } $helpUrl = $is_allowedToEdit ? get_help_page_url('blockDocumentsHelp', 'CLDOC') : null; // Display title $out .= claro_html_tool_title($titleElement, $helpUrl, $cmdList);
if ($module['contentType'] == CTEXERCISE_) { $moduleImg = get_icon_url('quiz', 'CLQWZ'); } else { $moduleImg = get_icon_url(choose_image(basename($module['path']))); } $out .= '<img src="' . $moduleImg . '" alt="' . $contentType_alt . '" border="0" /> ' . "\n" . claro_htmlspecialchars(claro_utf8_decode($module['name'], get_conf('charset'))); } $out .= '</td>' . "\n"; if (claro_is_user_authenticated() && $module['contentType'] != CTLABEL_) { // display the progress value for current module $out .= '<td align="right">' . claro_html_progress_bar($progress, 1) . '</td>' . "\n" . '<td align="left">' . '<small> ' . $progress . '%</small>' . '</td>' . "\n"; } elseif (claro_is_user_authenticated() && $module['contentType'] == CTLABEL_) { $out .= '<td colspan="2"> </td>' . "\n"; } //-- reset link for current module if (claro_is_user_authenticated() && (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit())) { if (getModuleProgression(claro_get_current_user_id(), $_SESSION['path_id'], $module['learnPath_module_id'])) { $out .= '<td><a href="' . Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=resetModuleProgression&learnPath_module_id=' . $module['learnPath_module_id'] . '&path_id=' . $_SESSION['path_id']) . '" onclick="return confirm(\'' . clean_str_for_javascript(get_lang('Do you really want to reset module ') . $module['name']) . '?\');"><img src="' . get_icon_url('delete') . '" alt="' . get_lang('Reset') . '" /></a></td>' . "\n"; } else { $out .= '<td>' . get_lang('No results available') . '</td>' . "\n"; } } if ($progress > 0) { $globalProg = $globalProg + $progress; } if ($module['contentType'] != CTLABEL_) { $moduleNb++; } // increment number of modules used to compute global progression except if the module is a title $out .= '</tr>' . "\n\n"; $atleastOne = true;
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @author Claro Team <*****@*****.**> */ $tlabelReq = 'CLQWZ'; require '../../inc/claro_init_global.inc.php'; if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } require_once '../lib/add_missing_table.lib.php'; init_qwz_questions_categories(); claro_set_display_mode_available(true); $is_allowedToEdit = claro_is_allowed_to_edit(); if (!$is_allowedToEdit) { claro_disp_auth_form(true); } $is_allowedToTrack = claro_is_allowed_to_edit() && get_conf('is_trackingEnabled'); // tool libraries include_once '../lib/question.class.php'; // claroline libraries include_once get_path('incRepositorySys') . '/lib/pager.lib.php'; /* * DB tables definition */ $tbl_cdb_names = get_module_course_tbl(array('qwz_questions_categories'), claro_get_current_course_id()); $tbl_qwz_question_categorie = $tbl_cdb_names['qwz_questions_categories']; // init request vars $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $catId = isset($_REQUEST['catId']) ? $_REQUEST['catId'] : null; $dialogBox = new DialogBox(); if (!is_null($cmd)) { $questionCategory = new QuestionCategory();
* * @version $Revision: 14314 $ * @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/CLGRP * @package CLGRP * @author Claro Team <*****@*****.**> */ $tlabelReq = 'CLGRP'; require '../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/form.lib.php'; require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php'; if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $is_allowedToManage = claro_is_allowed_to_edit(); if (!$is_allowedToManage) { claro_die(get_lang("Not allowed")); } $dialogBox = new DialogBox(); $nameTools = get_lang("Edit this group"); $tbl_cdb_names = claro_sql_get_course_tbl(); $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_rel_user_course = $tbl_mdb_names['rel_course_user']; $tbl_user = $tbl_mdb_names['user']; $tbl_bb_forum = $tbl_cdb_names['bb_forums']; $tbl_group_rel_team_user = $tbl_cdb_names['group_rel_team_user']; $tbl_group_team = $tbl_cdb_names['group_team']; $currentCourseId = claro_get_current_course_id(); $_groupProperties = claro_get_current_group_properties_data(); $myStudentGroup = claro_get_current_group_data();
----------------------------------------------------------------------------*/ $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'])) { $label = $toolNameList[$thisTool['label']]; $toolName = get_lang($label); $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']); }
/** * Returns the documents contained into args['curDirPath'] * @param array $args array of parameters, can contain : * - (boolean) recursive : if true, return the content of the requested directory and its subdirectories, if any. Default = true * - (String) curDirPath : returns the content of the directory specified by this path. Default = '' (root) * @throws InvalidArgumentException if $cid is missing * @webservice{/module/MOBILE/CLDOC/getResourceList/cidReq/[?recursive=BOOL&curDirPath='']} * @ws_arg{Method,getResourcesList} * @ws_arg{cidReq,SYSCODE of requested cours} * @ws_arg{recursive,[Optionnal: if true\, return the content of the requested directory and its subdirectories\, if any. Default = true]} * @ws_arg{curDirPath,[Optionnal: returns the content of the directory specified by this path. Default = '' (root)]} * @return array of document object */ function getResourcesList($args) { $recursive = isset($args['recursive']) ? $args['recursive'] : true; $curDirPath = isset($args['curDirPath']) ? $args['curDirPath'] : ''; $cid = claro_get_current_course_id(); if (is_null($cid)) { throw new InvalidArgumentException('Missing cid argument!'); } elseif (!claro_is_course_allowed()) { throw new RuntimeException('Not allowed', 403); } /* READ CURRENT DIRECTORY CONTENT = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ $claroline = Claroline::getInstance(); $exSearch = false; $groupContext = FALSE; $courseContext = TRUE; $dbTable = get_module_course_tbl(array('document'), $cid); $dbTable = $dbTable['document']; $docToolId = get_course_tool_id('CLDOC'); $groupId = claro_get_current_group_id(); $date = $claroline->notification->getLastActionBeforeLoginDate(claro_get_current_user_id()); if (!defined('A_DIRECTORY')) { define('A_DIRECTORY', 1); } if (!defined('A_FILE')) { define('A_FILE', 2); } $baseWorkDir = get_path('coursesRepositorySys') . claro_get_course_path($cid) . '/document'; /*---------------------------------------------------------------------------- LOAD FILES AND DIRECTORIES INTO ARRAYS ----------------------------------------------------------------------------*/ $searchPattern = ''; $searchRecursive = false; $searchBasePath = $baseWorkDir . $curDirPath; $searchExcludeList = array(); $searchBasePath = secure_file_path($searchBasePath); if (false === ($filePathList = claro_search_file(search_string_to_pcre($searchPattern), $searchBasePath, $searchRecursive, 'ALL', $searchExcludeList))) { switch (claro_failure::get_last_failure()) { case 'BASE_DIR_DONT_EXIST': pushClaroMessage($searchBasePath . ' : call to an unexisting directory in groups'); break; default: pushClaroMessage('Search failed'); break; } $filePathList = array(); } for ($i = 0; $i < count($filePathList); $i++) { $filePathList[$i] = str_replace($baseWorkDir, '', $filePathList[$i]); } if ($exSearch && $courseContext) { $sql = "SELECT path FROM `" . $dbTable . "`\n\t\t\t\t\tWHERE comment LIKE '%" . claro_sql_escape($searchPattern) . "%'"; $dbSearchResult = claro_sql_query_fetch_all_cols($sql); $filePathList = array_unique(array_merge($filePathList, $dbSearchResult['path'])); } $fileList = array(); if (count($filePathList) > 0) { /*-------------------------------------------------------------------------- SEARCHING FILES & DIRECTORIES INFOS ON THE DB ------------------------------------------------------------------------*/ /* * Search infos in the DB about the current directory the user is in */ if ($courseContext) { $sql = "SELECT `path`, `visibility`, `comment`\n\t\t\t\t\t\tFROM `" . $dbTable . "`\n\t\t\t\t\t\t\t\tWHERE path IN ('" . implode("', '", array_map('claro_sql_escape', $filePathList)) . "')"; $xtraAttributeList = claro_sql_query_fetch_all_cols($sql); } else { $xtraAttributeList = array('path' => array(), 'visibility' => array(), 'comment' => array()); } foreach ($filePathList as $thisFile) { $fileAttributeList['cours']['sysCode'] = $cid; $fileAttributeList['path'] = $thisFile; $fileAttributeList['resourceId'] = $thisFile; $tmp = explode('/', $thisFile); if (is_dir($baseWorkDir . $thisFile)) { $fileYear = date('n', time()) < 8 ? date('Y', time()) - 1 : date('Y', time()); $fileAttributeList['title'] = $tmp[count($tmp) - 1]; $fileAttributeList['isFolder'] = true; $fileAttributeList['type'] = A_DIRECTORY; $fileAttributeList['size'] = 0; $fileAttributeList['date'] = $fileYear . '-09-20'; $fileAttributeList['extension'] = ""; $fileAttributeList['url'] = null; } elseif (is_file($baseWorkDir . $thisFile)) { $fileAttributeList['title'] = implode('.', explode('.', $tmp[count($tmp) - 1], -1)); $fileAttributeList['type'] = A_FILE; $fileAttributeList['isFolder'] = false; $fileAttributeList['size'] = claro_get_file_size($baseWorkDir . $thisFile); $fileAttributeList['date'] = date('Y-m-d', filemtime($baseWorkDir . $thisFile)); $fileAttributeList['extension'] = get_file_extension($baseWorkDir . $thisFile); $fileAttributeList['url'] = $_SERVER['SERVER_NAME'] . claro_get_file_download_url($thisFile); } $xtraAttributeKey = array_search($thisFile, $xtraAttributeList['path']); if ($xtraAttributeKey !== false) { $fileAttributeList['description'] = $xtraAttributeList['comment'][$xtraAttributeKey]; $fileAttributeList['visibility'] = $xtraAttributeList['visibility'][$xtraAttributeKey] == 'v'; unset($xtraAttributeList['path'][$xtraAttributeKey]); } else { $fileAttributeList['description'] = null; $fileAttributeList['visibility'] = true; } $notified = $claroline->notification->isANotifiedDocument($cid, $date, claro_get_current_user_id(), $groupId, $docToolId, $fileAttributeList, false); $fileAttributeList['notifiedDate'] = $notified ? $date : $fileAttributeList['date']; $d = new DateTime($date); $d->sub(new DateInterval('P1D')); $fileAttributeList['seenDate'] = $d->format('Y-m-d'); if ($fileAttributeList['visibility'] || claro_is_allowed_to_edit()) { $fileList[] = $fileAttributeList; } } // end foreach $filePathList } if ($recursive) { foreach ($fileList as $thisFile) { if ($thisFile['type'] == A_DIRECTORY) { $args = array('curDirPath' => $thisFile['path'], 'recursive' => true); $new_list = $this->getResourcesList($args); $fileList = array_merge($fileList, $new_list); } } } return $fileList; }
// $Id: question_pool.php 14420 2013-04-12 12:22:30Z zefredz $ /** * CLAROLINE * * @version $Revision: 14420 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @author Claro Team <*****@*****.**> */ $tlabelReq = 'CLQWZ'; require '../../inc/claro_init_global.inc.php'; if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $is_allowedToEdit = claro_is_allowed_to_edit(); // courseadmin reserved page if (!$is_allowedToEdit) { header("Location: " . Url::Contextualize("../exercise.php")); 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';
} 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')); } /*---------------------------------------------------------------------- Install module ----------------------------------------------------------------------*/ if (claro_is_in_a_course() && !is_module_installed_in_course($tlabelReq, claro_get_current_course_id())) { install_module_database_in_course($tlabelReq, claro_get_current_course_id()); } } /*---------------------------------------------------------------------- Context from URL ----------------------------------------------------------------------*/ // if page is called from another tool ... (from LP for an example) if (isset($_REQUEST['calledFrom'])) { $calledFrom = $_REQUEST['calledFrom'];