本文整理汇总了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>';
}
}