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


PHP Zend_Form_Element_File::addValidator方法代码示例

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


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

示例1: 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

示例2: init

	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'=>'上传'
			)
		);
	}
开发者ID:robliuning,项目名称:Luckyrabbit,代码行数:33,代码来源:ImageSave.php

示例3: 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

示例4: 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

示例5: init

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

示例6: 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

示例7: 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

示例8: 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

示例9: __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

示例10: tvinciElements

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

示例11: init

 public function init()
 {
     $this->setAttribs(array('id' => 'form-exposicao-add'));
     // exposicao_nome
     $exposicao_nome = new Zend_Form_Element_Text("exposicao_nome");
     $exposicao_nome->setLabel("Nome da Exposição:");
     $exposicao_nome->setAttrib('placeholder', 'Digite o nome de sua exposição');
     $exposicao_nome->setRequired();
     //exposicao_descricao
     $exposicao_descricao = new Zend_Form_Element_Textarea("exposicao_descricao");
     $exposicao_descricao->setLabel("Descrição da Exposição:");
     $exposicao_descricao->setAttrib('placeholder', 'Conte aos usuários sobre sua exposição');
     $exposicao_descricao->setAttrib('rows', 10);
     $exposicao_descricao->setRequired();
     // tipo_exposicao_id
     $tipo_exposicao_id = new Zend_Form_Element_Select("tipo_exposicao_id");
     $tipo_exposicao_id->setLabel("Categoria da Exposição:");
     $tipo_exposicao_id->setRequired();
     $tipo_exposicao_id->setMultiOptions($this->getTipoExposicao());
     //exposicao_capa
     $exposicao_capa = new Zend_Form_Element_File("files");
     $exposicao_capa->setLabel("Selecione a capa:");
     $exposicao_capa->setDestination(Zend_Registry::get('config')->path->images->exposicao->capa);
     $exposicao_capa->addValidator('Extension', false, 'jpg,png,gif');
     $exposicao_capa->addValidator('Size', false, 2097152)->setMaxFileSize(2097152);
     $exposicao_capa->setAttrib('id', 'exposicao_capa');
     $exposicao_capa->setRequired();
     // add elements
     $this->addElement($exposicao_nome);
     $this->addElement($exposicao_descricao);
     $this->addElement($tipo_exposicao_id);
     $this->addElement($exposicao_capa);
     parent::init();
 }
开发者ID:nandorodpires2,项目名称:gallery,代码行数:34,代码来源:Add.php

示例12: init

 public function init()
 {
     $media_library_model = new Cms_Model_MediaLibraries();
     $media_library = $media_library_model->getByPath($this->_attribs['media_library_path']);
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title');
     $title->setRequired(true);
     $title->addFilter('StringTrim');
     $title->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $this->addElement($title);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description');
     $description->addFilter('StringTrim');
     $description->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $this->addElement($description);
     $original = new Zend_Form_Element_File('original');
     $original->addValidator('Count', false, 1);
     $original->addValidator('Extension', false, 'jpeg,jpg,png');
     $original->addFilter('Rename', $this->_attribs['file_name']);
     $original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original'));
     $original->setLabel('Image:');
     $this->addElement($original);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Potvrdi');
     $this->setAction('')->setMethod('post')->addElement($submit);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'");
     $this->addElement($cancel);
 }
开发者ID:zelimirus,项目名称:yard,代码行数:32,代码来源:Medias.php

示例13: init

    public function init()
    {
        $this->setMethod('post');
        $this->setAttrib('enctype', 'multipart/form-data');

        $photo = new Zend_Form_Element_File('photo');
        $photo->setLabel('photo.upload');
        $photo->setDestination($this->getAttrib('tmp'));

        $photo->addValidator('Count', false, 1);
        $photo->addValidator('Size', false, $this->getAttrib('filesize'));
        $photo->addValidator(
            'Extension', false, $this->getAttrib('extensions')
        );

        $photo->setRequired(true);
        $photo->removeDecorator('Errors');

        $this->addElement($photo, 'photo');

        $fbId = new Zend_Form_Element_Hidden('fbid');
        $fbId->addValidator(
            'Db_NoRecordExists', false,
            array(
                'table' => 'zdjecia',
                'field' => 'fbuserid'
            )
        );
        $fbId->setLabel('fbid');

        $fbId->setRequired(true);
        $fbId->removeDecorator('Errors');
        $fbId->removeDecorator('Label');

        $this->addElement($fbId);

        $save = new Zend_Form_Element_Submit('Save');
        $save->setLabel('Zgłoś Zdjęcie');
        $save->setAttrib('class', 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only');

        $this->addElement($save);

        $this->addDecorator(
                new Zend_Form_Decorator_FormErrors(
                    array(
                        'ignoreSubForms'=>true,
                        'markupListStart' => '<ul class="ui-state-error ui-corner-all">',
                    )
                )
            )
            ->addDecorator('FormElements')
            ->addDecorator('HtmlTag')
            ->addDecorator('Form');
    }
开发者ID:robsohn,项目名称:portret-jesienny,代码行数:54,代码来源:Zdjecie.php

示例14: init

 function init()
 {
     parent::init();
     $this->addElement(new Zend_Form_Element_Hidden('idMarca'));
     $this->addElement(new Zend_Form_Element_Text('nombreMarca', array('label' => 'Nombre Marca:', 'required' => true, 'maxlength' => '100', 'validators' => array('NoRecordExists' => new Zend_Validate_Db_NoRecordExists(array('table' => 'marca', 'field' => 'NombreMarca')), 'AlfaNum' => new Zend_Validate_Alnum(true)), 'size' => '40')));
     $this->addElement(new Zend_Form_Element_Image('imagenUpload'));
     $element = new Zend_Form_Element_File('imagenMarca');
     $element->setLabel('Upload an image:')->setDestination(APPLICATION_PATH . '/../public/dinamic/img/marca/');
     $element->addValidator('Count', false, 1);
     $element->addValidator('Size', false, 1024000);
     $element->addValidator('Extension', false, 'jpg,png,gif');
     $this->addElement($element);
     $this->addElement(new Zend_Form_Element_Submit('Enviar', array('attribs' => array('class' => 'submit-button'))));
 }
开发者ID:nazart,项目名称:IteraZend,代码行数:14,代码来源:RegistroMarca.php

示例15: init

 public function init()
 {
     $this->setName('add_video_link');
     //$this->setAction('newExpert');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
     $title->setRequired(true)->setLabel('* Video Title:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $url_video = new Zend_Form_Element_Text('url_video', array('disableLoadDefaultDecorators' => true));
     $url_video->setRequired(true)->setLabel('* Video URL:')->setAttrib('id', 'url_video')->addValidator('NotEmpty')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim')->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Short Description:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->addFilter('StringTrim');
     $video_img = new Zend_Form_Element_File('video_img');
     //$video_img->setRequired(true)
     $video_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 1000, 'minheight' => 100, 'maxheight' => 1000))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
     $is_main->setAttrib("id", "is_main")->setLabel('Mark main video:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
     //$this->addElement('hash', 'csrf', array('ignore' => true,));
     $this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
 }
开发者ID:habbash18,项目名称:netefct,代码行数:27,代码来源:AddVideoLinkForm.php


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