本文整理汇总了PHP中completion_completion::is_complete方法的典型用法代码示例。如果您正苦于以下问题:PHP completion_completion::is_complete方法的具体用法?PHP completion_completion::is_complete怎么用?PHP completion_completion::is_complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类completion_completion
的用法示例。
在下文中一共展示了completion_completion::is_complete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_status
/**
* Return criteria status text for display in reports
*
* @param completion_completion $completion The user's completion record
* @return string
*/
public function get_status($completion)
{
return $completion->is_complete() ? get_string('yes') : get_string('no');
}
示例2: is_course_complete
/**
* Has the supplied user completed this course
*
* @param int $user_id User's id
* @return boolean
*/
public function is_course_complete($user_id)
{
$params = array('userid' => $user_id, 'course' => $this->course_id);
$ccompletion = new completion_completion($params);
return $ccompletion->is_complete();
}
示例3: sesskey
if ($csv) {
print $sep . csv_quote($describe);
} else {
if ($allow_marking_criteria === $criterion->id) {
$describe = get_string('completion-alt-auto-' . $completiontype, 'completion');
print '<td class="completion-progresscell">' . '<a href="' . $CFG->wwwroot . '/course/togglecompletion.php?user=' . $user->id . '&course=' . $course->id . '&rolec=' . $allow_marking_criteria . '&sesskey=' . sesskey() . '">' . '<img src="' . $OUTPUT->pix_url('i/completion-manual-' . ($is_complete ? 'y' : 'n')) . '" alt="' . $describe . '" class="icon" title="' . get_string('markcomplete', 'completion') . '" /></a></td>';
} else {
print '<td class="completion-progresscell">' . '<img src="' . $OUTPUT->pix_url('i/' . $completionicon) . '" alt="' . $describe . '" class="icon" title="' . $fulldescribe . '" /></td>';
}
}
}
// Handle overall course completion
// Load course completion
$params = array('userid' => $user->id, 'course' => $course->id);
$ccompletion = new completion_completion($params);
$completiontype = $ccompletion->is_complete() ? 'y' : 'n';
$describe = get_string('completion-alt-auto-' . $completiontype, 'completion');
$a = new StdClass();
$a->state = $describe;
$a->date = '';
$a->user = fullname($user);
$a->activity = strip_tags(get_string('coursecomplete', 'completion'));
$fulldescribe = get_string('progress-title', 'completion', $a);
if ($csv) {
print $sep . csv_quote($describe);
} else {
print '<td class="completion-progresscell">';
// Display course completion status icon
print '<img src="' . $OUTPUT->pix_url('i/completion-auto-' . $completiontype) . '" alt="' . $describe . '" class="icon" title="' . $fulldescribe . '" />';
print '</td>';
}
示例4: review
/**
* Review this criteria and decide if the user has completed
*
* @param completion_completion $completion The user's completion record
* @param bool $mark Optionally set false to not save changes to database
* @param bool $is_complete Set to false if the criteria has been completed just now.
* @return bool
*/
public function review($completion, $mark = true, $is_complete = false)
{
// If we are marking this as complete
if ($is_complete && $mark) {
$completion->completedself = 1;
$completion->mark_complete();
return true;
}
return $completion->is_complete();
}
示例5: get_status
/**
* Return criteria status text for display in reports
*
* @param completion_completion $completion The user's completion record
* @return string
*/
public function get_status($completion)
{
return $completion->is_complete() ? get_string('yes') : userdate($this->timeend, '%d-%h-%y');
}
示例6: sync_enrolments
//.........这里部分代码省略.........
if (!empty($grading_info->items)) {
$item = $grading_info->items[0];
if (isset($item->grades[$userid]->grade)) {
$currentgrade = $item->grades[$userid]->grade + 0;
$currentgrade = $currentgrade * 10;
}
}
$trace->output('Old grade for courseid ' . $cinfo['courseid'] . " and userid " . $userid . " is " . $currentgrade . ".");
} else {
$trace->output('Error: Unable to get final exam record for courseid ' . $cinfo['courseid'] . " and userid " . $userid . ". Course completion will be ignored.");
continue;
}
if (isset($cinfo['grade'])) {
if ($cinfo['grade'] > $currentgrade || empty($currentgrade)) {
// If imported grade is larger update the final exam grade
$grade = array();
$grade['userid'] = $userid;
$grade['rawgrade'] = $cinfo['grade'] / 10;
//learn.saylor.org is currently using rawmaxgrade of 10.0000
grade_update('mod/quiz', $cinfo['courseid'], $gi->itemtype, $gi->itemmodule, $gi->iteminstance, $gi->itemnumber, $grade);
$trace->output('Updating grade for courseid ' . $cinfo['courseid'] . " and userid " . $userid . " to " . $grade['rawgrade'] . ".");
} else {
if (!empty($currentgrade) && $currentgrade >= $cinfo['grade']) {
$trace->output("Current grade for final exam for courseid " . $cinfo['courseid'] . " and userid " . $userid . " is larger or equal to the imported grade. Not updating grade.");
continue;
} else {
debugging("Unable to determine if there is a current final exam grade for courseid " . $cinfo['courseid'] . " and userid " . $userid . " or whether it is less than the imported grade.");
continue;
}
}
//Mark course as complete. Create completion_completion object to handle completion info for that user and course.
$cparams = array('userid' => $userid, 'course' => $cinfo['courseid']);
$cc = new completion_completion($cparams);
if ($cc->is_complete()) {
continue;
//Skip adding completion info for this course if the user has already completed this course. Possibility that his grade gets bumped up.
}
if (isset($cinfo['completiondate'])) {
$completeddatestamp = strtotime($cinfo['completiondate']);
//Convert the date string to a unix time stamp.
} else {
$completeddatestamp = time();
//If not set, just use the current date.
}
if (isset($cinfo['enroldate'])) {
$enroldatestamp = strtotime($cinfo['enroldate']);
//Convert the date string to a unix time stamp.
} else {
$enroldatestamp = $completeddatestamp;
}
$cc->mark_enrolled($enroldatestamp);
$cc->mark_inprogress($enroldatestamp);
$cc->mark_complete($completeddatestamp);
$trace->output('Setting completion data for userid ' . $userid . ' and courseid ' . $cinfo['courseid'] . ".");
} else {
if (!isset($cinfo['grade'])) {
$trace->output("Error: No grade info in external db for completed course " . $cinfo['courseid'] . " for user " . $userid . ".");
}
}
}
}
// Deal with enrolments removed from external table.
if ($unenrolaction == ENROL_EXT_REMOVED_UNENROL) {
if (!$preventfullunenrol) {
// Unenrol.
foreach ($currentstatus as $userid => $status) {