* @package taoMediaManager */ class ZipExportForm extends \tao_helpers_form_FormContainer { 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'); } public function initElements() { if (isset($this->data['resource'])) { $resource = $this->data['resource']; } 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(".zip"); $this->form->addElement($nameElt); $this->form->createGroup('options', __('Export Media as Zip file'), ['filename']); } }