示例#1
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->setName('questionForm');
     $this->setMethod('post');
     $question = new Zend_Form_Element_Text('question');
     $question->setLabel('Question:')->setRequired(true)->addDecorators($this->_inputDecorators);
     $question->setAttrib('class', 'span8');
     $this->addElement($question);
     $answer = new Core_Form_Element_Redactor('answer', array('label' => 'Answer:', 'cols' => 50, 'rows' => 15, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/faq/images/upload/', 'imageGetJson' => '/faq/images/list/', 'fileUpload' => false)));
     $answer->addDecorators($this->_inputDecorators);
     $this->addElement($answer);
     $this->addElement($this->_submit());
 }
示例#2
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->setName('postForm');
     $this->setMethod('post');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->setAttribs(array('class' => 'span4'))->addValidator('regex', false, array('/^[\\w\\s\'",.\\-_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid title', Zend_Validate_Regex::NOT_MATCH => 'Invalid title')));
     $this->addElement($title);
     $body = new Core_Form_Element_Redactor('body', array('label' => 'Text', 'cols' => 50, 'rows' => 25, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/forum/images/upload/', 'imageGetJson' => '/forum/images/list/', 'fileUpload' => '/admin/files/upload/', 'fileDownload' => '/admin/files/download/?file=', 'fileDelete' => '/admin/files/delete/?file=')));
     $body->addDecorators($this->_inputDecorators);
     $this->addElement($body);
     $this->addElement($body);
     $this->addElement($this->_category());
     $this->addElement($this->_status());
     $this->addElement($this->_submit());
     $this->addElement(new Zend_Form_Element_Hidden('pid'));
 }
示例#3
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title:')->setRequired(true)->addDecorators($this->_inputDecorators)->addValidator('regex', false, array('/^[\\w\\s\'",.\\-_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid title', Zend_Validate_Regex::NOT_MATCH => 'Invalid title')));
     $title->setAttrib('class', 'span4');
     $alias = new Zend_Form_Element_Text('alias');
     $alias->setLabel('Alias(permalink):')->addDecorators($this->_inputDecorators)->setRequired(true)->addValidator('regex', false, array('/^[a-z0-9\\-\\_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid page alias', Zend_Validate_Regex::NOT_MATCH => 'Invalid page alias')));
     $alias->setAttrib('class', 'span4');
     $content = new Core_Form_Element_Redactor('content', array('label' => 'Content:', 'cols' => 50, 'rows' => 25, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/pages/images/upload/', 'imageGetJson' => '/pages/images/list/', 'fileUpload' => '/admin/files/upload/', 'fileDownload' => '/admin/files/download/?file=', 'fileDelete' => '/admin/files/delete/?file=')));
     $content->setRequired(true);
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords:')->setRequired(true)->addDecorators($this->_inputDecorators)->addValidator('regex', false, array('/^[\\w\\s\\,\\.\\-\\_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid meta keywords', Zend_Validate_Regex::NOT_MATCH => 'Invalid meta keywords')));
     $keywords->setAttrib('class', 'span6');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Description:')->setRequired(true)->addDecorators($this->_inputDecorators)->addValidator('regex', false, array('/^[\\w\\s\\,\\.\\-\\_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid meta description', Zend_Validate_Regex::NOT_MATCH => 'Invalid meta description')));
     $description->setAttrib('class', 'span6');
     $pid = new Zend_Form_Element_Hidden('pid');
     $this->addElements(array($title, $alias, $content, $keywords, $description, $this->_submit(), $pid));
 }
示例#4
0
 /**
  * Create mail body element
  *
  * @return object Zend_Form_Element_Text
  */
 protected function _body()
 {
     $body = new Core_Form_Element_Redactor('bodyHtml', array('label' => 'Content:', 'cols' => 50, 'rows' => 25, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/mail/images/upload/', 'imageGetJson' => '/mail/images/list/', 'fileUpload' => '/admin/files/upload/', 'fileDownload' => '/admin/files/download/?file=', 'fileDelete' => '/admin/files/delete/?file=')));
     $body->setRequired(true);
     return $body;
 }