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


PHP Zend_Form_Element_File::setRequired方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $this->setAction("user/files/addfile");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oOrderId = new Zend_Form_Element_Text("id");
     $oOrderId->setLabel("Numer zamówienia:");
     $oOrderId->addValidator(new Zend_Validate_Digits());
     $oOrderId->setRequired(TRUE);
     $this->addElement($oOrderId);
     $oScannedFile = new Zend_Form_Element_File("files");
     $oScannedFile->setLabel("Plik:");
     $oScannedFile->setRequired(TRUE);
     $this->addElement($oScannedFile);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("user");
     $oViewScript->setViewScript("_forms/uploadscannedfile.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
开发者ID:lstaszak,项目名称:zf_zk_aleph,代码行数:29,代码来源:UploadScannedFile.php

示例2: init

 public function init()
 {
     global $mySession;
     $PathType = '1';
     if (isset($_REQUEST['path_type'])) {
         $PathType = $_REQUEST['path_type'];
     }
     $video_title = new Zend_Form_Element_Text('video_title');
     $video_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput");
     $pathtypeArr = array();
     $pathtypeArr[0]['key'] = "1";
     $pathtypeArr[0]['value'] = "Computer";
     $pathtypeArr[1]['key'] = "2";
     $pathtypeArr[1]['value'] = "You Tube Url";
     $path_type = new Zend_Form_Element_Radio('path_type');
     $path_type->addMultiOptions($pathtypeArr)->setAttrib("onclick", "setType(this.value);")->setValue(1);
     $video_path = new Zend_Form_Element_File('video_path');
     $video_path->setDestination(SITE_ROOT . 'images/videos/')->addValidator('Extension', false, 'flv');
     $you_tube_url = new Zend_Form_Element_Text('you_tube_url');
     $you_tube_url->setAttrib("class", "textInput");
     if ($PathType == '1') {
         $video_path->setRequired(true)->addDecorator('Errors', array('class' => 'error'));
     } else {
         $you_tube_url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'You tube url is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $this->addElements(array($video_title, $video_path, $you_tube_url, $path_type));
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:27,代码来源:Video.php

示例3: setForm

		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;
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:34,代码来源:VideoController.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

 public function init()
 {
     $this->setName('photo_gallery');
     $photo_name = new Zend_Form_Element_File('photo_name');
     $photo_name->setRequired(true)->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
     // only JPEG, PNG, and GIFs
     $caption = new Zend_Form_Element_Text('caption', array('disableLoadDefaultDecorators' => true));
     $caption->setAttrib('id', 'caption')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $link = new Zend_Form_Element_Text('link', array('disableLoadDefaultDecorators' => true));
     $link->setAttrib('id', 'link')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $description = new Zend_Form_Element_Textarea('description', array('disableLoadDefaultDecorators' => true));
     $description->setAttrib('id', 'editor1')->setAttrib('name', 'description')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $category = new Zend_Form_Element_Select('category', array('disableLoadDefaultDecorators' => true));
     $category->setAttrib("id", "category")->setAttrib("class", "dropdown form-control")->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $data = new Application_Model_PGCategory();
     $results = $data->getAllCategoriesNames()->toArray();
     foreach ($results as $result) {
         $category->addMultiOption($result['pg_cat_id'], $value = $result['category_name']);
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-md 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('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('photo_name', 'category', 'caption', 'description', 'link'));
     $this->addElements(array($photo_name, $category, $caption, $description, $link, $submit));
 }
开发者ID:aliinfotech,项目名称:netefct,代码行数:25,代码来源:GalleryForm.php

示例6: init

 public function init()
 {
     $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'div_form'))->addDecorator('Form');
     $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p', 'class' => 'element-group'))));
     $this->addElement('text', 'nombre', array('label' => 'Nombre * ', 'required' => true, 'filters' => array('StripTags')));
     $validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
     $this->nombre->setAttrib('placeholder', 'Nombre');
     $this->nombre->addValidator($validator);
     $this->nombre->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras'));
     $this->addElement('text', 'apellido', array('label' => 'Apellido  *', 'value' => '', 'required' => true, 'filters' => array('StripTags')));
     $this->apellido->setAttrib('placeholder', 'Apellido');
     $this->apellido->addValidator($validator)->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras'));
     $this->addElement('text', 'telefono', array('label' => 'Telefono', 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $this->telefono->addValidator('digits')->setErrorMessages(array('messages' => 'El campo nombre solo puede contener numeros'));
     $this->addElement('text', 'domicilio', array('label' => 'Domicilio', 'filters' => array('StringTrim', 'StripTags')));
     $this->addElement('password', 'contraseña', array('label' => 'Contraseña *', 'filters' => array('StringTrim', 'StripTags')));
     $this->contraseña->addValidator('stringLength', false, array(6, 50))->setErrorMessages(array('messages' => 'La Contraseña debe tener como minimo 6 caracteres'));
     $this->addElement('password', 'verifypassword', array('label' => 'Verifica la Contraseña', 'required' => true, 'validators' => array(array('identical', true, array('contraseña')))));
     $this->addElement('text', 'email', array('label' => 'Email *', 'required' => true, 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $this->email->setAttrib('placeholder', 'Email@Host.cl');
     $this->email->addValidator('EmailAddress', TRUE);
     $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('usuarios', 'email');
     $this->email->addValidator($db_lookup_validator);
     $element = new Zend_Form_Element_File('element');
     $element->setRequired(false)->setLabel('Subir Imagen de Perfil')->setValueDisabled(true)->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this->addElement($element);
     $check = new Zend_Form_Element_Checkbox('check');
     $check->setLabel('Acepto el envio de promociones e Informacion por parte del Restaurant *')->setUncheckedValue(null)->setRequired()->setDecorators(array('ViewHelper', 'Description', 'Errors', array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'div', 'class' => 'terminos'))));
     $this->addElement($check);
     $this->addElement('submit', 'Enviar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group')))));
 }
开发者ID:JosefinaArayaTapia,项目名称:Capicua-Restobar,代码行数:33,代码来源:RegistrarCliente.php

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

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

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

示例10: init

 public function init()
 {
     $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'div_form'))->addDecorator('Form');
     $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p', 'class' => 'element-group'))));
     $this->addElement('text', 'nombre', array('label' => 'Nombre', 'value' => '', 'required' => true, 'filters' => array('StripTags')));
     $validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
     $this->nombre->addValidator($validator);
     $this->nombre->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras'));
     $this->addElement('textarea', 'descripcion', array('label' => 'Descripcion'));
     $menus = new Application_Model_DbTable_TipoProductos();
     $tipo_menu = $menus->select_tipoProducto();
     $this->addElement('select', 'id_tipo_producto', array('label' => 'Tipo de Producto'));
     $this->id_tipo_producto->addmultiOptions($tipo_menu);
     $this->addElement('text', 'precio', array('label' => 'Precio', 'value' => '', 'required' => true, 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $validatorDigit = new Zend_Validate_Digits();
     $this->precio->addValidator($validatorDigit);
     $this->precio->setErrorMessages(array('messages' => 'El campo precio solo puede contener Numeros'));
     $this->addElement('text', 'puntos_producto', array('label' => 'Puntos', 'value' => '', 'required' => true, 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $this->puntos_producto->addValidator($validatorDigit);
     $this->puntos_producto->setErrorMessages(array('messages' => 'El campo puntos solo puede contener Numeros'));
     $this->addElement('hidden', 'imagen');
     $element = new Zend_Form_Element_File('element');
     $element->setRequired(false)->setLabel('Subir Imagen')->setValueDisabled(true)->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this->addElement($element);
     $this->addElement('submit', 'Agregar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group')))));
 }
