*/ class tao_models_classes_export_RdfExportForm 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'); $this->form->setDecorators([ 'element' => new tao_helpers_form_xhtml_TagWrapper(['tag' => 'div']), 'group' => new tao_helpers_form_xhtml_TagWrapper(['tag' => 'div', 'cssClass' => 'form-group']), 'error' => new tao_helpers_form_xhtml_TagWrapper(['tag' => 'div', 'cssClass' => 'form-error ui-state-error ui-corner-all']), 'actions-bottom' => new tao_helpers_form_xhtml_TagWrapper(['tag' => 'div', 'cssClass' => 'form-toolbar']), //'actions-top' => new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-toolbar')) ]); $exportElt = tao_helpers_form_FormFactory::getElement('export', 'Free'); $exportElt->setValue(' ' . __('Export') . ''); $this->form->setActions([$exportElt], 'bottom'); } /** * overriden * * @access public * @author Joel Bout, * @return mixed */ public function initElements() { $fileName = ''; $instances = []; if (isset($this->data['instance'])) { $resource = $this->data['instance']; } elseif (isset($this->data['class'])) { $resource = $this->data['class']; } else { throw new common_Exception('No class nor instance specified for export'); } $fileName = strtolower(tao_helpers_Display::textCleaner($resource->getLabel(), '*')); $hiddenElt = tao_helpers_form_FormFactory::getElement('resource', 'Hidden'); $hiddenElt->setValue($resource->getUri()); $this->form->addElement($hiddenElt); $nameElt = tao_helpers_form_FormFactory::getElement('filename', 'Textbox'); $nameElt->setDescription(__('File name')); $nameElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty')); $nameElt->setValue($fileName); $nameElt->setUnit(".rdf"); $this->form->addElement($nameElt); $instances = tao_helpers_Uri::encodeArray($instances, tao_helpers_Uri::ENCODE_ARRAY_KEYS); $this->form->createGroup('options', '

' . __('Export Metadata as RDF/XML file') . '

', ['filename']); } }