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

PHP moodleform_mod类代码示例

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

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



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

示例1: definition_after_data

    /**
     * Make fields editable or non-editable depending on the administrator choices
     * @see moodleform_mod::definition_after_data()
     */
    public function definition_after_data() {
        parent::definition_after_data();

        //$mform =& $this->_form;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:9,代码来源:mod_form.php


示例2: validation

 public function validation($data, $files)
 {
     global $DB;
     $errors = parent::validation($data, $files);
     // If you enable sharing, you must enter an idnumber.
     if (!empty($data['enablesharing']) && empty($data['cmidnumber'])) {
         $errors['cmidnumber'] = get_string('error_noidnumber', 'subpage');
     }
     // If you turn off sharing, there must be no shared pages using it.
     if (empty($data['enablesharing']) && !empty($this->_instance)) {
         if ($DB->get_field('modules', 'id', array('name' => 'sharedsubpage'))) {
             // Check if there is a shared subpage...
             if ($DB->record_exists('sharedsubpage', array('subpageid' => $this->_instance))) {
                 $errors['enablesharing'] = get_string('error_sharingused', 'subpage');
             }
         }
     }
     // ID numbers must be unique, systemwide.
     if (!empty($data['cmidnumber'])) {
         // Except obviously on this existing course-module (if it does exist).
         $except = -1;
         if (!empty($data['coursemodule'])) {
             $except = $data['coursemodule'];
         }
         if ($DB->record_exists_sql('SELECT 1 FROM {course_modules} WHERE idnumber = ? AND id <> ?', array($data['cmidnumber'], $except))) {
             $errors['cmidnumber'] = get_string('error_duplicateidnumber', 'subpage');
         }
     }
     return $errors;
 }
开发者ID:ninelanterns,项目名称:moodle-mod_subpage,代码行数:30,代码来源:mod_form.php


示例3: validation

    function validation($data, $files) {
        global $USER;

        if ($errors = parent::validation($data, $files)) {
            return $errors;
        }

        $usercontext = get_context_instance(CONTEXT_USER, $USER->id);
        $fs = get_file_storage();

        if (!$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['package'], 'id', false)) {
            if (!$this->current->instance) {
                $errors['package'] = get_string('required');
                return $errors;
            }
        } else {
            $file = reset($files);
            if ($file->get_mimetype() != 'application/zip') {
                $errors['package'] = get_string('invalidfiletype', 'error', '', $file);
                // better delete current file, it is not usable anyway
                $fs->delete_area_files($usercontext->id, 'user', 'draft', $data['package']);
            }
        }

        return $errors;
    }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:26,代码来源:mod_form.php


示例4:

 /**
  * Load in existing data as form defaults. Usually new entry defaults are stored directly in
  * form definition (new entry form); this function is used to load in data where values
  * already exist and data is being edited (edit entry form).
  *
  * @see: /course/moodleform.php
  */
 function set_data($default_values)
 {
     if (is_object($default_values)) {
         $default_values = (array) $default_values;
     }
     $default_values['details']['text'] = $default_values['intro'];
     parent::set_data($default_values);
 }
开发者ID:blakekidney,项目名称:moodle-mod_activitytask,代码行数:15,代码来源:mod_form.php


示例5:

 function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     return $data;
 }
开发者ID:brum1975,项目名称:h5p-moodle-plugin,代码行数:8,代码来源:mod_form.php


示例6: validation

 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     if (count($errors) == 0) {
         return true;
     } else {
         return $errors;
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:9,代码来源:mod_form.php


示例7: validation

 function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Completion: Automatic on-view completion can not work together with
     // "display inline" option
     if (empty($errors['completion']) && array_key_exists('completion', $data) && $data['completion'] == COMPLETION_TRACKING_AUTOMATIC && !empty($data['completionview']) && $data['display'] == FOLDER_DISPLAY_INLINE) {
         $errors['completion'] = get_string('noautocompletioninline', 'mod_folder');
     }
     return $errors;
 }
开发者ID:alokr912,项目名称:moodle-hangout,代码行数:10,代码来源:mod_form.php


示例8: validation

 function validation($data, $files)
 {
     global $COURSE;
     $errors = parent::validation($data, $files);
     $mform =& $this->_form;
     $maxmembers = $data['maxmembers'];
     if ($maxmembers < 0) {
         $errors['maxmembers'] = get_string('error');
     }
     return $errors;
 }
开发者ID:rwijaya,项目名称:moodle-mod_groupselect,代码行数:11,代码来源:mod_form.php


示例9: validation

 function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Disabled this feature because client wants to be able to paste
     // URLs with spaces and only have them trimed just before the page
     // is redirected.
     //        if(!ezproxy_has_protocol($data['serverurl'])) {
     //            $errors['serverurl'] = get_string('missingprotocol', 'ezproxy');
     //        }
     return $errors;
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:11,代码来源:mod_form.php


示例10:

 function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     if (!isset($data->usecoursegroups)) {
         $data->usecoursegroups = 0;
     }
     return $data;
 }
开发者ID:troywilliams,项目名称:moodle-mod_dialogue,代码行数:11,代码来源:mod_form.php


示例11:

 function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     // Set up completion section even if checkbox is not ticked
     if (empty($data->completionsection)) {
         $data->completionsection = 0;
     }
     return $data;
 }
开发者ID:nustlms,项目名称:moodle-mod-quickfeedback,代码行数:12,代码来源:mod_form.php


