本文整理汇总了PHP中scorm_get_attempt_status函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_get_attempt_status函数的具体用法?PHP scorm_get_attempt_status怎么用?PHP scorm_get_attempt_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_get_attempt_status函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scorm_print_overview
/**
* writes overview info for course_overview block - displays upcoming scorm objects that have a due date
*
* @param object $type - type of log(aicc,scorm12,scorm13) used as prefix for filename
* @param array $htmlarray
* @return mixed
*/
function scorm_print_overview($courses, &$htmlarray) {
global $USER, $CFG, $DB;
if (empty($courses) || !is_array($courses) || count($courses) == 0) {
return array();
}
if (!$scorms = get_all_instances_in_courses('scorm', $courses)) {
return;
}
$scormids = array();
// Do scorm::isopen() here without loading the whole thing for speed
foreach ($scorms as $key => $scorm) {
$time = time();
if ($scorm->timeopen) {
$isopen = ($scorm->timeopen <= $time && $time <= $scorm->timeclose);
}
if (empty($scorm->displayattemptstatus) && (empty($isopen) || empty($scorm->timeclose))) {
unset($scorms[$key]);
} else {
$scormids[] = $scorm->id;
}
}
if (empty($scormids)) {
// no scorms to look at - we're done
return true;
}
$strscorm = get_string('modulename', 'scorm');
$strduedate = get_string('duedate', 'scorm');
foreach ($scorms as $scorm) {
$str = '<div class="scorm overview"><div class="name">'.$strscorm. ': '.
'<a '.($scorm->visible ? '':' class="dimmed"').
'title="'.$strscorm.'" href="'.$CFG->wwwroot.
'/mod/scorm/view.php?id='.$scorm->coursemodule.'">'.
$scorm->name.'</a></div>';
if ($scorm->timeclose) {
$str .= '<div class="info">'.$strduedate.': '.userdate($scorm->timeclose).'</div>';
}
if ($scorm->displayattemptstatus == 1) {
require_once($CFG->dirroot.'/mod/scorm/locallib.php');
$str .= '<div class="details">'.scorm_get_attempt_status($USER, $scorm).'</div>';
}
$str .= '</div>';
if (empty($htmlarray[$scorm->course]['scorm'])) {
$htmlarray[$scorm->course]['scorm'] = $str;
} else {
$htmlarray[$scorm->course]['scorm'] .= $str;
}
}
}
示例2: array
exit;
} else {
if ($action == 'deleteconfirm') {
//delete this users attempts.
$DB->delete_records('scorm_scoes_track', array('userid' => $USER->id, 'scormid' => $scorm->id));
scorm_update_grades($scorm, $USER->id, true);
echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
}
}
}
$currenttab = 'info';
require $CFG->dirroot . '/mod/scorm/tabs.php';
// Print the main part of the page
$attemptstatus = '';
if (empty($launch) && ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL || $scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY)) {
$attemptstatus = scorm_get_attempt_status($USER, $scorm, $cm);
}
echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id) . $attemptstatus, 'generalbox boxaligncenter boxwidthwide', 'intro');
$scormopen = true;
$timenow = time();
if (!empty($scorm->timeopen) && $scorm->timeopen > $timenow) {
echo $OUTPUT->box(get_string("notopenyet", "scorm", userdate($scorm->timeopen)), "generalbox boxaligncenter");
$scormopen = false;
}
if (!empty($scorm->timeclose) && $timenow > $scorm->timeclose) {
echo $OUTPUT->box(get_string("expired", "scorm", userdate($scorm->timeclose)), "generalbox boxaligncenter");
$scormopen = false;
}
if ($scormopen && empty($launch)) {
scorm_view_display($USER, $scorm, 'view.php?id=' . $cm->id, $cm);
}
示例3: scorm_print_overview
/**
* writes overview info for course_overview block - displays upcoming scorm objects that have a due date
*
* @param object $type - type of log(aicc,scorm12,scorm13) used as prefix for filename
* @param array $htmlarray
* @return mixed
*/
function scorm_print_overview($courses, &$htmlarray) {
global $USER, $CFG;
if (empty($courses) || !is_array($courses) || count($courses) == 0) {
return array();
}
if (!$scorms = get_all_instances_in_courses('scorm', $courses)) {
return;
}
$strscorm = get_string('modulename', 'scorm');
$strduedate = get_string('duedate', 'scorm');
foreach ($scorms as $scorm) {
$time = time();
$showattemptstatus = false;
if ($scorm->timeopen) {
$isopen = ($scorm->timeopen <= $time && $time <= $scorm->timeclose);
}
if ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL ||
$scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_MY) {
$showattemptstatus = true;
}
if ($showattemptstatus || !empty($isopen) || !empty($scorm->timeclose)) {
$str = '<div class="scorm overview"><div class="name">'.$strscorm. ': '.
'<a '.($scorm->visible ? '':' class="dimmed"').
'title="'.$strscorm.'" href="'.$CFG->wwwroot.
'/mod/scorm/view.php?id='.$scorm->coursemodule.'">'.
$scorm->name.'</a></div>';
if ($scorm->timeclose) {
$str .= '<div class="info">'.$strduedate.': '.userdate($scorm->timeclose).'</div>';
}
if ($showattemptstatus) {
require_once($CFG->dirroot.'/mod/scorm/locallib.php');
$str .= '<div class="details">'.scorm_get_attempt_status($USER, $scorm).'</div>';
}
$str .= '</div>';
if (empty($htmlarray[$scorm->course]['scorm'])) {
$htmlarray[$scorm->course]['scorm'] = $str;
} else {
$htmlarray[$scorm->course]['scorm'] .= $str;
}
}
}
}
示例4: scorm_print_overview
/**
* writes overview info for course_overview block - displays upcoming scorm objects that have a due date
*
* @param object $type - type of log(aicc,scorm12,scorm13) used as prefix for filename
* @param array $htmlarray
* @return mixed
*/
function scorm_print_overview($courses, &$htmlarray) {
global $USER, $CFG;
if (empty($courses) || !is_array($courses) || count($courses) == 0) {
return array();
}
if (!$scorms = get_all_instances_in_courses('scorm', $courses)) {
return;
}
$strscorm = get_string('modulename', 'scorm');
$strduedate = get_string('duedate', 'scorm');
foreach ($scorms as $scorm) {
$time = time();
$showattemptstatus = false;
if ($scorm->timeopen) {
$isopen = ($scorm->timeopen <= $time && $time <= $scorm->timeclose);
}
if ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL ||
$scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_MY) {
$showattemptstatus = true;
}
if ($showattemptstatus || !empty($isopen) || !empty($scorm->timeclose)) {
$str = html_writer::start_div('scorm overview').html_writer::div($strscorm. ': '.
html_writer::link($CFG->wwwroot.'/mod/scorm/view.php?id='.$scorm->coursemodule, $scorm->name,
array('title' => $strscorm, 'class' => $scorm->visible ? '' : 'dimmed')), 'name');
if ($scorm->timeclose) {
$str .= html_writer::div($strduedate.': '.userdate($scorm->timeclose), 'info');
}
if ($showattemptstatus) {
require_once($CFG->dirroot.'/mod/scorm/locallib.php');
$str .= html_writer::div(scorm_get_attempt_status($USER, $scorm), 'details');
}
$str .= html_writer::end_div();
if (empty($htmlarray[$scorm->course]['scorm'])) {
$htmlarray[$scorm->course]['scorm'] = $str;
} else {
$htmlarray[$scorm->course]['scorm'] .= $str;
}
}
}
}