示例#1
1
 /**
  * Hook for node form - if type is Filemanager Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if (!Zend_Controller_Front::getInstance()->getRequest()->isXmlHttpRequest() && $item->type == "filemanager_file") {
         // Add Filemanager fields
         $form->setAttrib('enctype', 'multipart/form-data');
         $file = new Zend_Form_Element_File('filemanager_file');
         $file->setLabel("Select file")->setDestination(ZfApplication::$_data_path . DIRECTORY_SEPARATOR . "files")->setRequired(false);
         $form->addElement($file);
         $fields[] = 'filemanager_file';
         if ($item->id > 0) {
             // Fetch Filemanager object
             $factory = new Filemanager_File_Factory();
             $file_item = $factory->find($item->id)->current();
             if ($file_item) {
                 $existing = new Zend_Form_Element_Image('filemanager_image');
                 if (substr($file_item->mimetype, 0, 5) == "image") {
                     $imageid = $file_item->nid;
                 } else {
                     $imageid = 0;
                 }
                 $urlOptions = array('module' => 'filemanager', 'controller' => 'file', 'action' => 'show', 'id' => $imageid);
                 $existing->setImage(Zend_Controller_Front::getInstance()->getRouter()->assemble($urlOptions, 'default'));
                 $fields[] = 'filemanager_image';
             }
         }
         $options = array('legend' => Zoo::_("File upload"));
         $form->addDisplayGroup($fields, 'filemanager_fileupload', $options);
     } else {
         // Add content node image selector
     }
 }
示例#2
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('product');
     $product_name = new Zend_Form_Element_Text('product_name');
     $product_name->setLabel('Product Name: ')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $id = new Zend_Form_Element_Hidden('id');
     $ProductIdExists = new Zend_Validate_Db_NoRecordExists(array('table' => 'products', 'field' => 'product_id'));
     $ProductIdExists->setMessage('This Product ID is already taken');
     $product_id = new Zend_Form_Element_Text('product_id');
     $product_id->setLabel('Product ID: ')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator($ProductIdExists)->addValidator('NotEmpty');
     $category = new Category();
     $categoriesList = $category->getCategoriesList();
     $category_id = new Zend_Form_Element_Select('category_id');
     $category_id->setLabel('Category: ')->addMultiOptions($categoriesList)->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $product_desc = new Zend_Form_Element_Text('product_desc');
     $product_desc->setLabel('Description ')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $product_img = new Zend_Form_Element_File('product_image');
     $product_img->setLabel('Upload an image:')->setDestination(PUBLIC_PATH . '/images');
     // ensure only 1 file
     $product_img->addValidator('Count', false, 1);
     // limit to 100K
     $product_img->addValidator('Size', false, 102400);
     // only JPEG, PNG, and GIFs
     $product_img->addValidator('Extension', false, 'jpg,png,gif');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->addElements(array($product_name, $product_id, $product_desc, $product_img, $id, $category_id, $submit));
 }
示例#3
0
 public function init()
 {
     /*
     		$this->setDecorators(array(
     			array('Description', array('tag' => 'p', 'class' => 'description','escape' => false)),
     			'formElements',
     			'fieldset',
     			array('form',array('class' => 'formdefault'))
     		));
     		$this->setElementDecorators(array(
     			'ViewHelper',
     			'Description',
     			'Label',
     			'Errors',
     			array(array('tipo' => 'HtmlTag'), array('tag' => 'div'))
     		));*/
     //$this->setAttrib('class','formdefault consumidorForm');
     //$this->setLegend('Enviar Arquivos');
     $this->setName('upload');
     $this->setAttrib('enctype', 'multipart/form-data');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Description')->setRequired(true)->addValidator('NotEmpty');
     $file = new Zend_Form_Element_File('arquivo');
     $file->setLabel('Selecione os arquivos EDI"s Zipados')->setDestination('temp/arquivos/zip')->setRequired(true)->addValidator('Extension', false, 'zip');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Enviar');
     $this->addElements(array($file, $submit));
 }
