当前位置: 首页>>代码示例>>PHP>>正文


PHP course_page_type_list函数代码示例

本文整理汇总了PHP中course_page_type_list函数的典型用法代码示例。如果您正苦于以下问题:PHP course_page_type_list函数的具体用法?PHP course_page_type_list怎么用?PHP course_page_type_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了course_page_type_list函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_course_page_type_list

 public function test_course_page_type_list()
 {
     global $DB;
     $this->resetAfterTest(true);
     // Create a category.
     $category = new stdClass();
     $category->name = 'Test Category';
     $testcategory = $this->getDataGenerator()->create_category($category);
     // Create a course.
     $course = new stdClass();
     $course->fullname = 'Apu loves Unit Təsts';
     $course->shortname = 'Spread the lŭve';
     $course->idnumber = '123';
     $course->summary = 'Awesome!';
     $course->summaryformat = FORMAT_PLAIN;
     $course->format = 'topics';
     $course->newsitems = 0;
     $course->numsections = 5;
     $course->category = $testcategory->id;
     $testcourse = $this->getDataGenerator()->create_course($course);
     // Create contexts.
     $coursecontext = context_course::instance($testcourse->id);
     $parentcontext = $coursecontext->get_parent_context();
     // Not actually used.
     $pagetype = 'page-course-x';
     // Not used either.
     $pagetypelist = course_page_type_list($pagetype, $parentcontext, $coursecontext);
     // Page type lists for normal courses.
     $testpagetypelist1 = array();
     $testpagetypelist1['*'] = 'Any page';
     $testpagetypelist1['course-*'] = 'Any course page';
     $testpagetypelist1['course-view-*'] = 'Any type of course main page';
     $this->assertEquals($testpagetypelist1, $pagetypelist);
     // Get the context for the front page course.
     $sitecoursecontext = context_course::instance(SITEID);
     $pagetypelist = course_page_type_list($pagetype, $parentcontext, $sitecoursecontext);
     // Page type list for the front page course.
     $testpagetypelist2 = array('*' => 'Any page');
     $this->assertEquals($testpagetypelist2, $pagetypelist);
     // Make sure that providing no current context to the function doesn't result in an error.
     // Calls made from generate_page_type_patterns() may provide null values.
     $pagetypelist = course_page_type_list($pagetype, null, null);
     $this->assertEquals($pagetypelist, $testpagetypelist1);
 }
开发者ID:uniedpa,项目名称:moodle,代码行数:44,代码来源:courselib_test.php

示例2: question_page_type_list

/**
 * Return a list of page types
 * @param string $pagetype current page type
 * @param stdClass $parentcontext Block's parent context
 * @param stdClass $currentcontext Current context of block
 */
function question_page_type_list($pagetype, $parentcontext, $currentcontext)
{
    global $CFG;
    $types = array('question-*' => get_string('page-question-x', 'question'), 'question-edit' => get_string('page-question-edit', 'question'), 'question-category' => get_string('page-question-category', 'question'), 'question-export' => get_string('page-question-export', 'question'), 'question-import' => get_string('page-question-import', 'question'));
    if ($currentcontext->contextlevel == CONTEXT_COURSE) {
        require_once $CFG->dirroot . '/course/lib.php';
        return array_merge(course_page_type_list($pagetype, $parentcontext, $currentcontext), $types);
    } else {
        return $types;
    }
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:17,代码来源:questionlib.php


注:本文中的course_page_type_list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。