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


PHP plagiarism_get_form_elements_module函数代码示例

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


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

示例1: setup_elements

    function setup_elements(&$mform) {
        global $CFG, $COURSE;

        $ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));

        $mform->addElement('select', 'resubmit', get_string('allowresubmit', 'assignment'), $ynoptions);
        $mform->addHelpButton('resubmit', 'allowresubmit', 'assignment');
        $mform->setDefault('resubmit', 0);

        $mform->addElement('select', 'emailteachers', get_string('emailteachers', 'assignment'), $ynoptions);
        $mform->addHelpButton('emailteachers', 'emailteachers', 'assignment');
        $mform->setDefault('emailteachers', 0);

        $mform->addElement('select', 'var1', get_string('commentinline', 'assignment'), $ynoptions);
        $mform->addHelpButton('var1', 'commentinline', 'assignment');
        $mform->setDefault('var1', 0);

        $coursecontext = context_course::instance($COURSE->id);
        plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_assignment');

    }
开发者ID:JP-Git,项目名称:moodle,代码行数:21,代码来源:assignment.class.php

示例2: definition


//.........这里部分代码省略.........
     $mform->setType('gradinggradepass', PARAM_RAW);
     $options = array();
     for ($i = 5; $i >= 0; $i--) {
         $options[$i] = $i;
     }
     $label = get_string('gradedecimals', 'workshop');
     $mform->addElement('select', 'gradedecimals', $label, $options);
     $mform->setDefault('gradedecimals', $workshopconfig->gradedecimals);
     // Submission settings --------------------------------------------------------
     $mform->addElement('header', 'submissionsettings', get_string('submissionsettings', 'workshop'));
     $label = get_string('instructauthors', 'workshop');
     $mform->addElement('editor', 'instructauthorseditor', $label, null, workshop::instruction_editors_options($this->context));
     $options = array();
     for ($i = 7; $i >= 0; $i--) {
         $options[$i] = $i;
     }
     $label = get_string('nattachments', 'workshop');
     $mform->addElement('select', 'nattachments', $label, $options);
     $mform->setDefault('nattachments', 1);
     $label = get_string('allowedfiletypesforsubmission', 'workshop');
     $mform->addElement('text', 'submissionfiletypes', $label, array('maxlength' => 255, 'size' => 64));
     $mform->addHelpButton('submissionfiletypes', 'allowedfiletypesforsubmission', 'workshop');
     $mform->setType('submissionfiletypes', PARAM_TEXT);
     $mform->addRule('submissionfiletypes', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $mform->disabledIf('submissionfiletypes', 'nattachments', 'eq', 0);
     $options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes, 0, $workshopconfig->maxbytes);
     $mform->addElement('select', 'maxbytes', get_string('maxbytes', 'workshop'), $options);
     $mform->setDefault('maxbytes', $workshopconfig->maxbytes);
     $mform->disabledIf('maxbytes', 'nattachments', 'eq', 0);
     $label = get_string('latesubmissions', 'workshop');
     $text = get_string('latesubmissions_desc', 'workshop');
     $mform->addElement('checkbox', 'latesubmissions', $label, $text);
     $mform->addHelpButton('latesubmissions', 'latesubmissions', 'workshop');
     // Assessment settings --------------------------------------------------------
     $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
     $label = get_string('instructreviewers', 'workshop');
     $mform->addElement('editor', 'instructreviewerseditor', $label, null, workshop::instruction_editors_options($this->context));
     $label = get_string('useselfassessment', 'workshop');
     $text = get_string('useselfassessment_desc', 'workshop');
     $mform->addElement('checkbox', 'useselfassessment', $label, $text);
     $mform->addHelpButton('useselfassessment', 'useselfassessment', 'workshop');
     // Feedback -------------------------------------------------------------------
     $mform->addElement('header', 'feedbacksettings', get_string('feedbacksettings', 'workshop'));
     $mform->addElement('select', 'overallfeedbackmode', get_string('overallfeedbackmode', 'mod_workshop'), array(0 => get_string('overallfeedbackmode_0', 'mod_workshop'), 1 => get_string('overallfeedbackmode_1', 'mod_workshop'), 2 => get_string('overallfeedbackmode_2', 'mod_workshop')));
     $mform->addHelpButton('overallfeedbackmode', 'overallfeedbackmode', 'mod_workshop');
     $mform->setDefault('overallfeedbackmode', 1);
     $options = array();
     for ($i = 7; $i >= 0; $i--) {
         $options[$i] = $i;
     }
     $mform->addElement('select', 'overallfeedbackfiles', get_string('overallfeedbackfiles', 'workshop'), $options);
     $mform->setDefault('overallfeedbackfiles', 0);
     $mform->disabledIf('overallfeedbackfiles', 'overallfeedbackmode', 'eq', 0);
     $label = get_string('allowedfiletypesforoverallfeedback', 'workshop');
     $mform->addElement('text', 'overallfeedbackfiletypes', $label, array('maxlength' => 255, 'size' => 64));
     $mform->addHelpButton('overallfeedbackfiletypes', 'allowedfiletypesforoverallfeedback', 'workshop');
     $mform->setType('overallfeedbackfiletypes', PARAM_TEXT);
     $mform->addRule('overallfeedbackfiletypes', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $mform->disabledIf('overallfeedbackfiletypes', 'overallfeedbackfiles', 'eq', 0);
     $options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes);
     $mform->addElement('select', 'overallfeedbackmaxbytes', get_string('overallfeedbackmaxbytes', 'workshop'), $options);
     $mform->setDefault('overallfeedbackmaxbytes', $workshopconfig->maxbytes);
     $mform->disabledIf('overallfeedbackmaxbytes', 'overallfeedbackmode', 'eq', 0);
     $mform->disabledIf('overallfeedbackmaxbytes', 'overallfeedbackfiles', 'eq', 0);
     $label = get_string('conclusion', 'workshop');
     $mform->addElement('editor', 'conclusioneditor', $label, null, workshop::instruction_editors_options($this->context));
     $mform->addHelpButton('conclusioneditor', 'conclusion', 'workshop');
     // Example submissions --------------------------------------------------------
     $mform->addElement('header', 'examplesubmissionssettings', get_string('examplesubmissions', 'workshop'));
     $label = get_string('useexamples', 'workshop');
     $text = get_string('useexamples_desc', 'workshop');
     $mform->addElement('checkbox', 'useexamples', $label, $text);
     $mform->addHelpButton('useexamples', 'useexamples', 'workshop');
     $label = get_string('examplesmode', 'workshop');
     $options = workshop::available_example_modes_list();
     $mform->addElement('select', 'examplesmode', $label, $options);
     $mform->setDefault('examplesmode', $workshopconfig->examplesmode);
     $mform->disabledIf('examplesmode', 'useexamples');
     // Availability ---------------------------------------------------------------
     $mform->addElement('header', 'accesscontrol', get_string('availability', 'core'));
     $label = get_string('submissionstart', 'workshop');
     $mform->addElement('date_time_selector', 'submissionstart', $label, array('optional' => true));
     $label = get_string('submissionend', 'workshop');
     $mform->addElement('date_time_selector', 'submissionend', $label, array('optional' => true));
     $label = get_string('submissionendswitch', 'mod_workshop');
     $mform->addElement('checkbox', 'phaseswitchassessment', $label);
     $mform->disabledIf('phaseswitchassessment', 'submissionend[enabled]');
     $mform->addHelpButton('phaseswitchassessment', 'submissionendswitch', 'mod_workshop');
     $label = get_string('assessmentstart', 'workshop');
     $mform->addElement('date_time_selector', 'assessmentstart', $label, array('optional' => true));
     $label = get_string('assessmentend', 'workshop');
     $mform->addElement('date_time_selector', 'assessmentend', $label, array('optional' => true));
     $coursecontext = context_course::instance($this->course->id);
     plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_workshop');
     // Common module settings, Restrict availability, Activity completion etc. ----
     $features = array('groups' => true, 'groupings' => true, 'outcomes' => true, 'gradecat' => false, 'idnumber' => false);
     $this->standard_coursemodule_elements();
     // Standard buttons, common to all modules ------------------------------------
     $this->add_action_buttons();
 }
