• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_sorted_course_formats函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_plugins

 /**
  * Gathers and returns the information about all plugins of the given type
  *
  * @param string $type the name of the plugintype, eg. mod, auth or workshopform
  * @param string $typerootdir full path to the location of the plugin dir
  * @param string $typeclass the name of the actually called class
  * @param core_plugin_manager $pluginman the plugin manager calling this method
  * @return array of plugintype classes, indexed by the plugin name
  */
 public static function get_plugins($type, $typerootdir, $typeclass, $pluginman)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     $formats = parent::get_plugins($type, $typerootdir, $typeclass, $pluginman);
     $order = get_sorted_course_formats();
     $sortedformats = array();
     foreach ($order as $formatname) {
         $sortedformats[$formatname] = $formats[$formatname];
     }
     return $sortedformats;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:21,代码来源:format.php


示例2: get_format_or_default

 /**
  * Validates that course format exists and enabled and returns either itself or default format
  *
  * @param string $format
  * @return string
  */
 protected static final function get_format_or_default($format)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     if (array_key_exists($format, self::$classesforformat)) {
         return self::$classesforformat[$format];
     }
     $plugins = get_sorted_course_formats();
     foreach ($plugins as $plugin) {
         self::$classesforformat[$plugin] = $plugin;
     }
     if (array_key_exists($format, self::$classesforformat)) {
         return self::$classesforformat[$format];
     }
     if (PHPUNIT_TEST && class_exists('format_' . $format)) {
         // Allow unittests to use non-existing course formats.
         return $format;
     }
     // Else return default format
     $defaultformat = get_config('moodlecourse', 'format');
     if (!in_array($defaultformat, $plugins)) {
         // when default format is not set correctly, use the first available format
         $defaultformat = reset($plugins);
     }
     debugging('Format plugin format_' . $format . ' is not found. Using default format_' . $defaultformat, DEBUG_DEVELOPER);
     self::$classesforformat[$format] = $defaultformat;
     return $defaultformat;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:34,代码来源:lib.php


示例3: definition