开发者ID:JosefinaArayaTapia,项目名称:Capicua-Restobar,代码行数:28,代码来源:Agregarproducto.php

示例11: init

 public function init()
 {
     $this->setName('article');
     $this->setIsArray(true);
     $this->name = new Zend_Form_Element_Text('name');
     $this->description = new Zend_Form_Element_Textarea('description');
     $this->image = new Zend_Form_Element_File('image');
     $this->draft = new Zend_Form_Element_Submit('draft');
     $this->submit = new Zend_Form_Element_Submit('submit');
     $this->name->setRequired(true)->setAttrib('class', 'span6')->setAttrib('style', 'padding:10px;');
     $this->description->setRequired(true);
     $this->image->setRequired(true)->setDestination(UPLOAD_FOLDER . 'article/')->addValidator(new Zend_Validate_File_Extension('jpg,png'));
     $this->submit->setAttrib('class', 'btn btn-success');
     $this->draft->setAttrib('class', 'btn');
     $this->addElements(array($this->name, $this->description, $this->image, $this->draft, $this->submit));
     $this->setElementDecorators(array('ViewHelper', 'Errors'), array('image'), false);
     $this->image->setDecorators(array('File'));
 }
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:18,代码来源:ArticleForm.php

示例12: testAutoInsertNotEmptyValidator

 /**
  * @group ZF-12210
  */
 public function testAutoInsertNotEmptyValidator()
 {
     $this->testElementShouldAllowSpecifyingAdapterUsingConcreteInstance();
     $this->element->setRequired(true);
     // Test before validation
     $this->assertNull($this->element->getValidator('NotEmpty'));
     // Test after validation
     $this->element->isValid('foo.jpg');
     $this->assertTrue($this->element->getValidator('NotEmpty') instanceof Zend_Validate_NotEmpty);
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:13,代码来源:FileTest.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

 public function init()
 {
     $file = new Zend_Form_Element_File('file');
     $file->setRequired(true)->addValidator('Extension', false, 'csv')->addValidator('Size', false, 1048576 * 2)->addValidator('Count', false, 1);
     $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+'/locale/translate-messages/'");
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Upload CSV file');
     $this->setAttrib('enctype', 'multipart/form-data')->setMethod('post')->addElement($file)->addElement($cancel)->addElement($submit);
 }
开发者ID:zelimirus,项目名称:yard,代码行数:12,代码来源:UploadTranslate.php

示例15: init

 public function init($blogid)
 {
     //echo $blogid; die;
     global $mySession;
     $db = new Db();
     $image_value = "";
     $blogtitle_value = "";
     $blogdesc_value = "";
     $status_value = "";
     $blog_value = "";
     $old_image_value = "";
     if ($blogid != "") {
         $Data = $db->runQuery("select * from " . BLOGPOST . " where blog_id='" . $blogid . "'");
         //$image_value=$Data[0]['post_image'];
         $blogtitle_value = $Data[0]['blog_title'];
         $blogdesc_value = $Data[0]['blog_desc'];
         $image_value = $Data[0]['blog_image'];
         $status_value = $Data[0]['blog_status'];
         $old_image_value = $Data[0]['blog_image'];
     }
     $old_image = new Zend_Form_Element_Hidden('old_image');
     $old_image->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($old_image_value);
     $this->addElement($old_image);
     $image = new Zend_Form_Element_File('image');
     $image->setDestination(SITE_ROOT . 'images/blogimg/');
     if ($blogid == "") {
         $image->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select a photo.'));
     }
     $image->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'))->setValue($image_value);
     $this->addElement($image);
     $blogtitle = new Zend_Form_Element_Text('blogtitle');
     $blogtitle->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:165px;")->setValue($blogtitle_value);
     $this->addElement($blogtitle);
     $blog_description = new Zend_Form_Element_Textarea('blog_description');
     $blog_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter this field.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:170px; height:60px;")->setValue($blogdesc_value);
     $this->addElement($blog_description);
     //echo "dfs"; die;
     $StatusArr = array();
     $StatusArr[0]['key'] = "1";
     $StatusArr[0]['value'] = "Active";
     $StatusArr[1]['key'] = "0";
     $StatusArr[1]['value'] = "Inactive";
     $blog_status = new Zend_Form_Element_Select('blog_status');
     $blog_status->addMultiOptions($StatusArr)->setAttrib("class", "textInput")->setValue($status_value);
     $this->addElement($blog_status);
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:46,代码来源:Blog.php


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