예제 #1
0
 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");
     }
 }
예제 #2
0
 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));
 }
예제 #3
0
		function setForm()
		{
			$form = new Zend_Form;
			$form->setMethod('post')->setAction('');
			//$this->setAttrib('enctype','multipart/form-data');
			
			$file = new Zend_Form_Element_File('video_file');
			//$file->setAttrib('class','file');
			$file->setLabel('video_file');
           	$file->setRequired(true);
           	
			$video_title = new Zend_Form_Element_Text('video_title');
			$video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống'));
			
			$video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail');
			$video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label');
			
			$video_description = new Zend_Form_Element_Textarea('video_description');
			$video_description->setAttrib('rows','7');
			$video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống'));
			
			$is_active = new Zend_Form_Element_Radio('is_active');
			$is_active->setRequired(true)
					->setLabel('is_active')
					->setMultiOptions(array("1" => "Có","0" => "Không"));
			
			$file->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_title->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_description->removeDecorator('HtmlTag')->removeDecorator('Label');
			$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');		
			
			$form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail));
			return $form;
		}
예제 #4
0
파일: Upload.php 프로젝트: henvic/MediaLab
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $registry = Zend_Registry::getInstance();
     $authedUserInfo = $registry->get('authedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Files:');
     $file->setRequired(true);
     $file->addValidator('Count', false, array('min' => 1, 'max' => 1));
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     // hack for not showing 'the file exceeds the defined form size'
     $file->setMaxFileSize($maxFileSize * 2);
     /*$file->setMultiFile(1);*/
     $this->addElement($file, 'file');
     $title = $this->addElement('text', 'title', array('label' => 'Title:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 100)))));
     $short = $this->addElement('text', 'short', array('label' => 'Short description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 120)))));
     $description = $this->addElement('textarea', 'description', array('label' => 'Description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 4096)))));
 }
예제 #5
0
 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));
 }
 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', '*****@*****.**');
     $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')))));
 }
예제 #7
0
파일: Thread.php 프로젝트: ranahedia/RNR
 public function init()
 {
     $this->setMethod("post");
     $title = new Zend_Form_Element_Text("title");
     $title->setAttrib("placeholder", "Title");
     $title->setAttrib("class", "form-control");
     $title->setLabel("Title: ");
     $title->setRequired();
     $body = new Zend_Form_Element_Textarea("body");
     $body->setAttrib("class", "form-control");
     $body->setAttrib("placeholder", "Write body here....");
     $body->setLabel("Body: ");
     $body->setAttrib("rows", "5");
     $body->setAttrib("cols", "55");
     $body->setRequired();
     $picture = new Zend_Form_Element_File('picture');
     $picture->setLabel("Picture:");
     $picture->setRequired();
     $picture->setDestination('/var/www/html/RNR/public/images/thread');
     $stick = new Zend_Form_Element_Radio("stick");
     $stick->setLabel("Sticky:");
     $stick->addMultiOption("on", "on");
     $stick->addMultiOption("off", "off");
     $stick->setRequired();
     $id = new Zend_Form_Element_Hidden("id");
     $submit = new Zend_Form_Element_Submit("Submit");
     $submit->setAttrib("class", "btn btn-primary");
     $submit->setLabel("Save");
     $rest = new Zend_Form_Element_Submit('Rest');
     $rest->setAttrib("class", "btn btn-info");
     $this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest));
 }
예제 #8
0
 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();
 }
예제 #9
0
파일: Upload.php 프로젝트: henvic/MediaLab
 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');
 }
 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')))));
 }
예제 #11
0
 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'));
 }
