function definition()
 {
     $mform = $this->_form;
     $current = $this->_customdata['current'];
     $teamwork = $this->_customdata['teamwork'];
     $editoropts = $this->_customdata['editoropts'];
     $options = $this->_customdata['options'];
     $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'teamwork'));
     if (!empty($options['editableweight'])) {
         $mform->addElement('select', 'weight', get_string('assessmentweight', 'teamwork'), teamwork::available_assessment_weights_list());
         $mform->setDefault('weight', 1);
     }
     $mform->addElement('static', 'gradinggrade', get_string('gradinggradecalculated', 'teamwork'));
     if (!empty($options['overridablegradinggrade'])) {
         $grades = array('' => get_string('notoverridden', 'teamwork'));
         for ($i = (int) $teamwork->gradinggrade; $i >= 0; $i--) {
             $grades[$i] = $i;
         }
         $mform->addElement('select', 'gradinggradeover', get_string('gradinggradeover', 'teamwork'), $grades);
         $mform->addElement('editor', 'feedbackreviewer_editor', get_string('feedbackreviewer', 'teamwork'), null, $editoropts);
         $mform->setType('feedbackreviewer_editor', PARAM_RAW);
     }
     $mform->addElement('hidden', 'asid');
     $mform->setType('asid', PARAM_INT);
     $mform->addElement('submit', 'save', get_string('saveandclose', 'teamwork'));
     $this->set_data($current);
 }
Example #2
0
 /**
  * Add the fields that are common for all grading strategies.
  *
  * If the strategy does not support all these fields, then you can override
  * this method and remove the ones you don't want with
  * $mform->removeElement().
  * Strategy subclassess should define their own fields in definition_inner()
  *
  * @return void
  */
 public function definition()
 {
     global $CFG;
     $mform = $this->_form;
     $this->mode = $this->_customdata['mode'];
     // influences the save buttons
     $this->strategy = $this->_customdata['strategy'];
     // instance of the strategy api class
     $this->teamwork = $this->_customdata['teamwork'];
     // instance of the teamwork api class
     $this->options = $this->_customdata['options'];
     // array with addiotional options
     // Disable shortforms
     $mform->setDisableShortforms();
     // add the strategy-specific fields
     $this->definition_inner($mform);
     // add the data common for all subplugins
     $mform->addElement('hidden', 'strategy', $this->teamwork->strategy);
     $mform->setType('strategy', PARAM_PLUGIN);
     if ($this->teamwork->overallfeedbackmode and $this->is_editable()) {
         $mform->addElement('header', 'overallfeedbacksection', get_string('overallfeedback', 'mod_teamwork'));
         $mform->addElement('editor', 'feedbackauthor_editor', get_string('feedbackauthor', 'mod_teamwork'), null, $this->teamwork->overall_feedback_content_options());
         if ($this->teamwork->overallfeedbackmode == 2) {
             $mform->addRule('feedbackauthor_editor', null, 'required', null, 'client');
         }
         if ($this->teamwork->overallfeedbackfiles) {
             $mform->addElement('filemanager', 'feedbackauthorattachment_filemanager', get_string('feedbackauthorattachment', 'mod_teamwork'), null, $this->teamwork->overall_feedback_attachment_options());
         }
     }
     if (!empty($this->options['editableweight']) and $this->is_editable()) {
         $mform->addElement('header', 'assessmentsettings', get_string('assessmentweight', 'teamwork'));
         $mform->addElement('select', 'weight', get_string('assessmentweight', 'teamwork'), teamwork::available_assessment_weights_list());
         $mform->setDefault('weight', 1);
     }
     $buttonarray = array();
     if ($this->mode == 'preview') {
         $buttonarray[] = $mform->createElement('cancel', 'backtoeditform', get_string('backtoeditform', 'teamwork'));
     }
     if ($this->mode == 'assessment') {
         if (!empty($this->options['pending'])) {
             $buttonarray[] = $mform->createElement('submit', 'saveandshownext', get_string('saveandshownext', 'teamwork'));
         }
         $buttonarray[] = $mform->createElement('submit', 'saveandclose', get_string('saveandclose', 'teamwork'));
         $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'teamwork'));
         $buttonarray[] = $mform->createElement('cancel');
     }
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     $mform->closeHeaderBefore('buttonar');
 }