//.........这里部分代码省略.........
         } else {
             $mform->setConstant('visible', $courseconfig->visible);
         }
     }
     $mform->addElement('date_selector', 'startdate', get_string('startdate'));
     $mform->addHelpButton('startdate', 'startdate');
     $mform->setDefault('startdate', time() + 3600 * 24);
     $mform->addElement('text', 'idnumber', get_string('idnumbercourse'), 'maxlength="100"  size="10"');
     $mform->addHelpButton('idnumber', 'idnumbercourse');
     $mform->setType('idnumber', PARAM_RAW);
     if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
         $mform->hardFreeze('idnumber');
         $mform->setConstants('idnumber', $course->idnumber);
     }
     // Description.
     $mform->addElement('header', 'descriptionhdr', get_string('description'));
     $mform->setExpanded('descriptionhdr');
     $mform->addElement('editor', 'summary_editor', get_string('coursesummary'), null, $editoroptions);
     $mform->addHelpButton('summary_editor', 'coursesummary');
     $mform->setType('summary_editor', PARAM_RAW);
     $summaryfields = 'summary_editor';
     if ($overviewfilesoptions = course_overviewfiles_options($course)) {
         $mform->addElement('filemanager', 'overviewfiles_filemanager', get_string('courseoverviewfiles'), null, $overviewfilesoptions);
         $mform->addHelpButton('overviewfiles_filemanager', 'courseoverviewfiles');
         $summaryfields .= ',overviewfiles_filemanager';
     }
     if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) {
         // Remove the description header it does not contain anything any more.
         $mform->removeElement('descriptionhdr');
         $mform->hardFreeze($summaryfields);
     }
     // Course format.
     $mform->addElement('header', 'courseformathdr', get_string('type_format', 'plugin'));
     $courseformats = get_sorted_course_formats(true);
     $formcourseformats = array();
     foreach ($courseformats as $courseformat) {
         $formcourseformats[$courseformat] = get_string('pluginname', "format_{$courseformat}");
     }
     if (isset($course->format)) {
         $course->format = course_get_format($course)->get_format();
         // replace with default if not found
         if (!in_array($course->format, $courseformats)) {
             // this format is disabled. Still display it in the dropdown
             $formcourseformats[$course->format] = get_string('withdisablednote', 'moodle', get_string('pluginname', 'format_' . $course->format));
         }
     }
     $mform->addElement('select', 'format', get_string('format'), $formcourseformats);
     $mform->addHelpButton('format', 'format');
     $mform->setDefault('format', $courseconfig->format);
     // Button to update format-specific options on format change (will be hidden by JavaScript).
     $mform->registerNoSubmitButton('updatecourseformat');
     $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
     // Just a placeholder for the course format options.
     $mform->addElement('hidden', 'addcourseformatoptionshere');
     $mform->setType('addcourseformatoptionshere', PARAM_BOOL);
     // Appearance.
     $mform->addElement('header', 'appearancehdr', get_string('appearance'));
     if (!empty($CFG->allowcoursethemes)) {
         $themeobjects = get_list_of_themes();
         $themes = array();
         $themes[''] = get_string('forceno');
         foreach ($themeobjects as $key => $theme) {
             if (empty($theme->hidefromselector)) {
                 $themes[$key] = get_string('pluginname', 'theme_' . $theme->name);
             }
         }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:67,代码来源:edit_form.php


示例4: admin_externalpage

 // Speedup for non-admins, add all caps used on this page.
 $ADMIN->add('courses', new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/management.php', array('moodle/category:manage', 'moodle/course:create')));
 $ADMIN->add('courses', new admin_externalpage('addcategory', new lang_string('addcategory', 'admin'), new moodle_url('/course/editcategory.php', array('parent' => 0)), array('moodle/category:manage')));
 $ADMIN->add('courses', new admin_externalpage('restorecourse', new lang_string('restorecourse', 'admin'), new moodle_url('/backup/restorefile.php', array('contextid' => context_system::instance()->id)), array('moodle/restore:restorecourse')));
 // Course Default Settings Page.
 // NOTE: these settings must be applied after all other settings because they depend on them.
 // Main course settings.
 $temp = new admin_settingpage('coursesettings', new lang_string('coursesettings'));
 require_once $CFG->dirroot . '/course/lib.php';
 $choices = array();
 $choices['0'] = new lang_string('hide');
 $choices['1'] = new lang_string('show');
 $temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'), 1, $choices));
 // Course format.
 $temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
 $courseformats = get_sorted_course_formats(true);
 $formcourseformats = array();
 foreach ($courseformats as $courseformat) {
     $formcourseformats[$courseformat] = new lang_string('pluginname', "format_{$courseformat}");
 }
 $temp->add(new admin_setting_configselect('moodlecourse/format', new lang_string('format'), new lang_string('coursehelpformat'), 'weeks', $formcourseformats));
 $temp->add(new admin_setting_configtext('moodlecourse/maxsections', new lang_string('maxnumberweeks'), new lang_string('maxnumberweeks_desc'), 52));
 $temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', new lang_string('numberweeks'), new lang_string('coursehelpnumberweeks'), 10));
 $choices = array();
 $choices['0'] = new lang_string('hiddensectionscollapsed');
 $choices['1'] = new lang_string('hiddensectionsinvisible');
 $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'), new lang_string('coursehelphiddensections'), 0, $choices));
 $choices = array();
 $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single');
 $choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi');
 $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices));
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:courses.php


示例5: definition