示例12: get_data

 /**
  * Return submitted data if properly submitted or returns NULL if validation fails or
  * if there is no submitted data.
  *
  * @return stdClass submitted data; NULL if not valid or not submitted or cancelled
  */
 public function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     if (!empty($data->completionunlocked)) {
         // Turn off completion settings if the checkboxes aren't ticked.
         $autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
         if (!$autocompletion || empty($data->completionsubmit)) {
             $data->completionsubmit = 0;
         }
     }
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:21,代码来源:mod_form.php


示例13: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     if ($id = $mform->getElementValue('update')) {
         $dta = $mform->getElementValue('open');
         $dt = mktime($dta['hour'][0], $dta['minute'][0], 0, $dta['month'][0], $dta['day'][0], $dta['year'][0]);
         if ($dt < time()) {
             $el = $mform->createElement('static', 'openlabel', 'Open', date("D d/m/Y H:i", $dt));
             $mform->insertElementBefore($el, 'open');
             $mform->removeElement('open');
             $mform->addElement('hidden', 'opendt', $dt);
         }
     }
 }
开发者ID:netspotau,项目名称:moodle-mod_teambuilder,代码行数:15,代码来源:mod_form.php


示例14: validation

 function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Validating entered NeuroK course url.
     if (!empty($data['url'])) {
         $testurl = $data['url'];
         if (preg_match('|^https:|i', $testurl)) {
             if (!preg_match('|' . NEUROKBASEURL . '|i', $testurl)) {
                 $errors['url'] = get_string('invalidurl', 'neurok');
             }
         } else {
             $errors['url'] = get_string('invalidurl', 'neurok');
         }
     }
     return $errors;
 }
开发者ID:aspgems,项目名称:neuromoodle,代码行数:16,代码来源:mod_form.php


示例15:

 function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     if (!empty($data->completionunlocked)) {
         // Turn off completion settings if the checkboxes aren't ticked
         $autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
         if (empty($data->completionentriesenabled) || !$autocompletion) {
             $data->completionentries = 0;
         }
     }
     return $data;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:mod_form.php


示例16: validation

 /**
  * Perform minimal validation on the settings form
  * @param array $data
  * @param array $files
  */
 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     if ($data['allowsubmissionsfromdate'] && $data['duedate']) {
         if ($data['allowsubmissionsfromdate'] > $data['duedate']) {
             $errors['duedate'] = get_string('duedatevalidation', 'publication');
         }
     }
     if ($data['duedate'] && $data['cutoffdate']) {
         if ($data['duedate'] > $data['cutoffdate']) {
             $errors['cutoffdate'] = get_string('cutoffdatevalidation', 'publication');
         }
     }
     if ($data['allowsubmissionsfromdate'] && $data['cutoffdate']) {
         if ($data['allowsubmissionsfromdate'] > $data['cutoffdate']) {
             $errors['cutoffdate'] = get_string('cutoffdatefromdatevalidation', 'publication');
         }
     }
     if ($data['mode'] == PUBLICATION_MODE_IMPORT) {
         if ($data['importfrom'] == "0") {
             $errors['importfrom'] = get_string('importfrom_err', 'publication');
         }
     }
     return $errors;
 }
开发者ID:Kathrin84,项目名称:moodle-mod_publication,代码行数:30,代码来源:mod_form.php


示例17: validation

 function validation($data, $files)
 {
     global $USER;
     $errors = parent::validation($data, $files);
     $usercontext = context_user::instance($USER->id);
     $fs = get_file_storage();
     if (!($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['files'], 'sortorder, id', false))) {
         $errors['files'] = get_string('required');
         return $errors;
     }
     if (count($files) == 1) {
         // no need to select main file if only one picked
         return $errors;
     } else {
         if (count($files) > 1) {
             $mainfile = false;
             foreach ($files as $file) {
                 if ($file->get_sortorder() == 1) {
                     $mainfile = true;
                     break;
                 }
             }
             // set a default main file
             if (!$mainfile) {
                 $file = reset($files);
                 file_set_sortorder($file->get_contextid(), $file->get_component(), $file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename(), 1);
             }
         }
     }
     return $errors;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:mod_form.php


示例18: validation

 public function validation($data, $files)
 {
     $current_activity =& $this->current;
     $errors = parent::validation($data, $files);
     if ($data['timeavailable'] != 0 && $data['timedue'] != 0 && $data['timedue'] < $data['timeavailable']) {
         $errors['timedue'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn');
     }
     return $errors;
 }
开发者ID:justinmdy,项目名称:moodle-mod_streamline,代码行数:9,代码来源:mod_form.php


示例19: get_data

 public function get_data()
 {
     $data = parent::get_data();
     if (!$data) {
         return false;
     }
     // Turn off completion setting if the checkbox is not ticked.
     if (!empty($data->completionunlocked)) {
         $autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
         if (empty($data->completiontimespentenabled) || !$autocompletion) {
             $data->completiontimespent = 0;
         }
     }
     return $data;
 }
开发者ID:mongo0se,项目名称:moodle,代码行数:15,代码来源:mod_form.php


示例20: validation

 public function validation($data, $files)
 {
     $current_activity =& $this->current;
     $errors = parent::validation($data, $files);
     if ($current_activity->section > 0) {
         //This is not a general activity, it is part of a week, so it can have schedule
         // Check open and close times are consistent.
         if ($data['timeavailable'] != 0 && $data['timedue'] != 0 && $data['timedue'] < $data['timeavailable']) {
             $errors['timedue'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn');
         }
     }
     return $errors;
 }
开发者ID:rrusso,项目名称:moodle-mod_bigbluebutton,代码行数:13,代码来源:mod_form.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mosAdminMenus类代码示例发布时间:2022-05-23
下一篇:
PHP moodleform类代码示例发布时间: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