예제 #12
0
파일: FileTest.php 프로젝트: jsnshrmn/Suma
 /**
  * @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);
 }
예제 #13
0
    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');
    }
예제 #14
0
 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);
 }
예제 #15
0
파일: Blog.php 프로젝트: Alexeykolobov/php
 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);
 }
 public function init()
 {
     // profissional_beleza_nome
     $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome");
     $profissional_beleza_nome->setLabel("Nome: ");
     $profissional_beleza_nome->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_nome->setRequired();
     $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // profissional_beleza_email
     $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email");
     $profissional_beleza_email->setLabel("E-mail: ");
     $profissional_beleza_email->setValidators(array('EmailAddress'));
     $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza());
     $profissional_beleza_email->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_email->setRequired();
     $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     /**
      * profisional_beleza_sexo
      */
     $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo");
     $profissional_beleza_sexo->setLabel("Sexo:");
     $profissional_beleza_sexo->setRequired();
     $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino'));
     // profissional_beleza_avatar
     $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar");
     $profissional_beleza_avatar->setLabel(" \n            Foto: \n        ");
     $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
     $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user'));
     $profissional_beleza_avatar->setRequired();
     $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path);
     $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png')));
     $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true)));
     // especialidade_id
     $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id");
     $especialidade_id->setLabel("Selecione as especialidades: ");
     $especialidade_id->setAttribs(array('class' => ''));
     $especialidade_id->setRequired();
     $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $especialidade_id->setSeparator(' ');
     $especialidade_id->setMultiOptions($this->getEspecialidades());
     // addElements
     $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id));
     parent::init();
 }
예제 #17
0
파일: Materials.php 프로젝트: abeinoo/Zend
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod("POST");
     $name = new Zend_Form_Element_Text("name");
     $name->setRequired();
     $name->setLabel("material name:");
     $name->setAttrib("placeholder", "Enter material name");
     $name->addValidator(new Zend_Validate_Alnum("true"));
     $name->setAttrib("class", "form-control");
     $name->getDecorator("Label")->setOption("class", "control-label");
     $name->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $name->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $path = new Zend_Form_Element_File('path');
     $path->setLabel('Select File:');
     $path->setRequired();
     $path->setAttrib("class", "form-control");
     $path->setAttrib("class", "file-loading");
     $path->getDecorator("Label")->setOption("class", "control-label");
     $path->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $path->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $course = new Zend_Form_Element_Select('cid');
     $course->setLabel('Course Name:');
     //$course ->setMultiOptions(array( '5'=>'a','6'=>'c'));
     $course->setRequired(true)->addValidator('NotEmpty', true);
     $course->setAttrib("class", "form-control");
     $course->getDecorator("Label")->setOption("class", "control-label");
     $course->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $course->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $type = new Zend_Form_Element_Select('tid');
     $type->setLabel('Material Type:');
     //$type->setMultiOptions(array( '1'=>'pdf','2'=>'ppt'));
     $type->setRequired(true)->addValidator('NotEmpty', true);
     $type->setAttrib("class", "form-control");
     $type->getDecorator("Label")->setOption("class", "control-label");
     $type->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $type->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $mdate = new Zend_Form_Element_Hidden("mdate");
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setAttrib("class", "btn btn-xl center-block");
     //$submit->setAttrib("class", "btn");
     $this->addElements(array($name, $path, $course, $type, $mdate, $submit));
 }
예제 #18
0
파일: Picture.php 프로젝트: henvic/MediaLab
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $file = new Zend_Form_Element_File('Image');
     $file->setLabel('Choose a picture:');
     $file->addValidator('Count', false, 1);
     $file->addValidator('Size', false, array('max' => '1MB'));
     $file->setMaxFileSize(2048 * 1024);
     $file->addValidator('Extension', false, 'jpg,png,gif');
     $file->setRequired(false);
     $file->setOptions(array('ignoreNoFile' => true));
     $this->addElement($file, 'Image');
     $this->addElement('submit', 'submit', array('label' => 'Submit!', 'class' => 'btn primary'));
     $this->addElement('submit', 'delete', array('label' => 'Delete current', 'class' => 'btn danger'));
     $this->setAttrib('class', 'form-stacked');
     $this->addElement(Ml_Model_MagicCookies::formElement());
 }
예제 #19
0
 public static function getUploadForm()
 {
     $form = new Zend_Form();
     $form->setAction('')->setMethod(Zend_Form::METHOD_POST)->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART);
     $form->setDecorators(array(array('ViewScript', array('viewScript' => 'import/uploadForm.phtml')), 'Errors'));
     $f = new Zend_Form_Element_File('file');
     //, array ('label' => 'Веберіть файл пакету') );
     //		$f->setAttrib ( 'style', 'width: 600px' );
     $f->setRequired();
     $f->addValidator('Count', false, 1);
     //		$f->addValidator ( 'Size', false, 204800 );
     $f->addValidator('Extension', false, 'xls');
     $cfg = Zend_Registry::get('cfg');
     $target = $cfg['temp']['path'] . Zend_Auth::getInstance()->getIdentity()->NODEID . '.xls';
     $f->addFilter('Rename', array('target' => $target, 'overwrite' => 'true'));
     $form->addElement($f);
     $e = new Zend_Form_Element_Submit('submit', array('label' => 'Завантажити'));
     $form->addElement($e);
     return $form;
 }
