'sorter ASC'); protected $_formDefaults = array( 'featured' => 'y' ); protected function _bindListColumns($list) { $list->addColumn('image', 'image') ->addColumn('text', 'title', array('orderBy' => 'title')) ->addColumn('text', 'location', array('orderBy' => 'location')) ->addColumn('text', 'introduction', array('orderBy' => 'introduction')) ->addColumn( 'link_enum', 'featured', array('orderBy' => 'featured', 'attribs' => array('width' => 100, 'align' => 'center'), 'values' => array('y' => 'Yes', 'n' => 'No'))) ->addColumn('options', 'options'); return $this; } protected function _bindFormFields($form) { $form->addElement('text', 'title', array('label' => 'Title', 'required' => true) ); $form->addElement('text', 'location', array('label' => 'Location', 'required' => true) ); $form->addElement('extendedImage', 'image', array('label' => 'Image', 'required' => true, 'resize' => $this->dataObj->imageWidth . 'x' . $this->dataObj->imageHeight) ); $form->image->addValidator('File_IsImage'); $form->addElement('textarea', 'introduction', array('label' => 'Introduction', 'required' => true, 'rows' => 5, 'description' => "Please try to limit the intro text to {$this->dataObj->maxIntroLength} " . "symbols for it to look nicer on the user side.") ); $form->addElement( 'htmlEditor', 'description', array('label' => 'Description', 'required' => true) ); $form->addElement( 'checkbox', 'featured', array( 'label' => 'Featured', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => array( 'ViewHelper', array(array('topLabel' => 'Label'), array('placement' => 'APPEND', 'label' => 'Show as a Featured Project item')), array('HtmlTag', array('tag' => 'dd', 'id' => 'featured-element')), array(array('rightLabel' => 'Label'), array('placement' => 'PREPEND', 'tag' => 'dt')), ) ) ); $form->addFormRule(array($this, 'validateFrom')); return $this; } public function validateFrom($data) { $errors = array(); if (!empty($data['html'])) { $length = strlen(strip_tags($data['html'])); if ($length > $this->dataObj->maxIntroLength) { $errors['html'] = "Text is too long. You entered {$length} characters"; } } return (empty($errors)) ? true : $errors; } protected function _renderMainForm($form) { $this->doc->addStylesheet('css/admin-projects.css'); return parent::_renderMainForm($form); } protected function _addListItem($list = null, $template = 'list.tpl') { if (null == $list) { $list = $this->list; } $list->listFiltered = (Qs_Request::getRequestValue('query') == '') ? false : true; parent::_addListItem($list, $template); return $this; } }