*/ class tao_models_classes_import_RdfImportForm extends tao_helpers_form_FormContainer { // --- ASSOCIATIONS --- // --- ATTRIBUTES --- // --- OPERATIONS --- /** * Short description of method initForm * * @access public * @author Joel Bout, * @return mixed */ public function initForm() { $this->form = new tao_helpers_form_xhtml_Form('export'); $submitElt = tao_helpers_form_FormFactory::getElement('import', 'Free'); $submitElt->setValue(' ' . __('Import') . ''); $this->form->setActions([$submitElt], 'bottom'); $this->form->setActions([], 'top'); } /** * overriden * * @access public * @author Joel Bout, * @return mixed */ public function initElements() { //create file upload form box $fileElt = tao_helpers_form_FormFactory::getElement('source', 'AsyncFile'); $fileElt->setDescription(__("Add an RDF/XML file")); if (isset($_POST['import_sent_rdf'])) { $fileElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty')); } else { $fileElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty', ['message' => ''])); } $fileElt->addValidators([ tao_helpers_form_FormFactory::getValidator('FileMimeType', ['mimetype' => ['text/xml', 'application/rdf+xml', 'application/xml'], 'extension' => ['rdf', 'rdfs']]), tao_helpers_form_FormFactory::getValidator('FileSize', ['max' => SystemHelper::getFileUploadLimit()]) ]); $this->form->addElement($fileElt); $this->form->createGroup('file', __('Import Metadata from RDF file'), ['source']); $rdfSentElt = tao_helpers_form_FormFactory::getElement('import_sent_rdf', 'Hidden'); $rdfSentElt->setValue(1); $this->form->addElement($rdfSentElt); } }