예제 #20
0
 public function init()
 {
     $this->setName('image_block');
     $block = new Zend_Form_Element_File('block');
     $block->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
     $name = new Zend_Form_Element_Text('name', array('disableLoadDefaultDecorators' => true));
     $name->setRequired(true)->setAttrib('id', 'image-name')->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $caption = new Zend_Form_Element_Text('caption', array('disableLoadDefaultDecorators' => true));
     $caption->setAttrib('id', 'caption')->addFilter('StringTrim')->addFilter('StripTags')->addFilter('htmlentities')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $disable_link = new Zend_Form_Element_Checkbox('disable_link', array('disableLoadDefaultDecorators' => true));
     $disable_link->setAttrib("id", "disable_link")->setAttrib("class", "float-left")->addFilter('StringTrim')->removeDecorator('htmlTag');
     $link = new Zend_Form_Element_Text('link', array('disableLoadDefaultDecorators' => true));
     $link->setAttrib('id', 'link')->addFilter('StringTrim')->addFilter('StripTags')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib('class', 'btn btn-middium btn-primary pull-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Update");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('block', 'name', 'link', 'caption', 'disable_link'));
     $this->addElements(array($block, $name, $link, $caption, $disable_link, $submit));
 }
 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));
     $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('text', 'apellido', array('label' => 'Apellido', 'value' => '', 'required' => true));
     $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'));
     $this->addElement('hidden', 'foto_perfil');
     $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);
     $this->addElement('submit', 'Enviar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group')))));
 }
 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' => 'div', 'class' => 'element-group'))));
     $this->addElement('text', 'titulo', array('label' => 'Titulo', 'value' => '', 'required' => true));
     $this->titulo->addValidator('stringLength', false, array(1, 30));
     $this->titulo->setErrorMessages(array('messages' => 'El campo titulo solo puede contener letras y un largo de 20'));
     $this->addElement('textarea', 'contenido', array('label' => 'Contenido'));
     $this->addElement('text', 'datepicker', array('label' => 'Fecha Vigencia', 'required' => true));
     $this->addElement('hidden', 'imagen');
     $tipopublicacion = new Application_Model_DbTable_TipoPublicaciones();
     $tipo = $tipopublicacion->selecttipopublicaciones();
     $this->addElement('select', 'tipopublicacion', array('label' => 'Tipo de Publicacion', 'multiOptions' => $tipo));
     // 1° version
     $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', 'Aceptar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group')))));
 }
예제 #23
0
파일: Category.php 프로젝트: RanaRizk/RNR
 public function init()
 {
     $form = new Zend_Form("form");
     $form->setMethod('post');
     $title = new Zend_Form_Element_Text("title");
     $title->setLabel("Title:");
     $title->setAttrib("placeholder", "Title");
     $title->setAttrib("class", "form-control");
     $title->setRequired();
     $picture = new Zend_Form_Element_File("picture");
     $picture->setLabel("Picture:");
     $picture->setDestination('/var/www/html/RNR/public/images/category');
     $picture->setRequired();
     $id = new Zend_Form_Element_Hidden("id");
     $submit = new Zend_Form_Element_Submit("Submit");
     $submit->setLabel("Save");
     $submit->setAttrib("class", "btn btn-primary");
     $rest = new Zend_Form_Element_Reset('Reset');
     $rest->setAttrib("class", "btn btn-info");
     $this->addElements(array($title, $picture, $submit, $rest, $id));
 }
