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

PHP wiki_get_formats函数代码示例

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

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



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

示例1: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     //-------------------------------------------------------------------------------
     /// Adding the "general" fieldset, where all the common settings are showed
     $mform->addElement('header', 'general', get_string('general', 'form'));
     /// Adding the standard "name" field
     $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     /// Adding the optional "intro" and "introformat" pair of fields
     //    	$mform->addElement('htmleditor', 'intro', get_string('wikiintro', 'wiki'));
     //		$mform->setType('intro', PARAM_RAW);
     //		$mform->addRule('intro', get_string('required'), 'required', null, 'client');
     //
     //        $mform->addElement('format', 'introformat', get_string('format'));
     $this->add_intro_editor(true, get_string('wikiintro', 'wiki'));
     //-------------------------------------------------------------------------------
     /// Adding the rest of wiki settings, spreeading all them into this fieldset
     /// or adding more fieldsets ('header' elements) if needed for better logic
     $mform->addElement('header', 'wikifieldset', get_string('wikisettings', 'wiki'));
     $attr = array('size' => '20');
     if (!empty($this->_instance)) {
         $attr['disabled'] = 'disabled';
     } else {
         $attr['value'] = get_string('firstpagetitle', 'wiki');
     }
     $mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr);
     $mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki');
     if (empty($this->_instance)) {
         $mform->addRule('firstpagetitle', null, 'required', null, 'client');
     }
     $wikimodeoptions = array('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki'));
     // don't allow to change wiki type once is set
     $wikitype_attr = array();
     if (!empty($this->_instance)) {
         $wikitype_attr['disabled'] = 'disabled';
     }
     $mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr);
     $mform->addHelpButton('wikimode', 'wikimode', 'wiki');
     $formats = wiki_get_formats();
     $editoroptions = array();
     foreach ($formats as $format) {
         $editoroptions[$format] = get_string($format, 'wiki');
     }
     $mform->addElement('select', 'defaultformat', get_string('defaultformat', 'wiki'), $editoroptions);
     $mform->addHelpButton('defaultformat', 'defaultformat', 'wiki');
     $mform->addElement('checkbox', 'forceformat', get_string('forceformat', 'wiki'));
     $mform->addHelpButton('forceformat', 'forceformat', 'wiki');
     //-------------------------------------------------------------------------------
     // add standard elements, common to all modules
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // add standard buttons, common to all modules
     $this->add_action_buttons();
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:57,代码来源:mod_form.php


示例2: definition

 protected function definition()
 {
     $mform = $this->_form;
     $required = get_string('required');
     //-------------------------------------------------------------------------------
     // Adding the "general" fieldset, where all the common settings are shown.
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Adding the standard "name" field.
     $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', $required, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     // Adding the optional "intro" and "introformat" pair of fields
     $this->add_intro_editor(true, get_string('wikiintro', 'wiki'));
     $wikimodeoptions = array('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki'));
     // Don't allow changes to the wiki type once it is set.
     $wikitype_attr = array();
     if (!empty($this->_instance)) {
         $wikitype_attr['disabled'] = 'disabled';
     }
     $mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr);
     $mform->addHelpButton('wikimode', 'wikimode', 'wiki');
     $attr = array('size' => '20');
     if (!empty($this->_instance)) {
         $attr['disabled'] = 'disabled';
     }
     $mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr);
     $mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki');
     $mform->setType('firstpagetitle', PARAM_TEXT);
     if (empty($this->_instance)) {
         $mform->addRule('firstpagetitle', $required, 'required', null, 'client');
     }
     // Format.
     $mform->addElement('header', 'wikifieldset', get_string('format'));
     $formats = wiki_get_formats();
     $editoroptions = array();
     foreach ($formats as $format) {
         $editoroptions[$format] = get_string($format, 'wiki');
     }
     $mform->addElement('select', 'defaultformat', get_string('defaultformat', 'wiki'), $editoroptions);
     $mform->addHelpButton('defaultformat', 'defaultformat', 'wiki');
     $mform->addElement('checkbox', 'forceformat', get_string('forceformat', 'wiki'));
     $mform->addHelpButton('forceformat', 'forceformat', 'wiki');
     //-------------------------------------------------------------------------------
     // Add standard elements, common to all modules.
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // Add standard buttons, common to all modules.
     $this->add_action_buttons();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:50,代码来源:mod_form.php


示例3: set_action

    function set_action($action) {
        global $PAGE;
        $this->action = $action;

        require_once(dirname(__FILE__) . '/create_form.php');
        $url = new moodle_url('/mod/wiki/create.php', array('action' => 'create', 'wid' => $PAGE->activityrecord->id, 'group' => $this->gid, 'uid' => $this->uid));
        $formats = wiki_get_formats();
        $options = array('formats' => $formats, 'defaultformat' => $PAGE->activityrecord->defaultformat, 'forceformat' => $PAGE->activityrecord->forceformat, 'groups' => $this->groups);
        if ($this->title != get_string('newpage', 'wiki')) {
            $options['disable_pagetitle'] = true;
        }
        $this->mform = new mod_wiki_create_form($url->out(false), $options);
    }
开发者ID:Burick,项目名称:moodle,代码行数:13,代码来源:pagelib.php


示例4: new_page

 /**
  * Creates a new page.
  *
  * @param string $title New page title.
  * @param string $content Page contents.
  * @param int $contentformat Page contents format. If an invalid format is provided, default wiki format is used.
  * @param int $subwikiid The Subwiki ID where to store the page.
  * @param int $wikiid Page\'s wiki ID. Used if subwiki does not exists.
  * @param int $userid Subwiki\'s user ID. Used if subwiki does not exists.
  * @param int $groupid Subwiki\'s group ID. Used if subwiki does not exists.
  * @return array of warnings and page data.
  * @since Moodle 3.1
  */
 public static function new_page($title, $content, $contentformat = null, $subwikiid = null, $wikiid = null, $userid = null, $groupid = null)
 {
     global $USER;
     $params = self::validate_parameters(self::new_page_parameters(), array('title' => $title, 'content' => $content, 'contentformat' => $contentformat, 'subwikiid' => $subwikiid, 'wikiid' => $wikiid, 'userid' => $userid, 'groupid' => $groupid));
     $warnings = array();
     // Get wiki and subwiki instances.
     if (!empty($params['subwikiid'])) {
         if (!($subwiki = wiki_get_subwiki($params['subwikiid']))) {
             throw new moodle_exception('incorrectsubwikiid', 'wiki');
         }
         if (!($wiki = wiki_get_wiki($subwiki->wikiid))) {
             throw new moodle_exception('incorrectwikiid', 'wiki');
         }
         // Permission validation.
         $cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
         $context = context_module::instance($cm->id);
         self::validate_context($context);
     } else {
         if (!($wiki = wiki_get_wiki($params['wikiid']))) {
             throw new moodle_exception('incorrectwikiid', 'wiki');
         }
         // Permission validation.
         $cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
         $context = context_module::instance($cm->id);
         self::validate_context($context);
         // Determine groupid and userid to use.
         list($groupid, $userid) = self::determine_group_and_user($cm, $wiki, $params['groupid'], $params['userid']);
         // Get subwiki and validate it.
         $subwiki = wiki_get_subwiki_by_group_and_user_with_validation($wiki, $groupid, $userid);
         if ($subwiki === false) {
             // User cannot view page.
             throw new moodle_exception('cannoteditpage', 'wiki');
         } else {
             if ($subwiki->id < 0) {
                 // Subwiki needed to check edit permissions.
                 if (!wiki_user_can_edit($subwiki)) {
                     throw new moodle_exception('cannoteditpage', 'wiki');
                 }
                 // Subwiki does not exists and it can be created.
                 $swid = wiki_add_subwiki($wiki->id, $groupid, $userid);
                 if (!($subwiki = wiki_get_subwiki($swid))) {
                     throw new moodle_exception('incorrectsubwikiid', 'wiki');
                 }
             }
         }
     }
     // Subwiki needed to check edit permissions.
     if (!wiki_user_can_edit($subwiki)) {
         throw new moodle_exception('cannoteditpage', 'wiki');
     }
     if ($page = wiki_get_page_by_title($subwiki->id, $params['title'])) {
         throw new moodle_exception('pageexists', 'wiki');
     }
     // Ignore invalid formats and use default instead.
     if (!$params['contentformat'] || $wiki->forceformat) {
         $params['contentformat'] = $wiki->defaultformat;
     } else {
         $formats = wiki_get_formats();
         if (!in_array($params['contentformat'], $formats)) {
             $params['contentformat'] = $wiki->defaultformat;
         }
     }
     $newpageid = wiki_create_page($subwiki->id, $params['title'], $params['contentformat'], $USER->id);
     if (!($page = wiki_get_page($newpageid))) {
         throw new moodle_exception('incorrectpageid', 'wiki');
     }
     // Save content.
     $save = wiki_save_page($page, $params['content'], $USER->id);
     if (!$save) {
         throw new moodle_exception('savingerror', 'wiki');
     }
     $result = array();
     $result['pageid'] = $page->id;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:89,代码来源:external.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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