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


PHP Zend_Form_Element_File类代码示例

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


在下文中一共展示了Zend_Form_Element_File类的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: 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

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

 public function myInit($Id)
 {
     global $mySession;
     $db = new Db();
     if ($Id != "") {
         $adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'");
         $title_value = $adminData[0]['title'];
         $oldicon_value = $adminData[0]['icon'];
         $colorcode_value = $adminData[0]['colorcode'];
     } else {
         $title_value = '';
         $oldicon_value = '';
         $colorcode_value = '';
     }
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value);
     $colorcode = new Zend_Form_Element_Text('colorcode');
     $colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value);
     $this->addElement($colorcode);
     $this->addElement($title);
     if ($Id == "") {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
     } else {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox");
     }
     $this->addElement($image);
     if ($Id != "") {
         $oldicon = new Zend_Form_Element_Hidden('oldicon');
         $oldicon->setValue($oldicon_value);
         $this->addElement($oldicon);
         $this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;")))));
     }
 }
开发者ID:artyomvolodyev,项目名称:php,代码行数:35,代码来源:Icons.php

示例5: uploadImage

 /**
  * upload image
  *
  * @param  string  $base64
  */
 public function uploadImage($base64 = 'no')
 {
     $tmpFile = tempnam(Tinebase_Core::getTempDir(), '');
     $file = new Zend_Form_Element_File('file');
     $maxsize = $file->getMaxFileSize();
     $sessionId = Tinebase_Core::get(Tinebase_Session::SESSIONID);
     if (move_uploaded_file($_FILES['upload']['tmp_name'], $tmpFile)) {
         $image_id = str_replace(Tinebase_Core::getTempDir() . '/', '', $tmpFile);
         $image_size = filesize($tmpFile);
         if ($base64 === 'yes') {
             // converts image to base64
             try {
                 $image = file_get_contents($tmpFile);
                 $encoded_data = base64_encode($image);
                 echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '", "base64":"' . $encoded_data . '"}';
             } catch (Exception $e) {
                 echo '{"success":false, "error":' . $e . description . '}';
             }
         } else {
             echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '"}';
         }
     } else {
         echo '{"success":false, "method":"uploadImage", "maxsize":"' . $maxsize . '"}';
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:30,代码来源:Http.php

示例6: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('registercomplete_form');
     $this->setAttrib('id', 'registercomplete_form');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $this->removeDecorator('DtDdWrapper');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel($translate->_("account-register-firstname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_firstname')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_firstname'))))->setDecorators(array('RegistercompleteDecorator'));
     $surname = new Zend_Form_Element_Text('surname');
     $surname->setLabel($translate->_("account-register-surname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_surname'))))->setAttrib('id', 'registercomplete_surname')->setDecorators(array('RegistercompleteDecorator'));
     $image = new Zend_Form_Element_File('image');
     $image->setLabel($translate->_("account-registercomplete-add-image"))->setDestination('../www/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 25600)->addValidator('Extension', false, 'jpg,png,gif')->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_image')->removeDecorator('DefaultDecorator')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'form_registercomplete_image', 'style' => 'display:block'))->addDecorator('Label', array('tag' => 'div', 'id' => 'form_registercomplete_image_label', 'style' => 'display:block'));
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setLabel($translate->_("account-register-bio"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_bio')->setAttribs(array("onkeydown" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");", "onkeyup" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");"))->setDescription($translate->_('account-register-bio-desc'))->setDecorators(array('RegistercompleteDecorator'));
     // $bio_counter here...
     $select_str = $translate->_("account-select");
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel($translate->_("account-register-country"))->setRequired(false)->removeDecorator('DtDdWrapper')->setMultiOptions(array($select_str, 'fi' => 'Finland'))->setAttrib('id', 'registercomplete_country')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_country'))))->setDecorators(array('RegistercompleteDecorator'));
     $deflang = new Zend_Form_Element_Select('deflang');
     $deflang->setLabel($translate->_("account-register-deflang"))->setMultiOptions(array($select_str, 'en' => 'English', 'fi' => 'Finnish'))->addFilter('StringToLower')->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_deflang'))))->setAttrib('id', 'registercomplete_deflang')->setDecorators(array('RegistercompleteDecorator'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-register-submit"))->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_submit')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_submit_div'))))->setAttrib('class', 'registrationcomplete_form_submit_' . $translate->getLocale())->setAttrib('disabled', 'true');
     $this->addElements(array($firstname, $surname, $image, $bio, $country, $deflang, $submit));
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->addDisplayGroup(array('firstname', 'surname', 'image', 'bio', 'country', 'deflang', 'submit'), 'allFields');
     $this->allFields->removeDecorator('DtDdWrapper');
     $this->allFields->setLegend('register-confirmations');
 }
开发者ID:jannev,项目名称:site,代码行数:31,代码来源:RegistercompleteForm.php

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

示例8: myInit

 public function myInit()
 {
     global $mySession;
     $db = new Db();
     $public_name = "";
     $emailid_val = "";
     $bio_value = '';
     $old_profile_image_value = '';
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['public_name'];
         $emailid_val = $qur[0]['emailid'];
         $bio_value = $qur[0]['bio'];
         $old_profile_image_value = $qur[0]['profile_image'];
     }
     $publicname = new Zend_Form_Element_Text('publicname');
     $publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
     $profile_image = new Zend_Form_Element_File('profile_image');
     $profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->setValue($old_profile_image_value);
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
     $this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:27,代码来源:Profile.php

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

示例10: init

 public function init()
 {
     $this->setName("Texto");
     $this->setAttrib('accept-charset', 'utf-8');
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $this->addElement('hidden', 'id', '1');
     $this->addElement('text', 'rotulo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Rotulo deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Rotulo:', 'class' => 'input-long'));
     $this->addElement('text', 'titulo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Titulo deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Titulo:', 'class' => 'input-long'));
     $this->addElement('textarea', 'comentario', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Destaque deve ser informado'), 'breakChainOnFailure' => true)), 'required' => true, 'label' => 'Destaque:', 'class' => 'ckeditor'));
     $this->addElement('select', 'ativo', array('filters' => array('StringTrim'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Status deve ser informado'), 'breakChainOnFailure' => true), array('StringLength', false, array(0, 150))), 'required' => true, 'label' => 'Status:', 'class' => 'input-short', 'MultiOptions' => array('' => '-- Selesionar --', 'Sim' => 'Sim', 'Não' => 'Não')));
     $this->addElement('hidden', 'foto', '1');
     $foto = new Zend_Form_Element_File('foto1');
     $foto->setLabel('Foto:')->addValidator('Extension', false, array('jpg', 'png', 'gif'))->addValidator('Size', false, 1002400)->setDescription("Images")->setDestination('../public/upload/texto/');
     $this->addElement($foto);
     $this->addElement('submit', 'enviar', array('required' => false, 'ignore' => true, 'class' => 'submit-green'));
     $this->addElement('button', 'Listar', array('label' => 'Listar', 'required' => false, 'ignore' => true, 'order' => '1', 'class' => 'submit-gray', 'attribs' => array('onclick' => 'List("Texto/index")')));
     // decorado form com css
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => '<div>', 'class' => 'module-body'))->addDecorator('Form');
     $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Description'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p'))));
     $this->getElement('foto1')->setDecorators(array('File', 'Errors', array(array('td' => 'HtmlTag'), array('tag' => 'p')), array('Label', array('tag' => 'p')), array(array('tr' => 'HtmlTag'), array('tag' => 'p'))));
     $this->getElement('enviar')->removeDecorator('label')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => '<fieldset>', 'id' => 'element'))));
     $this->getElement('Listar')->removeDecorator('label');
 }
