當前位置: 首頁>>代碼示例>>PHP>>正文


PHP completion_info::has_activities方法代碼示例

本文整理匯總了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());
 }
開發者ID:masaterutakeno,項目名稱:MoodleMobile,代碼行數:16,代碼來源:completionlib_advanced_test.php

示例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', ''));
    }
}
開發者ID:evltuma,項目名稱:moodle,代碼行數:24,代碼來源:lib.php

示例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());
 }
開發者ID:janaece,項目名稱:globalclassroom4_clean,代碼行數:18,代碼來源:completionlib_test.php


注:本文中的completion_info::has_activities方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。