예제 #24
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->addPrefixPath('Application_Form_Decorator', APPLICATION_PATH . '/forms/decorators/', 'decorator');
     $this->addElement('text', 'name', array('label' => 'Name:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'name-element')), 'RequiredLabel')));
     $this->addElement('text', 'country', array('label' => 'Country:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'country-element')), 'RequiredLabel')));
     $this->addElement('text', 'town', array('label' => 'Town:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'town-element')), 'RequiredLabel')));
     $this->addElement('text', 'link', array('label' => 'Link:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256)))));
     $this->addElement('hidden', 'useExisting', array('required' => true, 'value' => 0, 'decorators' => array('ViewHelper')));
     $element = new Zend_Form_Element_File('filename');
     $element->setValueDisabled(true);
     $element->setRequired(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, 'filename');
     $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('hidden', 'id', array('ignore' => false, 'decorators' => array('ViewHelper')));
 }
예제 #25
0
 public function init($photoId)
 {
     global $mySession;
     $db = new Db();
     $path = "";
     $title = "";
     $date = "";
     $description = "";
     $status = "";
     $featuredstatus = "";
     $phototype = "";
     $featurepath = "";
     if ($photoId != "") {
         $photoData = $db->runQuery("select * from " . PHOTO . " where \tphoto_id='" . $photoId . "'");
         $path = $photoData[0]['photo_path'];
         $title = $photoData[0]['photo_title'];
         $date = date('F d-Y, h:i:s a', strtotime($photoData[0]['video_date']));
         $description = $photoData[0]['photo_description'];
         $status = $photoData[0]['photo_status'];
         $featuredstatus = $photoData[0]['featured_status'];
     }
     //->setValue($phototype);
     $photo_path2 = new Zend_Form_Element_File('photo_path2');
     $photo_path2->setAttrib("class", "textInput")->setDestination(SITE_ROOT . 'photo/')->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $photo_path2->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Photo path required.'))->addDecorator('Errors', array('class' => 'error'));
     $photo_title = new Zend_Form_Element_Text('photo_title');
     $photo_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Photo Title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($title);
     $up_date = new Zend_Form_Element_Text('up_date');
     $up_date->setAttrib("class", "textInput")->setAttrib("disabled", "disabled")->setValue($date);
     $photo_description = new Zend_Form_Element_Textarea('photo_description');
     $photo_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textarea_medium")->setValue($description);
     $Option[0]['key'] = "1";
     $Option[0]['value'] = "Active";
     $Option[1]['key'] = "0";
     $Option[1]['value'] = "Inactive";
     $photo_status = new Zend_Form_Element_Radio('photo_status');
     $photo_status->setRequired(true)->addMultiOptions($Option)->addValidator('NotEmpty', true, array('messages' => 'Please select status of photo.'))->addDecorator('Errors', array('class' => 'error'))->setValue($status);
     //->setValue($featurepath);
     $this->addElements(array($photo_path2, $photo_title, $up_date, $photo_description, $photo_status));
 }
예제 #26
0
 public function init($videoId)
 {
     global $mySession;
     $db = new Db();
     $path = "";
     $title = "";
     $date = "";
     $description = "";
     $status = "";
     $featuredstatus = "";
     $featurepath = "";
     $videotype = "";
     if ($videoId != "") {
         $videoData = $db->runQuery("select * from " . VIDEOGALLERY . " where \tvideo_id='" . $videoId . "'");
         $type = $videoData[0]['video_type'];
         $path = $videoData[0]['video_path'];
         $title = $videoData[0]['video_title'];
         $date = date('F d-Y, h:i:s a', strtotime($videoData[0]['date_uploaded']));
         $description = $videoData[0]['video_description'];
         $keyword = $videoData[0]['video_keyword'];
         $status = $videoData[0]['video_status'];
         $videotype = $photoData[0]['video_type'];
         /*$featuredstatus =$videoData[0]['featured_status'];*/
         $featurepath = $photoData[0]['featured_path'];
     }
     $Type[0]['key'] = "1";
     $Type[0]['value'] = "URL from YouTube";
     $Type[1]['key'] = "2";
     $Type[1]['value'] = "Upload from computer";
     $video_type = new Zend_Form_Element_Radio('video_type');
     $video_type->addMultiOptions($Type)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video type required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('onclick', 'changetype();');
     $video_path1 = new Zend_Form_Element_Text('video_path1');
     $video_path1->setAttrib("class", "textInput");
     if ($_REQUEST['video_type'] == 1) {
         $video_path1->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video path required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $video_path2 = new Zend_Form_Element_File('video_path2');
     $video_path2->setAttrib("class", "textInput")->setDestination(SITE_ROOT . 'images/videos/')->addValidator('Extension', false, 'flv');
     if ($_REQUEST['video_type'] == 2) {
         $video_path2->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video path required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $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")->setValue($title);
     $up_date = new Zend_Form_Element_Text('up_date');
     $up_date->setAttrib("class", "textInput")->setAttrib("disabled", "disabled")->setValue($date);
     $video_description = new Zend_Form_Element_Textarea('video_description');
     $video_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textarea_medium")->setValue($description);
     $Option[0]['key'] = "1";
     $Option[0]['value'] = "Active";
     $Option[1]['key'] = "0";
     $Option[1]['value'] = "Inactive";
     $video_status = new Zend_Form_Element_Radio('video_status');
     $video_status->setRequired(true)->addMultiOptions($Option)->addValidator('NotEmpty', true, array('messages' => 'Please select status of video.'))->addDecorator('Errors', array('class' => 'error'))->setValue($status);
     $Option1[1]['key'] = "1";
     $Option1[1]['value'] = "Featured";
     $Option1[2]['key'] = "2";
     $Option1[2]['value'] = "Not Featured";
     /*$featured_status= new Zend_Form_Element_Radio('featured_status');
     		$featured_status->setRequired(true)
     		->addMultiOptions($Option1)
     		->addValidator('NotEmpty',true,array('messages' =>'Please select status of featured.'))
     		->addDecorator('Errors', array('class'=>'error'))
     		->setValue($featuredstatus);*/
     $this->addElements(array($video_type, $video_path1, $video_path2, $video_title, $up_date, $video_description, $video_keyword, $video_status, $feature_path));
 }
예제 #27
0
파일: User.php 프로젝트: Alexeykolobov/php
 public function init($userId)
 {
     global $mySession;
     $db = new Db();
     if ($userId != "") {
         $adminData = $db->runQuery("select * from " . USERS . " where user_id='" . $userId . "'");
         $first_name_value = $adminData[0]['first_name'];
         $last_name_value = $adminData[0]['last_name'];
         $email_address_value = $adminData[0]['email_address'];
         $old_profile_image_value = $adminData[0]['image'];
         $gender_value = $adminData[0]['gender'];
         //$dob_value=$adminData[0]['dob'];
         $dob_value = changeDate($adminData[0]['dob'], 1);
         $location_value = $adminData[0]['location'];
         $country_value = $adminData[0]['country'];
         $blog_url_value = $adminData[0]['blog_url'];
         $website_url_value = $adminData[0]['website_url'];
         $about_me_value = $adminData[0]['about_me'];
         $occupation_value = $adminData[0]['occupation'];
         //$password_value=md5($adminData[0]['password']);
     }
     $first_name = new Zend_Form_Element_Text('first_name');
     $first_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($first_name_value);
     $this->addElement($first_name);
     $last_name = new Zend_Form_Element_Text('last_name');
     $last_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("onkeypress", "return checknummsp1(event);")->setValue($last_name_value);
     $this->addElement($last_name);
     $email_address = new Zend_Form_Element_Text('email_address');
     $email_address->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($email_address_value);
     $this->addElement($email_address);
     if (@$_REQUEST['email_address'] != "") {
         $email_address->addValidator('EmailAddress', true)->addErrorMessage('Please enter a valid email address');
     }
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($old_profile_image_value);
     $this->addElement($old_profile_image);
     $user_pic = new Zend_Form_Element_File('user_pic');
     $user_pic->setDestination(SITE_ROOT . 'images/profileimgs/');
     if ($userId == "") {
         $user_pic->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select a photo.'));
     }
     $user_pic->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'))->setValue($image_value);
     $this->addElement($user_pic);
     $GenderArr = array();
     $GenderArr[0]['key'] = "1";
     $GenderArr[0]['value'] = "Male";
     $GenderArr[1]['key'] = "2";
     $GenderArr[1]['value'] = "Female";
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->addMultiOptions($GenderArr)->setValue($gender_value);
     $this->addElement($gender);
     $countryArr = array();
     $sql = "select * from " . COUNTRIES;
     $countryData = $db->runQuery($sql);
     $countryArr[0]['key'] = 0;
     $countryArr[0]['value'] = "---Select Country---";
     $i = 1;
     foreach ($countryData as $key => $data) {
         $countryArr[$i]['key'] = $data['country_id'];
         $countryArr[$i]['value'] = $data['country_name'];
         $i++;
     }
     $country = new Zend_Form_Element_Select('country');
     $country->setRequired(true)->addMultiOptions($countryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setValue($country_value);
     $this->addElement($country);
     $password = new Zend_Form_Element_Text('password');
     $password->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($password);
     $cpassword = new Zend_Form_Element_Password('cpassword');
     $cpassword->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($cpassword);
     $npassword = new Zend_Form_Element_Password('npassword');
     $npassword->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($npassword);
     if (isset($_REQUEST['changePass']) && $userId != "") {
         $npassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Password is required.'))->addDecorator('Errors', array('class' => 'error'));
         $cpassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Confirm password is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $GenderArr = array();
     $GenderArr[0]['key'] = "1";
     $GenderArr[0]['value'] = "Male";
     $GenderArr[1]['key'] = "2";
     $GenderArr[1]['value'] = "Female";
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->addMultiOptions($GenderArr)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Field is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($gender_value);
     $this->addElement($gender);
     $location = new Zend_Form_Element_Text('location');
     $location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Location is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($location_value);
     $this->addElement($location);
     $occupation = new Zend_Form_Element_Text('occupation');
     $occupation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Occupation is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($occupation_value);
     $this->addElement($occupation);
     $about_me = new Zend_Form_Element_Textarea('about_me');
     //$about_me->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Please enter this field.'))
     $about_me->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:150px; height:60px;")->setValue($about_me_value);
     $this->addElement($about_me);
     $blog_url = new Zend_Form_Element_Text('blog_url');
     //$blog_url->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Blog URL is required.'))
     $blog_url->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->addValidator('Hostname', true)->setAttrib("Placeholder", "http://")->setValue("{$website_url_value}");
     $this->addElement($blog_url);
     $website_url = new Zend_Form_Element_Text('website_url');
     //$website_url->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Website URL is required.'))
     $website_url->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->addValidator('Hostname', true)->setAttrib("Placeholder", "http://")->setValue("{$website_url_value}");
     $this->addElement($website_url);
 }
예제 #28
0
 /**
  * Method shows the fields for file uploads by looking in config file
  * @return <Zend_Element>
  */
 private function _createFileuploadField()
 {
     // get path to store files
     $tempPath = $this->_config->form->first->temp;
     if (true === empty($tempPath)) {
         $tempPath = APPLICATION_PATH . '/workspace/tmp/';
     }
     // get allowed filetypes
     $filetypes = $this->_config->publish->filetypes->allowed;
     if (true === empty($filetypes)) {
         $filetypes = 'pdf,txt,html,htm';
     }
     //get allowed file size
     $maxFileSize = (int) $this->_config->publish->maxfilesize;
     if (true === empty($maxFileSize)) {
         $maxFileSize = 1024000;
         //1MB
     }
     // Upload-fields required to enter second stage
     $requireUpload = $this->_config->form->first->require_upload;
     if (true === empty($requireUpload)) {
         $requireUpload = 0;
     }
     //file upload field(s)
     $fileupload = new Zend_Form_Element_File('fileupload');
     $fileupload->setDisableTranslator(true)->setLabel('fileupload')->setDestination($tempPath)->addValidator('Size', false, $maxFileSize)->setMaxFileSize($maxFileSize)->addValidator('Extension', false, $filetypes)->setValueDisabled(true)->setAttrib('enctype', 'multipart/form-data');
     if (1 == $requireUpload) {
         if (!isset($this->_session->fulltext) || $this->_session->fulltext == '0') {
             $fileupload->setRequired(true);
         }
     } else {
         $fileupload->setRequired(false);
     }
     $this->addElement($fileupload);
     $this->addSubmitButton('addAnotherFile', 'addAnotherFile');
     $comment = $this->createElement('textarea', 'uploadComment');
     $comment->setDisableTranslator(true);
     $comment->setLabel('uploadComment');
     $this->addElement($comment);
     $group = array($fileupload->getName(), 'addAnotherFile', $comment->getName());
     return $group;
 }