/** * First publishing form of two forms * Here: Doctype + Upload-File * * @return void */ public function init() { parent::init(); $this->setDisableTranslator(true); //create and add document type $doctypes = $this->_createDocumentTypeField(); $this->addElement($doctypes); //create and add file upload $this->enableUpload = $this->_config->form->first->enable_upload == 1; if ($this->enableUpload) { $fileupload = $this->_createFileuploadField(); $this->addDisplayGroup($fileupload, 'documentUpload'); } //create and add bibliographie $bibliographie = $this->_createBibliographyField(); if (!is_null($bibliographie)) { $this->addElement($bibliographie); } //create and add rights checkbox $rights = $this->_createRightsCheckBox(); if (!is_null($rights)) { $this->addElement($rights); } // TODO can be removed? //$this->addSubmitButton('Send', 'send'); $this->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART); $this->setViewValues(); }
/** * Build document publishing form whose fields depend on the choosen document type. * * @return void */ public function init() { parent::init(); $this->setDisableTranslator(true); $this->doctype = $this->session->documentType; if (!isset($this->doctype) or empty($this->doctype)) { throw new Publish_Model_FormSessionTimeoutException(); } $dom = null; try { // Fetch the current XML DOM structure of the documenttype. $dom = $this->documentTypesHelper->getDocument($this->doctype); } catch (Application_Exception $e) { $this->log->err("Unable to load document type '" . $this->doctype . "'"); throw $e; } $this->additionalFields = $this->session->additionalFields; $parser = new Publish_Model_DocumenttypeParser($dom, $this, $this->additionalFields, $this->postData); $parser->parse(); $parserElements = $parser->getFormElements(); $this->log->debug("DocumenttypeParser (doctype '" . $this->doctype . "') found: " . count($parserElements) . " elements."); $this->addElements($parserElements); $this->addElements($this->getExternalElements()); $this->addSubmitButton('button_label_send', 'send'); $this->addSubmitButton('button_label_back', 'back'); if (!is_null($this->postData)) { $this->populate($this->postData); } $this->setViewValues(); }