addElement( 'date', 'date', array('label' => 'Publication Date', 'required' => true, 'value' => date('Y-m-d')) ); $this->addElement( 'date', 'expiredDate', array('label' => 'Expiration Date', 'value' => null) ); $this->addElement('text', 'title', array('label' => 'Volunteer Title', 'required' => true)); $this->addElement( 'textarea', 'metaDescription', array('label' => 'Meta Description', 'rows' => 3, 'required' => false) ); $this->addElement( 'textarea', 'metaKeywords', array('label' => 'Meta Keywords', 'rows' => 3, 'required' => false) ); $this->addElement( 'extendedImage', 'image', array( 'label' => 'Image', 'required' => false, 'resize' => $config->image->width . 'x' . $config->image->height . $config->image->resizeMethodAlias, ) ); $this->addElement( 'textarea', 'introduction', array( 'label' => 'Introduction', 'rows' => 5, 'description' => 'Text space is limited to 300 characters. Characters above the limit won\'t be shown on user end.' ) ); $this->addElement( 'htmlEditor', 'content', array('label' => 'Content', 'required' => true, 'hasMsWordNote' => true) ); $this->addElement( 'radio', 'linkType', array('label' => 'Type', 'multiOptions' => array('none' => 'No Link', 'url' => 'URL', 'cms' => 'Site Page', 'file' => 'File'), 'required' => true, 'separator' => ' | ', 'onclick' => 'this.blur()', 'onchange' => "$('#fieldset-linkTypeGroup>dl:first').attr('class', this.value);", 'value' => 'none') ); $this->addElement( 'text', 'url', array('label' => 'Url', 'class' => 'text', 'filters' => array('StringTrim'), 'validators' => array('Url'), 'description' => 'Example: http://www.adaptainc.com') ); $this->getElement('url')->getDecorator('Label')->setOption('class', 'required'); $this->addElement( 'select', 'idPage', array('label' => 'Site Page', 'escapeLabel' => false, 'multiOptions' => array('' => '- Select Page -') + App_Cms_Obj::getInstance()->getParent4Select(0)) ); $this->getElement('idPage')->getDecorator('Label')->setOption('class', 'required'); $this->addElement('extendedFile', 'file', array('label' => 'File')); $this->getElement('file')->getDecorator('Label')->setOption('class', 'required'); $linkType = $this->_getData('linkType', 'none'); switch ($linkType) { case 'url': $this->getElement('url')->setRequired(true); break; case 'cms': $this->getElement('idPage')->setRequired(true); break; case 'file': $this->getElement('file')->setRequired(true); break; } $this->addDisplayGroup( array('linkType', 'url', 'idPage', 'file'), 'linkTypeGroup', array('legend' => 'Link') ); $this->getDisplayGroup('linkTypeGroup')->getDecorator('HtmlTag')->setOption('class', $linkType); return $this; } public function render(Zend_View_Interface $view = null) { /** @var $doc Qs_Doc */ $doc = Zend_Registry::get('doc'); $doc->addStylesheet('css/modules/admin-volunteer.css'); return parent::render($view); } }