addElement( 'date', 'date', array('label' => 'Publication Date', 'required' => true, 'value' => date('Y-m-d')) ); $this->addElement('text', 'title', array('label' => 'News Title', 'required' => true)); $this->addSeoGroup('News'); if ($config->hasImage) { $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)); $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'), '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()->getPages4Select()) ); $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); $this->getElement('url')->addValidator('Url'); 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); if (true === $config->hasFeatured) { $this->addElement('checkbox', 'featured', array('label' => 'Featured', 'decoration' => 'simple')); } $this->addElement('checkbox', 'enabled', array('label' => 'Show on user end', 'decoration' => 'simple')); return $this; } public function render(Zend_View_Interface $view = null) { /** @var $doc Qs_Doc */ $doc = Zend_Registry::get('doc'); $doc->addStylesheet('css/modules/admin-news.css'); return parent::render($view); } }