/** * (non-PHPdoc) * @see SpecialEPFormPage::getFormFields() * @return array */ protected function getFormFields() { $fields = parent::getFormFields(); $fields['name'] = array('type' => 'text', 'label-message' => 'educationprogram-org-edit-name', 'maxlength' => 255, 'required' => true, 'validation-callback' => function ($value, array $alldata = null) { return strlen($value) < 2 ? wfMsg('educationprogram-org-invalid-name') : true; }); $fields['city'] = array('type' => 'text', 'label-message' => 'educationprogram-org-edit-city', 'required' => true, 'validation-callback' => function ($value, array $alldata = null) { return strlen($value) < 2 ? wfMsg('educationprogram-org-invalid-city') : true; }); $fields['country'] = array('type' => 'select', 'label-message' => 'educationprogram-org-edit-country', 'maxlength' => 255, 'required' => true, 'options' => EPUtils::getCountryOptions($this->getLanguage()->getCode()), 'validation-callback' => array($this, 'countryIsValid')); return $this->processFormFields($fields); }
/** * (non-PHPdoc) * @see SpecialEPFormPage::getFormFields() * @return array */ protected function getFormFields() { $fields = parent::getFormFields(); $fields['name'] = array('type' => 'text', 'label-message' => 'ep-course-edit-name', 'maxlength' => 255, 'required' => true, 'validation-callback' => function ($value, array $alldata = null) { return strlen($value) < 5 ? wfMsgExt('ep-course-invalid-name', 'parsemag', 5) : true; }); $orgOptions = EPOrg::getOrgOptions(); $fields['org_id'] = array('type' => 'select', 'label-message' => 'ep-course-edit-org', 'required' => true, 'options' => $orgOptions, 'validation-callback' => function ($value, array $alldata = null) use($orgOptions) { return in_array((int) $value, array_values($orgOptions)) ? true : wfMsg('ep-course-invalid-org'); }); $fields['description'] = array('type' => 'textarea', 'label-message' => 'ep-course-edit-description', 'required' => true, 'validation-callback' => function ($value, array $alldata = null) { return strlen($value) < 10 ? wfMsgExt('ep-course-invalid-description', 'parsemag', 10) : true; }, 'rows' => 10); return $this->processFormFields($fields); }
/** * (non-PHPdoc) * @see SpecialEPFormPage::getFormFields() * @return array */ protected function getFormFields() { $fields = parent::getFormFields(); $courseOptions = EPCourse::getCourseOptions(); $fields['course_id'] = array('type' => 'select', 'label-message' => 'ep-term-edit-course', 'required' => true, 'options' => $courseOptions, 'validation-callback' => function ($value, array $alldata = null) use($courseOptions) { return in_array((int) $value, array_values($courseOptions)) ? true : wfMsg('ep-term-invalid-course'); }); $fields['token'] = array('type' => 'text', 'label-message' => 'ep-term-edit-token', 'maxlength' => 255, 'required' => true, 'size' => 20, 'validation-callback' => function ($value, array $alldata = null) { $strLen = strlen($value); return $strLen !== 0 && $strLen < 2 ? wfMsgExt('ep-term-invalid-token', 'parsemag', 2) : true; }); $fields['year'] = array('type' => 'int', 'label-message' => 'ep-term-edit-year', 'required' => true, 'min' => 2000, 'max' => 9001, 'size' => 15); $fields['start'] = array('class' => 'EPHTMLDateField', 'label-message' => 'ep-term-edit-start', 'required' => true); $fields['end'] = array('class' => 'EPHTMLDateField', 'label-message' => 'ep-term-edit-end', 'required' => true); $fields['description'] = array('type' => 'textarea', 'label-message' => 'ep-term-edit-description', 'required' => true, 'validation-callback' => function ($value, array $alldata = null) { return strlen($value) < 10 ? wfMsgExt('ep-term-invalid-description', 'parsemag', 10) : true; }, 'rows' => 10); return $this->processFormFields($fields); }