当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_File::setLabel方法代码示例

本文整理汇总了PHP中Zend_Form_Element_File::setLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::setLabel方法的具体用法?PHP Zend_Form_Element_File::setLabel怎么用?PHP Zend_Form_Element_File::setLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_File的用法示例。


在下文中一共展示了Zend_Form_Element_File::setLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nodeForm

 /**
  * 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
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:38,代码来源:Node.php

示例2: __construct

 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));
 }
开发者ID:ashikkalavadiya,项目名称:zendapp,代码行数:30,代码来源:ProductForm.php

示例3: init

 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));
 }
开发者ID:mayconheerdt,项目名称:zfSkeleton,代码行数:28,代码来源:EnviarArquivo.php

示例4: init

 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)))));
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:28,代码来源:Upload.php

示例5: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:36,代码来源:UserForm.php

示例6: __construct

 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');
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:27,代码来源:AddRulerImageForm.php

示例7: init

 /**
  * 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'));
 }
开发者ID:cngroupdk,项目名称:InterviewMe_Tym3,代码行数:30,代码来源:ApplicantFormOnlyAttachment.php

示例8: init

 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));
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:25,代码来源:Advice.php

示例9: init

 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));
 }
开发者ID:ranahedia,项目名称:RNR,代码行数:32,代码来源:Thread.php

示例10: getAddContentForm

 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;
 }
开发者ID:seant23,项目名称:red,代码行数:29,代码来源:ContentController.php

示例11: init

 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');
 }
开发者ID:cliftonscott,项目名称:EasyBib_Form_Decorator,代码行数:29,代码来源:ExampleForm.php

示例12: init

 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'));
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:26,代码来源:SHCD.php

示例13: init

 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'));
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:34,代码来源:Create_BK.php

示例14: buildFileUpload

 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;
 }
开发者ID:olhsha,项目名称:OpenSKOS2tempMeertens,代码行数:29,代码来源:UploadIcon.php

示例15: init

 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')));
 }
开发者ID:richardlawson,项目名称:gcblog,代码行数:26,代码来源:BlogEntry.php


注:本文中的Zend_Form_Element_File::setLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。