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


PHP badges_add_course_navigation函数代码示例

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


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

示例1: load_course_settings


//.........这里部分代码省略.........
         if (!empty($course->showgrades)) {
             $reports = core_component::get_plugin_list('gradereport');
             if (is_array($reports) && count($reports) > 0) {
                 // Get all installed reports
                 arsort($reports);
                 // user is last, we want to test it first
                 foreach ($reports as $plugin => $plugindir) {
                     if (has_capability('gradereport/' . $plugin . ':view', $coursecontext)) {
                         //stop when the first visible plugin is found
                         $reportavailable = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($reportavailable) {
         $url = new moodle_url('/grade/report/index.php', array('id' => $course->id));
         $gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, 'grades', new pix_icon('i/grades', ''));
     }
     // Check if we can view the gradebook's setup page.
     if (has_capability('moodle/grade:manage', $coursecontext)) {
         $url = new moodle_url('/grade/edit/tree/index.php', array('id' => $course->id));
         $coursenode->add(get_string('gradebooksetup', 'grades'), $url, self::TYPE_SETTING, null, 'gradebooksetup', new pix_icon('i/settings', ''));
     }
     //  Add outcome if permitted
     if (!empty($CFG->enableoutcomes) && has_capability('moodle/course:update', $coursecontext)) {
         $url = new moodle_url('/grade/edit/outcome/course.php', array('id' => $course->id));
         $coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', ''));
     }
     //Add badges navigation
     if (!empty($CFG->enablebadges)) {
         require_once $CFG->libdir . '/badgeslib.php';
         badges_add_course_navigation($coursenode, $course);
     }
     // Backup this course
     if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
         $url = new moodle_url('/backup/backup.php', array('id' => $course->id));
         $coursenode->add(get_string('backup'), $url, self::TYPE_SETTING, null, 'backup', new pix_icon('i/backup', ''));
     }
     // Restore to this course
     if (has_capability('moodle/restore:restorecourse', $coursecontext)) {
         $url = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
         $coursenode->add(get_string('restore'), $url, self::TYPE_SETTING, null, 'restore', new pix_icon('i/restore', ''));
     }
     // Import data from other courses
     if (has_capability('moodle/restore:restoretargetimport', $coursecontext)) {
         $url = new moodle_url('/backup/import.php', array('id' => $course->id));
         $coursenode->add(get_string('import'), $url, self::TYPE_SETTING, null, 'import', new pix_icon('i/import', ''));
     }
     // Publish course on a hub
     if (has_capability('moodle/course:publish', $coursecontext)) {
         $url = new moodle_url('/course/publish/index.php', array('id' => $course->id));
         $coursenode->add(get_string('publish'), $url, self::TYPE_SETTING, null, 'publish', new pix_icon('i/publish', ''));
     }
     // Reset this course
     if (has_capability('moodle/course:reset', $coursecontext)) {
         $url = new moodle_url('/course/reset.php', array('id' => $course->id));
         $coursenode->add(get_string('reset'), $url, self::TYPE_SETTING, null, 'reset', new pix_icon('i/return', ''));
     }
     // Questions
     require_once $CFG->libdir . '/questionlib.php';
     question_extend_settings_navigation($coursenode, $coursecontext)->trim_if_empty();
     if (has_capability('moodle/course:update', $coursecontext)) {
         // Repository Instances
         if (!$this->cache->cached('contexthasrepos' . $coursecontext->id)) {
开发者ID:evltuma,项目名称:moodle,代码行数:67,代码来源:navigationlib.php

示例2: load_course_settings

 /**
  * This function loads the course settings that are available for the user
  *
  * @param bool $forceopen If set to true the course node will be forced open
  * @return navigation_node|false
  */
 protected function load_course_settings($forceopen = false)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     $course = $this->page->course;
     $coursecontext = context_course::instance($course->id);
     $adminoptions = course_get_user_administration_options($course, $coursecontext);
     // note: do not test if enrolled or viewing here because we need the enrol link in Course administration section
     $coursenode = $this->add(get_string('courseadministration'), null, self::TYPE_COURSE, null, 'courseadmin');
     if ($forceopen) {
         $coursenode->force_open();
     }
     if ($adminoptions->update) {
         // Add the course settings link
         $url = new moodle_url('/course/edit.php', array('id' => $course->id));
         $coursenode->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, 'editsettings', new pix_icon('i/settings', ''));
     }
     if ($this->page->user_allowed_editing()) {
         // Add the turn on/off settings
         if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) {
             // We are on the course page, retain the current page params e.g. section.
             $baseurl = clone $this->page->url;
             $baseurl->param('sesskey', sesskey());
         } else {
             // Edit on the main course page.
             $baseurl = new moodle_url('/course/view.php', array('id' => $course->id, 'return' => $this->page->url->out_as_local_url(false), 'sesskey' => sesskey()));
         }
         $editurl = clone $baseurl;
         if ($this->page->user_is_editing()) {
             $editurl->param('edit', 'off');
             $editstring = get_string('turneditingoff');
         } else {
             $editurl->param('edit', 'on');
             $editstring = get_string('turneditingon');
         }
         $coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, 'turneditingonoff', new pix_icon('i/edit', ''));
     }
     if ($adminoptions->update) {
         // Add the course completion settings link
         if ($CFG->enablecompletion && $course->enablecompletion) {
             $url = new moodle_url('/course/completion.php', array('id' => $course->id));
             $coursenode->add(get_string('coursecompletion', 'completion'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
         }
     } else {
         if ($adminoptions->tags) {
             $url = new moodle_url('/course/tags.php', array('id' => $course->id));
             $coursenode->add(get_string('coursetags', 'tag'), $url, self::TYPE_SETTING, null, 'coursetags', new pix_icon('i/settings', ''));
         }
     }
     // add enrol nodes
     enrol_add_course_navigation($coursenode, $course);
     // Manage filters
     if ($adminoptions->filters) {
         $url = new moodle_url('/filter/manage.php', array('contextid' => $coursecontext->id));
         $coursenode->add(get_string('filters', 'admin'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/filter', ''));
     }
     // View course reports.
     if ($adminoptions->reports) {
         $reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, 'coursereports', new pix_icon('i/stats', ''));
         $coursereports = core_component::get_plugin_list('coursereport');
         foreach ($coursereports as $report => $dir) {
             $libfile = $CFG->dirroot . '/course/report/' . $report . '/lib.php';
             if (file_exists($libfile)) {
                 require_once $libfile;
                 $reportfunction = $report . '_report_extend_navigation';
                 if (function_exists($report . '_report_extend_navigation')) {
                     $reportfunction($reportnav, $course, $coursecontext);
                 }
             }
         }
         $reports = get_plugin_list_with_function('report', 'extend_navigation_course', 'lib.php');
         foreach ($reports as $reportfunction) {
             $reportfunction($reportnav, $course, $coursecontext);
         }
     }
     // Check if we can view the gradebook's setup page.
     if ($adminoptions->gradebook) {
         $url = new moodle_url('/grade/edit/tree/index.php', array('id' => $course->id));
         $coursenode->add(get_string('gradebooksetup', 'grades'), $url, self::TYPE_SETTING, null, 'gradebooksetup', new pix_icon('i/settings', ''));
     }
     //  Add outcome if permitted
     if ($adminoptions->outcomes) {
         $url = new moodle_url('/grade/edit/outcome/course.php', array('id' => $course->id));
         $coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', ''));
     }
     //Add badges navigation
     if ($adminoptions->badges) {
         require_once $CFG->libdir . '/badgeslib.php';
         badges_add_course_navigation($coursenode, $course);
     }
     // Backup this course
     if ($adminoptions->backup) {
         $url = new moodle_url('/backup/backup.php', array('id' => $course->id));
         $coursenode->add(get_string('backup'), $url, self::TYPE_SETTING, null, 'backup', new pix_icon('i/backup', ''));
//.........这里部分代码省略.........
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:101,代码来源:navigationlib.php


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