开发者ID:conectapb,项目名称:sysagroweb,代码行数:25,代码来源:Texto.php

示例11: init

 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input medium-input'));
     $statusOptions = array("multiOptions" => array(1 => 'Thuộc SGU', 0 => 'Liên kết trang mạng'));
     $is_sgu = new Zend_Form_Element_Radio('is_sgu', $statusOptions);
     $is_sgu->setRequired(true)->setLabel('Liên kết')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $url = new Zend_Form_Element_Text('url');
     $url->setLabel('Url (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/small/images/lien_ket')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $maxOrder = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getMaxOrderItem();
     $order = new Zend_Form_Element_Text('order');
     $order->setLabel('Thứ tự *')->setValue($maxOrder->order + 1)->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input tinysmall-input'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $Url = new Zend_View_Helper_Url();
     $link = $Url->url(array('module' => 'admin', 'controller' => 'lien-ket', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ten, $is_sgu, $url, $file, $order, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'lien_ket')), 'Form'));
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:27,代码来源:LienKet.php

示例12: init

 /**
  *
  * Change network background
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $background_image = new Zend_Form_Element_File('background');
     $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $background_color = new Zend_Form_Element_Text('background_color');
     $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input');
     $background_repeat = new Zend_Form_Element_Checkbox('background_repeat');
     $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_scroll = new Zend_Form_Element_Checkbox('background_scroll');
     $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_stretch = new Zend_Form_Element_Checkbox('background_stretch');
     $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0");
     $disable_image = new Zend_Form_Element_Checkbox('background_noimage');
     $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit));
     $this->postInit();
 }
开发者ID:georgepaul,项目名称:songslikesocial,代码行数:32,代码来源:SettingsBackground.php

示例13: init

 public function init()
 {
     $this->setName('add_testimonial');
     //$this->setAction('newExpert');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
     $first_name->setRequired(true)->setLabel('* First Name:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
     $last_name->setRequired(true)->setLabel('* Last Name:')->setAttrib('id', 'url_video')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
     $email->setRequired(true)->setLabel('* Email:')->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Testimonial:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
     $image1 = new Zend_Form_Element_File('image1');
     //$image1->setRequired(true)
     $image1->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 400, 'minheight' => 100, 'maxheight' => 400))->addValidator('Size', false, 1000240000)->setErrorMessages(array("*Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif');
     // 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');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $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('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
     //$this->addElement('hash', 'csrf', array('ignore' => true,));
     $this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
 }
开发者ID:habbash18,项目名称:netefct,代码行数:27,代码来源:AddTestimonialForm.php

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

示例15: init

 public function init()
 {
     $username = new Zend_Form_Element_Text('name');
     //  $username = $this->createElement('text', 'name');
     $username->setLabel('Username: *')->setRequired(true);
     //$username->addFilter(new Zend_Filter_HtmlEntities());
     $username->addFilter(new Zend_Filter_StripTags());
     $email = $this->createElement('text', 'email');
     $email->setLabel('Email: *')->setRequired(false);
     $password = $this->createElement('password', 'password');
     $password->setLabel('Password: *')->setRequired(true);
     $confirmPassword = $this->createElement('password', 'confirmPassword');
     $confirmPassword->setLabel('Confirm Password: *')->setRequired(true);
     //        $confirmPasswor = $this->createElement('text', 'image');
     //        $confirmPasswor->setLabel('Confirm image: *')
     //                ->setRequired(false);
     $image = new Zend_Form_Element_File('image');
     $image->setLabel("upload your iamge")->setDestination(APPLICATION_PATH . '/../public/data')->setRequired(true)->addValidator('Extension', false, array('jpg', 'jpeg', 'png'))->getValidator('Extension')->setMessage('This file type is not supportted.');
     // $image->setDestination('/www/coff/data');
     $this->setAttrib('enctype', 'multipart/form-data');
     $room_no = $this->createElement('text', 'room_no');
     $room_no->setLabel('Room number:')->setRequired(false);
     $ext = $this->createElement('text', 'ext');
     $ext->setLabel('Ext:')->setRequired(false);
     $register = $this->createElement('submit', 'register');
     $register->setLabel('Sign up')->setIgnore(true);
     $this->addElements(array($username, $email, $password, $confirmPassword, $image, $room_no, $ext, $register));
 }
开发者ID:nguyenkiet,项目名称:cafeteria,代码行数:28,代码来源:Registration.php


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