开发者ID:sirromas,项目名称:lms,代码行数:101,代码来源:mod_form.php

示例3: setup_elements

 function setup_elements(&$mform)
 {
     global $CFG, $COURSE;
     $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
     $mform->addElement('select', 'resubmit', get_string('allowresubmit', 'assignment'), $ynoptions);
     $mform->addHelpButton('resubmit', 'allowresubmit', 'assignment');
     $mform->setDefault('resubmit', 0);
     $mform->addElement('select', 'emailteachers', get_string('emailteachers', 'assignment'), $ynoptions);
     $mform->addHelpButton('emailteachers', 'emailteachers', 'assignment');
     $mform->setDefault('emailteachers', 0);
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
     $mform->addElement('select', 'maxbytes', get_string('maximumsize', 'assignment'), $choices);
     $mform->setDefault('maxbytes', $CFG->assignment_maxbytes);
     $course_context = context_course::instance($COURSE->id);
     plagiarism_get_form_elements_module($mform, $course_context, 'mod_assignment');
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:16,代码来源:assignment.class.php

示例4: definition


//.........这里部分代码省略.........
     $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');
     $mform->addElement('selectyesno', 'sendstudentnotifications', $name);
     $mform->addHelpButton('sendstudentnotifications', 'sendstudentnotificationsdefault', 'assign');
     // Plagiarism enabling form.
     if (!empty($CFG->enableplagiarism)) {
         require_once $CFG->libdir . '/plagiarismlib.php';
         plagiarism_get_form_elements_module($mform, $ctx->get_course_context(), 'mod_assign');
     }
     $this->standard_grading_coursemodule_elements();
     $name = get_string('blindmarking', 'assign');
     $mform->addElement('selectyesno', 'blindmarking', $name);
     $mform->addHelpButton('blindmarking', 'blindmarking', 'assign');
     if ($assignment->has_submissions_or_grades()) {
         $mform->freeze('blindmarking');
     }
     $name = get_string('markingworkflow', 'assign');
     $mform->addElement('selectyesno', 'markingworkflow', $name);
     $mform->addHelpButton('markingworkflow', 'markingworkflow', 'assign');
     $name = get_string('markingallocation', 'assign');
     $mform->addElement('selectyesno', 'markingallocation', $name);
     $mform->addHelpButton('markingallocation', 'markingallocation', 'assign');
     $mform->disabledIf('markingallocation', 'markingworkflow', 'eq', 0);
     $this->standard_coursemodule_elements();
     $this->apply_admin_defaults();
     $this->add_action_buttons();
     // Add warning popup/noscript tag, if grades are changed by user.
     $hasgrade = false;
     if (!empty($this->_instance)) {
         $hasgrade = $DB->record_exists_select('assign_grades', 'assignment = ? AND grade <> -1', array($this->_instance));
     }
     if ($mform->elementExists('grade') && $hasgrade) {
         $module = array('name' => 'mod_assign', 'fullpath' => '/mod/assign/module.js', 'requires' => array('node', 'event'), 'strings' => array(array('changegradewarning', 'mod_assign')));
         $PAGE->requires->js_init_call('M.mod_assign.init_grade_change', null, false, $module);
         // Add noscript tag in case.
         $noscriptwarning = $mform->createElement('static', 'warning', null, html_writer::tag('noscript', get_string('changegradewarning', 'mod_assign')));
         $mform->insertElementBefore($noscriptwarning, 'grade');
     }
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:101,代码来源:mod_form.php

示例5: 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');
        $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);
            }
            $assignment->set_course($DB->get_record('course', array('id'=>$this->current->course), '*', MUST_EXIST));
        }

        $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('selectyesno', 'alwaysshowdescription', get_string('alwaysshowdescription', 'assign'));
        $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'assign');
        $mform->setDefault('alwaysshowdescription', 1);
        $mform->addElement('selectyesno', 'preventlatesubmissions', get_string('preventlatesubmissions', 'assign'));
        $mform->addHelpButton('preventlatesubmissions', 'preventlatesubmissions', 'assign');
        $mform->setDefault('preventlatesubmissions', 0);
        $mform->addElement('selectyesno', 'submissiondrafts', get_string('submissiondrafts', 'assign'));
        $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
        $mform->setDefault('submissiondrafts', 0);
        $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);

        // plagiarism enabling form
        if (!empty($CFG->enableplagiarism)) {
            /** Include plagiarismlib.php */
            require_once($CFG->libdir . '/plagiarismlib.php');
            plagiarism_get_form_elements_module($mform, $ctx->get_course_context());
        }

        $assignment->add_all_plugin_settings($mform);
        $this->standard_grading_coursemodule_elements();
        $this->standard_coursemodule_elements();

        $this->add_action_buttons();

        // Add warning popup/noscript tag, if grades are changed by user.
        if ($mform->elementExists('grade') && !empty($this->_instance) && $DB->record_exists_select('assign_grades', 'assignment = ? AND grade <> -1', array($this->_instance))) {
            $module = array(
                'name' => 'mod_assign',
                'fullpath' => '/mod/assign/module.js',
                'requires' => array('node', 'event'),
                'strings' => array(array('changegradewarning', 'mod_assign'))
                );
            $PAGE->requires->js_init_call('M.mod_assign.init_grade_change', null, false, $module);

            // Add noscript tag in case
            $noscriptwarning = $mform->createElement('static', 'warning', null,  html_writer::tag('noscript', get_string('changegradewarning', 'mod_assign')));
            $mform->insertElementBefore($noscriptwarning, 'grade');
        }
    }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:87,代码来源:mod_form.php

