本文整理汇总了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);
}
示例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');
}
}
}
示例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);
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........
示例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();
}
示例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();
}
示例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');
}
}
}
示例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');
//.........这里部分代码省略.........
示例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();
}
示例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;
}
$this->repeat_elements(array($group), $count, array(), 'conditiongraderepeats', 'conditiongradeadds', 2, get_string('addgrades', 'condition'), true);
$mform->setHelpButton('conditiongradegroup[0]', array('gradecondition', get_string('help_gradecondition', 'condition'), 'condition'));
// Conditions based on completion
$completion = new completion_info($COURSE);
if ($completion->is_enabled()) {
$completionoptions = array();
$modinfo = get_fast_modinfo($COURSE);
foreach ($modinfo->cms as $id => $cm) {
// Add each course-module if it:
//.........这里部分代码省略.........
示例11: taskchain_navigation_accesscontrol_form
//.........这里部分代码省略.........
$modules = '<select id="id_modules" name="modules[]" size="' . min($select_size, $count_modules) . '" multiple="multiple">' . "\n" . $modules . "\n" . '</select>' . "\n";
$days = array();
for ($i = 1; $i <= 31; $i++) {
$days[$i] = $i;
}
$months = array();
for ($i = 1; $i <= 12; $i++) {
$months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), '%B');
}
$years = array();
for ($i = 1970; $i <= 2020; $i++) {
$years[$i] = $i;
}
$hours = array();
for ($i = 0; $i <= 23; $i++) {
$hours[$i] = sprintf('%02d', $i);
}
$minutes = array();
for ($i = 0; $i < 60; $i += 5) {
$minutes[$i] = sprintf('%02d', $i);
}
$visibilitymenu = array(-1 => '', 0 => get_string('hidden', 'grades'), 1 => get_string('visible'));
$visiblemenu = array(0 => get_string('hide'), 1 => get_string('show'));
$ratings = new rating_manager();
$ratings = $ratings->get_aggregate_types();
$gradings = array();
$maxgrades = array();
$gradepassmenu = array();
for ($i = 100; $i >= 1; $i--) {
$maxgrades[$i] = $i . '%';
$gradepassmenu[$i] = $i . '%';
}
$maxgrades[0] = get_string('nograde');
$gradecategories = grade_get_categories_menu($course->id);
$groupmodes = array(NOGROUPS => get_string('groupsnone'), SEPARATEGROUPS => get_string('groupsseparate'), VISIBLEGROUPS => get_string('groupsvisible'));
//groupings selector - used for normal grouping mode or also when restricting access with groupmembersonly
$groupings = array();
if ($records = $DB->get_records('groupings', array('courseid' => $course->id))) {
$groupings = array(0 => get_string('none'));
foreach ($records as $record) {
$groupings[$record->id] = format_string($record->name);
}
}
$indentmenu = array();
for ($i = -5; $i <= 5; $i++) {
if ($i == 0) {
$indentmenu[$i] = get_string('reset');
} else {
$indentmenu[$i] = ($i < 0 ? '-' : '+') . abs($i);
}
}
$positionmenu = array(1 => get_string('startofsection', $plugin), 2 => get_string('endofsection', $plugin));
if ($strman->string_exists('direction_from', 'availability_date')) {
// Moodle >= 2.7
$conditiondatedirectionmenu = array(1 => get_string('direction_from', 'availability_date'), 2 => get_string('direction_until', 'availability_date'));
} else {
// Moodle >= 2.6
$conditiondatedirectionmenu = array(1 => get_string('from'), 2 => get_string('durationuntil', 'calendar'));
}
$conditiongradeitemidmenu = array();
$conditioncmidmenu = array();
$conditionfieldnamemenu = array();
$conditionfieldoperatormenu = array();
$conditiongroupidmenu = array();
$conditiongroupingidmenu = array();
$conditionactionmenu = array();
示例12: definition
//.........这里部分代码省略.........
$mform->setType('totalpages', PARAM_INT);
// Anonymous eMarking setting
$ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
if (has_capability('mod/emarking:manageanonymousmarking', $ctx)) {
$mform->addElement('select', 'anonymous', get_string('anonymous', 'mod_emarking'), $ynoptions);
$mform->addHelpButton('anonymous', 'anonymous', 'mod_emarking');
} else {
$mform->addElement('hidden', 'anonymous');
}
$mform->setDefault('anonymous', 0);
$mform->setType('anonymous', PARAM_INT);
// Students can see peers answers
$mform->addElement('select', 'peervisibility', get_string('viewpeers', 'mod_emarking'), $ynoptions);
$mform->addHelpButton('peervisibility', 'viewpeers', 'mod_emarking');
$mform->setDefault('peervisibility', 0);
$mform->setType('peervisibility', PARAM_INT);
// Custom marks
if (has_capability('mod/emarking:managespecificmarks', $ctx)) {
$mform->addElement('textarea', 'custommarks', get_string('specificmarks', 'mod_emarking'), array('rows' => 17, 'cols' => 100, 'class' => 'smalltext'));
$mform->addHelpButton('custommarks', 'specificmarks', 'mod_emarking');
} else {
$mform->addElement('hidden', 'custommarks');
}
$mform->setDefault('custommarks', '');
$mform->setType('custommarks', PARAM_TEXT);
// Regrade settings, dates and enabling
$mform->addElement('checkbox', 'regraderestrictdates', get_string('regraderestrictdates', 'mod_emarking'));
$mform->addHelpButton('regraderestrictdates', 'regraderestrictdates', 'mod_emarking');
$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->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->disabledIf('regradesclosedate', 'regraderestrictdates');
// -------------------------------------------------------------------------------
// add standard elements, common to all modules
$this->standard_coursemodule_elements();
// -------------------------------------------------------------------------------
// add standard grading elements...
if (!$this->_features->rating || $this->_features->gradecat) {
$mform->addElement('header', 'modstandardgrade', get_string('grade'));
}
$grades = array();
for ($i = 0; $i <= 100; $i++) {
$grades[] = $i;
}
// if supports grades and grades arent being handled via ratings
if (!$this->_features->rating) {
$mform->addElement('select', 'grade', get_string('grademax', 'grades'), $pages);
$mform->setDefault('grade', 7);
$mform->addElement('select', 'grademin', get_string('grademin', 'grades'), $pages);
$mform->setDefault('grademin', 1);
}
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'), array('rubric' => "Rubrica"));
$mform->addHelpButton('advancedgradingmethod_' . $areaname, 'gradingmethod', 'core_grading');
} 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');
}
// Regrade settings, dates and enabling
$mform->addElement('checkbox', 'adjustslope', get_string('adjustslope', 'mod_emarking'));
$mform->addHelpButton('adjustslope', 'adjustslope', 'mod_emarking');
$mform->addElement('select', 'adjustslopegrade', get_string('adjustslopegrade', 'mod_emarking'), $grades);
$mform->setDefault('adjustslopegrade', 0);
$mform->addHelpButton('adjustslopegrade', 'adjustslopegrade', 'mod_emarking');
$mform->disabledIf('adjustslopegrade', 'adjustslope');
$mform->addElement('text', 'adjustslopescore', get_string('adjustslopescore', 'mod_emarking'), array('size' => '64'));
$mform->setType('adjustslopescore', PARAM_FLOAT);
$mform->setDefault('adjustslopescore', null);
$mform->addHelpButton('adjustslopescore', 'adjustslopescore', 'mod_emarking');
$mform->disabledIf('adjustslopescore', 'adjustslope');
// -------------------------------------------------------------------------------
// Experimental features
$mform->addElement('header', 'experimental', get_string('experimental', 'mod_emarking'));
// Regrade settings, dates and enabling
$mform->addElement('checkbox', 'heartbeatenabled', get_string('heartbeatenabled', 'mod_emarking'));
$mform->addHelpButton('heartbeatenabled', 'heartbeatenabled', 'mod_emarking');
$mform->addElement('checkbox', 'downloadrubricpdf', get_string('downloadrubricpdf', 'mod_emarking'));
$mform->addHelpButton('downloadrubricpdf', 'downloadrubricpdf', 'mod_emarking');
$mform->addElement('checkbox', 'linkrubric', get_string('linkrubric', 'mod_emarking'));
$mform->addHelpButton('linkrubric', 'linkrubric', 'mod_emarking');
$mform->addElement('checkbox', 'collaborativefeatures', get_string('collaborativefeatures', 'mod_emarking'));
$mform->addHelpButton('collaborativefeatures', 'collaborativefeatures', 'mod_emarking');
$mform->addElement('checkbox', 'experimentalgroups', get_string('experimentalgroups', 'mod_emarking'));
$mform->addHelpButton('experimentalgroups', 'experimentalgroups', 'mod_emarking');
// -------------------------------------------------------------------------------
// add standard buttons, common to all modules
$this->add_action_buttons();
}