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


PHP assign::has_submissions_or_grades方法代码示例

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


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

示例1: definition

 /**
  * Called to define this moodle form
  *
  * @return void
  */
 public function definition()
 {
     global $CFG, $DB, $PAGE;
     $mform = $this->_form;
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('assignmentname', 'assign'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $this->add_intro_editor(true, get_string('description', 'assign'));
     $ctx = null;
     if ($this->current && $this->current->coursemodule) {
         $cm = get_coursemodule_from_instance('assign', $this->current->id, 0, false, MUST_EXIST);
         $ctx = context_module::instance($cm->id);
     }
     $assignment = new assign($ctx, null, null);
     if ($this->current && $this->current->course) {
         if (!$ctx) {
             $ctx = context_course::instance($this->current->course);
         }
         $course = $DB->get_record('course', array('id' => $this->current->course), '*', MUST_EXIST);
         $assignment->set_course($course);
     }
     $config = get_config('assign');
     $mform->addElement('header', 'availability', get_string('availability', 'assign'));
     $mform->setExpanded('availability', true);
     $name = get_string('allowsubmissionsfromdate', 'assign');
     $options = array('optional' => true);
     $mform->addElement('date_time_selector', 'allowsubmissionsfromdate', $name, $options);
     $mform->addHelpButton('allowsubmissionsfromdate', 'allowsubmissionsfromdate', 'assign');
     $name = get_string('duedate', 'assign');
     $mform->addElement('date_time_selector', 'duedate', $name, array('optional' => true));
     $mform->addHelpButton('duedate', 'duedate', 'assign');
     $name = get_string('cutoffdate', 'assign');
     $mform->addElement('date_time_selector', 'cutoffdate', $name, array('optional' => true));
     $mform->addHelpButton('cutoffdate', 'cutoffdate', 'assign');
     $name = get_string('alwaysshowdescription', 'assign');
     $mform->addElement('checkbox', 'alwaysshowdescription', $name);
     $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'assign');
     $mform->disabledIf('alwaysshowdescription', 'allowsubmissionsfromdate[enabled]', 'notchecked');
     $assignment->add_all_plugin_settings($mform);
     $mform->addElement('header', 'submissionsettings', get_string('submissionsettings', 'assign'));
     $name = get_string('submissiondrafts', 'assign');
     $mform->addElement('selectyesno', 'submissiondrafts', $name);
     $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
     $name = get_string('requiresubmissionstatement', 'assign');
     $mform->addElement('selectyesno', 'requiresubmissionstatement', $name);
     $mform->addHelpButton('requiresubmissionstatement', 'requiresubmissionstatement', 'assign');
     $mform->setType('requiresubmissionstatement', PARAM_BOOL);
     $options = array(ASSIGN_ATTEMPT_REOPEN_METHOD_NONE => get_string('attemptreopenmethod_none', 'mod_assign'), ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL => get_string('attemptreopenmethod_manual', 'mod_assign'), ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS => get_string('attemptreopenmethod_untilpass', 'mod_assign'));
     $mform->addElement('select', 'attemptreopenmethod', get_string('attemptreopenmethod', 'mod_assign'), $options);
     $mform->addHelpButton('attemptreopenmethod', 'attemptreopenmethod', 'mod_assign');
     $options = array(ASSIGN_UNLIMITED_ATTEMPTS => get_string('unlimitedattempts', 'mod_assign'));
     $options += array_combine(range(1, 30), range(1, 30));
     $mform->addElement('select', 'maxattempts', get_string('maxattempts', 'mod_assign'), $options);
     $mform->addHelpButton('maxattempts', 'maxattempts', 'assign');
     $mform->disabledIf('maxattempts', 'attemptreopenmethod', 'eq', ASSIGN_ATTEMPT_REOPEN_METHOD_NONE);
     $mform->addElement('header', 'groupsubmissionsettings', get_string('groupsubmissionsettings', 'assign'));
     $name = get_string('teamsubmission', 'assign');
     $mform->addElement('selectyesno', 'teamsubmission', $name);
     $mform->addHelpButton('teamsubmission', 'teamsubmission', 'assign');
     if ($assignment->has_submissions_or_grades()) {
         $mform->freeze('teamsubmission');
     }
     $name = get_string('requireallteammemberssubmit', 'assign');
     $mform->addElement('selectyesno', 'requireallteammemberssubmit', $name);
     $mform->addHelpButton('requireallteammemberssubmit', 'requireallteammemberssubmit', 'assign');
     $mform->disabledIf('requireallteammemberssubmit', 'teamsubmission', 'eq', 0);
     $mform->disabledIf('requireallteammemberssubmit', 'submissiondrafts', 'eq', 0);
     $groupings = groups_get_all_groupings($assignment->get_course()->id);
     $options = array();
     $options[0] = get_string('none');
     foreach ($groupings as $grouping) {
         $options[$grouping->id] = $grouping->name;
     }
     $name = get_string('teamsubmissiongroupingid', 'assign');
     $mform->addElement('select', 'teamsubmissiongroupingid', $name, $options);
     $mform->addHelpButton('teamsubmissiongroupingid', 'teamsubmissiongroupingid', 'assign');
     $mform->disabledIf('teamsubmissiongroupingid', 'teamsubmission', 'eq', 0);
     if ($assignment->has_submissions_or_grades()) {
         $mform->freeze('teamsubmissiongroupingid');
     }
     $mform->addElement('header', 'notifications', get_string('notifications', 'assign'));
     $name = get_string('sendnotifications', 'assign');
     $mform->addElement('selectyesno', 'sendnotifications', $name);
     $mform->addHelpButton('sendnotifications', 'sendnotifications', 'assign');
     $name = get_string('sendlatenotifications', 'assign');
     $mform->addElement('selectyesno', 'sendlatenotifications', $name);
     $mform->addHelpButton('sendlatenotifications', 'sendlatenotifications', 'assign');
     $mform->disabledIf('sendlatenotifications', 'sendnotifications', 'eq', 1);
     $name = get_string('sendstudentnotificationsdefault', 'assign');
//.........这里部分代码省略.........
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:101,代码来源:mod_form.php

示例2: definition

    /**
     * Called to define this moodle form
     *
     * @return void
     */
    function definition() {
        global $CFG, $DB, $PAGE;
        $mform = $this->_form;

        $mform->addElement('header', 'general', get_string('general', 'form'));

        $mform->addElement('text', 'name', get_string('assignmentname', 'assign'), array('size'=>'64'));
        if (!empty($CFG->formatstringstriptags)) {
            $mform->setType('name', PARAM_TEXT);
        } else {
            $mform->setType('name', PARAM_CLEANHTML);
        }
        $mform->addRule('name', null, 'required', null, 'client');

        $this->add_intro_editor(true, get_string('description', 'assign'));

        $ctx = null;
        if ($this->current && $this->current->coursemodule) {
            $cm = get_coursemodule_from_instance('assign', $this->current->id, 0, false, MUST_EXIST);
            $ctx = context_module::instance($cm->id);
        }
        $assignment = new assign($ctx, null, null);
        if ($this->current && $this->current->course) {
            if (!$ctx) {
                $ctx = context_course::instance($this->current->course);
            }
            $assignment->set_course($DB->get_record('course', array('id'=>$this->current->course), '*', MUST_EXIST));
        }

        $config = get_config('assign');

        $mform->addElement('header', 'general', get_string('settings', 'assign'));
        $mform->addElement('date_time_selector', 'allowsubmissionsfromdate', get_string('allowsubmissionsfromdate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('allowsubmissionsfromdate', 'allowsubmissionsfromdate', 'assign');
        $mform->setDefault('allowsubmissionsfromdate', time());
        $mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('duedate', 'duedate', 'assign');
        $mform->setDefault('duedate', time()+7*24*3600);
        $mform->addElement('date_time_selector', 'cutoffdate', get_string('cutoffdate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('cutoffdate', 'cutoffdate', 'assign');
        $mform->setDefault('cutoffdate', time()+7*24*3600);
        $mform->addElement('selectyesno', 'alwaysshowdescription', get_string('alwaysshowdescription', 'assign'));
        $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'assign');
        $mform->setDefault('alwaysshowdescription', 1);
        $mform->addElement('selectyesno', 'submissiondrafts', get_string('submissiondrafts', 'assign'));
        $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
        $mform->setDefault('submissiondrafts', 0);
        // submission statement
        if (empty($config->requiresubmissionstatement)) {
            $mform->addElement('selectyesno', 'requiresubmissionstatement', get_string('requiresubmissionstatement', 'assign'));
            $mform->setDefault('requiresubmissionstatement', 0);
            $mform->addHelpButton('requiresubmissionstatement', 'requiresubmissionstatement', 'assign');
        } else {
            $mform->addElement('hidden', 'requiresubmissionstatement', 1);
        }

        $mform->addElement('selectyesno', 'sendnotifications', get_string('sendnotifications', 'assign'));
        $mform->addHelpButton('sendnotifications', 'sendnotifications', 'assign');
        $mform->setDefault('sendnotifications', 1);
        $mform->addElement('selectyesno', 'sendlatenotifications', get_string('sendlatenotifications', 'assign'));
        $mform->addHelpButton('sendlatenotifications', 'sendlatenotifications', 'assign');
        $mform->setDefault('sendlatenotifications', 1);
        $mform->disabledIf('sendlatenotifications', 'sendnotifications', 'eq', 1);
        $mform->addElement('selectyesno', 'teamsubmission', get_string('teamsubmission', 'assign'));
        $mform->addHelpButton('teamsubmission', 'teamsubmission', 'assign');
        $mform->setDefault('teamsubmission', 0);
        $mform->addElement('selectyesno', 'requireallteammemberssubmit', get_string('requireallteammemberssubmit', 'assign'));
        $mform->addHelpButton('requireallteammemberssubmit', 'requireallteammemberssubmit', 'assign');
        $mform->setDefault('requireallteammemberssubmit', 0);
        $mform->disabledIf('requireallteammemberssubmit', 'teamsubmission', 'eq', 0);
        $mform->disabledIf('requireallteammemberssubmit', 'submissiondrafts', 'eq', 0);

        $groupings = groups_get_all_groupings($assignment->get_course()->id);
        $options = array();
        $options[0] = get_string('none');
        foreach ($groupings as $grouping) {
            $options[$grouping->id] = $grouping->name;
        }
        $mform->addElement('select', 'teamsubmissiongroupingid', get_string('teamsubmissiongroupingid', 'assign'), $options);
        $mform->addHelpButton('teamsubmissiongroupingid', 'teamsubmissiongroupingid', 'assign');
        $mform->setDefault('teamsubmissiongroupingid', 0);
        $mform->disabledIf('teamsubmissiongroupingid', 'teamsubmission', 'eq', 0);

        $mform->addElement('selectyesno', 'blindmarking', get_string('blindmarking', 'assign'));
        $mform->addHelpButton('blindmarking', 'blindmarking', 'assign');
        $mform->setDefault('blindmarking', 0);
        if ($assignment->has_submissions_or_grades() ) {
            $mform->freeze('blindmarking');
        }


        // plagiarism enabling form
        if (!empty($CFG->enableplagiarism)) {
            /** Include plagiarismlib.php */
            require_once($CFG->libdir . '/plagiarismlib.php');
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:mod_form.php


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