Exemplo n.º 1
0
 /**
  *
  */
 protected function saveEctsForm()
 {
     if (!$this->objectSupportsEctsGrades() && $this->object->canEditEctsGrades()) {
         $this->showMarkSchema();
         return;
     }
     $ects_form = $this->getEctsForm();
     if (!$ects_form->checkInput()) {
         $ects_form->setValuesByPost();
         $this->showMarkSchema($ects_form);
         return;
     }
     $grades = array();
     for ($i = ord('a'); $i <= ord('e'); $i++) {
         $mark = chr($i);
         $grades[chr($i - 32)] = $ects_form->getInput('ects_grade_' . $mark);
     }
     $this->object->setECTSGrades($grades);
     $this->object->setECTSOutput((int) $ects_form->getInput('ectcs_status'));
     $this->object->setECTSFX($ects_form->getInput('use_ects_fx') && preg_match('/\\d+/', $ects_form->getInput('ects_fx_threshold')) ? $ects_form->getInput('ects_fx_threshold') : NULL);
     $this->object->saveECTSStatus();
     ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
     $ects_form->setValuesByPost();
     $this->showMarkSchema($ects_form);
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     $short_name = new ilTextInputGUI('', 'mark_short_' . $row['mark_id']);
     $short_name->setValue($row['mark_short']);
     $short_name->setDisabled(!$this->is_editable);
     $short_name->setSize(10);
     $official_name = new ilTextInputGUI('', 'mark_official_' . $row['mark_id']);
     $official_name->setSize(20);
     $official_name->setDisabled(!$this->object->canEditMarks());
     $official_name->setValue($row['mark_official']);
     $percentage = new ilNumberInputGUI('', 'mark_percentage_' . $row['mark_id']);
     $percentage->allowDecimals(true);
     $percentage->setValue($row['mark_percentage']);
     $percentage->setSize(10);
     $percentage->setDisabled(!$this->is_editable);
     $percentage->setMinValue(0);
     $percentage->setMaxValue(100);
     $this->tpl->setVariable('VAL_MARK_ID', $row['mark_id']);
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'marks[]', $row['mark_id'], !$this->is_editable));
     $this->tpl->setVariable('VAL_SHORT_NAME', $short_name->render());
     $this->tpl->setVariable('VAL_OFFICIAL_NAME', $official_name->render());
     $this->tpl->setVariable('VAL_PERCENTAGE', $percentage->render());
     $this->tpl->setVariable('VAL_PASSED_CHECKBOX', ilUtil::formCheckbox((bool) $row['mark_passed'], 'passed_' . $row['mark_id'], '1', !$this->is_editable));
 }