示例#4
0
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $registry = Zend_Registry::getInstance();
     $authedUserInfo = $registry->get('authedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Files:');
     $file->setRequired(true);
     $file->addValidator('Count', false, array('min' => 1, 'max' => 1));
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     // hack for not showing 'the file exceeds the defined form size'
     $file->setMaxFileSize($maxFileSize * 2);
     /*$file->setMultiFile(1);*/
     $this->addElement($file, 'file');
     $title = $this->addElement('text', 'title', array('label' => 'Title:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 100)))));
     $short = $this->addElement('text', 'short', array('label' => 'Short description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 120)))));
     $description = $this->addElement('textarea', 'description', array('label' => 'Description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 4096)))));
 }
示例#5
0
 /**
  * Form init
  *
  */
 public function init()
 {
     $this->setMethod('post');
     $this->addElement('text', 'first_name', array('label' => 'First Name*', 'placeholder' => 'e.g. John', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'last_name', array('label' => 'Last Name*', 'placeholder' => 'e.g. Smith', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
     //http://stackoverflow.com/questions/8014011/queyring-database-for-existing-username-with-zend-and-doctrine
     $this->addElement('text', 'username', array('label' => 'Username*', 'placeholder' => 'e.g. smithj01', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', true, array('min' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Account username must be at least %min% characters'))), array('Regex', true, array('pattern' => '/^\\w(?:[\\w\\d\\.\\-_]+)(?:\\w|\\d)$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => "The username contained invalid characters"))))));
     $frmPassword1 = new Zend_Form_Element_Password('password', 'password', array('validators' => array(array('StringLength', false, array('min' => 6, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Password must be at least %min% characters long.'))))));
     $frmPassword1->setLabel('Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim());
     //->addValidator('StringLength', false, array(6, 20))
     $this->addElement($frmPassword1);
     $frmPassword2 = new Zend_Form_Element_Password('confirm_password');
     $frmPassword2->setLabel('Confirm Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim())->addValidator('StringLength', false, array(6, 20))->addValidator(new Zend_Validate_Identical('password'));
     $this->addElement($frmPassword2);
     //        $this->addElement('text', 'password', array(
     //            'label' => 'Password (Visible!)*',
     //            'class' => 'input',
     //            'required' => true,
     //            'filters' => array('StringTrim'),
     //            'validators' => array(
     //                array('validator' => 'StringLength', 'options' => array(6, 20))
     //            )
     //        ));
     $this->addElement('select', 'role', array('label' => 'Role*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('reviewer' => 'reviewer', 'admin' => 'admin')));
     $fileUploader = new Zend_Form_Element_File('photo');
     $fileUploader->setLabel('Photo (max 2MB, JPEG)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 2048000);
     $fileUploader->addValidator('Extension', false, 'jpg,jpeg');
     $this->addElement($fileUploader, 'photo');
     $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add User'));
 }
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setName('AddRulerImage');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $image = new Zend_Form_Element_File('image');
     $image->setLabel('Upload an image: ')->setRequired(true)->setDestination('./images/rulers/')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'jpeg,tif,jpg,png,gif,JPG,TIFF')->setMaxFileSize(1024000)->setAttribs(array('class' => 'textInput'))->addValidator('Count', false, array('min' => 1, 'max' => 1))->addDecorator('File');
     $caption = new Zend_Form_Element_Text('caption');
     $caption->setLabel('Image caption')->setRequired(true)->setAttrib('size', 60)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a label');
     $rulerID = new Zend_Form_Element_Hidden('rulerID');
     $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int')->setRequired(true);
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Upload an image of a ruler')->setAttribs(array('class' => 'large'));
     $this->addElements(array($image, $rulerID, $caption, $submit))->setLegend('Add an image to a ruler profile');
     $this->addDisplayGroup(array('image', 'caption'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
 /**
  * Form init
  *
  */
 public function init()
 {
     $this->setMethod('post');
     $fileUploader = new Zend_Form_Element_File('photo');
     $fileUploader->setLabel('Photo (max 2MB, JPEG)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 2048000);
     $fileUploader->addValidator('Extension', false, 'jpg,jpeg');
     $this->addElement($fileUploader, 'photo');
     $fileUploader = new Zend_Form_Element_File('attach1');
     $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 15728640);
     $this->addElement($fileUploader, 'attach1');
     $fileUploader = new Zend_Form_Element_File('attach2');
     $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 15728640);
     $this->addElement($fileUploader, 'attach2');
     $fileUploader = new Zend_Form_Element_File('attach3');
     $fileUploader->setLabel('Attachment (max 15MB)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 15728640);
     $this->addElement($fileUploader, 'attach3');
     $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add Applicant'));
 }
示例#8
0
 public function init()
 {
     //get user lsit
     $userM = new Application_Model_User();
     $usersArr = $userM->getUsersList(null, '--- Select Author ---');
     $this->addElement('select', 'userId', array('label' => 'Author:', 'style' => 'width: 313px;', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select author.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $usersArr));
     $categories = new Application_Model_Category();
     $categoriesArr = $categories->getCategory("--- Select Category ---", "advice");
     $this->addElement('select', 'categoryId', array('label' => 'Category:', 'style' => 'width: 313px;', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select advice category.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $categoriesArr));
     $this->addElement('text', 'title', array('label' => 'Title :', 'class' => 'title-input-box', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the advice title')))), 'decorators' => $this->elementDecorators));
     $this->addElement('text', 'identifire', array('label' => 'URL Re-write :', 'class' => 'title-input-box', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the advice URL Re-write')))), 'decorators' => $this->elementDecorators));
     // Add an body element
     $this->addElement('textarea', 'content', array('label' => 'Content:', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the page content')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an body element
     $this->addElement('textarea', 'synopsis', array('label' => 'Synopsis:', 'required' => false, 'class' => 'title-input-box', 'cols' => '50', 'rows' => '3', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the synopsis')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'metaTitle', array('label' => 'Meta Title :', 'cols' => '50', 'rows' => '3', 'class' => 'title-input-box', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the page identifire')))), 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'metaKeyword', array('label' => 'Meta Keyword :', 'cols' => '50', 'rows' => '3', 'class' => 'title-input-box', 'required' => false, 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'metaDescription', array('label' => 'Meta Description :', 'class' => 'title-input-box', 'cols' => '50', 'rows' => '3', 'required' => false, 'decorators' => $this->elementDecorators));
     $Name = new Zend_Form_Element_File('name');
     $Name->setLabel('Upload an image:')->setRequired(false)->addValidator('Extension', false, 'jpg,png,gif')->clearDecorators()->addDecorators($this->fileDecorators);
     $this->addElements(array($Name));
     $this->addElement('submit', 'savePublish', array('required' => false, 'ignore' => true, 'title' => 'Save and Publish', 'label' => 'Save and Publish', 'decorators' => $this->buttonDecorators));
     $this->addElement('submit', 'saveUnpublish', array('required' => false, 'ignore' => true, 'title' => 'Save and Unpublish', 'label' => 'Save and Unpublish', 'decorators' => $this->buttonDecorators));
     $this->addElement('submit', 'previewPage', array('required' => false, 'ignore' => true, 'title' => 'Preview Page', 'label' => 'Preview Page', 'decorators' => $this->buttonDecorators));
 }
示例#9
0
文件: Thread.php 项目: ranahedia/RNR
 public function init()
 {
     $this->setMethod("post");
     $title = new Zend_Form_Element_Text("title");
     $title->setAttrib("placeholder", "Title");
     $title->setAttrib("class", "form-control");
     $title->setLabel("Title: ");
     $title->setRequired();
     $body = new Zend_Form_Element_Textarea("body");
     $body->setAttrib("class", "form-control");
     $body->setAttrib("placeholder", "Write body here....");
     $body->setLabel("Body: ");
     $body->setAttrib("rows", "5");
     $body->setAttrib("cols", "55");
     $body->setRequired();
     $picture = new Zend_Form_Element_File('picture');
     $picture->setLabel("Picture:");
     $picture->setRequired();
     $picture->setDestination('/var/www/html/RNR/public/images/thread');
     $stick = new Zend_Form_Element_Radio("stick");
     $stick->setLabel("Sticky:");
     $stick->addMultiOption("on", "on");
     $stick->addMultiOption("off", "off");
     $stick->setRequired();
     $id = new Zend_Form_Element_Hidden("id");
     $submit = new Zend_Form_Element_Submit("Submit");
     $submit->setAttrib("class", "btn btn-primary");
     $submit->setLabel("Save");
     $rest = new Zend_Form_Element_Submit('Rest');
     $rest->setAttrib("class", "btn btn-info");
     $this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest));
 }
示例#10
0
 public function getAddContentForm($submitLabel, $contentTitle = null, $contentDescription = null)
 {
     $database = Zend_Db_Table::getDefaultAdapter();
     $content = $database->select()->from('content')->order('content_id DESC')->query()->fetch();
     $imageName = $content['content_id'] + 1;
     $form = new Zend_Form();
     $form->setMethod('post');
     if ($submitLabel == 'Add Content!') {
         $form->setAttrib('enctype', 'multipart/form-data');
         $image = new Zend_Form_Element_File('foo');
         $image->setLabel('Upload an image:')->setDestination('../images');
         $image->addFilter('Rename', array('target' => $imageName . '.jpg', 'overwrite' => TRUE));
         $image->addValidator('Count', false, 1);
         $image->addValidator('Extension', false, 'jpg,png,gif');
         $form->addElement($image, 'foo');
     }
     $title = $form->createElement('text', 'title');
     $title->setRequired(true);
     $title->setValue($contentTitle);
     $title->setLabel('Title');
     $form->addElement($title);
     $description = $form->createElement('textarea', 'description', array('rows' => 10));
     $description->setRequired(true);
     $description->setValue($contentDescription);
     $description->setLabel('Description');
     $form->addElement($description);
     $form->addElement('submit', 'submit', array('label' => $submitLabel));
     return $form;
 }
 public function init()
 {
     // create elements
     $userId = new Zend_Form_Element_Hidden('id');
     $mail = new Zend_Form_Element_Text('email');
     $name = new Zend_Form_Element_Text('name');
     $radio = new Zend_Form_Element_Radio('radio');
     $file = new Zend_Form_Element_File('file');
     $multi = new Zend_Form_Element_MultiCheckbox('multi');
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'Figlet'));
     $submit = new Zend_Form_Element_Button('submit');
     $cancel = new Zend_Form_Element_Button('cancel');
     // config elements
     $mail->setLabel('Mail:')->setAttrib('placeholder', 'data please!')->setRequired(true)->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis fringilla purus eget ante ornare vitae iaculis est varius.')->addValidator('emailAddress');
     $name->setLabel('Name:')->setRequired(true);
     $radio->setLabel('Radio:')->setMultiOptions(array('1' => PHP_EOL . 'test1', '2' => PHP_EOL . 'test2'))->setRequired(true);
     $file->setLabel('File:')->setRequired(true)->setDescription('Check file upload');
     $multiOptions = array('view' => PHP_EOL . 'view', 'edit' => PHP_EOL . 'edit', 'comment' => PHP_EOL . 'comment');
     $multi->setLabel('Multi:')->addValidator('Alpha')->setMultiOptions($multiOptions)->setRequired(true);
     $captcha->setLabel('Captcha:')->setRequired(true)->setDescription("This is a test");
     $submit->setLabel('Save')->setAttrib('type', 'submit');
     $cancel->setLabel('Cancel');
     // add elements
     $this->addElements(array($userId, $mail, $name, $radio, $file, $captcha, $multi, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('email', 'name', 'radio', 'multi', 'file', 'captcha', 'submit', 'cancel'), 'users');
     // set decorators
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP_MINIMAL, 'submit', 'cancel');
 }
示例#12
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setAttrib('class', 'form_create_tai_lieu');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Chuyên đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $thoi_gian = new Zend_Form_Element_Text('thoi_gian');
     $thoi_gian->setLabel('Ngày tổ chức')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'thoi_gian'));
     $dia_diem = new Zend_Form_Element_Text('dia_diem');
     $dia_diem->setLabel('Địa điểm')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload file')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/sinh_hoat_chuyen_de')->addValidator(new Zend_Validate_File_Extension(array('doc,docx,pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setLabel('Lưu và tiếp tục')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setLabel('Lưu và thoát')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'sinh-hoat-chuyen-de', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Không lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ten, $noi_dung, $thoi_gian, $dia_diem, $file, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
示例#13
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setAttrib('class', 'form_create_bai_bao');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên sản phẩm (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $so_luong_thanh_vien = new Zend_Form_Element_Text('so_luong_thanh_vien');
     $so_luong_thanh_vien->setRequired(true)->setLabel('Số lượng thành viên')->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'so_luong_thanh_vien'))->setAttrib('class', 'text-input small-input');
     $mo_ta = new Zend_Form_Element_Textarea('mo_ta');
     $mo_ta->setLabel('Nội dung')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta', 'class' => 'text-input textarea'));
     $thong_tin = new Zend_Form_Element_Text('thong_tin');
     $thong_tin->setRequired(true)->setLabel('Thông tin')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'thong_tin'))->setAttrib('class', 'text-input large-input');
     $thangOptions = Default_Model_Constraints::lichct_thang();
     $thang = new Zend_Form_Element_Select('thang');
     $thang->setLabel('Tháng')->addMultiOptions($thangOptions)->setValue(date('m'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $namOptions = Default_Model_Constraints::years();
     $nam = new Zend_Form_Element_Select('nam');
     $nam->setLabel('Năm')->addMultiOptions($namOptions)->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $dot = new Zend_Form_Element_Text('dot');
     $dot->setRequired(true)->setLabel('Đợt')->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'dot'));
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload file')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_bao')->addValidator(new Zend_Validate_File_Extension(array('doc,docx,pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setLabel('Lưu và tiếp tục')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setLabel('Lưu và thoát')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'bai-bao', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Không lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ten, $thong_tin, $mo_ta, $so_luong_thanh_vien, $thang, $nam, $dot, $file, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
示例#14
0
 protected function buildFileUpload()
 {
     $tenantFromIdentity = OpenSKOS_Db_Table_Tenants::fromIdentity();
     // We always need tenant for getting icon path.
     if (null !== $tenantFromIdentity) {
         $iconUpload = new Zend_Form_Element_File('icon');
         $iconUpload->setLabel('Upload a new icon:')->addValidator('Count', false, 1)->setRequired(true);
         $editorOptions = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('editor');
         if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['uploadPath'])) {
             $iconUpload->setDestination(APPLICATION_PATH . $editorOptions['schemeIcons']['uploadPath'] . '/' . $tenantFromIdentity->code);
         } else {
             $iconUpload->setDestination(APPLICATION_PATH . self::DEFAULT_UPLOAD_PATH . '/' . $tenantFromIdentity->code);
         }
         if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['allowedExtensions'])) {
             $iconUpload->addValidator('Extension', false, $editorOptions['schemeIcons']['allowedExtensions']);
         } else {
             $iconUpload->addValidator('Extension', false, 'jpg, jpeg, png, gif');
         }
         if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['maxSize'])) {
             $iconUpload->addValidator('Size', false, $editorOptions['schemeIcons']['maxSize']);
             $iconUpload->setMaxFileSize($editorOptions['schemeIcons']['maxSize']);
         } else {
             $iconUpload->addValidator('Size', false, 2097152);
             $iconUpload->setMaxFileSize(2097152);
         }
         $this->addElement($iconUpload, 'icon');
     }
     return $this;
 }
示例#15
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setName('blogEntryForm');
     $this->addPrefixPath('Application_Form_Decorator', APPLICATION_PATH . '/forms/decorators/', 'decorator');
     $categoryForm = new Admin_Form_CategorySelect(array('categories' => $this->getCategories()));
     $element = $categoryForm->getElement('categoryId');
     $this->addElement($element);
     $this->addElement('text', 'postDateAsString', array('label' => 'Post Date:', 'attribs' => array('maxlength' => 10, 'size' => 30), 'required' => true, 'validators' => array(array('Date', false, array('format' => 'dd/MM/YYYY'))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'postdate-element')), 'RequiredLabel')));
     $this->addElement('hidden', 'useExisting', array('required' => true, 'value' => 0, 'decorators' => array('ViewHelper')));
     $element = new Zend_Form_Element_File('image');
     $element->setValueDisabled(true);
     $element->setLabel('Upload an image:');
     $element->addValidator('Count', false, 1);
     $element->addValidator('Size', false, 9000000);
     $element->addValidator('Extension', false, 'jpg,png,gif');
     $this->addElement($element, 'image');
     $this->addElement('text', 'title', array('label' => 'Title:', 'attribs' => array('maxlength' => 128, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'title-element')), 'RequiredLabel')));
     $this->addElement('textarea', 'summary', array('label' => 'Summary:', 'attribs' => array('cols' => 60, 'rows' => 6), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength')), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'summary-element')), 'RequiredLabel')));
     $this->addElement('textarea', 'content', array('label' => 'Content:', 'attribs' => array('cols' => 50, 'rows' => 6), 'required' => false, 'decorators' => array('ViewHelper', 'Wysiwyg', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'content-element')), 'WarningLinkLabel')));
     $this->addElement('textarea', 'content', array('label' => 'Content:', 'attribs' => array('cols' => 50, 'rows' => 6), 'required' => false, 'decorators' => array('ViewHelper', 'Wysiwyg', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'content-element')), 'WarningLinkLabel')));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'Description' => 'Fields marked with an asterisk (*) are required', 'ignore' => true, 'decorators' => array('ViewHelper', 'Description', array('HtmlTag', array('tag' => 'dd', 'id' => 'submit-element')), array('Label', array('tag' => 'dt', 'style' => 'display:none')))));
     $this->addElement('hash', 'csrf', array('ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('hidden', 'id', array('ignore' => false, 'decorators' => array('ViewHelper')));
 }
示例#16
0
 public function init()
 {
     $this->setName("Texto");
     $this->setAttrib('accept-charset', 'utf-8');
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $this->addElement('hidden', 'id', '1');
     $this->addElement('text', 'rotulo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Rotulo deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Rotulo:', 'class' => 'input-long'));
     $this->addElement('text', 'titulo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Titulo deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Titulo:', 'class' => 'input-long'));
     $this->addElement('textarea', 'comentario', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Destaque deve ser informado'), 'breakChainOnFailure' => true)), 'required' => true, 'label' => 'Destaque:', 'class' => 'ckeditor'));
     $this->addElement('select', 'ativo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Status deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Status:', 'class' => 'input-short', 'MultiOptions' => array('' => '-- Selesionar --', 'Sim' => 'Sim', 'Não' => 'Não')));
     $this->addElement('hidden', 'foto', '1');
     $foto = new Zend_Form_Element_File('foto1');
     $foto->setLabel('Foto:')->addValidator('Extension', false, array('jpg', 'png', 'gif'))->addValidator('Size', false, 1002400)->setDescription("Images")->setDestination('../public/upload/texto/');
     $this->addElement($foto);
     $this->addElement('submit', 'enviar', array('required' => false, 'ignore' => true, 'class' => 'submit-green'));
     $this->addElement('button', 'Listar', array('label' => 'Listar', 'required' => false, 'ignore' => true, 'order' => '1', 'class' => 'submit-gray', 'attribs' => array('onclick' => 'List("Texto/index")')));
     // decorado form com css
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => '<div>', 'class' => 'module-body'))->addDecorator('Form');
     $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Description'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p'))));
     $this->getElement('foto1')->setDecorators(array('File', 'Errors', array(array('td' => 'HtmlTag'), array('tag' => 'p')), array('Label', array('tag' => 'p')), array(array('tr' => 'HtmlTag'), array('tag' => 'p'))));
     $this->getElement('enviar')->removeDecorator('label')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => '<fieldset>', 'id' => 'element'))));
     $this->getElement('Listar')->removeDecorator('label');
 }