示例6: definition


//.........这里部分代码省略.........
     $name = get_string('cutoffdate', 'sepl');
     $mform->addElement('date_time_selector', 'cutoffdate', $name, array('optional' => true));
     $mform->addHelpButton('cutoffdate', 'cutoffdate', 'sepl');
     $name = get_string('alwaysshowdescription', 'sepl');
     $mform->addElement('checkbox', 'alwaysshowdescription', $name);
     $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'sepl');
     $mform->disabledIf('alwaysshowdescription', 'allowsubmissionsfromdate[enabled]', 'notchecked');
     $seplment->add_all_plugin_settings($mform);
     $mform->addElement('header', 'submissionsettings', get_string('submissionsettings', 'sepl'));
     $name = get_string('submissiondrafts', 'sepl');
     $mform->addElement('selectyesno', 'submissiondrafts', $name);
     $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'sepl');
     $name = get_string('requiresubmissionstatement', 'sepl');
     $mform->addElement('selectyesno', 'requiresubmissionstatement', $name);
     $mform->addHelpButton('requiresubmissionstatement', 'requiresubmissionstatement', 'sepl');
     $mform->setType('requiresubmissionstatement', PARAM_BOOL);
     $options = array(ASSIGN_ATTEMPT_REOPEN_METHOD_NONE => get_string('attemptreopenmethod_none', 'mod_sepl'), ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL => get_string('attemptreopenmethod_manual', 'mod_sepl'), ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS => get_string('attemptreopenmethod_untilpass', 'mod_sepl'));
     $mform->addElement('select', 'attemptreopenmethod', get_string('attemptreopenmethod', 'mod_sepl'), $options);
     $mform->addHelpButton('attemptreopenmethod', 'attemptreopenmethod', 'mod_sepl');
     $options = array(ASSIGN_UNLIMITED_ATTEMPTS => get_string('unlimitedattempts', 'mod_sepl'));
     $options += array_combine(range(1, 30), range(1, 30));
     $mform->addElement('select', 'maxattempts', get_string('maxattempts', 'mod_sepl'), $options);
     $mform->addHelpButton('maxattempts', 'maxattempts', 'sepl');
     $mform->disabledIf('maxattempts', 'attemptreopenmethod', 'eq', ASSIGN_ATTEMPT_REOPEN_METHOD_NONE);
     $mform->addElement('header', 'groupsubmissionsettings', get_string('groupsubmissionsettings', 'sepl'));
     $name = get_string('teamsubmission', 'sepl');
     $mform->addElement('selectyesno', 'teamsubmission', $name);
     $mform->addHelpButton('teamsubmission', 'teamsubmission', 'sepl');
     if ($seplment->has_submissions_or_grades()) {
         $mform->freeze('teamsubmission');
     }
     $name = get_string('preventsubmissionnotingroup', 'sepl');
     $mform->addElement('selectyesno', 'preventsubmissionnotingroup', $name);
     $mform->addHelpButton('preventsubmissionnotingroup', 'preventsubmissionnotingroup', 'sepl');
     $mform->setType('preventsubmissionnotingroup', PARAM_BOOL);
     $mform->disabledIf('preventsubmissionnotingroup', 'teamsubmission', 'eq', 0);
     $name = get_string('requireallteammemberssubmit', 'sepl');
     $mform->addElement('selectyesno', 'requireallteammemberssubmit', $name);
     $mform->addHelpButton('requireallteammemberssubmit', 'requireallteammemberssubmit', 'sepl');
     $mform->disabledIf('requireallteammemberssubmit', 'teamsubmission', 'eq', 0);
     $mform->disabledIf('requireallteammemberssubmit', 'submissiondrafts', 'eq', 0);
     $groupings = groups_get_all_groupings($seplment->get_course()->id);
     $options = array();
     $options[0] = get_string('none');
     foreach ($groupings as $grouping) {
         $options[$grouping->id] = $grouping->name;
     }
     $name = get_string('teamsubmissiongroupingid', 'sepl');
     $mform->addElement('select', 'teamsubmissiongroupingid', $name, $options);
     $mform->addHelpButton('teamsubmissiongroupingid', 'teamsubmissiongroupingid', 'sepl');
     $mform->disabledIf('teamsubmissiongroupingid', 'teamsubmission', 'eq', 0);
     if ($seplment->has_submissions_or_grades()) {
         $mform->freeze('teamsubmissiongroupingid');
     }
     $mform->addElement('header', 'notifications', get_string('notifications', 'sepl'));
     $name = get_string('sendnotifications', 'sepl');
     $mform->addElement('selectyesno', 'sendnotifications', $name);
     $mform->addHelpButton('sendnotifications', 'sendnotifications', 'sepl');
     $name = get_string('sendlatenotifications', 'sepl');
     $mform->addElement('selectyesno', 'sendlatenotifications', $name);
     $mform->addHelpButton('sendlatenotifications', 'sendlatenotifications', 'sepl');
     $mform->disabledIf('sendlatenotifications', 'sendnotifications', 'eq', 1);
     $name = get_string('sendstudentnotificationsdefault', 'sepl');
     $mform->addElement('selectyesno', 'sendstudentnotifications', $name);
     $mform->addHelpButton('sendstudentnotifications', 'sendstudentnotificationsdefault', 'sepl');
     // Plagiarism enabling form.
     if (!empty($CFG->enableplagiarism)) {
         require_once $CFG->libdir . '/plagiarismlib.php';
         plagiarism_get_form_elements_module($mform, $ctx->get_course_context(), 'mod_sepl');
     }
     $this->standard_grading_coursemodule_elements();
     $name = get_string('blindmarking', 'sepl');
     $mform->addElement('selectyesno', 'blindmarking', $name);
     $mform->addHelpButton('blindmarking', 'blindmarking', 'sepl');
     if ($seplment->has_submissions_or_grades()) {
         $mform->freeze('blindmarking');
     }
     $name = get_string('markingworkflow', 'sepl');
     $mform->addElement('selectyesno', 'markingworkflow', $name);
     $mform->addHelpButton('markingworkflow', 'markingworkflow', 'sepl');
     $name = get_string('markingallocation', 'sepl');
     $mform->addElement('selectyesno', 'markingallocation', $name);
     $mform->addHelpButton('markingallocation', 'markingallocation', 'sepl');
     $mform->disabledIf('markingallocation', 'markingworkflow', 'eq', 0);
     $this->standard_coursemodule_elements();
     $this->apply_admin_defaults();
     $this->add_action_buttons();
     // Add warning popup/noscript tag, if grades are changed by user.
     $hasgrade = false;
     if (!empty($this->_instance)) {
         $hasgrade = $DB->record_exists_select('sepl_grades', 'seplment = ? AND grade <> -1', array($this->_instance));
     }
     if ($mform->elementExists('grade') && $hasgrade) {
         $module = array('name' => 'mod_sepl', 'fullpath' => '/mod/sepl/module.js', 'requires' => array('node', 'event'), 'strings' => array(array('changegradewarning', 'mod_sepl')));
         $PAGE->requires->js_init_call('M.mod_sepl.init_grade_change', null, false, $module);
         // Add noscript tag in case.
         $noscriptwarning = $mform->createElement('static', 'warning', null, html_writer::tag('noscript', get_string('changegradewarning', 'mod_sepl')));
         $mform->insertElementBefore($noscriptwarning, 'grade');
     }
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:101,代码来源:mod_form.php

示例7: definition


//.........这里部分代码省略.........
     $mform->addElement('select', 'maxattachments', get_string('maxattachments', 'forum'), $choices);
     $mform->addHelpButton('maxattachments', 'maxattachments', 'forum');
     $mform->setDefault('maxattachments', $CFG->forum_maxattachments);
     $mform->addElement('selectyesno', 'displaywordcount', get_string('displaywordcount', 'forum'));
     $mform->addHelpButton('displaywordcount', 'displaywordcount', 'forum');
     $mform->setDefault('displaywordcount', 0);
     // Subscription and tracking.
     $mform->addElement('header', 'subscriptionandtrackinghdr', get_string('subscriptionandtracking', 'forum'));
     $options = array();
     $options[FORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'forum');
     $options[FORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'forum');
     $options[FORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'forum');
     $options[FORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled', 'forum');
     $mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'forum'), $options);
     $mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'forum');
     $options = array();
     $options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
     $options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
     if ($CFG->forum_allowforcedreadtracking) {
         $options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
     }
     $mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
     $mform->addHelpButton('trackingtype', 'trackingtype', 'forum');
     $default = $CFG->forum_trackingtype;
     if (!$CFG->forum_allowforcedreadtracking && $default == FORUM_TRACKING_FORCED) {
         $default = FORUM_TRACKING_OPTIONAL;
     }
     $mform->setDefault('trackingtype', $default);
     if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'rssheader', get_string('rss'));
         $choices = array();
         $choices[0] = get_string('none');
         $choices[1] = get_string('discussions', 'forum');
         $choices[2] = get_string('posts', 'forum');
         $mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
         $mform->addHelpButton('rsstype', 'rsstype', 'forum');
         if (isset($CFG->forum_rsstype)) {
             $mform->setDefault('rsstype', $CFG->forum_rsstype);
         }
         $choices = array();
         $choices[0] = '0';
         $choices[1] = '1';
         $choices[2] = '2';
         $choices[3] = '3';
         $choices[4] = '4';
         $choices[5] = '5';
         $choices[10] = '10';
         $choices[15] = '15';
         $choices[20] = '20';
         $choices[25] = '25';
         $choices[30] = '30';
         $choices[40] = '40';
         $choices[50] = '50';
         $mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
         $mform->addHelpButton('rssarticles', 'rssarticles', 'forum');
         $mform->disabledIf('rssarticles', 'rsstype', 'eq', '0');
         if (isset($CFG->forum_rssarticles)) {
             $mform->setDefault('rssarticles', $CFG->forum_rssarticles);
         }
     }
     $mform->addElement('header', 'discussionlocking', get_string('discussionlockingheader', 'forum'));
     $options = [0 => get_string('discussionlockingdisabled', 'forum'), 1 * DAYSECS => get_string('numday', 'core', 1), 1 * WEEKSECS => get_string('numweek', 'core', 1), 2 * WEEKSECS => get_string('numweeks', 'core', 2), 30 * DAYSECS => get_string('nummonth', 'core', 1), 60 * DAYSECS => get_string('nummonths', 'core', 2), 90 * DAYSECS => get_string('nummonths', 'core', 3), 180 * DAYSECS => get_string('nummonths', 'core', 6), 1 * YEARSECS => get_string('numyear', 'core', 1)];
     $mform->addElement('select', 'lockdiscussionafter', get_string('lockdiscussionafter', 'forum'), $options);
     $mform->addHelpButton('lockdiscussionafter', 'lockdiscussionafter', 'forum');
     $mform->disabledIf('lockdiscussionafter', 'type', 'eq', 'single');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'blockafterheader', get_string('blockafter', 'forum'));
     $options = array();
     $options[0] = get_string('blockperioddisabled', 'forum');
     $options[60 * 60 * 24] = '1 ' . get_string('day');
     $options[60 * 60 * 24 * 2] = '2 ' . get_string('days');
     $options[60 * 60 * 24 * 3] = '3 ' . get_string('days');
     $options[60 * 60 * 24 * 4] = '4 ' . get_string('days');
     $options[60 * 60 * 24 * 5] = '5 ' . get_string('days');
     $options[60 * 60 * 24 * 6] = '6 ' . get_string('days');
     $options[60 * 60 * 24 * 7] = '1 ' . get_string('week');
     $mform->addElement('select', 'blockperiod', get_string('blockperiod', 'forum'), $options);
     $mform->addHelpButton('blockperiod', 'blockperiod', 'forum');
     $mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
     $mform->setType('blockafter', PARAM_INT);
     $mform->setDefault('blockafter', '0');
     $mform->addRule('blockafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('blockafter', 'blockafter', 'forum');
     $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
     $mform->addElement('text', 'warnafter', get_string('warnafter', 'forum'));
     $mform->setType('warnafter', PARAM_INT);
     $mform->setDefault('warnafter', '0');
     $mform->addRule('warnafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('warnafter', 'warnafter', 'forum');
     $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
     $coursecontext = context_course::instance($COURSE->id);
     plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_forum');
     //-------------------------------------------------------------------------------
     $this->standard_grading_coursemodule_elements();
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:101,代码来源:mod_form.php

示例8: definition

    /**
     * Called to define this moodle form
     *
     * @return void
     */
    function definition() {
        global $CFG, $DB;
        $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));
        }

        $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('selectyesno', 'alwaysshowdescription', get_string('alwaysshowdescription', 'assign'));
        $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'assign');
        $mform->setDefault('alwaysshowdescription', 1);
        $mform->addElement('selectyesno', 'preventlatesubmissions', get_string('preventlatesubmissions', 'assign'));
        $mform->addHelpButton('preventlatesubmissions', 'preventlatesubmissions', 'assign');
        $mform->setDefault('preventlatesubmissions', 0);
        $mform->addElement('selectyesno', 'submissiondrafts', get_string('submissiondrafts', 'assign'));
        $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
        $mform->setDefault('submissiondrafts', 0);
        $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);

        // plagiarism enabling form
        if (!empty($CFG->enableplagiarism)) {
            /** Include plagiarismlib.php */
            require_once($CFG->libdir . '/plagiarismlib.php');
            plagiarism_get_form_elements_module($mform, $ctx->get_course_context());
        }

        $assignment->add_all_plugin_settings($mform);
        $this->standard_grading_coursemodule_elements();
        $this->standard_coursemodule_elements();

        $this->add_action_buttons();
    }
