本文整理匯總了PHP中completion_info::has_activities方法的典型用法代碼示例。如果您正苦於以下問題:PHP completion_info::has_activities方法的具體用法?PHP completion_info::has_activities怎麽用?PHP completion_info::has_activities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類completion_info
的用法示例。
在下文中一共展示了completion_info::has_activities方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
function test_has_activities()
{
global $DB;
$this->resetAfterTest(true);
// Create a course with mixed auto completion data.
$course = $this->getDataGenerator()->create_course();
$course2 = $this->getDataGenerator()->create_course();
$completionauto = array('completion' => COMPLETION_TRACKING_AUTOMATIC);
$completionnone = array('completion' => COMPLETION_TRACKING_NONE);
$c1forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id), $completionauto);
$c2forum = $this->getDataGenerator()->create_module('forum', array('course' => $course2->id), $completionnone);
$c1 = new completion_info($course);
$c2 = new completion_info($course2);
$this->assertTrue($c1->has_activities());
$this->assertFalse($c2->has_activities());
}
示例2: report_progress_extend_navigation_course
/**
* 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 report_progress_extend_navigation_course($navigation, $course, $context)
{
global $CFG, $OUTPUT;
require_once $CFG->libdir . '/completionlib.php';
$showonnavigation = has_capability('report/progress:view', $context);
$group = groups_get_course_group($course, true);
// Supposed to verify group
if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
$showonnavigation = $showonnavigation && has_capability('moodle/site:accessallgroups', $context);
}
$completion = new completion_info($course);
$showonnavigation = $showonnavigation && $completion->is_enabled() && $completion->has_activities();
if ($showonnavigation) {
$url = new moodle_url('/report/progress/index.php', array('course' => $course->id));
$navigation->add(get_string('pluginname', 'report_progress'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
}
示例3: test_has_activities
public function test_has_activities()
{
global $CFG;
$this->resetAfterTest();
// Enable completion before creating modules, otherwise the completion data is not written in DB.
$CFG->enablecompletion = true;
// Create a course with mixed auto completion data.
$course = $this->getDataGenerator()->create_course(array('enablecompletion' => true));
$course2 = $this->getDataGenerator()->create_course(array('enablecompletion' => true));
$completionauto = array('completion' => COMPLETION_TRACKING_AUTOMATIC);
$completionnone = array('completion' => COMPLETION_TRACKING_NONE);
$c1forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id), $completionauto);
$c2forum = $this->getDataGenerator()->create_module('forum', array('course' => $course2->id), $completionnone);
$c1 = new completion_info($course);
$c2 = new completion_info($course2);
$this->assertTrue($c1->has_activities());
$this->assertFalse($c2->has_activities());
}