本文整理汇总了PHP中claro_is_allowed_to_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_is_allowed_to_edit函数的具体用法?PHP claro_is_allowed_to_edit怎么用?PHP claro_is_allowed_to_edit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_is_allowed_to_edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResourcesList
/**
* 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;
}
示例2: getSingleResource
/**
* 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);
}
}
示例3: getSingleResource
/**
* 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);
}
}
示例4: renderTitle
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;
}
示例5: renderTitle
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;
}
示例6: claro_redirect
/*============================================================================
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));
}
示例7: array
}
//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);
示例8: get_lang
?>
">
<?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>
示例9: claro_disp_auth_form
* @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";
示例10: getAdvancedJs
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;
}
示例11: get_path
$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;
示例12: get_access_mode_to_group_forum
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;
}
示例13:
// 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";
示例14: claro_get_current_user_id
*/
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;
示例15: set_current_module_label
* @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 <cvs@claroline.net>
*/
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 */