本文整理汇总了PHP中claro_is_user_authenticated函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_is_user_authenticated函数的具体用法?PHP claro_is_user_authenticated怎么用?PHP claro_is_user_authenticated使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_is_user_authenticated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _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');
}
}
示例3: event
public function event($type, $args = null)
{
if (!is_array($args)) {
$args = array();
}
if (!array_key_exists('cid', $args) && claro_is_in_a_course()) {
$args['cid'] = claro_get_current_course_id();
}
if (!array_key_exists('gid', $args) && claro_is_in_a_group()) {
$args['gid'] = claro_get_current_group_id();
}
if (!array_key_exists('tid', $args) && claro_is_in_a_tool()) {
$args['tid'] = claro_get_current_tool_id();
// $args['tlabel'] = get_current_module_label();
}
if (!array_key_exists('uid', $args) && claro_is_user_authenticated()) {
$args['uid'] = claro_get_current_user_id();
}
if (!array_key_exists('date', $args)) {
$args['date'] = claro_date("Y-m-d H:i:00");
}
$this->notifyEvent($type, $args);
}
示例4: claro_parse_user_text
}
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Exercises'), 'exercise.php');
$out = '';
$nameTools = $exercise->getTitle();
//-- display properties
if (trim($exercise->getDescription()) != '' || !($showResult && !$recordResults) && $exercise->getTimeLimit() > $currentTime) {
$out .= '<blockquote>' . "\n" . claro_parse_user_text($exercise->getDescription()) . "\n" . '</blockquote>' . "\n";
}
$out .= '<ul style="font-size:small">' . "\n";
if ($exercise->getDisplayType() == 'SEQUENTIAL' && $exercise->getTimeLimit() > 0 && (!$exercise->getAttempts() || $userAttemptCount <= $exercise->getAttempts()) && !($showResult && !$recordResults) && $exercise->getTimeLimit() > $currentTime && $startExercise) {
$out .= '<li>' . get_lang('Current time') . ' : <span id="currentTime">' . claro_html_duration($currentTime) . '</span></li>' . "\n";
}
if ($exercise->getTimeLimit() > 0 && (!$exercise->getAttempts() || $userAttemptCount <= $exercise->getAttempts()) && !($showResult && !$recordResults) && $exercise->getTimeLimit() > $currentTime) {
$out .= '<li>' . get_lang('Time limit') . " : " . claro_html_duration($exercise->getTimeLimit()) . '</li>' . "\n";
}
if (claro_is_user_authenticated() && isset($userAttemptCount) && (!$exercise->getAttempts() || $userAttemptCount <= $exercise->getAttempts()) && !($showResult && !$recordResults) && $exercise->getTimeLimit() > $currentTime) {
if ($exercise->getAttempts() > 0) {
$out .= '<li>' . get_lang('Attempt %attemptCount on %attempts', array('%attemptCount' => $userAttemptCount, '%attempts' => $exercise->getAttempts())) . '</li>' . "\n";
}
}
if (!is_null($exercise->getEndDate()) && !($showResult && !$recordResults) && $exercise->getTimeLimit() > $currentTime) {
$out .= '<li>' . get_lang('Available from %startDate until %endDate', array('%startDate' => claro_html_localised_date(get_locale('dateTimeFormatLong'), $exercise->getStartDate()), '%endDate' => claro_html_localised_date(get_locale('dateTimeFormatLong'), $exercise->getEndDate()))) . '</li>' . "\n";
}
$out .= '</ul>' . "\n\n";
if ($showResult) {
if (isset($_SESSION['inPathMode']) && $_SESSION['inPathMode']) {
// old learning path tool
$out .= '<form method="get" action="../learnPath/navigation/backFromExercise.php">' . "\n" . '<input type="hidden" name="op" value="finish" />';
} elseif (!$inLP) {
// standard exercise mode
$out .= '<form method="get" action="exercise.php">';
示例5: claro_get_course_user_data
// and claro_get_current_course_user_data() do the same job
$_profileId = $_course_user_properties['privilege']['_profileId'];
$is_courseMember = $_course_user_properties['privilege']['is_courseMember'];
$is_courseTutor = $_course_user_properties['privilege']['is_courseTutor'];
$is_courseAdmin = $_course_user_properties['privilege']['is_courseAdmin'];
$_courseUser = claro_get_course_user_data($_cid, $_uid);
} else {
// course
$_profileId = claro_get_profile_id('anonymous');
$is_courseMember = false;
$is_courseAdmin = false;
$is_courseTutor = false;
$_courseUser = null;
// not used
}
$is_courseAllowed = (bool) ($_course['visibility'] && ($_course['access'] == 'public' || $_course['access'] == 'platform' && claro_is_user_authenticated()) || $is_courseMember || $is_platformAdmin);
// here because it's a right and not a state
} else {
$_profileId = !empty($_SESSION['_profileId']) ? $_SESSION['_profileId'] : false;
$is_courseMember = !empty($_SESSION['is_courseMember']) ? $_SESSION['is_courseMember'] : false;
$is_courseAdmin = !empty($_SESSION['is_courseAdmin']) ? $_SESSION['is_courseAdmin'] : false;
$is_courseAllowed = !empty($_SESSION['is_courseAllowed']) ? $_SESSION['is_courseAllowed'] : false;
$is_courseTutor = !empty($_SESSION['is_courseTutor']) ? $_SESSION['is_courseTutor'] : false;
// not used !?!
$_courseUser = !empty($_SESSION['_courseUser']) ? $_SESSION['_courseUser'] : null;
}
// Installed module in course if available in platform and not in course
if ($_cid && is_array($_course) && isset($_course['dbNameGlu']) && !empty($_course['dbNameGlu']) && trim($_course['dbNameGlu'])) {
// 0. load course configuration to avoid creating uneeded examples
require claro_get_conf_repository() . 'course_main.conf.php';
// 1. get tool list from main db
示例6: get_lang
break;
case 2:
$anonymity = 'default';
break;
default:
$anonymity = 'forbidden';
break;
}
if (get_conf('clfrm_anonymity_enabled', true)) {
if ('allowed' == $anonymity) {
$displayName .= ' (' . get_lang('anonymity allowed') . ')';
} elseif ('default' == $anonymity) {
$displayName .= ' (' . get_lang('anonymous forum') . ')';
}
}
$itemClass = claro_is_user_authenticated() && $this->claro_notifier->is_a_notified_forum(claro_get_current_course_id(), $this->claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisForum['forum_id']) ? 'item hot' : 'item';
?>
<tr align="left" valign="top">
<td>
<span class="<?php
echo $itemClass;
?>
">
<img src="<?php
echo get_icon_url('forum', 'CLFRM');
?>
" alt="" />
<?php
if (!is_null($thisForum['group_id'])) {
?>
<?php
示例7: __construct
/**
* @param string $template name of the template
*/
public function __construct($template)
{
$template = secure_file_path($template);
$customTemplatePath = get_path('rootSys') . '/platform/templates/' . $template;
$defaultTemplatePath = get_path('includePath') . '/templates/' . $template;
if (file_exists($customTemplatePath)) {
parent::__construct($customTemplatePath);
} elseif (file_exists($defaultTemplatePath)) {
parent::__construct($defaultTemplatePath);
} else {
throw new Exception("Template not found {$template} " . "at custom location {$customTemplatePath} " . "or default location {$defaultTemplatePath} !");
}
if (claro_is_in_a_course()) {
$this->course = claro_get_current_course_data();
require_once dirname(__FILE__) . '/../claroCourse.class.php';
$this->courseObject = new ClaroCourse();
$this->courseObject->load(claro_get_current_course_id());
// Fetch related courses
$this->relatedCourses = $this->courseObject->getRelatedCourses();
// $this->relatedUserCourses = $this->courseObject->getRelatedUserCourses(claro_get_current_user_id());
if (claro_is_in_a_group()) {
$this->group = claro_get_current_group_data();
}
}
if (claro_is_user_authenticated()) {
$this->user = claro_get_current_user_data();
}
}
示例8: array
if (claro_is_user_authenticated()) {
$date = $claro_notifier->get_notification_date(claro_get_current_user_id());
}
$preparedAnnList = array();
$lastPostDate = '';
foreach ($announcementList as $thisAnn) {
// Hide hidden and out of deadline elements
$isVisible = (bool) ($thisAnn['visibility'] == 'SHOW') ? 1 : 0;
$isOffDeadline = (bool) (isset($thisAnn['visibleFrom']) && strtotime($thisAnn['visibleFrom']) > time() || isset($thisAnn['visibleUntil']) && time() > strtotime($thisAnn['visibleUntil']) + 86400) ? 1 : 0;
if (!$isVisible || $isOffDeadline) {
$thisAnn['visible'] = false;
} else {
$thisAnn['visible'] = true;
}
// Flag hot items
if (claro_is_user_authenticated() && $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisAnn['id'])) {
$thisAnn['hot'] = true;
} else {
$thisAnn['hot'] = false;
}
$thisAnn['content'] = make_clickable($thisAnn['content']);
// Post time format in MySQL date format
$lastPostDate = isset($thisAnn['visibleFrom']) ? $thisAnn['visibleFrom'] : $thisAnn['time'];
// Set the current locator
$currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => $thisAnn['id']));
$thisAnn['currentLocator'] = $currentLocator;
if ($is_allowedToEdit || $isVisible && !$isOffDeadline) {
$preparedAnnList[] = $thisAnn;
}
}
$maxMinRanks = clann_get_max_and_min_rank();
示例9: claro_htmlspecialchars
// poses problems on PHP 4.1, when the array contains only
// a single element
$dspFileName = claro_htmlspecialchars(basename($thisFile['path']));
$cmdFileName = download_url_encode($thisFile['path']);
if ($thisFile['visibility'] == 'i') {
if ($is_allowedToEdit) {
$style = 'invisible ';
} else {
continue;
// skip the display of this file
}
} else {
$style = '';
}
//modify style if the file is recently added since last login
if (claro_is_user_authenticated() && $claro_notifier->is_a_notified_document(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $thisFile)) {
$classItem = ' hot';
} else {
$classItem = '';
}
if ($thisFile['type'] == A_FILE) {
$image = choose_image($thisFile['path']);
$size = format_file_size($thisFile['size']);
$date = format_date($thisFile['date']);
$urlFileName = claro_htmlspecialchars(claro_get_file_download_url($thisFile['path']));
//$urlFileName = "goto/?doc_url=".rawurlencode($cmdFileName);
//format_url($baseServUrl.$courseDir.$curDirPath."/".$fileName));
$target = get_conf('openNewWindowForDoc') ? 'target="_blank"' : '';
} elseif ($thisFile['type'] == A_DIRECTORY) {
$image = 'folder';
$size = ' ';
示例10: current_language
public static function current_language()
{
// FIXME : use init.lib instead of global variables !!!
global $_course, $_user, $platformLanguage;
if (claro_is_in_a_course() && isset($_course['language'])) {
// course language
return $_course['language'];
} else {
if (claro_is_user_authenticated() && !empty($_user['language'])) {
// user language
return $_user['language'];
} else {
if (isset($_REQUEST['language']) && in_array($_REQUEST['language'], array_keys(get_language_list()))) {
// selected language
$_SESSION['language'] = $_REQUEST['language'];
return $_REQUEST['language'];
} else {
if (empty($_SESSION['language'])) {
// default platform language
return $platformLanguage;
} else {
return $_SESSION['language'];
}
}
}
}
}
示例11: claro_get_current_course_id
?>
" method="post" enctype="multipart/form-data" >
<input type="hidden" name="cidReset" value="true" />
<input type="hidden" name="cidReq" value="<?php
echo claro_get_current_course_id();
?>
" />
<input type="hidden" id="cmd" name="cmd" value="registration" />
<input type="hidden" id="claroFormId" name="claroFormId" value="<?php
echo uniqid('');
?>
" />
<input id="confirmUserCreate" name="confirmUserCreate" value="0" type="hidden" />
<?php
if (claro_is_user_authenticated() && isset($_SESSION['csrf_token'])) {
?>
<input id="csrf_token" name="csrf_token" value="<?php
echo $_SESSION['csrf_token'];
?>
" type="hidden" />
<?php
}
?>
<fieldset>
<legend><?php
echo get_lang('Fill in the user information');
?>
:</legend>
示例12: elseif
} 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;
}
$out .= '</tbody>' . "\n\n";
if ($atleastOne == false) {
$out .= '<tfoot>' . "\n\n" . '<tr>' . "\n" . '<td align="center" colspan="3">' . get_lang('No module') . '</td>' . "\n" . '</tr>' . "\n\n" . '</tfoot>' . "\n\n";
} elseif (claro_is_user_authenticated() && $moduleNb > 0) {
// add a blank line between module progression and global progression
$out .= '<tfoot>' . "\n\n" . '<tr>' . "\n" . '<td colspan="' . ($maxDeep + 3) . '"> </td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td align="right" colspan="' . ($maxDeep + 1) . '">' . get_lang('Learning path progression :') . '</td>' . "\n" . '<td align="right">' . claro_html_progress_bar(round($globalProg / $moduleNb), 1) . '</td>' . "\n" . '<td align="left">' . '<small> ' . round($globalProg / $moduleNb) . '%</small>' . '</td>' . "\n" . '</tr>' . "\n\n" . '</tfoot>' . "\n\n";
}
$out .= '</table>' . "\n\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
示例13: MIN
// check if user is anonymous
if ($lpUid) {
$uidCheckString = "AND UMP.`user_id` = " . (int) $lpUid;
} else {
$uidCheckString = "AND UMP.`user_id` IS NULL ";
}
// list available learning paths
$sql = "SELECT LP.* , MIN(UMP.`raw`) AS minRaw, LP.`lock`\n FROM `" . $TABLELEARNPATH . "` AS LP\n LEFT JOIN `" . $TABLELEARNPATHMODULE . "` AS LPM\n ON LPM.`learnPath_id` = LP.`learnPath_id`\n LEFT JOIN `" . $TABLEUSERMODULEPROGRESS . "` AS UMP\n ON UMP.`learnPath_module_id` = LPM.`learnPath_module_id`\n " . $uidCheckString . "\n WHERE 1=1\n " . $visibility . "\n GROUP BY LP.`learnPath_id`\n ORDER BY LP.`rank`";
$result = claro_sql_query($sql);
// used to know if the down array (for order) has to be displayed
$LPNumber = mysql_num_rows($result);
$iterator = 1;
$is_blocked = false;
while ($list = mysql_fetch_array($result)) {
//modify style if the file is recently added since last login
if (claro_is_user_authenticated() && $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $list['learnPath_id'])) {
$classItem = ' hot';
} else {
$classItem = '';
}
if ($list['visibility'] == 'HIDE') {
if ($is_allowedToEdit) {
$style = " class=\"invisible\"";
} else {
continue;
// skip the display of this file
}
} else {
$style = "";
}
$out .= "<tr align=\"center\"" . $style . ">";
示例14: getInstance
/**
* Singleton constructor
* @todo avoid using the singleton pattern and use a factory instead ?
* @param int $uid user id
* @param boolean $forceReload force reloading the data
* @return Claro_CurrentUser current user
*/
public static function getInstance($uid = null, $forceReload = false)
{
if ($forceReload || !self::$instance) {
self::$instance = new self($uid);
if (!$forceReload && claro_is_user_authenticated()) {
self::$instance->loadFromSession();
} else {
self::$instance->load($forceReload);
}
}
return self::$instance;
}
示例15: render_course_in_dl_list
/**
* Return course informations in <dt> and <dd> html tags.
* Use it in a <dl> tag (description list).
*
* @param $course
* @param $hot
* @param $displayIconAccess
* @return string
* @deprecated use UserCourseList and CourseTreeView instead
*/
function render_course_in_dl_list($course, $hot = false, $displayIconAccess = true)
{
$out = '';
$classItem = $hot ? 'hot' : '';
$langNameOfLang = get_locale('langNameOfLang');
// Display a manager icon if the user is manager of the course
$userStatusImg = isset($course['isCourseManager']) && $course['isCourseManager'] == 1 ? ' <img class="qtip role" src="' . get_icon_url('manager') . '" alt="' . get_lang('You are manager of this course') . '" />' : '';
// Show course language if not the same of the platform
if (get_conf('platformLanguage') != $course['language'] || get_conf('showAlwaysLanguageInCourseList', false)) {
$courseLanguageTxt = !empty($langNameOfLang[$course['language']]) ? ' – ' . claro_htmlspecialchars(ucfirst($langNameOfLang[$course['language']])) : ' – ' . claro_htmlspecialchars(ucfirst($course['language']));
} else {
$courseLanguageTxt = '';
}
// Display the course title following the platform configuration requirements
$courseTitle = get_conf('course_order_by') == 'official_code' ? $course['officialCode'] . ' - ' . $course['title'] : $course['title'] . ' (' . $course['officialCode'] . ')';
$url = get_path('url') . '/claroline/course/index.php?cid=' . claro_htmlspecialchars($course['sysCode']);
// Display an icon following the course's access settings
$iconUrl = $displayIconAccess ? get_course_access_icon($course['access']) : get_icon_url('course');
// Display course's manager email
$managerString = isset($course['email']) && claro_is_user_authenticated() ? '<a href="mailto:' . $course['email'] . '">' . $course['titular'] . '</a>' : $course['titular'] . $courseLanguageTxt;
// Don't give a link to the course if the user is in pending state
$isUserPending = isset($course['isPending']) && $course['isPending'] == 1 ? true : false;
$courseLink = '<a href="' . claro_htmlspecialchars($url) . '">' . claro_htmlspecialchars($courseTitle) . '</a>' . $userStatusImg . "\n";
if ($isUserPending) {
$courseLink .= ' [' . get_lang('Pending registration') . ']' . "\n";
}
// Make a nice explicit sentence about the course's access
if ($course['access'] == 'public') {
$courseAccess = get_lang('Access allowed to anybody (even without login)');
} elseif ($course['access'] == 'platform') {
$courseAccess = get_lang('Access allowed only to platform members (user registered to the platform)');
} elseif ($course['access'] == 'private') {
$courseAccess = get_lang('Access allowed only to course members (people on the course user list)');
} else {
$courseAccess = $course['access'];
}
$out .= '<dt>' . "\n" . '<img class="qtip iconDefinitionList" src="' . $iconUrl . '" alt="' . $courseAccess . '" /> ' . '<span' . (!empty($classItem) ? ' class="' . $classItem . '"' : '') . '>' . $courseLink . '</span>' . "\n" . '</dt>' . "\n" . '<dd>' . "\n" . '<span class="managerString">' . $managerString . "</span>\n";
if (!empty($course['sessionCourses'])) {
$out .= '<dl>' . "\n";
foreach ($course['sessionCourses'] as $sessionCourse) {
$out .= render_course_in_dl_list($sessionCourse, $sessionCourse['hot']) . "\n";
}
$out .= '</dl>' . "\n";
}
$out .= '</dd>' . "\n\n";
return $out;
}