本文整理汇总了PHP中claro_is_platform_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_is_platform_admin函数的具体用法?PHP claro_is_platform_admin怎么用?PHP claro_is_platform_admin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_is_platform_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current_user_is_allowed_to_send_message_to_current_group
/**
* return the autorisation of the current user to send a message to the current group
*
* @return bool true if the current user is autorised do send a message to the current group
* false if the current user is not autorised do send a message to the current group
*/
function current_user_is_allowed_to_send_message_to_current_group()
{
if (claro_is_platform_admin()) {
return true;
}
if (claro_is_group_tutor() || claro_is_course_admin()) {
return true;
}
return false;
}
示例2: buildRecords
function buildRecords($exportUserInfo = true)
{
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_user = $tbl_mdb_names['user'];
$tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->course_id));
$tbl_team = $tbl_cdb_names['group_team'];
$tbl_rel_team_user = $tbl_cdb_names['group_rel_team_user'];
$username = claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_username', false) ? "`U`.`username` AS `username`," : "";
if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password', false)) {
if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password_encrypted', true)) {
$password = "MD5(`U`.`password`) AS `password`,";
} else {
$password = "`U`.`password` AS `password`,";
}
} else {
$password = '';
}
// get user list
$sql = "SELECT `U`.`user_id` AS `userId`,\n `U`.`nom` AS `lastname`,\n `U`.`prenom` AS `firstname`,\n {$username}\n {$password}\n `U`.`email` AS `email`,\n `U`.`officialCode` AS `officialCode`,\n GROUP_CONCAT(`G`.`id`) AS `groupId`,\n GROUP_CONCAT(`G`.`name`) AS `groupName`\n FROM\n (\n `" . $tbl_user . "` AS `U`,\n `" . $tbl_rel_course_user . "` AS `CU`\n )\n LEFT JOIN `" . $tbl_rel_team_user . "` AS `GU`\n ON `U`.`user_id` = `GU`.`user`\n LEFT JOIN `" . $tbl_team . "` AS `G`\n ON `GU`.`team` = `G`.`id`\n WHERE `U`.`user_id` = `CU`.`user_id`\n AND `CU`.`code_cours`= '" . claro_sql_escape($this->course_id) . "'\n GROUP BY U.`user_id`\n ORDER BY U.`user_id`";
$userList = claro_sql_query_fetch_all($sql);
// build recordlist with good values for answers
if (is_array($userList) && !empty($userList)) {
// add titles at row 0, for that get the keys of the first row of array
$this->recordList[0] = array_keys($userList[0]);
$i = 1;
$userIdList = array();
foreach ($userList as $user) {
$userIdList[$user['userId']] = $i;
if (!(claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_id', false))) {
$user['userId'] = $i;
}
// $this->recordList is defined in parent class csv
$this->recordList[$i] = $user;
$i++;
}
if ($exportUserInfo) {
$userInfoList = new UserInfoList($this->course_id);
$userInfoLabelList = $userInfoList->getUserInfoLabels();
foreach ($userInfoLabelList as $catId => $catTitle) {
$this->recordList[0][] = $catTitle;
$userCatInfo = $userInfoList->getUserInfo($catId);
foreach ($userCatInfo as $userCatInfo) {
$this->recordList[$userIdList[$userCatInfo['userId']]][] = $userCatInfo['content'];
}
}
}
}
if (is_array($this->recordList) && !empty($this->recordList)) {
return true;
} else {
return false;
}
}
示例3: render
public function render()
{
$out = '';
if (!claro_is_user_authenticated()) {
if (get_conf('claro_displayLocalAuthForm', true) == true) {
$out .= $this->renderLoginLink();
}
} elseif (!claro_is_platform_admin() && (claro_is_in_a_course() && !claro_is_course_member()) && claro_get_current_course_data('registrationAllowed')) {
if (claro_is_current_user_enrolment_pending()) {
$out .= '<img src="' . get_icon_url('warning') . '" alt="off" /> ' . '<b>' . get_lang('Enrolment pending') . '</b>';
} else {
$out .= $this->renderRegistrationLink();
}
} elseif (claro_is_display_mode_available()) {
$out .= $this->renderViewModeSwitch();
}
return $out;
}
示例4: _prepareUserBanner
/**
* Prepare the user banner
*/
private function _prepareUserBanner()
{
if (claro_is_user_authenticated()) {
$userToolUrlListLeft = array();
$userToolUrlListRight = array();
if (get_conf('display_former_homepage')) {
}
$userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'desktop/index.php" target="_top">' . get_lang('My desktop') . '</a>';
$userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'messaging" target="_top">' . get_lang('My messages') . '</a>';
if (claro_is_platform_admin()) {
$userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'admin/" target="_top">' . get_lang('Platform administration') . '</a>';
}
$userToolUrlListRight[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/profile.php" target="_top">' . get_lang('Manage my account') . '</a>';
$userToolUrlListRight[] = '<a href="' . get_path('url') . '/index.php?logout=true" target="_top">' . get_lang('Logout') . '</a>';
$this->assign('userToolListRight', $userToolUrlListRight);
$this->assign('userToolListLeft', $userToolUrlListLeft);
$this->showBlock('userBanner');
} else {
$this->hideBlock('userBanner');
}
}
示例5: isModuleAllowed
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';
}
}
示例6: claro_is_allowed_to_edit
// course context
$is_allowedToEdit = claro_is_allowed_to_edit();
$pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/document/';
$pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/document/';
require claro_get_conf_repository() . 'CLDOC.conf.php';
$maxFilledSpace = get_conf('maxFilledSpace_for_course');
} elseif (claro_is_in_a_group()) {
// course context
$is_allowedToEdit = claro_is_allowed_to_edit();
$pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
$pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
require claro_get_conf_repository() . 'CLDOC.conf.php';
$maxFilledSpace = get_conf('maxFilledSpace_for_course');
} else {
// platform context
$is_allowedToEdit = claro_is_platform_admin();
$pathSys = get_path('rootSys') . 'platform/document/';
$pathWeb = get_path('rootWeb') . 'platform/document/';
}
/*
* Libraries
*/
include_once $includePath . '/lib/fileUpload.lib.php';
include_once $includePath . '/lib/fileManage.lib.php';
/*
* Init directory
*/
if (!file_exists($pathSys)) {
claro_mkdir($pathSys);
}
/*
示例7: trim
$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";
}
}
示例8: claro_is_course_enable
/**
* 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;
}
示例9: displayForm
/**
* Display form
*
* @param $cancelUrl string url of the cancel button
* @return string html output of form
*/
public function displayForm($cancelUrl = null)
{
JavascriptLoader::getInstance()->load('course_form');
$languageList = get_language_to_display_list('availableLanguagesForCourses');
$categoriesList = claroCategory::getAllCategoriesFlat();
$linkedCategoriesListHtml = '';
// Categories linked to the course
$unlinkedCategoriesListHtml = '';
// Other categories (not linked to the course)
foreach ($categoriesList as $category) {
// Is that category linked to the current course or not ?
$match = false;
foreach ($this->categories as $searchCategory) {
if ($category['id'] == (int) $searchCategory->id) {
$match = true;
break;
} else {
$match = false;
}
}
// Dispatch in the lists
if ($match) {
$linkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n";
} else {
if ($category['canHaveCoursesChild'] || claro_is_platform_admin()) {
$unlinkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n";
}
}
}
$publicDisabled = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' disabled="disabled"' : '';
$publicCssClass = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' class="notice"' : '';
$publicMessage = $this->access != 'public' && !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? '<br /><span class="notice">' . get_lang('If you need to create a public course, please contact the platform administrator') . '</span>' : '';
$cancelUrl = is_null($cancelUrl) ? get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($this->courseId) : $cancelUrl;
$template = new CoreTemplate('course_form.tpl.php');
$template->assign('formAction', $_SERVER['PHP_SELF']);
$template->assign('relayContext', claro_form_relay_context());
$template->assign('course', $this);
$template->assign('linkedCategoriesListHtml', $linkedCategoriesListHtml);
$template->assign('unlinkedCategoriesListHtml', $unlinkedCategoriesListHtml);
$template->assign('languageList', $languageList);
$template->assign('publicDisabled', $publicDisabled);
$template->assign('publicCssClass', $publicCssClass);
$template->assign('publicMessage', $publicMessage);
$template->assign('cancelUrl', $cancelUrl);
$template->assign('nonRootCategoryRequired', !get_conf('clcrs_rootCategoryAllowed', true));
return $template->render();
}
示例10: include_textzone
/**
* Include a textzone file
* @param string $textzone name of the textzone
* @param string $defaultContent content displayed if textzone cannot be found or doesn't exist
*/
function include_textzone($textzone, $defaultContent = null)
{
$textzone = secure_file_path($textzone);
// find correct path where the file is
// FIXME : move ALL textzones to the same location !
if (file_exists(get_path('rootSys') . './platform/textzone/' . $textzone)) {
$textzonePath = get_path('rootSys') . './platform/textzone/' . $textzone;
} elseif (file_exists(get_path('rootSys') . './' . $textzone)) {
$textzonePath = get_path('rootSys') . './' . $textzone;
} else {
$textzonePath = null;
}
// textzone content
if (!is_null($textzonePath)) {
include $textzonePath;
} else {
if (!is_null($defaultContent)) {
echo $defaultContent;
}
if (claro_is_platform_admin()) {
// help tip for administrator
echo '<p>' . get_lang('blockTextZoneHelp', array('%textZoneFile' => $textzone)) . '</p>';
}
}
// edit link
if (claro_is_platform_admin()) {
echo '<p>' . "\n" . '<a href="' . get_path('rootAdminWeb') . 'managing/editFile.php?cmd=rqEdit&file=' . $textzone . '">' . "\n" . '<img src="' . get_icon_url('edit') . '" alt="" />' . get_lang('Edit text zone') . "\n" . '</a>' . "\n" . '</p>' . "\n";
}
}
示例11: isset
$sortKeyList['title'] = SORT_ASC;
}
}
$offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
$assignmentPager = new claro_sql_pager($sql, $offset, $assignmentsPerPage);
foreach ($sortKeyList as $thisSortKey => $thisSortDir) {
$assignmentPager->add_sort_key($thisSortKey, $thisSortDir);
}
$assignmentList = $assignmentPager->get_result_list();
// Help URL
$helpUrl = $is_allowedToEdit ? get_help_page_url('blockAssignmentsHelp', 'CLWRK') : null;
// Command list
$cmdList = array();
if ($is_allowedToEdit) {
$cmdList[] = array('img' => 'assignment', 'name' => get_lang('Create a new assignment'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMkAssig')));
if (claro_is_platform_admin() || get_conf('allow_download_all_submissions')) {
$cmdList[] = array('img' => 'save', 'name' => get_lang('Download submissions'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqDownload')));
}
if (get_conf('mail_notification', false) && !get_conf('automatic_mail_notification', false)) {
$cmdList[] = array('img' => 'settings', 'name' => get_lang('Assignments preferences'), 'url' => claro_htmlspecialchars(Url::Contextualize('work_settings.php')));
}
}
$out = '';
$out .= claro_html_tool_title($nameTools, $helpUrl, $cmdList);
if ($is_allowedToEdit) {
$out .= $dialogBox->render();
// Form
if (isset($displayAssigForm) && $displayAssigForm) {
$out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" 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() . "\n" . '<fieldset>';
if (!is_null($assigId)) {
$out .= '<input type="hidden" name="assigId" value="' . $assigId . '" />' . "\n";
示例12: getUserAuthProfile
/**
* 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;
}
示例13: get_group_tool_list
/**
* 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 <moosh@claroline.net>
* @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;
}
示例14: get_path
<?php
// $Id: index.php 12977 2011-03-15 14:26:44Z abourguignon $
/**
* CLAROLINE
*
* This is the index page of sdk tools.
*
* @version $Revision: 12977 $
* @copyright (c) 2001-2011, Universite catholique de Louvain (UCL)
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
* @package SDK
* @author Claro Team <cvs@claroline.net>
* @author Christophe Gesche <moosh@claroline.net>
*/
require '../../inc/claro_init_global.inc.php';
if (file_exists(get_path('rootSys') . 'platform/currentVersion.inc.php')) {
include get_path('rootSys') . 'platform/currentVersion.inc.php';
}
$is_allowedToUseSDK = claro_is_platform_admin();
if (!$is_allowedToUseSDK) {
claro_disp_auth_form();
}
$nameTools = get_lang('Technical Tools');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$out = '';
$out .= claro_html_tool_title(array('mainTitle' => $nameTools)) . '<ul>' . "\n" . '<li><a href="./files_stats.php">' . get_lang('Files statistics') . '</a></li>' . "\n" . '<li><a href="./phpInfo.php">' . get_lang('PHP system information') . '</a></li>' . "\n" . '</ul>' . "\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
示例15: claro_is_current_user_enrolment_pending
function claro_is_current_user_enrolment_pending()
{
return !claro_is_platform_admin() && claro_is_course_registration_pending();
}