本文整理汇总了PHP中learnpath::getCurrentLpFromSession方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::getCurrentLpFromSession方法的具体用法?PHP learnpath::getCurrentLpFromSession怎么用?PHP learnpath::getCurrentLpFromSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类learnpath
的用法示例。
在下文中一共展示了learnpath::getCurrentLpFromSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_protect_course_script
$show_learnpath = true;
api_protect_course_script();
$lp_id = intval($_GET['lp_id']);
$sessionId = api_get_session_id();
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_platform_admin()) {
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
api_not_allowed(true);
}
}
// Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), $sessionId);
if (!api_is_allowed_to_edit(false, true, false, false) && intval($visibility) == 0) {
api_not_allowed(true);
}
$learnPath = learnpath::getCurrentLpFromSession();
if (empty($learnPath)) {
api_not_allowed(true);
}
$debug = 0;
if ($debug) {
error_log('------ Entering lp_view.php -------');
}
$learnPath->error = '';
$lp_item_id = $learnPath->get_current_item_id();
$lpType = $learnPath->get_type();
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
$platform_theme = api_get_setting('stylesheets');
// Platform's css.
示例2: get_document_preview
/**
* @param array $course_info
* @param bool $lp_id
* @param string $target
* @param int $session_id
* @param bool $add_move_button
* @param string $filter_by_folder
* @param string $overwrite_url
* @param bool $showInvisibleFiles
* @param bool $showOnlyFolders
* @param int $folderId
* @return string
*/
public static function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false, $filter_by_folder = null, $overwrite_url = null, $showInvisibleFiles = false, $showOnlyFolders = false, $folderId = false)
{
if (empty($course_info['real_id']) || empty($course_info['code']) || !is_array($course_info)) {
return '';
}
$overwrite_url = Security::remove_XSS($overwrite_url);
$user_id = api_get_user_id();
$user_in_course = false;
if (api_is_platform_admin()) {
$user_in_course = true;
}
if (!$user_in_course) {
if (CourseManager::is_course_teacher($user_id, $course_info['code'])) {
$user_in_course = true;
}
}
// Condition for the session
$session_id = intval($session_id);
if (!$user_in_course) {
if (empty($session_id)) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$user_in_course = true;
}
// Check if course is open then we can consider that the student is registered to the course
if (isset($course_info) && in_array($course_info['visibility'], array(2, 3))) {
$user_in_course = true;
}
} else {
$user_status = SessionManager::get_user_status_in_course_session($user_id, $course_info['real_id'], $session_id);
//is true if is an student, course session teacher or coach
if (in_array($user_status, array('0', '2', '6'))) {
$user_in_course = true;
}
}
}
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
$tbl_item_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
$condition_session = " AND (last.session_id = '{$session_id}' OR last.session_id = '0' OR last.session_id IS NULL)";
$add_folder_filter = null;
if (!empty($filter_by_folder)) {
$add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
}
// If we are in LP display hidden folder https://support.chamilo.org/issues/6679
$lp_visibility_condition = null;
if ($lp_id) {
// $lp_visibility_condition = " OR filetype='folder'";
if ($showInvisibleFiles) {
$lp_visibility_condition .= ' OR last.visibility = 0';
}
}
$showOnlyFoldersCondition = null;
if ($showOnlyFolders) {
//$showOnlyFoldersCondition = " AND docs.filetype = 'folder' ";
}
$folderCondition = " AND docs.path LIKE '/%' ";
if (!api_is_allowed_to_edit()) {
$protectedFolders = self::getProtectedFolderFromStudent();
foreach ($protectedFolders as $folder) {
$folderCondition .= " AND docs.path NOT LIKE '{$folder}' ";
}
}
$parentData = [];
if ($folderId !== false) {
$parentData = self::get_document_data_by_id($folderId, $course_info['code']);
if (!empty($parentData)) {
$cleanedPath = $parentData['path'];
$num = substr_count($cleanedPath, '/');
$notLikeCondition = null;
for ($i = 1; $i <= $num; $i++) {
$repeat = str_repeat('/%', $i + 1);
$notLikeCondition .= " AND docs.path NOT LIKE '" . Database::escape_string($cleanedPath . $repeat) . "' ";
}
$folderCondition = " AND\n docs.id <> {$folderId} AND\n docs.path LIKE '" . $cleanedPath . "/%'\n {$notLikeCondition}\n ";
} else {
$folderCondition = " AND\n docs.filetype = 'file' ";
}
}
$levelCondition = null;
if ($folderId === false) {
$levelCondition = " AND docs.path NOT LIKE'/%/%'";
}
$sql = "SELECT last.visibility, docs.*\n FROM {$tbl_item_prop} AS last INNER JOIN {$tbl_doc} AS docs\n ON (docs.id = last.ref AND docs.c_id = last.c_id)\n WHERE\n docs.path NOT LIKE '%_DELETED_%' AND\n last.tool = '" . TOOL_DOCUMENT . "' {$condition_session} AND\n (last.visibility = '1' {$lp_visibility_condition}) AND\n last.visibility <> 2 AND\n docs.c_id = {$course_info['real_id']} AND\n last.c_id = {$course_info['real_id']}\n {$showOnlyFoldersCondition}\n {$folderCondition}\n {$levelCondition}\n {$add_folder_filter}\n ORDER BY docs.filetype DESC, docs.title ASC";
$res_doc = Database::query($sql);
$resources = Database::store_result($res_doc, 'ASSOC');
$return = '';
if ($lp_id) {
$learnPath = learnpath::getCurrentLpFromSession();
//.........这里部分代码省略.........
示例3: isset
* @author Yannick Warnier <ywarnier@beeznest.org> (extended and maintained - 2005-2014)
* @version v 1.2
* @access public
* @package chamilo.learnpath.scorm
*/
// If you open the imsmanifest.xml via local machine (f.ex.: file://c:/...), then the Apiwrapper.js
// of Maritime Navigation when trying to execute this row
// var result = api.LMSInitialize("");
// get the error response : you are not authorized to call this function
// Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true;
//require_once '../inc/global.inc.php';
\Chamilo\CoreBundle\Framework\Container::$legacyTemplate = 'layout_empty.html.twig';
$file = Session::read('file');
/** @var learnpath $oLP */
$oLP = learnpath::getCurrentLpFromSession();
/** @var learnpathItem $oItem */
$oItem = isset($oLP->items[$oLP->current]) ? $oLP->items[$oLP->current] : null;
if (!is_object($oItem)) {
error_log('New LP - scorm_api - Could not load oItem item', 0);
exit;
}
$autocomplete_when_80pct = 0;
$user = api_get_user_info();
$userId = api_get_user_id();
header('Content-type: text/javascript');
?>
var scorm_logs=<?php
echo (empty($oLP->scorm_debug) or !api_is_course_admin() && !api_is_platform_admin()) ? '0' : '3';
?>
; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame