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


PHP moodle_major_version函数代码示例

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


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

示例1: get_content

 /**
  *  Get the block content
  *  
  *  @global object $CFG
  *  @global object $USER
  *  @return object|string
  */
 public function get_content()
 {
     global $CFG, $USER;
     if ($this->content !== null) {
         return $this->content;
     }
     if (!$this->page->user_is_editing()) {
         return $this->content = '';
     }
     $context = context_course::instance($this->page->course->id);
     if (!has_capability('moodle/backup:backupactivity', $context)) {
         return $this->content = '';
     }
     $controller = new sharing_cart\controller();
     $html = $controller->render_tree($USER->id);
     if (moodle_major_version() >= 2.7) {
         // Moodle 2.7 or later runs always with Ajax
     } elseif (empty($CFG->enableajax)) {
         $html = $this->get_content_noajax();
     } else {
         $noscript = html_writer::tag('noscript', html_writer::tag('div', get_string('requirejs', __CLASS__), array('class' => 'error')));
         $html = $noscript . $html;
     }
     $this->page->requires->css('/blocks/sharing_cart/styles.css');
     $this->page->requires->js('/blocks/sharing_cart/module.js');
     $this->page->requires->yui_module('block_sharing_cart', 'M.block_sharing_cart.init', array(), null, true);
     $this->page->requires->strings_for_js(array('yes', 'no', 'ok', 'cancel', 'error', 'edit', 'move', 'delete', 'movehere'), 'moodle');
     $this->page->requires->strings_for_js(array('copyhere', 'notarget', 'backup', 'restore', 'movedir', 'clipboard', 'confirm_backup', 'confirm_userdata', 'confirm_delete'), __CLASS__);
     $footer = '<div style="display:none;">' . '<div class="header-commands">' . $this->get_header() . '</div>' . '</div>';
     return $this->content = (object) array('text' => $html, 'footer' => $footer);
 }
开发者ID:edurenye,项目名称:sharing_cart,代码行数:38,代码来源:block_sharing_cart.php

示例2: init

 private function init()
 {
     global $CFG;
     $this->moodlerelease = moodle_major_version();
     if (!is_float($this->moodlerelease)) {
         $this->moodlerelease = floatval($this->moodlerelease);
     }
     $this->moodleversion = $CFG->version;
 }
开发者ID:tmuras,项目名称:moosh,代码行数:9,代码来源:PluginInstall.php

示例3: can_use_drag_and_drop

 /**
  * Check whether drag and drop is supported
  *
  * @return boolean Whether or not to generate the drag and drop content
  */
 protected function can_use_drag_and_drop()
 {
     global $USER, $CFG;
     // Note: The screenreader setting no longer exists from Moodle 2.4.
     // Note: The enableajax setting no longer exists from Moodle 2.7.
     if (empty($CFG->enableajax) && moodle_major_version() < 2.7 || !empty($USER->screenreader)) {
         return false;
     }
     return true;
 }
开发者ID:VERSION2-Inc,项目名称:moodle-qtype_ddmatch,代码行数:15,代码来源:renderer.php

示例4: definition

 /**
  * Called to define this moodle form
  *
  * @return void
  */
 public function definition()
 {
     $mform =& $this->_form;
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->setDefault('name', get_string('modulename', 'attendance'));
     if (version_compare(moodle_major_version(true), '2.9', '>=')) {
         $this->standard_intro_elements();
     } else {
         $this->add_intro_editor();
     }
     $mform->addElement('modgrade', 'grade', get_string('grade'));
     $mform->setDefault('grade', 100);
     $this->standard_coursemodule_elements(true);
     $this->add_action_buttons();
 }
开发者ID:ralferlebach,项目名称:moodle-mod_attendance,代码行数:23,代码来源:mod_form.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     global $CFG;
     $moodle_version = 'moodle-' . moodle_major_version();
     $moodle_version .= ' ' . testable_simplecertificate::PLUGIN_VERSION;
     $moodle_version .= ' build: ' . get_config('mod_simplecertificate', 'version') . "\n";
     self::$fhandle = fopen("{$CFG->dirroot}/mod/simplecertificate/TestCaseResults.txt", "w");
     fwrite(self::$fhandle, $moodle_version);
     fwrite(self::$fhandle, 'Runned at: ' . date('Y-m-d H:i') . "\n\n");
     fwrite(self::$fhandle, "\n------\nPHPUnit tests:\n\n");
     self::$count = 0;
     parent::setUpBeforeClass();
 }
开发者ID:seducto,项目名称:moodle-mod_simplecertificate,代码行数:13,代码来源:locallib_test.php

示例6: load_current_environment

 /**
  * Sets the properties currentversion, currentrelease, currentbranch and currentplugins
  *
  * @param bool $forcereload
  */
 protected function load_current_environment($forcereload = false)
 {
     global $CFG;
     if (!is_null($this->currentversion) and !$forcereload) {
         // nothing to do
         return;
     }
     $version = null;
     $release = null;
     require $CFG->dirroot . '/version.php';
     $this->currentversion = $version;
     $this->currentrelease = $release;
     $this->currentbranch = moodle_major_version(true);
     $pluginman = plugin_manager::instance();
     foreach ($pluginman->get_plugins() as $type => $plugins) {
         foreach ($plugins as $plugin) {
             if (!$plugin->is_standard()) {
                 $this->currentplugins[$plugin->component] = $plugin->versiondisk;
             }
         }
     }
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:27,代码来源:pluginlib.php

示例7: __construct

 /**
  * Prepare the installer
  *
  * @param string|array $langcode a code of the language to install
  */
 public function __construct($langcode = '')
 {
     global $CFG;
     $this->set_queue($langcode);
     $this->version = moodle_major_version(true);
     if (!empty($CFG->langotherroot) and $CFG->langotherroot !== $CFG->dataroot . '/lang') {
         debugging('The in-built language pack installer does not support alternative location ' . 'of languages root directory. You are supposed to install and update your language ' . 'packs on your own.');
     }
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:14,代码来源:componentlib.class.php

示例8: get_site_major_version

 /**
  * @return string major version like 2.5, 2.6 etc.
  */
 protected function get_site_major_version()
 {
     return moodle_major_version();
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:7,代码来源:installer.php

示例9: definition

 /**
  * Defines forms elements
  *
  * @return  void
  *
  * @since  0.0.1
  */
 public function definition()
 {
     global $CFG;
     // Get the setting for elang
     $config = get_config('elang');
     // Get the video maxsize
     $videomaxsize = $config->videomaxsize;
     if (preg_match('/Gb$/', $videomaxsize)) {
         $videomaxsize = intval(floatval($videomaxsize) * 1000000000);
     } elseif (preg_match('/Mb$/', $videomaxsize)) {
         $videomaxsize = intval(floatval($videomaxsize) * 1000000);
     } elseif (preg_match('/Kb$/', $videomaxsize)) {
         $videomaxsize = intval(floatval($videomaxsize) * 1000);
     } else {
         $videomaxsize = intval($videomaxsize);
     }
     // Get the subtitle maxsize
     $subtitlemaxsize = $config->subtitlemaxsize;
     if (preg_match('/Gb$/', $subtitlemaxsize)) {
         $subtitlemaxsize = intval(floatval($subtitlemaxsize) * 1000000000);
     } elseif (preg_match('/Mb$/', $subtitlemaxsize)) {
         $subtitlemaxsize = intval(floatval($subtitlemaxsize) * 1000000);
     } elseif (preg_match('/Kb$/', $subtitlemaxsize)) {
         $subtitlemaxsize = intval(floatval($subtitlemaxsize) * 1000);
     } else {
         $subtitlemaxsize = intval($subtitlemaxsize);
     }
     // Get the poster maxsize
     $postermaxsize = $config->postermaxsize;
     if (preg_match('/Gb$/', $postermaxsize)) {
         $postermaxsize = intval(floatval($postermaxsize) * 1000000000);
     } elseif (preg_match('/Mb$/', $postermaxsize)) {
         $postermaxsize = intval(floatval($postermaxsize) * 1000000);
     } elseif (preg_match('/Kb$/', $postermaxsize)) {
         $postermaxsize = intval(floatval($postermaxsize) * 1000);
     } else {
         $postermaxsize = intval($postermaxsize);
     }
     // Get the form
     $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('elangname', 'elang'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEAN);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $mform->addHelpButton('name', 'elangname', 'elang');
     // Adding the standard "intro" and "introformat" fields
     if (version_compare(moodle_major_version(true), '2.9', '>=')) {
         $this->standard_intro_elements();
     } else {
         $this->add_intro_editor($config->requiremodintro);
     }
     // Adding the rest of elang settings, spreeading all them into this fieldset
     $mform->addElement('header', 'elangfieldset', get_string('upload', 'elang'));
     $languages = Elang\getLanguages();
     $options = array();
     foreach (explode(',', $config->language) as $key) {
         $options[$key] = $languages[$key];
     }
     $element = $mform->addElement('select', 'language', get_string('language', 'elang'), $options);
     if ($options['en-GB']) {
         $element->setSelected('en-GB');
     }
     $mform->addRule('language', null, 'required', null, 'client');
     $mform->addElement('filemanager', 'videos', get_string('videos', 'elang'), null, array('subdirs' => 0, 'maxbytes' => $videomaxsize, 'maxfiles' => 20, 'accepted_types' => array('video')));
     $mform->addHelpButton('videos', 'videos', 'elang');
     $mform->addRule('videos', null, 'required', null, 'client');
     /**		//TODO deal with specific mimetype (moodle does not seem to take this code into account when file is uploaded
     		require_once $CFG->libdir . '/filelib.php';
     		$info = & get_mimetypes_array();
     		$info['vtt'] = array('type' => 'text/vtt', 'icon'=>'text', 'defaulticon'=>true, 'groups' => array('subtitle'));
     		$info['srt'] = array('type' => 'text/plain', 'icon'=>'text', 'defaulticon'=>true, 'groups' => array('subtitle'));
     */
     $mform->addElement('filemanager', 'subtitle', get_string('subtitle', 'elang'), null, array('subdirs' => 0, 'maxbytes' => $subtitlemaxsize, 'maxfiles' => 1, 'accepted_types' => array('subtitle')));
     $mform->addHelpButton('subtitle', 'subtitle', 'elang');
     $mform->addRule('subtitle', null, 'required', null, 'client');
     $mform->addElement('filemanager', 'poster', get_string('poster', 'elang'), null, array('subdirs' => 0, 'maxbytes' => $postermaxsize, 'maxfiles' => 1, 'accepted_types' => array('image')));
     $mform->addHelpButton('poster', 'poster', 'elang');
     // Adding the "general" fieldset, where all the common settings are showed
     $mform->addElement('header', 'setting', get_string('settings', 'elang'));
     $mform->addElement('checkbox', 'showlanguage', get_string('showlanguage', 'elang'));
     $mform->addHelpButton('showlanguage', 'showlanguage', 'elang');
     $mform->addElement('text', 'repeatedunderscore', get_string('repeatedunderscore', 'elang'));
     $mform->addHelpButton('repeatedunderscore', 'repeatedunderscore', 'elang');
     $mform->addRule('repeatedunderscore', get_string('repeatedunderscore_error', 'elang'), 'numeric', null, 'client');
     $mform->setType('repeatedunderscore', PARAM_INT);
     $mform->addElement('text', 'titlelength', get_string('titlelength', 'elang'));
//.........这里部分代码省略.........
开发者ID:e-lang,项目名称:moodle-mod_elang,代码行数:101,代码来源:mod_form.php

示例10: dirname

 * @subpackage  elang
 * @copyright   2013-2016 University of La Rochelle, France
 * @license     http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html CeCILL-B license
 *
 * @since       0.0.1
 */
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/lib.php';
// Get the course number
$id = required_param('id', PARAM_INT);
// Get the course
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
// Verify the login
require_course_login($course);
// Get the moodle version
$version = moodle_major_version(true);
// Add a view all log
if (version_compare($version, '2.7') < 0) {
    add_to_log($course->id, 'elang', 'view all', 'index.php?id=' . $course->id, '');
} else {
    $event = \mod_elang\event\course_module_instance_list_viewed::create(array('context' => context_course::instance($course->id)));
    $event->trigger();
}
// Get the context from the course id
$coursecontext = context_course::instance($course->id);
// Prepare the page output
$PAGE->set_url('/mod/elang/index.php', array('id' => $id));
$PAGE->set_title(format_string($course->fullname));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($coursecontext);
// Send the header
开发者ID:e-lang,项目名称:moodle-mod_elang,代码行数:31,代码来源:index.php

示例11: defined

 *
 * @since       0.0.1
 */
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    require_once dirname(__FILE__) . '/lib.php';
    require_once dirname(__FILE__) . '/locallib.php';
    require_once $CFG->libdir . '/resourcelib.php';
    $languages = Elang\getLanguages();
    $tmp = Elang\getEncodings();
    $encodings = array();
    foreach ($tmp as $encoding) {
        $encodings[$encoding] = $encoding;
    }
    // General settings
    if (version_compare(moodle_major_version(true), '2.8', '<')) {
        // This should be present only until Moodle 2.7.x
        $settings->add(new admin_setting_configcheckbox('elang/requiremodintro', get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
    }
    $settings->add(new admin_setting_configtext('elang/videomaxsize', get_string('videomaxsize', 'elang'), get_string('videomaxsize_config', 'elang'), '10Mb', '/^(([1-9][0-9]*)|((([1-9][0-9]*(\\.[0-9]*[1-9])?)|(0\\.[0-9]*[1-9]))[MGK]b))$/'));
    $settings->add(new admin_setting_configtext('elang/postermaxsize', get_string('postermaxsize', 'elang'), get_string('postermaxsize_config', 'elang'), '1Mb', '/^(([1-9][0-9]*)|((([1-9][0-9]*(\\.[0-9]*[1-9])?)|(0\\.[0-9]*[1-9]))[MGK]b))$/'));
    $settings->add(new admin_setting_configtext('elang/subtitlemaxsize', get_string('subtitlemaxsize', 'elang'), get_string('subtitlemaxsize_config', 'elang'), '100Kb', '/^(([1-9][0-9]*)|((([1-9][0-9]*(\\.[0-9]*[1-9])?)|(0\\.[0-9]*[1-9]))[MGK]b))$/'));
    $settings->add(new admin_setting_configtext('elang/repeatedunderscore', get_string('repeatedunderscore', 'elang'), get_string('repeatedunderscore_config', 'elang'), 10, PARAM_INT));
    $settings->add(new admin_setting_configtext('elang/titlelength', get_string('titlelength', 'elang'), get_string('titlelength_config', 'elang'), 100, PARAM_INT));
    $settings->add(new admin_setting_configselect('elang/limit', get_string('limit', 'elang'), get_string('limit_config', 'elang'), 10, array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25)));
    $settings->add(new admin_setting_configtext('elang/timeout', get_string('timeout', 'elang'), get_string('timeout_config', 'elang'), 3000, PARAM_INT));
    $settings->add(new admin_setting_configmultiselect('elang/language', get_string('language', 'elang'), get_string('language_config', 'elang'), array_keys($languages), $languages));
    $settings->add(new admin_setting_configmultiselect('elang/encoding', get_string('encoding', 'elang'), get_string('encoding_config', 'elang'), $encodings, $encodings));
    $settings->add(new admin_setting_configcheckbox('elang/showlanguage', get_string('showlanguage', 'elang'), get_string('showlanguage_config', 'elang'), 1));
    $settings->add(new admin_setting_configtext('elang/left', get_string('left', 'elang'), get_string('left_config', 'elang'), 20, PARAM_INT));
    $settings->add(new admin_setting_configtext('elang/top', get_string('top', 'elang'), get_string('top_config', 'elang'), 20, PARAM_INT));
开发者ID:e-lang,项目名称:moodle-mod_elang,代码行数:31,代码来源:settings.php


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