//.........这里部分代码省略.........

        $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100"  size="10"');
        $mform->addHelpButton('idnumber', 'idnumbercourse');
        $mform->setType('idnumber', PARAM_RAW);
        if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
            $mform->hardFreeze('idnumber');
            $mform->setConstants('idnumber', $course->idnumber);
        }

        // Description.
        $mform->addElement('header', 'descriptionhdr', get_string('description'));
        $mform->setExpanded('descriptionhdr');

        $mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions);
        $mform->addHelpButton('summary_editor', 'coursesummary');
        $mform->setType('summary_editor', PARAM_RAW);
        $summaryfields = 'summary_editor';

        if ($overviewfilesoptions = course_overviewfiles_options($course)) {
            $mform->addElement('filemanager', 'overviewfiles_filemanager', get_string('courseoverviewfiles'), null, $overviewfilesoptions);
            $mform->addHelpButton('overviewfiles_filemanager', 'courseoverviewfiles');
            $summaryfields .= ',overviewfiles_filemanager';
        }

        if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) {
            // Remove the description header it does not contain anything any more.
            $mform->removeElement('descriptionhdr');
            $mform->hardFreeze($summaryfields);
        }

        // Course format.
        $mform->addElement('header', 'courseformathdr', get_string('type_format', 'plugin'));

        $courseformats = get_sorted_course_formats(true);
        $formcourseformats = array();
        foreach ($courseformats as $courseformat) {
            $formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
        }
        if (isset($course->format)) {
            $course->format = course_get_format($course)->get_format(); // replace with default if not found
            if (!in_array($course->format, $courseformats)) {
                // this format is disabled. Still display it in the dropdown
                $formcourseformats[$course->format] = get_string('withdisablednote', 'moodle',
                        get_string('pluginname', 'format_'.$course->format));
            }
        }

        $mform->addElement('select', 'format', get_string('format'), $formcourseformats);
        $mform->addHelpButton('format', 'format');
        $mform->setDefault('format', $courseconfig->format);

        // Button to update format-specific options on format change (will be hidden by JavaScript).
        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));

        // Just a placeholder for the course format options.
        $mform->addElement('hidden', 'addcourseformatoptionshere');
        $mform->setType('addcourseformatoptionshere', PARAM_BOOL);

        // Appearance.
        $mform->addElement('header', 'appearancehdr', get_string('appearance'));

        if (!empty($CFG->allowcoursethemes)) {
            $themeobjects = get_list_of_themes();
            $themes=array();
            $themes[''] = get_string('forceno');
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:67,代码来源:edit_form.php


示例6: get_format_or_default

 /**
  * Validates that course format exists and enabled and returns either itself or default format
  *
  * @param string $format
  * @return string
  */
 protected static final function get_format_or_default($format)
 {
     if (array_key_exists($format, self::$classesforformat)) {
         return self::$classesforformat[$format];
     }
     $plugins = get_sorted_course_formats();
     foreach ($plugins as $plugin) {
         self::$classesforformat[$plugin] = $plugin;
     }
     if (array_key_exists($format, self::$classesforformat)) {
         return self::$classesforformat[$format];
     }
     // Else return default format
     $defaultformat = get_config('moodlecourse', 'format');
     if (!in_array($defaultformat, $plugins)) {
         // when default format is not set correctly, use the first available format
         $defaultformat = reset($plugins);
     }
     debugging('Format plugin format_' . $format . ' is not found. Using default format_' . $defaultformat, DEBUG_DEVELOPER);
     self::$classesforformat[$format] = $defaultformat;
     return $defaultformat;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:28,代码来源:lib.php


示例7: definition

 /**
  * The standard form definiton.
  * @return void.
  */
 public function definition()
 {
     global $CFG;
     $mform = $this->_form;
     $data = $this->_customdata['data'];
     $courseconfig = get_config('moodlecourse');
     // Import options.
     $this->add_import_options();
     // Course options.
     $mform->addElement('header', 'courseoptionshdr', get_string('courseprocess', 'tool_uploadcourse'));
     $mform->setExpanded('courseoptionshdr', true);
     $mform->addElement('text', 'options[shortnametemplate]', get_string('shortnametemplate', 'tool_uploadcourse'), 'maxlength="100" size="20"');
     $mform->setType('options[shortnametemplate]', PARAM_RAW);
     $mform->addHelpButton('options[shortnametemplate]', 'shortnametemplate', 'tool_uploadcourse');
     $mform->disabledIf('options[shortnametemplate]', 'options[mode]', 'eq', tool_uploadcourse_processor::MODE_CREATE_OR_UPDATE);
     $mform->disabledIf('options[shortnametemplate]', 'options[mode]', 'eq', tool_uploadcourse_processor::MODE_UPDATE_ONLY);
     // Restore file is not in the array options on purpose, because formslib can't handle it!
     $contextid = $this->_customdata['contextid'];
     $mform->addElement('hidden', 'contextid', $contextid);
     $mform->setType('contextid', PARAM_INT);
     $mform->addElement('filepicker', 'restorefile', get_string('templatefile', 'tool_uploadcourse'));
     $mform->addHelpButton('restorefile', 'templatefile', 'tool_uploadcourse');
     $mform->addElement('text', 'options[templatecourse]', get_string('coursetemplatename', 'tool_uploadcourse'));
     $mform->setType('options[templatecourse]', PARAM_TEXT);
     $mform->addHelpButton('options[templatecourse]', 'coursetemplatename', 'tool_uploadcourse');
     $mform->addElement('selectyesno', 'options[reset]', get_string('reset', 'tool_uploadcourse'));
     $mform->setDefault('options[reset]', 0);
     $mform->disabledIf('options[reset]', 'options[mode]', 'eq', tool_uploadcourse_processor::MODE_CREATE_NEW);
     $mform->disabledIf('options[reset]', 'options[mode]', 'eq', tool_uploadcourse_processor::MODE_CREATE_ALL);
     $mform->disabledIf('options[reset]', 'options[allowresets]', 'eq', 0);
     $mform->addHelpButton('options[reset]', 'reset', 'tool_uploadcourse');
     // Default values.
     $mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'tool_uploadcourse'));
     $mform->setExpanded('defaultheader', true);
     $displaylist = coursecat::make_categories_list('moodle/course:create');
     $mform->addElement('select', 'defaults[category]', get_string('coursecategory'), $displaylist);
     $mform->addHelpButton('defaults[category]', 'coursecategory');
     $choices = array();
     $choices['0'] = get_string('hide');
     $choices['1'] = get_string('show');
     $mform->addElement('select', 'defaults[visible]', get_string('visible'), $choices);
     $mform->addHelpButton('defaults[visible]', 'visible');
     $mform->setDefault('defaults[visible]', $courseconfig->visible);
     $mform->addElement('date_selector', 'defaults[startdate]', get_string('startdate'));
     $mform->addHelpButton('defaults[startdate]', 'startdate');
     $mform->setDefault('defaults[startdate]', time() + 3600 * 24);
     $mform->addElement('date_selector', 'defaults[enddate]', get_string('enddate'), array('optional' => true));
     $mform->addHelpButton('defaults[enddate]', 'enddate');
     $courseformats = get_sorted_course_formats(true);
     $formcourseformats = array();
     foreach ($courseformats as $courseformat) {
         $formcourseformats[$courseformat] = get_string('pluginname', "format_{$courseformat}");
     }
     $mform->addElement('select', 'defaults[format]', get_string('format'), $formcourseformats);
     $mform->addHelpButton('defaults[format]', 'format');
     $mform->setDefault('defaults[format]', $courseconfig->format);
     if (!empty($CFG->allowcoursethemes)) {
         $themeobjects = get_list_of_themes();
         $themes = array();
         $themes[''] = get_string('forceno');
         foreach ($themeobjects as $key => $theme) {
             if (empty($theme->hidefromselector)) {
                 $themes[$key] = get_string('pluginname', 'theme_' . $theme->name);
             }
         }
         $mform->addElement('select', 'defaults[theme]', get_string('forcetheme'), $themes);
     }
     $languages = array();
     $languages[''] = get_string('forceno');
     $languages += get_string_manager()->get_list_of_translations();
     $mform->addElement('select', 'defaults[lang]', get_string('forcelanguage'), $languages);
     $mform->setDefault('defaults[lang]', $courseconfig->lang);
     $options = range(0, 10);
     $mform->addElement('select', 'defaults[newsitems]', get_string('newsitemsnumber'), $options);
     $mform->addHelpButton('defaults[newsitems]', 'newsitemsnumber');
     $mform->setDefault('defaults[newsitems]', $courseconfig->newsitems);
     $mform->addElement('selectyesno', 'defaults[showgrades]', get_string('showgrades'));
     $mform->addHelpButton('defaults[showgrades]', 'showgrades');
     $mform->setDefault('defaults[showgrades]', $courseconfig->showgrades);
     $mform->addElement('selectyesno', 'defaults[showreports]', get_string('showreports'));
     $mform->addHelpButton('defaults[showreports]', 'showreports');
     $mform->setDefault('defaults[showreports]', $courseconfig->showreports);
     if (!empty($CFG->legacyfilesinnewcourses)) {
         $mform->addElement('select', 'defaults[legacyfiles]', get_string('courselegacyfiles'), $choices);
         $mform->addHelpButton('defaults[legacyfiles]', 'courselegacyfiles');
         if (!isset($courseconfig->legacyfiles)) {
             $courseconfig->legacyfiles = 0;
         }
         $mform->setDefault('defaults[legacyfiles]', $courseconfig->legacyfiles);
     }
     $choices = get_max_upload_sizes($CFG->maxbytes);
     $mform->addElement('select', 'defaults[maxbytes]', get_string('maximumupload'), $choices);
     $mform->addHelpButton('defaults[maxbytes]', 'maximumupload');
     $mform->setDefault('defaults[maxbytes]', $courseconfig->maxbytes);
     $choices = array();
     $choices[NOGROUPS] = get_string('groupsnone', 'group');
//.........这里部分代码省略.........
开发者ID:janeklb,项目名称:moodle,代码行数:101,代码来源:step2_form.php


示例8: get_format_or_default

 /**
  * Validates that course format exists and enabled and returns either itself or default format
  *
  * @param string $format
  * @return string
  */
 protected static final function get_format_or_default($format)
 {
     if ($format === 'site') {
         return $format;
     }
     $plugins = get_sorted_course_formats();
     if (in_array($format, $plugins)) {
         return $format;
     }
     // Else return default format
     $defaultformat = get_config('moodlecourse', 'format');
     if (!in_array($defaultformat, $plugins)) {
         // when default format is not set correctly, use the first available format
         $defaultformat = reset($plugins);
     }
     static $warningprinted = array();
     if (empty($warningprinted[$format])) {
         debugging('Format plugin format_' . $format . ' is not found. Using default format_' . $defaultformat, DEBUG_DEVELOPER);
         $warningprinted[$format] = true;
     }
     return $defaultformat;
 }
开发者ID:Burick,项目名称:moodle,代码行数:28,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_source函数代码示例发布时间:2022-05-15
下一篇:
PHP get_sort_link函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap