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

PHP grade_get_categories_menu函数代码示例

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

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



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

示例1: create_instance

 public function create_instance($record = null, array $options = null)
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $workshopconfig = get_config('workshop');
     // Add default values for workshop.
     $record = (array) $record + array('strategy' => $workshopconfig->strategy, 'grade' => $workshopconfig->grade, 'gradinggrade' => $workshopconfig->gradinggrade, 'gradedecimals' => $workshopconfig->gradedecimals, 'nattachments' => 1, 'maxbytes' => $workshopconfig->maxbytes, 'latesubmissions' => 0, 'useselfassessment' => 0, 'overallfeedbackmode' => 1, 'overallfeedbackfiles' => 0, 'overallfeedbackmaxbytes' => $workshopconfig->maxbytes, 'useexamples' => 0, 'examplesmode' => $workshopconfig->examplesmode, 'submissionstart' => 0, 'submissionend' => 0, 'phaseswitchassessment' => 0, 'assessmentstart' => 0, 'assessmentend' => 0);
     if (!isset($record['gradecategory']) || !isset($record['gradinggradecategory'])) {
         require_once $CFG->libdir . '/gradelib.php';
         $courseid = is_object($record['course']) ? $record['course']->id : $record['course'];
         $gradecategories = grade_get_categories_menu($courseid);
         reset($gradecategories);
         $defaultcategory = key($gradecategories);
         $record += array('gradecategory' => $defaultcategory, 'gradinggradecategory' => $defaultcategory);
     }
     if (!isset($record['instructauthorseditor'])) {
         $record['instructauthorseditor'] = array('text' => 'Instructions for submission ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['instructreviewerseditor'])) {
         $record['instructreviewerseditor'] = array('text' => 'Instructions for assessment ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['conclusioneditor'])) {
         $record['conclusioneditor'] = array('text' => 'Conclusion ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     return parent::create_instance($record, (array) $options);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:26,代码来源:lib.php


示例2: standard_grading_coursemodule_elements

 public function standard_grading_coursemodule_elements()
 {
     global $COURSE, $CFG;
     $mform =& $this->_form;
     if ($this->_features->hasgrades) {
         if (!$this->_features->rating || $this->_features->gradecat) {
             $mform->addElement('header', 'modstandardgrade', get_string('grade'));
         }
         //if supports grades and grades arent being handled via ratings
         if (!$this->_features->rating) {
             $mform->addElement('modgrade', 'grade', get_string('grade'));
             $mform->addHelpButton('grade', 'modgrade', 'grades');
             $mform->setDefault('grade', $CFG->gradepointdefault);
         }
         if ($this->_features->advancedgrading and !empty($this->current->_advancedgradingdata['methods']) and !empty($this->current->_advancedgradingdata['areas'])) {
             if (count($this->current->_advancedgradingdata['areas']) == 1) {
                 // if there is just one gradable area (most cases), display just the selector
                 // without its name to make UI simplier
                 $areadata = reset($this->current->_advancedgradingdata['areas']);
                 $areaname = key($this->current->_advancedgradingdata['areas']);
                 $mform->addElement('select', 'advancedgradingmethod_' . $areaname, get_string('gradingmethod', 'core_grading'), $this->current->_advancedgradingdata['methods']);
                 $mform->addHelpButton('advancedgradingmethod_' . $areaname, 'gradingmethod', 'core_grading');
                 if (!$this->_features->rating) {
                     $mform->disabledIf('advancedgradingmethod_' . $areaname, 'grade[modgrade_type]', 'eq', 'none');
                 }
             } else {
                 // the module defines multiple gradable areas, display a selector
                 // for each of them together with a name of the area
                 $areasgroup = array();
                 foreach ($this->current->_advancedgradingdata['areas'] as $areaname => $areadata) {
                     $areasgroup[] = $mform->createElement('select', 'advancedgradingmethod_' . $areaname, $areadata['title'], $this->current->_advancedgradingdata['methods']);
                     $areasgroup[] = $mform->createElement('static', 'advancedgradingareaname_' . $areaname, '', $areadata['title']);
                 }
                 $mform->addGroup($areasgroup, 'advancedgradingmethodsgroup', get_string('gradingmethods', 'core_grading'), array(' ', '<br />'), false);
             }
         }
         if ($this->_features->gradecat) {
             $mform->addElement('select', 'gradecat', get_string('gradecategoryonmodform', 'grades'), grade_get_categories_menu($COURSE->id, $this->_outcomesused));
             $mform->addHelpButton('gradecat', 'gradecategoryonmodform', 'grades');
             if (!$this->_features->rating) {
                 $mform->disabledIf('gradecat', 'grade[modgrade_type]', 'eq', 'none');
             }
         }
         // Grade to pass.
         $mform->addElement('text', 'gradepass', get_string('gradepass', 'grades'));
         $mform->addHelpButton('gradepass', 'gradepass', 'grades');
         $mform->setDefault('gradepass', '');
         $mform->setType('gradepass', PARAM_RAW);
         if (!$this->_features->rating) {
             $mform->disabledIf('gradepass', 'grade[modgrade_type]', 'eq', 'none');
         } else {
             $mform->disabledIf('gradepass', 'assessed', 'eq', '0');
         }
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:55,代码来源:moodleform_mod.php


示例3: update_specific_module_test

 /**
  * Test a specific type of module.
  *
  * @param string $modulename - the module name to test
  */
 private function update_specific_module_test($modulename)
 {
     global $DB, $CFG;
     $this->resetAfterTest(true);
     $this->setAdminUser();
     // Warnings: you'll need to change this line if ever you come to test a module not following Moodle standard.
     require_once $CFG->dirroot . '/mod/' . $modulename . '/lib.php';
     // Enable avaibility.
     // If not enabled all conditional fields will be ignored.
     set_config('enableavailability', 1);
     // Enable course completion.
     // If not enabled all completion settings will be ignored.
     set_config('enablecompletion', COMPLETION_ENABLED);
     // Enable forum RSS feeds.
     set_config('enablerssfeeds', 1);
     set_config('forum_enablerssfeeds', 1);
     $course = $this->getDataGenerator()->create_course(array('numsections' => 1, 'enablecompletion' => COMPLETION_ENABLED), array('createsections' => true));
     $grouping = $this->getDataGenerator()->create_grouping(array('courseid' => $course->id));
     // Create assign module instance for testing gradeitem.
     $generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
     $params['course'] = $course->id;
     $instance = $generator->create_instance($params);
     $assigncm = get_coursemodule_from_instance('assign', $instance->id);
     // Create the test forum to update.
     $initvalues = new stdClass();
     $initvalues->introformat = FORMAT_HTML;
     $initvalues->course = $course->id;
     $forum = self::getDataGenerator()->create_module('forum', $initvalues);
     // Retrieve course module.
     $cm = get_coursemodule_from_instance('forum', $forum->id);
     // Module test values.
     $moduleinfo = new stdClass();
     // Always mandatory generic values to any module.
     $moduleinfo->coursemodule = $cm->id;
     $moduleinfo->modulename = $modulename;
     $moduleinfo->course = $course->id;
     $moduleinfo->groupingid = $grouping->id;
     $moduleinfo->visible = true;
     // Sometimes optional generic values for some modules.
     $moduleinfo->name = 'My test module';
     $moduleinfo->showdescription = 1;
     // standard boolean
     require_once $CFG->libdir . '/gradelib.php';
     $gradecats = grade_get_categories_menu($moduleinfo->course, false);
     $gradecatid = current(array_keys($gradecats));
     // Retrieve the first key of $gradecats
     $moduleinfo->gradecat = $gradecatid;
     $moduleinfo->groupmode = VISIBLEGROUPS;
     $moduleinfo->cmidnumber = 'idnumber_XXX';
     // Completion common to all module.
     $moduleinfo->completion = COMPLETION_TRACKING_AUTOMATIC;
     $moduleinfo->completionview = COMPLETION_VIEW_REQUIRED;
     $moduleinfo->completiongradeitemnumber = 1;
     $moduleinfo->completionexpected = time() + 7 * 24 * 3600;
     $moduleinfo->completionunlocked = 1;
     // Conditional activity.
     $coursegradeitem = grade_item::fetch_course_item($moduleinfo->course);
     //the activity will become available only when the user reach some grade into the course itself.
     $moduleinfo->availability = json_encode(\core_availability\tree::get_root_json(array(\availability_date\condition::get_json('>=', time()), \availability_date\condition::get_json('<', time() + 7 * 24 * 3600), \availability_grade\condition::get_json($coursegradeitem->id, 10, 80), \availability_profile\condition::get_json(false, 'email', 'contains', '@'), \availability_completion\condition::get_json($assigncm->id, COMPLETION_COMPLETE)), '&'));
     // Grading and Advanced grading.
     require_once $CFG->dirroot . '/rating/lib.php';
     $moduleinfo->assessed = RATING_AGGREGATE_AVERAGE;
     $moduleinfo->scale = 10;
     // Note: it could be minus (for specific course scale). It is a signed number.
     $moduleinfo->assesstimestart = time();
     $moduleinfo->assesstimefinish = time() + 7 * 24 * 3600;
     // RSS.
     $moduleinfo->rsstype = 2;
     $moduleinfo->rssarticles = 10;
     // Optional intro editor (depends of module).
     $draftid_editor = 0;
     file_prepare_draft_area($draftid_editor, null, null, null, null);
     $moduleinfo->introeditor = array('text' => 'This is a module', 'format' => FORMAT_HTML, 'itemid' => $draftid_editor);
     // Following is the advanced grading method area called 'submissions' for the 'assign' module.
     if (plugin_supports('mod', $modulename, FEATURE_GRADE_HAS_GRADE, false) && !plugin_supports('mod', $modulename, FEATURE_RATE, false)) {
         $moduleinfo->grade = 100;
     }
     // Plagiarism form values.
     // No plagiarism plugin installed by default. Use this space to make your own test.
     // Values specific to the module.
     $modulesetvalues = $modulename . '_update_set_values';
     $this->{$modulesetvalues}($moduleinfo);
     // Create the module.
     $result = update_module($moduleinfo);
     // Retrieve the module info.
     $dbmodinstance = $DB->get_record($moduleinfo->modulename, array('id' => $result->instance));
     $dbcm = get_coursemodule_from_instance($moduleinfo->modulename, $result->instance);
     // Retrieve the grade item.
     $gradeitem = $DB->get_record('grade_items', array('courseid' => $moduleinfo->course, 'iteminstance' => $dbmodinstance->id, 'itemmodule' => $moduleinfo->modulename));
     // Compare the values common to all module instances.
     $this->assertEquals($moduleinfo->modulename, $dbcm->modname);
     $this->assertEquals($moduleinfo->course, $dbcm->course);
     $this->assertEquals($moduleinfo->groupingid, $dbcm->groupingid);
     $this->assertEquals($moduleinfo->visible, $dbcm->visible);
     $this->assertEquals($moduleinfo->completion, $dbcm->completion);
//.........这里部分代码省略.........
开发者ID:uniedpa,项目名称:moodle,代码行数:101,代码来源:courselib_test.php


示例4: definition

 /**
  * Defines the workshop instance configuration form
  *
  * @return void
  */
 public function definition()
 {
     global $CFG;
     $workshopconfig = get_config('workshop');
     $mform = $this->_form;
     // General --------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Workshop name
     $label = get_string('workshopname', 'workshop');
     $mform->addElement('text', 'name', $label, 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');
     // Introduction
     $this->standard_intro_elements(get_string('introduction', 'workshop'));
     // Grading settings -----------------------------------------------------------
     $mform->addElement('header', 'gradingsettings', get_string('gradingsettings', 'workshop'));
     $mform->setExpanded('gradingsettings');
     $label = get_string('strategy', 'workshop');
     $mform->addElement('select', 'strategy', $label, workshop::available_strategies_list());
     $mform->setDefault('strategy', $workshopconfig->strategy);
     $mform->addHelpButton('strategy', 'strategy', 'workshop');
     $grades = workshop::available_maxgrades_list();
     $gradecategories = grade_get_categories_menu($this->course->id);
     $label = get_string('submissiongrade', 'workshop');
     $mform->addGroup(array($mform->createElement('select', 'grade', '', $grades), $mform->createElement('select', 'gradecategory', '', $gradecategories)), 'submissiongradegroup', $label, ' ', false);
     $mform->setDefault('grade', $workshopconfig->grade);
     $mform->addHelpButton('submissiongradegroup', 'submissiongrade', 'workshop');
     $mform->addElement('text', 'submissiongradepass', get_string('gradetopasssubmission', 'workshop'));
     $mform->addHelpButton('submissiongradepass', 'gradepass', 'grades');
     $mform->setDefault('submissiongradepass', '');
     $mform->setType('submissiongradepass', PARAM_RAW);
     $label = get_string('gradinggrade', 'workshop');
     $mform->addGroup(array($mform->createElement('select', 'gradinggrade', '', $grades), $mform->createElement('select', 'gradinggradecategory', '', $gradecategories)), 'gradinggradegroup', $label, ' ', false);
     $mform->setDefault('gradinggrade', $workshopconfig->gradinggrade);
     $mform->addHelpButton('gradinggradegroup', 'gradinggrade', 'workshop');
     $mform->addElement('text', 'gradinggradepass', get_string('gradetopassgrading', 'workshop'));
     $mform->addHelpButton('gradinggradepass', 'gradepass', 'grades');
     $mform->setDefault('gradinggradepass', '');
     $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);
//.........这里部分代码省略.........
开发者ID:sirromas,项目名称:lms,代码行数:101,代码来源:mod_form.php


示例5: standard_coursemodule_elements

 /**
  * Adds all the standard elements to a form to edit the settings for an activity module.
  *
  * @param mixed array or object describing supported features - groups, groupings, groupmembersonly, etc.
  */
 function standard_coursemodule_elements($features = null)
 {
     global $COURSE, $CFG;
     $mform =& $this->_form;
     // deal with legacy $supportgroups param
     if ($features === true or $features === false) {
         $groupmode = $features;
         $this->_features = new object();
         $this->_features->groups = $groupmode;
     } else {
         if (is_array($features)) {
             $this->_features = (object) $features;
         } else {
             if (empty($features)) {
                 $this->_features = new object();
             } else {
                 $this->_features = $features;
             }
         }
     }
     if (!isset($this->_features->groups)) {
         $this->_features->groups = true;
     }
     if (!isset($this->_features->groupings)) {
         $this->_features->groupings = false;
     }
     if (!isset($this->_features->groupmembersonly)) {
         $this->_features->groupmembersonly = false;
     }
     if (!isset($this->_features->outcomes)) {
         $this->_features->outcomes = true;
     }
     if (!isset($this->_features->gradecat)) {
         $this->_features->gradecat = true;
     }
     if (!isset($this->_features->idnumber)) {
         $this->_features->idnumber = true;
     }
     $outcomesused = false;
     if (!empty($CFG->enableoutcomes) and $this->_features->outcomes) {
         if ($outcomes = grade_outcome::fetch_all_available($COURSE->id)) {
             $outcomesused = true;
             $mform->addElement('header', 'modoutcomes', get_string('outcomes', 'grades'));
             foreach ($outcomes as $outcome) {
                 $mform->addElement('advcheckbox', 'outcome_' . $outcome->id, $outcome->get_name());
             }
         }
     }
     $mform->addElement('header', 'modstandardelshdr', get_string('modstandardels', 'form'));
     if ($this->_features->groups) {
         $options = array(NOGROUPS => get_string('groupsnone'), SEPARATEGROUPS => get_string('groupsseparate'), VISIBLEGROUPS => get_string('groupsvisible'));
         $mform->addElement('select', 'groupmode', get_string('groupmode'), $options, NOGROUPS);
         $mform->setHelpButton('groupmode', array('groupmode', get_string('groupmode')));
     }
     if (!empty($CFG->enablegroupings)) {
         if ($this->_features->groupings or $this->_features->groupmembersonly) {
             //groupings selector - used for normal grouping mode or also when restricting access with groupmembersonly
             $options = array();
             $options[0] = get_string('none');
             if ($groupings = get_records('groupings', 'courseid', $COURSE->id)) {
                 foreach ($groupings as $grouping) {
                     $options[$grouping->id] = format_string($grouping->name);
                 }
             }
             $mform->addElement('select', 'groupingid', get_string('grouping', 'group'), $options);
             $mform->setHelpButton('groupingid', array('grouping', get_string('grouping', 'group')));
             $mform->setAdvanced('groupingid');
         }
         if ($this->_features->groupmembersonly) {
             $mform->addElement('checkbox', 'groupmembersonly', get_string('groupmembersonly', 'group'));
             $mform->setHelpButton('groupmembersonly', array('groupmembersonly', get_string('groupmembersonly', 'group')));
             $mform->setAdvanced('groupmembersonly');
         }
     }
     $mform->addElement('modvisible', 'visible', get_string('visible'));
     if ($this->_features->idnumber) {
         $mform->addElement('text', 'cmidnumber', get_string('idnumbermod'));
         $mform->setHelpButton('cmidnumber', array('cmidnumber', get_string('idnumbermod')), true);
     }
     if ($this->_features->gradecat) {
         $categories = grade_get_categories_menu($COURSE->id, $outcomesused);
         $mform->addElement('select', 'gradecat', get_string('gradecategory', 'grades'), $categories);
     }
     $this->standard_hidden_coursemodule_elements();
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:90,代码来源:moodleform_mod.php


示例6: definition


//.........这里部分代码省略.........
     $mform->setAdvanced('answerkeyfile');
     // Custom marks.
     $mform->addElement('textarea', 'custommarks', get_string('specificmarks', 'mod_emarking'), array('rows' => 5, 'cols' => 100, 'class' => 'smalltext'));
     $mform->addHelpButton('custommarks', 'specificmarks', 'mod_emarking');
     $mform->setDefault('custommarks', '');
     $mform->setType('custommarks', PARAM_TEXT);
     $mform->setAdvanced('custommarks');
     // Due date settings.
     $mform->addElement('checkbox', 'enableduedate', get_string('enableduedate', 'mod_emarking'));
     $mform->setAdvanced('enableduedate');
     $mform->addElement('date_time_selector', 'markingduedate', get_string('markingduedate', 'mod_emarking'), array('startyear' => date('Y'), 'stopyear' => date('Y') + 1, 'step' => 5, 'defaulttime' => $date->getTimestamp(), 'optional' => false), null);
     $mform->addHelpButton('markingduedate', 'markingduedate', 'mod_emarking');
     $mform->setAdvanced('markingduedate');
     $mform->disabledIf('markingduedate', 'enableduedate');
     // Regrade settings, dates and enabling.
     $mform->addElement('checkbox', 'regraderestrictdates', get_string('regraderestrictdates', 'mod_emarking'));
     $mform->addHelpButton('regraderestrictdates', 'regraderestrictdates', 'mod_emarking');
     $mform->setAdvanced('regraderestrictdates');
     $mform->addElement('date_time_selector', 'regradesopendate', get_string('regradesopendate', 'mod_emarking'), array('startyear' => date('Y'), 'stopyear' => date('Y') + 1, 'step' => 5, 'defaulttime' => $date->getTimestamp(), 'optional' => false), null);
     $mform->addHelpButton('regradesopendate', 'regradesopendate', 'mod_emarking');
     $mform->setAdvanced('regradesopendate');
     $mform->disabledIf('regradesopendate', 'regraderestrictdates');
     $date->modify('+2 months');
     $mform->addElement('date_time_selector', 'regradesclosedate', get_string('regradesclosedate', 'mod_emarking'), array('startyear' => date('Y'), 'stopyear' => date('Y') + 1, 'step' => 5, 'defaulttime' => $date->getTimestamp(), 'optional' => false), null);
     $mform->addHelpButton('regradesclosedate', 'regradesclosedate', 'mod_emarking');
     $mform->setAdvanced('regradesclosedate');
     $mform->disabledIf('regradesclosedate', 'regraderestrictdates');
     // Get all users with permission to grade in emarking.
     $chkmarkers = $this->get_markers_checkboxes($mform, $ctx);
     if ($chkmarkers) {
         // Due date settings.
         $mform->addElement("static", "qualitycontroldescription", get_string("qualitycontrol", "mod_emarking"), get_string("qualitycontroldescription", "mod_emarking"));
         $mform->setAdvanced('qualitycontroldescription');
         $mform->addElement('checkbox', 'qualitycontrol', get_string('enablequalitycontrol', 'mod_emarking'));
         $mform->addHelpButton('qualitycontrol', 'enablequalitycontrol', 'mod_emarking');
         $mform->setAdvanced('qualitycontrol');
         $mform->disabledIf('qualitycontrol', 'type', 'eq', '2');
         // Add markers group as checkboxes.
         $mform->addGroup($chkmarkers, 'markers', get_string('markersqualitycontrol', 'mod_emarking'), array('<br />'), false);
         $mform->addHelpButton('markers', 'markersqualitycontrol', 'mod_emarking');
         $mform->setType('markers', PARAM_INT);
         $mform->disabledIf('markers', 'qualitycontrol');
         $mform->setAdvanced('markers');
         $mform->disabledIf('markers', 'type', 'eq', '2');
     }
     // Add standard grading elements.
     $mform->addElement('header', 'modstandardgrade', get_string('grade'));
     // If supports grades and grades arent being handled via ratings.
     $mform->addElement('select', 'grademin', get_string('grademin', 'grades'), $numbers1to100);
     $mform->setDefault('grademin', 1);
     $mform->addElement('select', 'grade', get_string('grademax', 'grades'), $numbers1to100);
     $mform->setDefault('grade', 7);
     if (count($this->current->_advancedgradingdata['areas']) == 1) {
         // If there is just one gradable area (most cases), display just the selector
         // without its name to make UI simplier.
         $areadata = reset($this->current->_advancedgradingdata['areas']);
         $areaname = key($this->current->_advancedgradingdata['areas']);
         // Regrade settings, dates and enabling.
         $mform->addElement('hidden', 'advancedgradingmethod_' . $areaname, 'rubric');
         $mform->setType('advancedgradingmethod_' . $areaname, PARAM_ALPHA);
     } else {
         throw new Exception("The emarking module should not define more than one grading area");
     }
     $mform->addElement('select', 'gradecat', get_string('gradecategoryonmodform', 'grades'), grade_get_categories_menu($COURSE->id, $this->_outcomesused));
     $mform->addHelpButton('gradecat', 'gradecategoryonmodform', 'grades');
     $mform->setAdvanced('gradecat');
     $mform->disabledIf('gradecat', 'type', 'eq', '2');
     // Regrade settings, dates and enabling.
     $mform->addElement('checkbox', 'adjustslope', get_string('adjustslope', 'mod_emarking'));
     $mform->addHelpButton('adjustslope', 'adjustslope', 'mod_emarking');
     $mform->setAdvanced('adjustslope');
     $mform->disabledIf('adjustslope', 'type', 'eq', '2');
     $mform->addElement('text', 'adjustslopegrade', get_string('adjustslopegrade', 'mod_emarking'), array('size' => '5'));
     $mform->setType('adjustslopegrade', PARAM_FLOAT);
     $mform->setDefault('adjustslopegrade', 0);
     $mform->addHelpButton('adjustslopegrade', 'adjustslopegrade', 'mod_emarking');
     $mform->disabledIf('adjustslopegrade', 'adjustslope');
     $mform->setAdvanced('adjustslopegrade');
     $mform->disabledIf('adjustslopegrade', 'type', 'eq', '2');
     $mform->addElement('text', 'adjustslopescore', get_string('adjustslopescore', 'mod_emarking'), array('size' => '5'));
     $mform->setType('adjustslopescore', PARAM_FLOAT);
     $mform->setDefault('adjustslopescore', 0);
     $mform->addHelpButton('adjustslopescore', 'adjustslopescore', 'mod_emarking');
     $mform->disabledIf('adjustslopescore', 'adjustslope');
     $mform->setAdvanced('adjustslopescore');
     $mform->disabledIf('adjustslopescore', 'type', 'eq', '2');
     // Add standard elements, common to all modules.
     $this->standard_coursemodule_elements();
     // Regrade settings, dates and enabling.
     $mform->addElement('hidden', 'heartbeatenabled', true);
     $mform->setType('heartbeatenabled', PARAM_BOOL);
     $mform->addElement('hidden', 'downloadrubricpdf', true);
     $mform->setType('downloadrubricpdf', PARAM_BOOL);
     // If we are in editing mode we can not change the type anymore.
     if ($this->_instance) {
         $mform->freeze($this->get_elements_to_freeze($emarking, $exam, $mform));
     }
     // Add standard buttons, common to all modules.
     $this->add_action_buttons();
 }
开发者ID:hansnok,项目名称:emarking,代码行数:101,代码来源:mod_form.php


示例7: standard_grading_coursemodule_elements

 public function standard_grading_coursemodule_elements()
 {
     global $COURSE, $CFG;
     $mform =& $this->_form;
     if ($this->_features->hasgrades) {
         if (!$this->_features->rating || $this->_features->gradecat) {
             $mform->addElement('header', 'modstandardgrade', get_string('grade'));
         }
         //if supports grades and grades arent being handled via ratings
         if (!$this->_features->rating) {
             $mform->addElement('modgrade', 'grade', get_string('grade'));
             $mform->setDefault('grade', 100);
         }
         if ($this->_features->gradecat) {
             $mform->addElement('select', 'gradecat', get_string('gradecategoryonmodform', 'grades'), grade_get_categories_menu($COURSE->id, $this->_outcomesused));
             $mform->addHelpButton('gradecat', 'gradecategoryonmodform', 'grades');
         }
     }
 }
开发者ID:ravivare,项目名称:moodle-1,代码行数:19,代码来源:moodleform_mod.php


示例8: definition

 /**
  * Defines the workshop instance configuration form
  *
  * @return void
  */
 public function definition()
 {
     global $CFG;
     $workshopconfig = get_config('workshop');
     $mform = $this->_form;
     // General --------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Workshop name
     $label = get_string('workshopname', 'workshop');
     $mform->addElement('text', 'name', $label, 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');
     // Introduction
     $this->add_intro_editor(false, get_string('introduction', 'workshop'));
     // Workshop features ----------------------------------------------------------
     $mform->addElement('header', 'workshopfeatures', get_string('workshopfeatures', '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('usepeerassessment', 'workshop');
     $text = get_string('usepeerassessment_desc', 'workshop');
     $mform->addElement('checkbox', 'usepeerassessment', $label, $text);
     $mform->addHelpButton('usepeerassessment', 'usepeerassessment', 'workshop');
     $label = get_string('useselfassessment', 'workshop');
     $text = get_string('useselfassessment_desc', 'workshop');
     $mform->addElement('checkbox', 'useselfassessment', $label, $text);
     $mform->addHelpButton('useselfassessment', 'useselfassessment', 'workshop');
     // Grading settings -----------------------------------------------------------
     $mform->addElement('header', 'gradingsettings', get_string('gradingsettings', 'workshop'));
     $grades = workshop::available_maxgrades_list();
     $gradecategories = grade_get_categories_menu($this->course->id);
     $label = get_string('submissiongrade', 'workshop');
     $mform->addGroup(array($mform->createElement('select', 'grade', '', $grades), $mform->createElement('select', 'gradecategory', '', $gradecategories)), 'submissiongradegroup', $label, ' ', false);
     $mform->setDefault('grade', $workshopconfig->grade);
     $mform->addHelpButton('submissiongradegroup', 'submissiongrade', 'workshop');
     $label = get_string('gradinggrade', 'workshop');
     $mform->addGroup(array($mform->createElement('select', 'gradinggrade', '', $grades), $mform->createElement('select', 'gradinggradecategory', '', $gradecategories)), 'gradinggradegroup', $label, ' ', false);
     $mform->setDefault('gradinggrade', $workshopconfig->gradinggrade);
     $mform->addHelpButton('gradinggradegroup', 'gradinggrade', 'workshop');
     $label = get_string('strategy', 'workshop');
     $mform->addElement('select', 'strategy', $label, workshop::available_strategies_list());
     $mform->setDefault('strategy', $workshopconfig->strategy);
     $mform->addHelpButton('strategy', 'strategy', 'workshop');
     $options = array();
     for ($i = 5; $i >= 0; $i--) {
         $options[$i] = $i;
     }
     $label = get_string('gradedecimals', 'workshop');
     $mform->addElement('select', 'gradedecimals', $label, $options);
     $mform->setAdvanced('gradedecimals');
     $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);
     $options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes);
     $options[0] = get_string('courseuploadlimit') . ' (' . display_size($this->course->maxbytes) . ')';
     $mform->addElement('select', 'maxbytes', get_string('maxbytes', 'workshop'), $options);
     $mform->setDefault('maxbytes', $workshopconfig->maxbytes);
     $label = get_string('latesubmissions', 'workshop');
     $text = get_string('latesubmissions_desc', 'workshop');
     $mform->addElement('checkbox', 'latesubmissions', $label, $text);
     $mform->addHelpButton('latesubmissions', 'latesubmissions', 'workshop');
     $mform->setAdvanced('latesubmissions');
     // 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('examplesmode', 'workshop');
     $options = workshop::available_example_modes_list();
     $mform->addElement('select', 'examplesmode', $label, $options);
     $mform->setDefault('examplesmode', $workshopconfig->examplesmode);
     $mform->disabledIf('examplesmode', 'useexamples');
     $mform->setAdvanced('examplesmode');
     // Access control -------------------------------------------------------------
     $mform->addElement('header', 'accesscontrol', get_string('accesscontrol', 'workshop'));
     $label = get_string('submissionstart', 'workshop');
     $mform->addElement('date_time_selector', 'submissionstart', $label, array('optional' => true));
     $mform->setAdvanced('submissionstart');
     $label = get_string('submissionend', 'workshop');
     $mform->addElement('date_time_selector', 'submissionend', $label, array('optional' => true));
     $mform->setAdvanced('submissionend');
//.........这里部分代码省略.........
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:mod_form.php


示例9: definition


//.........这里部分代码省略.........
     foreach ($markers as $marker) {
         $chkmarkers[] = $mform->createElement('checkbox', 'marker-' . $marker->id, null, $marker->firstname . " " . $marker->lastname);
     }
     // Add markers group as checkboxes
     $mform->addGroup($chkmarkers, 'markers', get_string('markersqualitycontrol', 'mod_emarking'), array('<br />'), false);
     $mform->addHelpButton('markers', 'markersqualitycontrol', 'mod_emarking');
     $mform->setType('markers', PARAM_INT);
     $mform->disabledIf('markers', 'qualitycontrol');
     $mform->setAdvanced('markers');
     $mform->disabledIf('markers', 'type', 'eq', '2');
     // -------------------------------------------------------------------------------
     // add standard grading elements...
     if (!$this->_features->rating || $this->_features->gradecat) {
         $mform->addElement('header', 'modstandardgrade', get_string('grade'));
     }
     // if supports grades and grades arent being handled via ratings
     if (!$this->_features->rating) {
         $mform->addElement('select', 'grademin', get_string('grademin', 'grades'), $numbers1to100);
         $mform->setDefault('grademin', 1);
         $mform->addElement('select', 'grade', get_string('grademax', 'grades'), $numbers1to100);
         $mform->setDefault('grade', 7);
     }
     if ($this->_features->advancedgrading and !empty($this->current->_advancedgradingdata['methods']) and !empty($this->current->_advancedgradingdata['areas'])) {
         if (count($this->current->_advancedgradingdata['areas']) == 1) {
             // if there is just one gradable area (most cases), display just the selector
             // without its name to make UI simplier
             $areadata = reset($this->current->_advancedgradingdata['areas']);
             $areaname = key($this->current->_advancedgradingdata['areas']);
             // Regrade settings, dates and enabling
             $mform->addElement('hidden', 'advancedgradingmethod_' . $areaname, 'rubric');
             $mform->setType('advancedgradingmethod_' . $areaname, PARAM_ALPHA);
             /*
              * $mform->addElement('select', 'advancedgradingmethod_' . $areaname, get_string('gradingmethod', 'core_grading'), array(
              * null => "sIMPLE GRADING",
              * 'rubric' => "Rubrica"
              * ));
              * $mform->addHelpButton('advancedgradingmethod_' . $areaname, 'gradingmethod', 'core_grading');
              * $mform->setAdvanced('advancedgradingmethod_' . $areaname);
              * $mform->disabledIf('advancedgradingmethod_' . $areaname, 'type', 'eq', '2');
              */
         } else {
             throw new Exception("The emarking module should not define more than one grading area");
         }
     }
     if ($this->_features->gradecat) {
         $mform->addElement('select', 'gradecat', get_string('gradecategoryonmodform', 'grades'), grade_get_categories_menu($COURSE->id, $this->_outcomesused));
         $mform->addHelpButton('gradecat', 'gradecategoryonmodform', 'grades');
         $mform->setAdvanced('gradecat');
         $mform->disabledIf('gradecat', 'type', 'eq', '2');
     }
     // Regrade settings, dates and enabling
     $mform->addElement('checkbox', 'adjustslope', get_string('adjustslope', 'mod_emarking'));
     $mform->addHelpButton('adjustslope', 'adjustslope', 'mod_emarking');
     $mform->setAdvanced('adjustslope');
     $mform->disabledIf('adjustslope', 'type', 'eq', '2');
     $mform->addElement('text', 'adjustslopegrade', get_string('adjustslopegrade', 'mod_emarking'), array('size' => '5'));
     $mform->setType('adjustslopegrade', PARAM_FLOAT);
     $mform->setDefault('adjustslopegrade', 0);
     $mform->addHelpButton('adjustslopegrade', 'adjustslopegrade', 'mod_emarking');
     $mform->disabledIf('adjustslopegrade', 'adjustslope');
     $mform->setAdvanced('adjustslopegrade');
     $mform->disabledIf('adjustslopegrade', 'type', 'eq', '2');
     $mform->addElement('text', 'adjustslopescore', get_string('adjustslopescore', 'mod_emarking'), array('size' => '5'));
     $mform->setType('adjustslopescore', PARAM_FLOAT);
     $mform->setDefault('adjustslopescore', 0);
     $mform->addHelpButton('adjustslopescore', 'adjustslopescore', 'mod_emarking');
     $mform->disabledIf('adjustslopescore', 'adjustslope');
     $mform->setAdvanced('adjustslopescore');
     $mform->disabledIf('adjustslopescore', 'type', 'eq', '2');
     // -------------------------------------------------------------------------------
     // add standard elements, common to all modules
     $this->standard_coursemodule_elements();
     // Regrade settings, dates and enabling
     $mform->addElement('hidden', 'heartbeatenabled', true);
     $mform->setType('heartbeatenabled', PARAM_BOOL);
     $mform->addElement('hidden', 'downloadrubricpdf', true);
     $mform->setType('downloadrubricpdf', PARAM_BOOL);
     // If we are in editing mode we can not change the type anymore
     if ($this->_instance) {
         $freeze = array();
         if ($emarking->type == EMARKING_TYPE_NORMAL) {
             $freeze[] = 'qualitycontrol';
         }
         if ($exam && $exam->status >= EMARKING_EXAM_SENT_TO_PRINT) {
             $freeze[] = 'printlist';
             $freeze[] = 'printdoublesided';
             $freeze[] = 'headerqr';
             $freeze[] = 'extrasheets';
             $freeze[] = 'extraexams';
             $freeze[] = 'enrolments';
             if ($mform->elementExists('multicourse')) {
                 $freeze[] = 'multicourse';
             }
         }
         $mform->freeze($freeze);
     }
     // -------------------------------------------------------------------------------
     // add standard buttons, common to all modules
     $this->add_action_buttons();
 }
开发者ID:mandrato1,项目名称:emarking,代码行数:101,代码来源:mod_form.php


示例10: standard_coursemodule_elements

 /**
  * Adds all the standard elements to a form to edit the settings for an activity module.
  */
 function standard_coursemodule_elements()
 {
     global $COURSE, $CFG, $DB;
     $mform =& $this->_form;
     $outcomesused = false;
     if ($this->_features->outcomes) {
         if ($outcomes = grade_outcome::fetch_all_available($COURSE->id)) {
             $outcomesused = true;
             $mform->addElement('header', 'modoutcomes', get_string('outcomes', 'grades'));
             foreach ($outcomes as $outcome) {
                 $mform->addElement('advcheckbox', 'outcome_' . $outcome->id, $outcome->get_name());
             }
         }
     }
     $mform->addElement('header', 'modstandardelshdr', get_string('modstandardels', 'form'));
     if ($this->_features->groups) {
         $options = array(NOGROUPS => get_string('groupsnone'), SEPARATEGROUPS => get_string('groupsseparate'), VISIBLEGROUPS => get_string('groupsvisible'));
         $mform->addElement('select', 'groupmode', get_string('groupmode'), $options, NOGROUPS);
         $mform->setHelpButton('groupmode', array('groupmode', get_string('groupmode')));
     }
     if (!empty($CFG->enablegroupings)) {
         if ($this->_features->groupings or $this->_features->groupmembersonly) {
             //groupings selector - used for normal grouping mode or also when restricting access with groupmembersonly
             $options = array();
             $options[0] = get_string('none');
             if ($groupings = $DB->get_records('groupings', array('courseid' => $COURSE->id))) {
                 foreach ($groupings as $grouping) {
                     $options[$grouping->id] = format_string($grouping->name);
                 }
             }
             $mform->addElement('select', 'groupingid', get_string('grouping', 'group'), $options);
             $mform->setHelpButton('groupingid', array('grouping', get_string('grouping', 'group')));
             $mform->setAdvanced('groupingid');
         }
         if ($this->_features->groupmembersonly) {
             $mform->addElement('checkbox', 'groupmembersonly', get_string('groupmembersonly', 'group'));
             $mform->setHelpButton('groupmembersonly', array('groupmembersonly', get_string('groupmembersonly', 'group')));
             $mform->setAdvanced('groupmembersonly');
         }
     }
     $mform->addElement('modvisible', 'visible', get_string('visible'));
     if ($this->_features->idnumber) {
         $mform->addElement('text', 'cmidnumber', get_string('idnumbermod'));
         $mform->setHelpButton('cmidnumber', array('cmidnumber', get_string('idnumbermod')), true);
     }
     if ($this->_features->gradecat) {
         $categories = grade_get_categories_menu($COURSE->id, $outcomesused);
         $mform->addElement('select', 'gradecat', get_string('gradecategory', 'grades'), $categories);
     }
     if (!empty($CFG->enableavailability)) {
         // Conditional availability
         $mform->addElement('header', '', get_string('availabilityconditions', 'condition'));
         $mform->addElement('date_selector', 'availablefrom', get_string('availablefrom', 'condition'), array('optional' => true));
         $mform->setHelpButton('availablefrom', array('conditiondates', get_string('help_conditiondates', 'condition'), 'condition'));
         $mform->addElement('date_selector', 'availableuntil', get_string('availableuntil', 'condition'), array('optional' => true));
         $mform->setHelpButton('availableuntil', array('conditiondates', get_string('help_conditiondates', 'condition'), 'condition'));
         // Conditions based on grades
         $gradeoptions = array();
         $items = grade_item::fetch_all(array('courseid' => $COURSE->id));
         $items = $items ? $items : array();
         foreach ($items as $id => $item) {
             // Do not include grades for current item
             if (!empty($this->_cm) && $this->_cm->instance == $item->iteminstance && $this->_cm->modname == $item->itemmodule && $item->itemtype == 'mod') {
                 continue;
             }
             $gradeoptions[$id] = $item->get_name();
         }
         asort($gradeoptions);
         $gradeoptions = array(0 => get_string('none', 'condition')) + $gradeoptions;
         $grouparray = array();
         $grouparray[] =& $mform->createElement('select', 'conditiongradeitemid', '', $gradeoptions);
         $grouparray[] =& $mform->createElement('static', '', '', ' ' . get_string('grade_atleast', 'condition') . ' ');
         $grouparray[] =& $mform->createElement('text', 'conditiongrademin', '', array('size' => 3));
         $grouparray[] =& $mform->createElement('static', '', '', '% ' . get_string('grade_upto', 'condition') . ' ');
         $grouparray[] =& $mform->createElement('text', 'conditiongrademax', '', array('size' => 3));
         $grouparray[] =& $mform->createElement('static', '', '', '%');
         $mform->setType('conditiongrademin', PARAM_FLOAT);
         $mform->setType('conditiongrademax', PARAM_FLOAT);
         $group = $mform->createElement('group', 'conditiongradegroup', get_string('gradecondition', 'condition'), $grouparray);
         // Get version with condition info and store it so we don't ask
         // twice
         if (!empty($this->_cm)) {
             $ci = new condition_info($this->_cm, CONDITION_MISSING_EXTRATABLE);
             $this->_cm = $ci->get_full_course_module();
             $count = count($this->_cm->conditionsgrade) + 1;
         } else {
             $count = 1;
   

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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