public function checkInput() { if ($this->getRequired() && !isset($_POST[$this->getPostVar()])) { global $lng; $this->setAlert($lng->txt("msg_input_is_required")); return false; } return parent::checkInput(); }
/** * Allows to add additional form fields to the certificate editor form * This method will be called when the certificate editor form will built * using the ilPropertyFormGUI class. Additional fields will be added at the * bottom of the form. * * @param object $form An ilPropertyFormGUI instance * @param array $form_fields An array containing the form values. The array keys are the names of the form fields */ public function addAdditionalFormElements(&$form, $form_fields) { global $lng; $short_name = new ilTextInputGUI($lng->txt("certificate_short_name"), "short_name"); $short_name->setRequired(TRUE); require_once "./Services/Utilities/classes/class.ilStr.php"; $short_name->setValue(strlen($form_fields["short_name"]) ? $form_fields["short_name"] : ilStr::subStr($this->object->getTitle(), 0, 30)); $short_name->setSize(30); if (strlen($form_fields["short_name"])) { $short_name->setInfo(str_replace("[SHORT_TITLE]", $form_fields["short_name"], $lng->txt("certificate_short_name_description"))); } else { $short_name->setInfo($lng->txt("certificate_short_name_description")); } if (count($_POST)) { $short_name->checkInput(); } $form->addItem($short_name); $visibility = new ilCheckboxInputGUI($lng->txt("certificate_enabled_scorm"), "certificate_enabled_scorm"); $visibility->setInfo($lng->txt("certificate_enabled_scorm_introduction")); $visibility->setValue(1); if ($form_fields["certificate_enabled_scorm"]) { $visibility->setChecked(TRUE); } if (count($_POST)) { $visibility->checkInput(); } $form->addItem($visibility); }