开发者ID:nicusX,项目名称:moodle,代码行数:71,代码来源:mod_form.php

示例9: definition


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

        $this->add_intro_editor(true, get_string('forumintro', 'forum'));

        $options = array();
        $options[FORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'forum');
        $options[FORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'forum');
        $options[FORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'forum');
        $options[FORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled','forum');
        $mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'forum'), $options);
        $mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'forum');

        $options = array();
        $options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
        $options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
        $options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
        $mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
        $mform->addHelpButton('trackingtype', 'trackingtype', 'forum');

        $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
        $choices[1] = get_string('uploadnotallowed');
        $choices[0] = get_string('courseuploadlimit') . ' ('.display_size($COURSE->maxbytes).')';
        $mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
        $mform->addHelpButton('maxbytes', 'maxattachmentsize', 'forum');
        $mform->setDefault('maxbytes', $CFG->forum_maxbytes);

        $choices = array(0,1,2,3,4,5,6,7,8,9,10,20,50,100);
        $mform->addElement('select', 'maxattachments', get_string('maxattachments', 'forum'), $choices);
        $mform->addHelpButton('maxattachments', 'maxattachments', 'forum');
        $mform->setDefault('maxattachments', $CFG->forum_maxattachments);

        if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
//-------------------------------------------------------------------------------
            $mform->addElement('header', '', get_string('rss'));
            $choices = array();
            $choices[0] = get_string('none');
            $choices[1] = get_string('discussions', 'forum');
            $choices[2] = get_string('posts', 'forum');
            $mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
            $mform->addHelpButton('rsstype', 'rsstype', 'forum');

            $choices = array();
            $choices[0] = '0';
            $choices[1] = '1';
            $choices[2] = '2';
            $choices[3] = '3';
            $choices[4] = '4';
            $choices[5] = '5';
            $choices[10] = '10';
            $choices[15] = '15';
            $choices[20] = '20';
            $choices[25] = '25';
            $choices[30] = '30';
            $choices[40] = '40';
            $choices[50] = '50';
            $mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
            $mform->addHelpButton('rssarticles', 'rssarticles', 'forum');
        }

//-------------------------------------------------------------------------------
        $mform->addElement('header', '', get_string('blockafter', 'forum'));
        $options = array();
        $options[0] = get_string('blockperioddisabled','forum');
        $options[60*60*24]   = '1 '.get_string('day');
        $options[60*60*24*2] = '2 '.get_string('days');
        $options[60*60*24*3] = '3 '.get_string('days');
        $options[60*60*24*4] = '4 '.get_string('days');
        $options[60*60*24*5] = '5 '.get_string('days');
        $options[60*60*24*6] = '6 '.get_string('days');
        $options[60*60*24*7] = '1 '.get_string('week');
        $mform->addElement('select', 'blockperiod', get_string('blockperiod', 'forum'), $options);
        $mform->addHelpButton('blockperiod', 'blockperiod', 'forum');

        $mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
        $mform->setType('blockafter', PARAM_INT);
        $mform->setDefault('blockafter', '0');
        $mform->addRule('blockafter', null, 'numeric', null, 'client');
        $mform->addHelpButton('blockafter', 'blockafter', 'forum');
        $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);


        $mform->addElement('text', 'warnafter', get_string('warnafter', 'forum'));
        $mform->setType('warnafter', PARAM_INT);
        $mform->setDefault('warnafter', '0');
        $mform->addRule('warnafter', null, 'numeric', null, 'client');
        $mform->addHelpButton('warnafter', 'warnafter', 'forum');
        $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);

        $coursecontext = context_course::instance($COURSE->id);
        plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_forum');

//-------------------------------------------------------------------------------

        $this->standard_grading_coursemodule_elements();

        $this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// buttons
        $this->add_action_buttons();

    }
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:mod_form.php

示例10: definition