示例#17
0
 public function init()
 {
     $username = new Zend_Form_Element_Text('name');
     //  $username = $this->createElement('text', 'name');
     $username->setLabel('Username: *')->setRequired(true);
     //$username->addFilter(new Zend_Filter_HtmlEntities());
     $username->addFilter(new Zend_Filter_StripTags());
     $email = $this->createElement('text', 'email');
     $email->setLabel('Email: *')->setRequired(false);
     $password = $this->createElement('password', 'password');
     $password->setLabel('Password: *')->setRequired(true);
     $confirmPassword = $this->createElement('password', 'confirmPassword');
     $confirmPassword->setLabel('Confirm Password: *')->setRequired(true);
     //        $confirmPasswor = $this->createElement('text', 'image');
     //        $confirmPasswor->setLabel('Confirm image: *')
     //                ->setRequired(false);
     $image = new Zend_Form_Element_File('image');
     $image->setLabel("upload your iamge")->setDestination(APPLICATION_PATH . '/../public/data')->setRequired(true)->addValidator('Extension', false, array('jpg', 'jpeg', 'png'))->getValidator('Extension')->setMessage('This file type is not supportted.');
     // $image->setDestination('/www/coff/data');
     $this->setAttrib('enctype', 'multipart/form-data');
     $room_no = $this->createElement('text', 'room_no');
     $room_no->setLabel('Room number:')->setRequired(false);
     $ext = $this->createElement('text', 'ext');
     $ext->setLabel('Ext:')->setRequired(false);
     $register = $this->createElement('submit', 'register');
     $register->setLabel('Sign up')->setIgnore(true);
     $this->addElements(array($username, $email, $password, $confirmPassword, $image, $room_no, $ext, $register));
 }
