本文整理汇总了PHP中learnpath::get_flat_ordered_items_list方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::get_flat_ordered_items_list方法的具体用法?PHP learnpath::get_flat_ordered_items_list怎么用?PHP learnpath::get_flat_ordered_items_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类learnpath
的用法示例。
在下文中一共展示了learnpath::get_flat_ordered_items_list方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_flat_ordered_items_list
/**
* Gets a flat list of item IDs ordered for display (level by level ordered by order_display)
* This method can be used as abstract and is recursive
* @param integer Learnpath ID
* @param integer Parent ID of the items to look for
* @return mixed Ordered list of item IDs or false on error
*/
function get_flat_ordered_items_list($lp, $parent = 0)
{
//if($this->debug>0){error_log('New LP - In learnpath::get_flat_ordered_items_list('.$lp.','.$parent.')',0);}
$list = array();
if (empty($lp)) {
return false;
}
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT * FROM {$tbl_lp_item} WHERE lp_id = {$lp} AND parent_item_id = {$parent} ORDER BY display_order";
$res = Database::query($sql, __FILE__, __LINE__);
while ($row = Database::fetch_array($res)) {
$sublist = learnpath::get_flat_ordered_items_list($lp, $row['id']);
$list[] = $row['id'];
foreach ($sublist as $item) {
$list[] = $item;
}
}
return $list;
}
示例2: getLpStats
/**
* @param int $user_id
* @param array $courseInfo
* @param int $session_id
* @param string $origin
* @param bool $export_csv
* @param int $lp_id
* @param int $lp_item_id
* @param int $extendId
* @param int $extendAttemptId
* @param string $extendedAttempt
* @param string $extendedAll
* @param string $type classic or simple
* @param boolean $allowExtend Optional. Allow or not extend te results
* @return null|string
*/
public static function getLpStats($user_id, $courseInfo, $session_id, $origin, $export_csv, $lp_id, $lp_item_id = null, $extendId = null, $extendAttemptId = null, $extendedAttempt = null, $extendedAll = null, $type = 'classic', $allowExtend = true)
{
if (empty($courseInfo) || empty($lp_id)) {
return null;
}
$lp_id = intval($lp_id);
$lp_item_id = intval($lp_item_id);
$user_id = intval($user_id);
$session_id = intval($session_id);
$origin = Security::remove_XSS($origin);
$list = learnpath::get_flat_ordered_items_list($lp_id, 0, $courseInfo['real_id']);
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$course_id = $courseInfo['real_id'];
$courseCode = $courseInfo['code'];
$session_condition = api_get_session_condition($session_id);
// Extend all button
$output = null;
$extend_all = 0;
if ($origin == 'tracking') {
$url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
} else {
$url_suffix = '&lp_id=' . $lp_id;
}
if (!empty($extendedAll)) {
$extend_all_link = Display::url(Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), api_get_self() . '?action=stats' . $url_suffix);
$extend_all = 1;
} else {
$extend_all_link = Display::url(Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), api_get_self() . '?action=stats&extend_all=1' . $url_suffix);
}
if ($origin != 'tracking') {
$output .= '<div class="section-status">';
$output .= Display::page_header(get_lang('ScormMystatus'));
$output .= '</div>';
}
$actionColumn = null;
if ($type == 'classic') {
$actionColumn = ' <th>' . get_lang('Actions') . '</th>';
}
$output .= '<div class="table-responsive">';
$output .= '<table class="table tracking">
<thead>
<tr class="table-header">
<th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th>
<th colspan="4">
' . get_lang('ScormLessonTitle') . '
</th>
<th colspan="2">
' . get_lang('ScormStatus') . '
</th>
<th colspan="2">
' . get_lang('ScormScore') . '
</th>
<th colspan="2">
' . get_lang('ScormTime') . '
</th>
' . $actionColumn . '
</tr>
</thead>
<tbody>
';
// Going through the items using the $items[] array instead of the database order ensures
// we get them in the same order as in the imsmanifest file, which is rather random when using
// the database table.
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
$tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
$tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$tbl_stats_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT max(view_count)\n FROM {$TBL_LP_VIEW}\n WHERE\n c_id = {$course_id} AND\n lp_id = {$lp_id} AND\n user_id = {$user_id}\n {$session_condition}";
$res = Database::query($sql);
$view = '';
if (Database::num_rows($res) > 0) {
$myrow = Database::fetch_array($res);
$view = $myrow[0];
}
$counter = 0;
$total_time = 0;
$h = get_lang('h');
if (!empty($export_csv)) {
$csv_content[] = array(get_lang('ScormLessonTitle'), get_lang('ScormStatus'), get_lang('ScormScore'), get_lang('ScormTime'));
}
$result_disabled_ext_all = true;
//.........这里部分代码省略.........
示例3: get_flat_ordered_items_list
/**
* Gets a flat list of item IDs ordered for display (level by level ordered by order_display)
* This method can be used as abstract and is recursive
* @param integer Learnpath ID
* @param integer Parent ID of the items to look for
* @return mixed Ordered list of item IDs or false on error
*/
public static function get_flat_ordered_items_list($lp, $parent = 0, $course_id = null)
{
if (empty($course_id)) {
$course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
}
$list = array();
if (empty($lp)) {
return false;
}
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT id FROM {$tbl_lp_item} WHERE c_id = {$course_id} AND lp_id = {$lp} AND parent_item_id = {$parent} ORDER BY display_order";
$res = Database::query($sql);
while ($row = Database::fetch_array($res)) {
$sublist = learnpath::get_flat_ordered_items_list($lp, $row['id'], $course_id);
$list[] = $row['id'];
foreach ($sublist as $item) {
$list[] = $item;
}
}
return $list;
}
示例4: intval
Display::display_header($nameTools);
$lp_id = intval($_GET['lp_id']);
$sql = 'SELECT name FROM ' . Database::get_course_table(TABLE_LP_MAIN) . ' WHERE c_id = ' . $course_info['real_id'] . ' AND id=' . $lp_id;
$rs = Database::query($sql);
$lp_title = Database::result($rs, 0, 0);
echo '<div class ="actions">';
echo '<a href="javascript:history.back();">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">
' . Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="' . api_get_self() . '?export=csv&' . Security::remove_XSS($_SERVER['QUERY_STRING']) . '">
' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
echo '<div class="clear"></div>';
$session_name = api_get_session_name($session_id);
$table_title = ($session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL) . ' ' . $session_name . ' ' : ' ') . Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL) . ' ' . $course_info['name'] . ' ' . Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL) . ' ' . $name;
echo Display::page_header($table_title);
echo Display::page_subheader('<h3>' . Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL) . ' ' . $lp_title . '</h3>');
//Needed in newscorm/lp_stats.php
$list = learnpath::get_flat_ordered_items_list($lp_id, 0, $course_info['real_id']);
$origin = 'tracking';
if ($export_csv) {
require_once api_get_path(SYS_CODE_PATH) . 'newscorm/lp_stats.php';
//Export :: export_table_csv($csv_content, 'reporting_student');
} else {
ob_start();
require_once api_get_path(SYS_CODE_PATH) . 'newscorm/lp_stats.php';
$tracking_content = ob_get_contents();
ob_end_clean();
echo api_utf8_decode($tracking_content, $charset);
}
Display::display_footer();
示例5: WSDeleteLp
/**
* @param array $params
* @return int|string
*/
function WSDeleteLp($params)
{
global $debug;
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'newscorm/learnpathItem.class.php';
$courseIdName = $params['course_id_name'];
$courseIdValue = $params['course_id_value'];
$lpId = $params['lp_id'];
$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null;
$sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;
$courseInfo = CourseManager::getCourseInfoFromOriginalId($courseIdValue, $courseIdName);
if (empty($courseInfo)) {
if ($debug) {
error_log("Course not found: {$courseIdName} : {$courseIdValue}");
}
return 'Course not found';
}
$courseId = $courseInfo['real_id'];
$courseCode = $courseInfo['code'];
$sessionId = 0;
/*
if (!empty($sessionIdName) && !empty($sessionIdValue)) {
$sessionId = SessionManager::get_session_id_from_original_id(
$sessionIdValue,
$sessionIdName
);
if (empty($sessionId)) {
if ($debug) error_log('Session not found');
return 'Session not found';
}
}
*/
$lp = new learnpath($courseCode, $lpId, null);
if ($lp) {
if ($debug) {
error_log("LP deleted {$lpId}");
}
$course_dir = $courseInfo['directory'] . '/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path . $course_dir;
$items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId);
if (!empty($items)) {
/** @var $item learnpathItem */
foreach ($items as $itemId) {
$item = new learnpathItem($itemId, null, $courseId);
if ($item) {
$documentId = $item->get_path();
if ($debug) {
error_log("lp item id found #{$itemId}");
}
$documentInfo = DocumentManager::get_document_data_by_id($documentId, $courseInfo['code'], false, $sessionId);
if (!empty($documentInfo)) {
if ($debug) {
error_log("Document id deleted #{$documentId}");
}
DocumentManager::delete_document($courseInfo, null, $base_work_dir, $sessionId, $documentId);
} else {
if ($debug) {
error_log("No document found for id #{$documentId}");
}
}
} else {
if ($debug) {
error_log("Document not found #{$itemId}");
}
}
}
}
$lp->delete($courseInfo, $lpId, 'remove');
return 1;
}
return 0;
}
示例6: api_get_course_id
$course_code = api_get_course_id();
if (empty($user_id)) {
$user_id = api_get_user_id();
}
// Declare variables to be used in lp_stats.php
//When checking the reporting myspace/lp_tracking.php
//isset($_GET['lp_id']) &&
if (isset($lp_id) && !empty($lp_id)) {
$lp_id = intval($lp_id);
if (!isset($list)) {
$list = learnpath::get_flat_ordered_items_list($lp_id);
}
} else {
if (isset($_SESSION['oLP'])) {
$lp_id = $_SESSION['oLP']->get_id();
$list = learnpath::get_flat_ordered_items_list($lp_id);
}
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (isset($_GET['course'])) {
$course_code = Security::remove_XSS($_GET['course']);
}
$course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id'];
if (isset($_GET['student_id'])) {
$student_id = intval($_GET['student_id']);
}
$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
//When origin is not set that means that the lp_stats are viewed from the "man running" icon
if (!isset($origin)) {