本文整理匯總了PHP中completion_info::has_criteria方法的典型用法代碼示例。如果您正苦於以下問題:PHP completion_info::has_criteria方法的具體用法?PHP completion_info::has_criteria怎麽用?PHP completion_info::has_criteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類completion_info
的用法示例。
在下文中一共展示了completion_info::has_criteria方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: completion_report_extend_navigation
/**
* This function extends the navigation with the report items
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $course The course to object for the report
* @param stdClass $context The context of the course
*/
function completion_report_extend_navigation($navigation, $course, $context)
{
global $CFG, $OUTPUT;
if (has_capability('coursereport/completion:view', $context)) {
$completion = new completion_info($course);
if ($completion->is_enabled() && $completion->has_criteria()) {
$url = new moodle_url('/course/report/completion/index.php', array('course' => $course->id));
$navigation->add(get_string('pluginname', 'coursereport_completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
}
}
示例2: array
// Check permissions
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('coursereport/completion:view', $context);
// Get group mode
$group = groups_get_course_group($course, true);
// Supposed to verify group
if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
require_capability('moodle/site:accessallgroups', $context);
}
/**
* Load data
*/
// Get criteria for course
$completion = new completion_info($course);
if (!$completion->has_criteria()) {
print_error('err_nocriteria', 'completion', $CFG->wwwroot . '/course/report.php?id=' . $course->id);
}
// Get criteria and put in correct order
$criteria = array();
foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_COURSE) as $criterion) {
$criteria[] = $criterion;
}
foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_ACTIVITY) as $criterion) {
$criteria[] = $criterion;
}
foreach ($completion->get_criteria() as $criterion) {
if (!in_array($criterion->criteriatype, array(COMPLETION_CRITERIA_TYPE_COURSE, COMPLETION_CRITERIA_TYPE_ACTIVITY))) {
$criteria[] = $criterion;
}
}
示例3: die
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.');
// It must be included from a Moodle page
}
require_once $CFG->libdir . '/completionlib.php';
if (has_capability('coursereport/completion:view', $context)) {
$completion = new completion_info($course);
if ($completion->is_enabled() && $completion->has_criteria()) {
echo '<p>';
echo '<a href="' . $CFG->wwwroot . '/course/report/completion/index.php?coursetest=' . $course->id . '">' . get_string('coursecompletion') . '</a>';
echo '</p>';
}
}