本文整理汇总了PHP中claro_is_in_a_course函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_is_in_a_course函数的具体用法?PHP claro_is_in_a_course怎么用?PHP claro_is_in_a_course使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_is_in_a_course函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAllowedToDownload
public function isAllowedToDownload($requestedUrl)
{
if (!$this->isModuleAllowed()) {
return false;
}
if (claro_is_in_a_course()) {
if (!claro_is_course_allowed()) {
pushClaroMessage('course not allowed', 'debug');
return false;
} else {
if (claro_is_in_a_group()) {
if (!claro_is_group_allowed()) {
pushClaroMessage('group not allowed', 'debug');
return false;
} else {
return true;
}
} else {
return $this->isDocumentDownloadableInCourse($requestedUrl);
}
}
} else {
return false;
}
}
示例2: render
public function render()
{
if ($this->hidden) {
return '<!-- footer hidden -->' . "\n";
}
$currentCourse = claro_get_current_course_data();
if (claro_is_in_a_course()) {
$courseManagerOutput = '<div id="courseManager">' . get_lang('Manager(s) for %course_code', array('%course_code' => $currentCourse['officialCode'])) . ' : ';
$currentCourseTitular = empty($currentCourse['titular']) ? get_lang('Course manager') : $currentCourse['titular'];
if (empty($currentCourse['email'])) {
$courseManagerOutput .= '<a href="' . get_module_url('CLUSR') . '/user.php">' . $currentCourseTitular . '</a>';
} else {
$courseManagerOutput .= '<a href="mailto:' . $currentCourse['email'] . '?body=' . $currentCourse['officialCode'] . '&subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . $currentCourseTitular . '</a>';
}
$courseManagerOutput .= '</div>';
$this->assign('courseManager', $courseManagerOutput);
} else {
$this->assign('courseManager', '');
}
$platformManagerOutput = '<div id="platformManager">' . get_lang('Administrator for %site_name', array('%site_name' => get_conf('siteName'))) . ' : ' . '<a href="mailto:' . get_conf('administrator_email') . '?subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . get_conf('administrator_name') . '</a>';
if (get_conf('administrator_phone') != '') {
$platformManagerOutput .= '<br />' . "\n" . get_lang('Phone : %phone_number', array('%phone_number' => get_conf('administrator_phone')));
}
$platformManagerOutput .= '</div>';
$this->assign('platformManager', $platformManagerOutput);
$poweredByOutput = '<span class="poweredBy">' . get_lang('Powered by') . ' <a href="http://www.claroline.net" target="_blank">Claroline</a> ' . '© 2001 - 2013' . '</span>';
$this->assign('poweredBy', $poweredByOutput);
return parent::render();
}
示例3: __construct
/**
*
* @param AuthProfile $userAuthProfile profile of the user we want to enrol to the cours
* @param Claro_Course $course kernel object representing the course
* @param type $givenCourseKey optionnal given registration key (default null)
* @param type $categoryId optionnal given categoryId (default null)
*/
public function __construct(AuthProfile $userAuthProfile, Claro_Course $course, $givenCourseKey = null, $categoryId = null)
{
$this->userAuthProfile = $userAuthProfile;
$this->course = $course;
$this->givenCourseKey = $givenCourseKey;
$this->categoryId = $categoryId;
// is the user doing the registration a super user ?
if (claro_is_in_a_course() && claro_get_current_course_id() == $this->course->courseId) {
$this->isSuperUser = claro_is_platform_admin() || claro_is_course_manager() || claro_is_allowed_tool_edit(get_module_data('CLUSER', 'id'));
} else {
$this->isSuperUser = claro_is_platform_admin();
}
}
示例4: 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;
}
示例5: isAllowedToDownload
public function isAllowedToDownload($requestedUrl)
{
$fromCLLNP = isset($_SESSION['fromCLLNP']) && $_SESSION['fromCLLNP'] === true ? true : false;
// unset CLLNP mode
unset($_SESSION['fromCLLNP']);
if (!$fromCLLNP || !$this->isModuleAllowed()) {
return false;
}
if (claro_is_in_a_course()) {
if (!claro_is_course_allowed()) {
pushClaroMessage('course not allowed', 'debug');
return false;
} else {
return $this->isDocumentDownloadableInCourse($requestedUrl);
}
} else {
return false;
}
}
示例6: getUrlContext
/**
* Get the given context array formated for use in urls
* @param array $givenContext
* @return array
*/
public static function getUrlContext($givenContext)
{
$context = array();
if (claro_is_in_a_group() && !isset($givenContext[CLARO_CONTEXT_GROUP]) || isset($givenContext[CLARO_CONTEXT_GROUP])) {
$context['gidReset'] = 'true';
}
if (claro_is_in_a_course() && !isset($givenContext[CLARO_CONTEXT_COURSE]) || isset($givenContext[CLARO_CONTEXT_COURSE])) {
$context['cidReset'] = 'true';
}
if (isset($givenContext[CLARO_CONTEXT_COURSE])) {
$context['cidReq'] = $givenContext[CLARO_CONTEXT_COURSE];
}
if (isset($givenContext[CLARO_CONTEXT_GROUP])) {
$context['gidReq'] = $givenContext[CLARO_CONTEXT_GROUP];
}
if (isset($_REQUEST['inPopup'])) {
$context['inPopup'] = $_REQUEST['inPopup'];
}
if (isset($_REQUEST['inFrame'])) {
$context['inFrame'] = $_REQUEST['inFrame'];
}
if (isset($_REQUEST['embedded'])) {
$context['embedded'] = $_REQUEST['embedded'];
}
if (isset($_REQUEST['hide_banner'])) {
$context['hide_banner'] = $_REQUEST['hide_banner'];
}
if (isset($_REQUEST['hide_footer'])) {
$context['hide_footer'] = $_REQUEST['hide_footer'];
}
if (isset($_REQUEST['hide_body'])) {
$context['hide_body'] = $_REQUEST['hide_body'];
}
if ($moduleLabel = claro_called_from()) {
$context['calledFrom'] = $moduleLabel;
}
return $context;
}
示例7: current_user_is_allowed_to_send_message_to_user
/**
* return the autorisation of the current user to send a message to the user in parameter
*
* @param int $userId user id of the recipient
* @return bool true if the current user is autorised do send a message to the user in parameter
* flase if the current user is not autorised do send a message to the user in parameter
*/
function current_user_is_allowed_to_send_message_to_user($userId)
{
if (claro_is_platform_admin()) {
return true;
}
if (claro_is_in_a_group()) {
if (claro_is_group_tutor() || claro_is_course_manager()) {
$userList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id());
for ($count = 0; $count < count($userList); $count++) {
if ($userList[$count]['id'] == $userId) {
return true;
}
}
}
return false;
} elseif (claro_is_in_a_course()) {
if (claro_is_course_manager()) {
$userList = claro_get_course_user_list();
for ($count = 0; $count < count($userList); $count++) {
if ($userList[$count]['user_id'] == $userId) {
return true;
}
}
}
return false;
} else {
// can answerd to a user
$tableName = get_module_main_tbl(array('im_message', 'im_recipient'));
$select = "SELECT count(*)\n" . " FROM `" . $tableName['im_message'] . "` as M\n" . " INNER JOIN `" . $tableName['im_recipient'] . "` as R ON R.message_id = M.message_id\n" . " WHERE (R.user_id = " . (int) claro_get_current_user_id() . " OR R.user_id = 0)\n" . " AND M.sender = " . (int) $userId;
$nbMessage = claro_sql_query_fetch_single_value($select);
if ($nbMessage > 0) {
return true;
} elseif (get_conf('userCanSendMessage')) {
}
return true;
return false;
}
}
示例8: render
/**
* Render the HTML page header
* @return string
*/
public function render()
{
$this->_globalVarsCompat();
$this->addInlineJavascript(JavascriptLanguage::getInstance()->buildJavascript());
$titlePage = '';
if (empty($this->_toolName) && !empty($this->_nameTools)) {
$titlePage .= $this->_nameTools . ' - ';
} elseif (!empty($this->_toolName)) {
$titlePage .= $this->_toolName . ' - ';
}
if (claro_is_in_a_course() && claro_get_current_course_data('officialCode') != '') {
$titlePage .= claro_get_current_course_data('officialCode') . ' - ';
}
$titlePage .= get_conf('siteName');
$this->assign('pageTitle', $titlePage);
if (true === get_conf('warnSessionLost', true) && claro_get_current_user_id()) {
$this->assign('warnSessionLost', "function claro_session_loss_countdown(sessionLifeTime){\n var chrono = setTimeout('claro_warn_of_session_loss()', sessionLifeTime * 1000);\n}\n\nfunction claro_warn_of_session_loss() {\n alert('" . clean_str_for_javascript(get_lang('WARNING ! You have just lost your session on the server.') . "\n" . get_lang('Copy any text you are currently writing and paste it outside the browser')) . "');\n}\n");
} else {
$this->assign('warnSessionLost', '');
}
$htmlXtraHeaders = '';
if (!empty($this->_htmlXtraHeaders)) {
$htmlXtraHeaders .= implode("\n", $this->_htmlXtraHeaders);
}
$this->assign('htmlScriptDefinedHeaders', $htmlXtraHeaders);
return parent::render() . "\n";
}
示例9: strip_tags
// 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.
*/
if (!$forum_post_allowed || !is_null($forumSettingList['idGroup']) && (!claro_is_in_a_group() || !claro_is_group_allowed() || $forumSettingList['idGroup'] != claro_get_current_group_id())) {
// NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking
// attempt like rewriting the request without $cidReq. If we are in group
// forum and the group of the concerned forum isn't the same as the session
示例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: array
*/
$acceptedCmdList = array('getFileList');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
$cmd = $_REQUEST['cmd'];
} else {
$cmd = null;
}
if (!empty($_REQUEST['relPath']) && $_REQUEST['relPath'] != '/' && $_REQUEST['relPath'] != '.') {
$relPath = str_replace('..', '', $_REQUEST['relPath']) . '/';
} else {
$relPath = '';
}
/*
* Init other vars
*/
if (claro_is_in_a_course() && !claro_is_in_a_group()) {
$course_data = claro_get_course_data();
// 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/';
} 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();
示例12: getCurrentLocator
public function getCurrentLocator($params = array())
{
$locator = new ClarolineResourceLocator();
if (claro_is_in_a_course()) {
$locator->setCourseId(claro_get_current_course_id());
}
if (claro_is_in_a_group()) {
$locator->setGroupId(claro_get_current_group_id());
}
if (get_current_module_label()) {
$locator->setModuleLabel(get_current_module_label());
$navigator = $this->loadModuleNavigator(get_current_module_label());
if ($resourceId = $navigator->getResourceId($params)) {
$locator->setResourceId($resourceId);
}
}
return $locator;
}
示例13: displayProfileToolRightList
/**
* Display table with tool/right of the profile
*/
public function displayProfileToolRightList()
{
$html = '';
$html_table_header_list = array();
$html_table_row_list = array();
foreach ($this->rightProfileToolRightList as $profile_id => $rightProfileToolRight) {
$isLocked = $rightProfileToolRight->profile->isLocked();
$className = get_class($rightProfileToolRight);
// use strtolower for PHP4 : get_class returns class name in lowercase
$className = strtolower($className);
$html_table_header_list[$profile_id] = claro_get_profile_name($profile_id);
if ($isLocked && $className == strtolower('RightCourseProfileToolRight')) {
$displayMode = claro_is_platform_admin() ? $this->displayMode : 'read';
$html_table_header_list[$profile_id] .= ' <img src="' . get_icon_url('locked') . '" alt="' . get_lang('Profile locked') . '" />';
} else {
$displayMode = $this->displayMode;
}
foreach ($rightProfileToolRight->toolActionList as $tool_id => $action_list) {
$action_right = $rightProfileToolRight->getToolRight($tool_id);
$html_right = '';
if ($displayMode == 'edit') {
$param_append = '?profile_id=' . urlencode($profile_id) . '&tool_id=' . urlencode($tool_id) . '&cmd=set_right';
foreach ($this->urlParamAppendList as $name => $value) {
$param_append .= '&' . $name . '=' . $value;
}
}
if (claro_get_profile_label($profile_id) != ANONYMOUS_PROFILE && claro_get_profile_label($profile_id) != GUEST_PROFILE) {
if ($action_right == 'none') {
$action_param_value = 'user';
$html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" /> <span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
} elseif ($action_right == 'user') {
$action_param_value = 'manager';
$html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" /> <span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
} else {
$action_param_value = 'none';
$html_right = '<img src="' . get_icon_url('manager') . '" alt="' . get_lang('Edition allowed') . '" /> <span style="font-size: smaller;">' . get_lang('Edition allowed') . "</span>\n";
}
} else {
if ($action_right == 'none') {
$action_param_value = 'user';
$html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" /> <span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
} else {
$action_param_value = 'none';
$html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" /> <span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
}
}
if ($displayMode == 'edit') {
$html_right = '<a href="' . $_SERVER['PHP_SELF'] . $param_append . '&right_value=' . $action_param_value . '">' . $html_right . '</a>';
}
$html_table_row_list[$tool_id][$profile_id] = $html_right;
}
}
// build table
$html .= '<table class="claroTable emphaseLine" >' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Tools') . '</th>' . "\n";
// visibility column
if ($this->isSetCourseToolInfo()) {
$html .= '<th style="text-align:center; width:100px;" >' . get_lang('Visibility') . '</th>' . "\n";
}
foreach ($html_table_header_list as $html_table_header) {
$html .= '<th style="text-align:center; width:100px;" >' . $html_table_header . '</th>' . "\n";
}
$html .= '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>';
foreach ($html_table_row_list as $tool_id => $html_table_row) {
if (claro_is_in_a_course() && (!$this->isSetCourseToolInfo() || !isset($this->courseToolInfo[$tool_id]))) {
// Not activated in course !
continue;
}
$html .= '<tr>' . "\n";
if ($this->isSetCourseToolInfo()) {
// Add visibility and icon from courseToolInfo
$html .= '<td ' . ($this->courseToolInfo[$tool_id]['visibility'] == true ? '' : 'class="invisible"') . '>' . '<img src="' . $this->courseToolInfo[$tool_id]['icon'] . '" alt="" />' . get_lang(claro_get_tool_name($tool_id)) . '</td>';
} else {
$html .= '<td>' . get_lang(claro_get_tool_name($tool_id)) . '</td>' . "\n";
}
// visibility column
if ($this->isSetCourseToolInfo()) {
if ($this->courseToolInfo[$tool_id]['visibility'] == true) {
$html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exInvisible&tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Visible') . '" />' . '</a>' . '</td>' . "\n";
} else {
$html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exVisible&tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Invisible') . '" />' . '</a></td>' . "\n";
}
}
// profile colums
foreach ($html_table_row as $html_table_row_cell) {
$html .= '<td align="center">' . $html_table_row_cell . '</td>';
}
$html .= '</tr>' . "\n";
}
$html .= '</tbody></table>';
return $html;
}
示例14: __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();
}
}
示例15: str_replace
/*
* Init request vars
*/
if (!empty($_REQUEST['relativePath']) && $_REQUEST['relativePath'] != '/' && $_REQUEST['relativePath'] != '.') {
$relativePath = str_replace('..', '', $_REQUEST['relativePath']) . '/';
} else {
$relativePath = '/';
}
/*
* Handle upload
*/
if ($is_allowedToEdit && isset($_FILES['sentFile']['tmp_name']) && is_uploaded_file($_FILES['sentFile']['tmp_name'])) {
$imgFile = $_FILES['sentFile'];
$imgFile['name'] = replace_dangerous_char($imgFile['name'], 'strict');
$imgFile['name'] = get_secure_file_name($imgFile['name']);
if (claro_is_in_a_course()) {
$enoughSize = enough_size($_FILES['sentFile']['size'], $pathSys, $maxFilledSpace);
} else {
$enoughSize = true;
}
if (is_image($imgFile['name']) && $enoughSize) {
// rename if file already exists
if (file_exists($pathSys . $relativePath . $imgFile['name'])) {
$pieceList = explode('.', $imgFile['name']);
$base = $pieceList[0];
$ext = $pieceList[1];
$i = 1;
while (file_exists($pathSys . $relativePath . $base . '_' . $i . '.' . $ext)) {
$i++;
}
$imgFile['name'] = $base . '_' . $i . '.' . $ext;