//.........这里部分代码省略.........
     $mform->addHelpButton('type', 'anonforumtype', 'anonforum');
     $mform->setDefault('type', 'general');
     // Attachments and word count.
     $mform->addElement('header', 'attachmentswordcounthdr', get_string('attachmentswordcount', 'anonforum'));
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, 0, $CFG->anonforum_maxbytes);
     $choices[1] = get_string('uploadnotallowed');
     $mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'anonforum'), $choices);
     $mform->addHelpButton('maxbytes', 'maxattachmentsize', 'anonforum');
     $mform->setDefault('maxbytes', $CFG->anonforum_maxbytes);
     $choices = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50, 100);
     $mform->addElement('select', 'maxattachments', get_string('maxattachments', 'anonforum'), $choices);
     $mform->addHelpButton('maxattachments', 'maxattachments', 'anonforum');
     $mform->setDefault('maxattachments', $CFG->anonforum_maxattachments);
     $mform->addElement('selectyesno', 'displaywordcount', get_string('displaywordcount', 'anonforum'));
     $mform->addHelpButton('displaywordcount', 'displaywordcount', 'anonforum');
     $mform->setDefault('displaywordcount', 0);
     // Subscription and tracking.
     $mform->addElement('header', 'subscriptionandtrackinghdr', get_string('subscriptionandtracking', 'anonforum'));
     $options = array();
     $options[ANONFORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'anonforum');
     $options[ANONFORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'anonforum');
     $options[ANONFORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'anonforum');
     $options[ANONFORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled', 'anonforum');
     $mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'anonforum'), $options);
     $mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'anonforum');
     $options = array();
     $options[ANONFORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'anonforum');
     $options[ANONFORUM_TRACKING_OFF] = get_string('trackingoff', 'anonforum');
     if ($CFG->anonforum_allowforcedreadtracking) {
         $options[ANONFORUM_TRACKING_FORCED] = get_string('trackingon', 'anonforum');
     }
     $mform->addElement('select', 'trackingtype', get_string('trackingtype', 'anonforum'), $options);
     $mform->addHelpButton('trackingtype', 'trackingtype', 'anonforum');
     $default = $CFG->anonforum_trackingtype;
     if (!$CFG->anonforum_allowforcedreadtracking && $default == ANONFORUM_TRACKING_FORCED) {
         $default = ANONFORUM_TRACKING_OPTIONAL;
     }
     $mform->setDefault('trackingtype', $default);
     if ($CFG->enablerssfeeds && isset($CFG->anonforum_enablerssfeeds) && $CFG->anonforum_enablerssfeeds) {
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'rssheader', get_string('rss'));
         $choices = array();
         $choices[0] = get_string('none');
         $choices[1] = get_string('discussions', 'anonforum');
         $choices[2] = get_string('posts', 'anonforum');
         $mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
         $mform->addHelpButton('rsstype', 'rsstype', 'anonforum');
         $choices = array();
         $choices[0] = '0';
         $choices[1] = '1';
         $choices[2] = '2';
         $choices[3] = '3';
         $choices[4] = '4';
         $choices[5] = '5';
         $choices[10] = '10';
         $choices[15] = '15';
         $choices[20] = '20';
         $choices[25] = '25';
         $choices[30] = '30';
         $choices[40] = '40';
         $choices[50] = '50';
         $mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
         $mform->addHelpButton('rssarticles', 'rssarticles', 'anonforum');
         $mform->disabledIf('rssarticles', 'rsstype', 'eq', '0');
     }
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'blockafterheader', get_string('blockafter', 'anonforum'));
     $options = array();
     $options[0] = get_string('blockperioddisabled', 'anonforum');
     $options[60 * 60 * 24] = '1 ' . get_string('day');
     $options[60 * 60 * 24 * 2] = '2 ' . get_string('days');
     $options[60 * 60 * 24 * 3] = '3 ' . get_string('days');
     $options[60 * 60 * 24 * 4] = '4 ' . get_string('days');
     $options[60 * 60 * 24 * 5] = '5 ' . get_string('days');
     $options[60 * 60 * 24 * 6] = '6 ' . get_string('days');
     $options[60 * 60 * 24 * 7] = '1 ' . get_string('week');
     $mform->addElement('select', 'blockperiod', get_string('blockperiod', 'anonforum'), $options);
     $mform->addHelpButton('blockperiod', 'blockperiod', 'anonforum');
     $mform->addElement('text', 'blockafter', get_string('blockafter', 'anonforum'));
     $mform->setType('blockafter', PARAM_INT);
     $mform->setDefault('blockafter', '0');
     $mform->addRule('blockafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('blockafter', 'blockafter', 'anonforum');
     $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
     $mform->addElement('text', 'warnafter', get_string('warnafter', 'anonforum'));
     $mform->setType('warnafter', PARAM_INT);
     $mform->setDefault('warnafter', '0');
     $mform->addRule('warnafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('warnafter', 'warnafter', 'anonforum');
     $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
     $coursecontext = context_course::instance($COURSE->id);
     plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_anonforum');
     //-------------------------------------------------------------------------------
     // Ratings are remove for the module as they will never be used
     $this->_features->rating = false;
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:101,代码来源:mod_form.php

示例11: setup_elements

 /**
  * Print the form for this assignment type
  *
  * @param $mform object Allready existant form
  */
 function setup_elements(&$mform)
 {
     global $CFG, $COURSE, $DB;
     // Some code are copied from parent::setup_elements(). Keep sync please.
     $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
     $choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
     $mform->addElement('select', 'maxbytes', get_string('maximumfilesize', 'assignment_onlinejudge'), $choices);
     $mform->setDefault('maxbytes', $CFG->assignment_maxbytes);
     $mform->addElement('select', 'resubmit', get_string('allowdeleting', 'assignment'), $ynoptions);
     $mform->addHelpButton('resubmit', 'allowdeleting', 'assignment');
     $mform->setDefault('resubmit', 1);
     $options = array();
     for ($i = 1; $i <= 20; $i++) {
         $options[$i] = $i;
     }
     $mform->addElement('select', 'var1', get_string('allowmaxfiles', 'assignment'), $options);
     $mform->addHelpButton('var1', 'allowmaxfiles', 'assignment');
     $mform->setDefault('var1', 1);
     $mform->addElement('select', 'var2', get_string('allownotes', 'assignment'), $ynoptions);
     $mform->addHelpButton('var2', 'allownotes', 'assignment');
     $mform->setDefault('var2', 0);
     $mform->addElement('select', 'var3', get_string('hideintro', 'assignment'), $ynoptions);
     $mform->addHelpButton('var3', 'hideintro', 'assignment');
     $mform->setDefault('var3', 0);
     $mform->addElement('select', 'emailteachers', get_string('emailteachers', 'assignment'), $ynoptions);
     $mform->addHelpButton('emailteachers', 'emailteachers', 'assignment');
     $mform->setDefault('emailteachers', 0);
     // Get existing onlinejudge settings
     $update = optional_param('update', 0, PARAM_INT);
     if (!empty($update)) {
         $cm = $DB->get_record('course_modules', array('id' => $update), '*', MUST_EXIST);
         $onlinejudge = $DB->get_record('assignment_oj', array('assignment' => $cm->instance));
     }
     // Programming languages
     unset($choices);
     $choices = onlinejudge_get_languages();
     $mform->addElement('select', 'language', get_string('assignmentlangs', 'assignment_onlinejudge'), $choices);
     $mform->setDefault('language', isset($onlinejudge) ? $onlinejudge->language : get_config('local_onlinejudge', 'defaultlanguage'));
     // Presentation error grade ratio
     unset($choices);
     $choices = get_grade_options()->gradeoptions;
     // Steal from question lib
     $mform->addElement('select', 'ratiope', get_string('ratiope', 'assignment_onlinejudge'), $choices);
     $mform->addHelpButton('ratiope', 'ratiope', 'assignment_onlinejudge');
     $mform->setDefault('ratiope', isset($onlinejudge) ? $onlinejudge->ratiope : 0);
     $mform->setAdvanced('ratiope');
     // Max. CPU time
     unset($choices);
     $choices = $this->get_max_cpu_times();
     $mform->addElement('select', 'cpulimit', get_string('cpulimit', 'assignment_onlinejudge'), $choices);
     $mform->setDefault('cpulimit', isset($onlinejudge) ? $onlinejudge->cpulimit : 1);
     // Max. memory usage
     unset($choices);
     $choices = $this->get_max_memory_usages();
     $mform->addElement('select', 'memlimit', get_string('memlimit', 'assignment_onlinejudge'), $choices);
     $mform->setDefault('memlimit', isset($onlinejudge) ? $onlinejudge->memlimit : 1048576);
     // Compile only?
     $mform->addElement('select', 'compileonly', get_string('compileonly', 'assignment_onlinejudge'), $ynoptions);
     $mform->addHelpButton('compileonly', 'compileonly', 'assignment_onlinejudge');
     $mform->setDefault('compileonly', isset($onlinejudge) ? $onlinejudge->compileonly : 0);
     $mform->setAdvanced('compileonly');
     //ideone.com
     $mform->addElement('text', 'ideoneuser', get_string('ideoneuser', 'assignment_onlinejudge'), array('size' => 20));
     $mform->addHelpButton('ideoneuser', 'ideoneuser', 'assignment_onlinejudge');
     $mform->setType('ideoneuser', PARAM_ALPHANUMEXT);
     $mform->setDefault('ideoneuser', isset($onlinejudge) ? $onlinejudge->ideoneuser : '');
     $mform->addElement('password', 'ideonepass', get_string('ideonepass', 'assignment_onlinejudge'), array('size' => 20));
     $mform->addHelpButton('ideonepass', 'ideonepass', 'assignment_onlinejudge');
     $mform->setDefault('ideonepass', isset($onlinejudge) ? $onlinejudge->ideonepass : '');
     $course_context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
     plagiarism_get_form_elements_module($mform, $course_context);
 }
开发者ID:boychunli,项目名称:moodle-local_onlinejudge,代码行数:78,代码来源:assignment.class.php

示例12: definition


//.........这里部分代码省略.........
     $mform->addHelpButton('maxbytes', 'maxattachmentsize', 'hsuforum');
     $mform->setDefault('maxbytes', $config->maxbytes);
     $choices = array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
     $mform->addElement('select', 'maxattachments', get_string('maxattachments', 'hsuforum'), $choices);
     $mform->addHelpButton('maxattachments', 'maxattachments', 'hsuforum');
     $mform->setDefault('maxattachments', $config->maxattachments);
     // Subscription and tracking.
     $mform->addElement('header', 'subscriptionhdr', get_string('subscription', 'hsuforum'));
     $options = array();
     $options[HSUFORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'hsuforum');
     $options[HSUFORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'hsuforum');
     $options[HSUFORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'hsuforum');
     $options[HSUFORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled', 'hsuforum');
     $mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'hsuforum'), $options);
     $mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'hsuforum');
     if ($CFG->enablerssfeeds && isset($config->enablerssfeeds) && $config->enablerssfeeds) {
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'rssheader', get_string('rss'));
         $choices = array();
         $choices[0] = get_string('none');
         $choices[1] = get_string('discussions', 'hsuforum');
         $choices[2] = get_string('posts', 'hsuforum');
         $mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
         $mform->addHelpButton('rsstype', 'rsstype', 'hsuforum');
         $choices = array();
         $choices[0] = '0';
         $choices[1] = '1';
         $choices[2] = '2';
         $choices[3] = '3';
         $choices[4] = '4';
         $choices[5] = '5';
         $choices[10] = '10';
         $choices[15] = '15';
         $choices[20] = '20';
         $choices[25] = '25';
         $choices[30] = '30';
         $choices[40] = '40';
         $choices[50] = '50';
         $mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
         $mform->addHelpButton('rssarticles', 'rssarticles', 'hsuforum');
         $mform->disabledIf('rssarticles', 'rsstype', 'eq', '0');
     }
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'blockafterheader', get_string('blockafter', 'hsuforum'));
     $options = array();
     $options[0] = get_string('blockperioddisabled', 'hsuforum');
     $options[60 * 60 * 24] = '1 ' . get_string('day');
     $options[60 * 60 * 24 * 2] = '2 ' . get_string('days');
     $options[60 * 60 * 24 * 3] = '3 ' . get_string('days');
     $options[60 * 60 * 24 * 4] = '4 ' . get_string('days');
     $options[60 * 60 * 24 * 5] = '5 ' . get_string('days');
     $options[60 * 60 * 24 * 6] = '6 ' . get_string('days');
     $options[60 * 60 * 24 * 7] = '1 ' . get_string('week');
     $mform->addElement('select', 'blockperiod', get_string('blockperiod', 'hsuforum'), $options);
     $mform->addHelpButton('blockperiod', 'blockperiod', 'hsuforum');
     $mform->addElement('text', 'blockafter', get_string('blockafter', 'hsuforum'));
     $mform->setType('blockafter', PARAM_INT);
     $mform->setDefault('blockafter', '0');
     $mform->addRule('blockafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('blockafter', 'blockafter', 'hsuforum');
     $mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
     $mform->addElement('text', 'warnafter', get_string('warnafter', 'hsuforum'));
     $mform->setType('warnafter', PARAM_INT);
     $mform->setDefault('warnafter', '0');
     $mform->addRule('warnafter', null, 'numeric', null, 'client');
     $mform->addHelpButton('warnafter', 'warnafter', 'hsuforum');
     $mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
     $coursecontext = context_course::instance($COURSE->id);
     plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_hsuforum');
     //-------------------------------------------------------------------------------
     $this->standard_grading_coursemodule_elements();
     $this->standard_coursemodule_elements();
     $mform->addElement('select', 'gradetype', get_string('gradetype', 'hsuforum'), hsuforum_get_grading_types());
     $mform->setDefault('gradetype', HSUFORUM_GRADETYPE_NONE);
     $mform->setType('gradetype', PARAM_INT);
     $mform->addHelpButton('gradetype', 'gradetype', 'hsuforum');
     $mform->insertElementBefore($mform->removeElement('gradetype'), 'grade');
     $scale = $mform->insertElementBefore($mform->removeElement('scale'), 'grade');
     $scale->setLabel(get_string('grade'));
     // Done abusing this poor fellow...
     $mform->removeElement('grade');
     if ($this->_features->advancedgrading) {
         foreach ($this->current->_advancedgradingdata['areas'] as $areaname => $areadata) {
             $mform->disabledIf('advancedgradingmethod_' . $areaname, 'gradetype', 'neq', HSUFORUM_GRADETYPE_MANUAL);
         }
     }
     $key = array_search('scale', $mform->_dependencies['assessed']['eq'][0]);
     if ($key !== false) {
         unset($mform->_dependencies['assessed']['eq'][0][$key]);
     }
     $mform->disabledIf('gradecat', 'gradetype', 'eq', HSUFORUM_GRADETYPE_NONE);
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
     if (!$this->_features->advancedgrading) {
         /** @var $renderer mod_hsuforum_renderer */
         $renderer = $PAGE->get_renderer('mod_hsuforum');
         $PAGE->requires->js_init_call('M.mod_hsuforum.init_modform', array(HSUFORUM_GRADETYPE_MANUAL), false, $renderer->get_js_module());
     }
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:101,代码来源:mod_form.php


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