示例#18
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input medium-input'));
     $statusOptions = array("multiOptions" => array(1 => 'Thuộc SGU', 0 => 'Liên kết trang mạng'));
     $is_sgu = new Zend_Form_Element_Radio('is_sgu', $statusOptions);
     $is_sgu->setRequired(true)->setLabel('Liên kết')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $url = new Zend_Form_Element_Text('url');
     $url->setLabel('Url (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/small/images/lien_ket')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $maxOrder = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getMaxOrderItem();
     $order = new Zend_Form_Element_Text('order');
     $order->setLabel('Thứ tự *')->setValue($maxOrder->order + 1)->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input tinysmall-input'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $Url = new Zend_View_Helper_Url();
     $link = $Url->url(array('module' => 'admin', 'controller' => 'lien-ket', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ten, $is_sgu, $url, $file, $order, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'lien_ket')), 'Form'));
 }
示例#19
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('registercomplete_form');
     $this->setAttrib('id', 'registercomplete_form');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $this->removeDecorator('DtDdWrapper');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel($translate->_("account-register-firstname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_firstname')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_firstname'))))->setDecorators(array('RegistercompleteDecorator'));
     $surname = new Zend_Form_Element_Text('surname');
     $surname->setLabel($translate->_("account-register-surname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_surname'))))->setAttrib('id', 'registercomplete_surname')->setDecorators(array('RegistercompleteDecorator'));
     $image = new Zend_Form_Element_File('image');
     $image->setLabel($translate->_("account-registercomplete-add-image"))->setDestination('../www/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 25600)->addValidator('Extension', false, 'jpg,png,gif')->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_image')->removeDecorator('DefaultDecorator')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'form_registercomplete_image', 'style' => 'display:block'))->addDecorator('Label', array('tag' => 'div', 'id' => 'form_registercomplete_image_label', 'style' => 'display:block'));
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setLabel($translate->_("account-register-bio"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_bio')->setAttribs(array("onkeydown" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");", "onkeyup" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");"))->setDescription($translate->_('account-register-bio-desc'))->setDecorators(array('RegistercompleteDecorator'));
     // $bio_counter here...
     $select_str = $translate->_("account-select");
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel($translate->_("account-register-country"))->setRequired(false)->removeDecorator('DtDdWrapper')->setMultiOptions(array($select_str, 'fi' => 'Finland'))->setAttrib('id', 'registercomplete_country')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_country'))))->setDecorators(array('RegistercompleteDecorator'));
     $deflang = new Zend_Form_Element_Select('deflang');
     $deflang->setLabel($translate->_("account-register-deflang"))->setMultiOptions(array($select_str, 'en' => 'English', 'fi' => 'Finnish'))->addFilter('StringToLower')->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_deflang'))))->setAttrib('id', 'registercomplete_deflang')->setDecorators(array('RegistercompleteDecorator'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-register-submit"))->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_submit')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_submit_div'))))->setAttrib('class', 'registrationcomplete_form_submit_' . $translate->getLocale())->setAttrib('disabled', 'true');
     $this->addElements(array($firstname, $surname, $image, $bio, $country, $deflang, $submit));
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->addDisplayGroup(array('firstname', 'surname', 'image', 'bio', 'country', 'deflang', 'submit'), 'allFields');
     $this->allFields->removeDecorator('DtDdWrapper');
     $this->allFields->setLegend('register-confirmations');
 }
示例#20
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $cateOptions = Khcn_Api::_()->getDbTable('loai_thong_tin', 'default')->getListAssoc();
     $loai_thong_tin_id = new Zend_Form_Element_Select('loai_thong_tin_id');
     $loai_thong_tin_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/thong_tin')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($loai_thong_tin_id, $tieu_de, $noi_dung, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
示例#21
0
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $signedUserInfo = $registry->get('signedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setRequired(false);
     $file->setLabel('What do you want to share today?');
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     $file->setMaxFileSize($maxFileSize);
     $file->setMultiFile(4);
     $file->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $this->addElement($file, 'file');
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submitupload', array('label' => 'Upload!', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
示例#22
0
 public function init()
 {
     $this->setName('f2')->setAttrib('class', 'form_create_nhan_su');
     $ho_ten = new Zend_Form_Element_Text('ho_ten');
     $ho_ten->setLabel('Họ tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $chuc_vu = new Zend_Form_Element_Text('chuc_vu');
     $chuc_vu->setLabel('Chức vụ')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $website = new Zend_Form_Element_Text('website');
     $website->setLabel('Website')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $so_dien_thoai = new Zend_Form_Element_Text('so_dien_thoai');
     $so_dien_thoai->setLabel('Số điện thoại')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Ảnh cá nhân')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/nhan_su/')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $maxOrder = Khcn_Api::_()->getDbTable('nhan_su', 'default')->getMaxOrder();
     $order = new Zend_Form_Element_Text('order');
     $order->setLabel('Số thứ tự')->setValue($maxOrder)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input tinysmall-input');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'gioi-thieu', 'action' => 'nhan-su'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Không lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ho_ten, $chuc_vu, $email, $website, $so_dien_thoai, $file, $order, $submit, $cancel));
     $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
示例#23
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('WhatIDoForm');
     // image, uploader
     $image = new Zend_Form_Element_File('Image');
     $image->setLabel('Image:')->setDestination('img/profile')->addValidator('Count', false, 1)->addValidator('Size', false, 10000000)->addValidator('Extension', false, 'jpg,png,gif')->addFilter('Rename', 'WhatIDo.jpg');
     // PictureCaption, string
     $pictureCaption = new Zend_Form_Element_Textarea('PictureCaption');
     $pictureCaption->setLabel('Picture caption:')->setRequired();
     // MainText, string
     $mainText = new Zend_Form_Element_Textarea('MainText');
     $mainText->setLabel('Main text:')->setRequired();
     // FooterText, string
     $footerText = new Zend_Form_Element_Textarea('FooterText');
     $footerText->setLabel('Footer text:')->setRequired();
     // LinkText, string
     $linkText = new Zend_Form_Element_Text('LinkText');
     $linkText->setLabel('Link text:')->setRequired();
     // LinkUrl, string
     $linkUrl = new Zend_Form_Element_Text('LinkUrl');
     $linkUrl->setLabel('Link Url:')->setRequired();
     // Submit button
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setLabel('Submit');
     $this->addElements(array($image, $pictureCaption, $mainText, $footerText, $linkText, $linkUrl, $submit));
 }
示例#24
0
	public function init()
	{
		$this->setMethod('post');

		$element = new Zend_Form_Element_File('imageUpload');
		$element->setLabel('选择要上传的图片:')
				->setDestination('images/upload')
				->setRequired(true);
				// ensure only 1 file
		$element->addValidator('Count', false, 1);
				// limit to 100K
		$element->addValidator('Size', false, 2024000);
				// only JPEG, PNG, and GIFs
		$element->addValidator('Extension', false, 'jpg');
		$this->addElement($element, 'imageUpload');

		$this->addElement(
			'textarea', 'description', array(
			'label' => '图片描述:',
			'class'=>'tbText',
			'cols'=> 60,
			'rows'=> 4
			)
		);
		
		$this->addElement(
			'submit','submit',array(
			'ignore'=>true,
			'class'=>'btUploadImage radius',
			'name'=>'上传'
			)
		);
	}
示例#25
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $quan_trong = new Zend_Form_Element_Select('quan_trong');
     $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $image = new Zend_Form_Element_Image('image');
     $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat');
     $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4'));
     $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet');
     $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea'));
     $pdf = new Zend_Form_Element_File('pdf');
     $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form'));
 }
示例#26
0
 public function init()
 {
     // Задаём имя форме
     $this->setName('warehouse');
     // Создаём переменную, которая будет хранить сообщение валидации
     $isEmptyMessage = 'Значение является обязательным и не может быть пустым';
     // Создаём элемент формы – text c именем = number
     $image = new Zend_Form_Element_File('image');
     $image->setLabel('Загрузить фотографию')->setDestination(DATA_PATH . '/public/img/')->addValidator('Size', false, '204800000')->addValidator('Extension', true, 'png,jpg,gif')->addValidator('ImageSize', false, array('minwidth' => 50, 'minheight' => 50, 'maxwidth' => 5000, 'maxheight' => 5000));
     $serial = new Zend_Form_Element_Text('serial', array('class' => 'form-control'));
     $serial->setLabel('Серийный номер')->setAttrib('placeholder', 'S\\N:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $isEmptyMessage)))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\-]{3,200}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $name = new Zend_Form_Element_Text('name', array('class' => 'form-control'));
     $name->setLabel('Название')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\- \\s ]{3,50}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $type = new Zend_Form_Element_Text('type', array('class' => 'form-control'));
     $type->setLabel('Тип')->setAttrib('placeholder', 'Viena,Royal,All')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[a-zA-Z0-9 \\- \\s]{3,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $remain = new Zend_Form_Element_Text('remain', array('class' => 'form-control'));
     $remain->setLabel('Остаток')->setAttrib('placeholder', 'кол-во')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9 \\-]{1,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $price = new Zend_Form_Element_Text('price', array('class' => 'form-control'));
     $price->setLabel('Цена')->setAttrib('placeholder', 'введите цену в грн')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9]{0,20}\$/i", 'messages' => 'Не верный формат ввода, для ввода доступны только цифры'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     // Создаём элемент hidden c именем = id
     $id = new Zend_Form_Element_Hidden('id');
     // Указываем, что данные в этом элементе фильтруются как число int
     $id->addFilter('Int')->removeDecorator('label')->removeDecorator('element');
     // Создаём элемент hidden c именем = id
     $path = new Zend_Form_Element_Hidden('path');
     // Указываем, что данные в этом элементе фильтруются как число int
     $path->removeDecorator('label')->removeDecorator('element');
     // Создаём элемент формы Submit c именем = submit
     $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-default'));
     // Добавляем все созданные элементы к форме.
     $this->addElements(array($id, $serial, $name, $type, $remain, $price, $image, $submit, $path));
 }
示例#27
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed');
     $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $youtube_embed = new Zend_Form_Element_Text('youtube_embed');
     $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_nct = new Zend_Form_Element_Text('link_nct');
     $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_mp3 = new Zend_Form_Element_Text('link_mp3');
     $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
示例#28
0
 public function init()
 {
     $this->setMethod('post');
     $subject = new \Zend_Form_Element_Text('subject');
     $message = new \Zend_Form_Element_Textarea('message');
     $priorityId = new \Zend_Form_Element_Select('priorityId');
     $categories = new \Zend_Form_Element_Select('categories', array('multiple' => true));
     $file = new \Zend_Form_Element_File('file');
     $submit = new \Zend_Form_Element_Button('submit');
     $cancel = new \Zend_Form_Element_Button('cancel');
     $subject->setLabel('Konu:')->setAttrib('placeholder', 'Konu giriniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!'));
     $message->setLabel('Mesaj:')->setAttrib('placeholder', 'Mesaj giriniz!')->setAttrib('class', 'form-control')->setAttrib('rows', '5')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!'));
     $priorityId->setLabel('Öncelik:')->setAttrib('placeholder', 'Öncelik seçiniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!'));
     $categories->setLabel('Kategori:')->setAttrib('placeholder', 'Kategori seçiniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setValidators(array('StringLength'))->setErrorMessages(array('StringLength' => 'En az bir adet seçmelisiniz!', 'reuqired' => 'Bu alan zorunludur'));
     $file->setLabel('File')->setAttrib('enctype', 'multipart/form-data')->setAttrib('accept', 'image/*')->setAttrib('id', 'upload')->setDestination('/var/www/destek-sistemi/web/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 8388608)->addValidator('Extension', false, 'png,jpg');
     $submit->setLabel('Kaydet')->setAttrib('class', 'btn btn-lg btn-primary btn-block')->setAttrib('type', 'submit');
     $cancel->setLabel('İptal')->setAttrib('class', 'btn btn-md btn-default btn-block')->setAttrib('type', 'reset');
     //$hash->setIgnore(true);
     // add elements
     $this->addElements(array($subject, $message, $priorityId, $categories, $file, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('subject', 'message', 'priorityId', 'categories', 'submit', 'cancel'), 'ticketForm');
     // set decorators
     \EasyBib_Form_Decorator::setFormDecorator($this, \EasyBib_Form_Decorator::BOOTSTRAP_MINIMAL, 'submit', 'cancel');
 }
示例#29
0
		function setForm()
		{
			$form = new Zend_Form;
			$form->setMethod('post')->setAction('');
			//$this->setAttrib('enctype','multipart/form-data');
			
			$file = new Zend_Form_Element_File('video_file');
			//$file->setAttrib('class','file');
			$file->setLabel('video_file');
           	$file->setRequired(true);
           	
			$video_title = new Zend_Form_Element_Text('video_title');
			$video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống'));
			
			$video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail');
			$video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label');
			
			$video_description = new Zend_Form_Element_Textarea('video_description');
			$video_description->setAttrib('rows','7');
			$video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống'));
			
			$is_active = new Zend_Form_Element_Radio('is_active');
			$is_active->setRequired(true)
					->setLabel('is_active')
					->setMultiOptions(array("1" => "Có","0" => "Không"));
			
			$file->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_title->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_description->removeDecorator('HtmlTag')->removeDecorator('Label');
			$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');		
			
			$form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail));
			return $form;
		}
 protected function tvinciElements()
 {
     // Ingest Configuration
     $this->addElement('text', 'ingest_url', array('label' => 'Ingest url:', 'filters' => array('StringTrim')));
     $this->addElement('text', 'username', array('label' => 'Username:'******'filters' => array('StringTrim')));
     $this->addElement('text', 'password', array('label' => 'Password:'******'filters' => array('StringTrim')));
     $this->addDisplayGroup(array('ingest_url', 'username', 'password'), 'ingest', array('legend' => 'Ingest URL Configuration', 'decorators' => array('FormElements', 'Fieldset')));
     // tag specific configuration
     $this->addTagItems("ism");
     $this->addTagItems("ipadnew");
     $this->addTagItems("iphonenew");
     $this->addTagItems("mbr");
     $this->addTagItems("dash");
     $this->addTagItems("widevine");
     $this->addTagItems("widevine_mbr");
     // xslt configuration
     $this->addElement('file', 'xsltFile', array('label' => 'XSLT:'));
     $element = new Zend_Form_Element_File('xsltFile');
     $element->setLabel('XSLT:');
     // limit only 1 file
     $element->addValidator('Count', true, 1);
     // limit to 100K (the default one is 31K)
     $element->addValidator('Size', true, 102400);
     // only XML related file extensions
     $element->addValidator('Extension', true, 'xml,xslt,xsl');
     $element->addValidator(new XSLTFileValidator());
     $this->addElement($element, 'xsltFile');
     $this->addElement('textarea', 'xsltFileText', array('label' => 'XSLT Data:', 'rows' => '2', 'cols' => '50', 'readonly' => '1'));
     $this->addDisplayGroup(array('xsltFile', 'xsltFileText'), 'additional', array('legend' => 'Additional Configuration', 'decorators' => array('FormElements', 'Fieldset')));
 }