'sorter ASC'); protected function _bindListColumns(Qs_ViewController_List $list) { $list->addColumn('image', 'image') ->addColumn('text', 'title', array('orderBy' => 'title')) ->addColumn('text', 'location', array('orderBy' => 'location')) ->addColumn('text', 'introduction', array('orderBy' => 'introduction')) ->addColumn('options', 'options'); return $this; } protected function _bindFormFields(Qs_Form $form) { $form->setAjaxValidation(false); $form->addElement('text', 'title', array('label' => 'Title', 'required' => true)); $form->addElement('text', 'location', array('label' => 'Location')); $form->addElement('extendedImage', 'image', array('label' => 'Image', 'required' => true, 'resize' => self::IMAGE_WIDTH . 'x' . self::IMAGE_HEIGHT) ); $form->addElement('textarea', 'introduction', array('label' => 'Introduction', 'required' => true, 'rows' => 5, 'description' => 'Please try to limit the intro text to ' . App_Story_AbstractObj::MAX_INTRO_LENGTH . ' symbols for it to look nicer on the user side.') ); $form->addElement('htmlEditor', 'description', array('label' => 'Description', 'required' => true)); $form->addFormRule(array($this, 'validateFrom')); return $this; } public function validateFrom($data) { $errors = array(); if (!empty($data['introduction'])) { $length = strlen(strip_tags($data['introduction'])); if ($length > App_Story_AbstractObj::MAX_INTRO_LENGTH) { $errors['introduction'] = "Text is too long. You entered {$length} characters"; } } return (empty($errors)) ? true : $errors; } }