function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $ads_banner = new Zend_Form_Element_Textarea('ads_banner'); $ads_banner->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Biểu ngữ không được để trống')); $ads_position = new Zend_Form_Element_Text('ads_position'); $ads_position->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vị trí không được để trống')); $ads_name = new Zend_Form_Element_Text('ads_name'); $ads_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên quảng cáo không được để trống')); $ads_link = new Zend_Form_Element_Text('ads_link'); $ads_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Đường dẫn không được để trống')); $ads_position = $form->createElement("select","ads_position",array( "label" => "Vị trí", "multioptions"=> array( "1" => "Trên", "2" => "Giữa", "3" => "Trái", "4" => "Phải", "5" => "Nội dung"))); $ads_banner->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_position->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_link->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($ads_banner,$ads_position,$ads_name,$ads_link)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $user_login = new Zend_Form_Element_Text('user_login'); $user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống')); $user_pass = new Zend_Form_Element_Password('user_pass'); $user_pass->setAttrib('renderPassword', true); $user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống')); $user_fullname = new Zend_Form_Element_Text('user_fullname'); $user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống')); $user_email = new Zend_Form_Element_Text('user_email'); $user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ')); $user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống')); $user_address = new Zend_Form_Element_Text('user_address'); $user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ không được để trống')); $user_login->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_pass->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_email->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_address->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $category_name = new Zend_Form_Element_Text('category_name'); $category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên danh mục không được để trống')); /* $category_parent_id = new Zend_Form_Element_Select('category_parent_id'); $category_parent_id->addMultiOption('', '0'); foreach($this->mDanhmuc->getListDM() as $item) { $category_parent_id->addMultiOption($item['category_name'], $item['category_id']); } */ $is_active = $form->createElement("select","is_active",array( "label" => "Kích hoạt", "multioptions"=> array( "0" => "Chưa kích hoạt", "1" => "Đã kích hoạt"))); $category_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($category_name,$is_active)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $youtube_username = new Zend_Form_Element_Text('youtube_username'); $youtube_username->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên tài khoản không được để trống')); $password = new Zend_Form_Element_Text('password'); $password->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống')); $youtube_gallery = new Zend_Form_Element_Text('youtube_gallery'); $youtube_gallery->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên album không được để trống')); $is_selected = $form->createElement("select","is_selected",array( "label" => "Kích hoạt", "multioptions"=> array( "0" => "Không", "1" => "Có"))); $youtube_username->removeDecorator('HtmlTag')->removeDecorator('Label'); $password->removeDecorator('HtmlTag')->removeDecorator('Label'); $youtube_gallery->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_selected->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($youtube_username,$password,$youtube_gallery,$is_selected)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $image_name = new Zend_Form_Element_Text('image_name'); $image_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên ảnh không được để trống')); $image_link = new Zend_Form_Element_Textarea('image_link'); $image_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Hình ảnh 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")); $image_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $image_link->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($image_name,$image_link,$is_active)); return $form; }
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; }
public function actionInputForm($params) { $info = array('label' => $this->key, 'title' => $this->title, 'size' => $this->size, 'value' => $this->value, 'data' => $this->getAttrData(array('validate' => $this->validate))); if (isset($params[$this->key])) { $info['value'] = $params[$this->key]; } $e = new Zend_Form_Element_Text($this->key, $info); $e->removeDecorator('Errors')->removeDecorator('Description')->removeDecorator('HtmlTag')->removeDecorator('Label'); $this->_model->result[$this->key] = $e; return true; }
public function outputAction($params) { $info = array('label' => $this->key, 'title' => $this->title, 'size' => $this->size, 'value' => $params[$this->key], 'data' => $this->getAttrData(array('validate' => $this->validate))); if (isset($params[$this->key])) { $info['value'] = $params[$this->key]; } $e = new Zend_Form_Element_Text($this->key, $info); $e->removeDecorator('Errors')->removeDecorator('Description')->removeDecorator('HtmlTag')->removeDecorator('Label'); $e = $e->__toString(); $e = str_replace('name="' . $this->key . '"', 'name="' . $this->key . '[' . $params['id'] . ']' . '"', $e); return $e; }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // Message $message = new Zend_Form_Element_Text('message'); $message->addFilter('StringTrim'); $message->setRequired(true); $message->setAttrib('class', 'form-control'); $message->setAttrib('placeholder', 'Type Message…'); $message->removeDecorator('Label'); $this->addElement($message, 'message'); // Send button $send = new Zend_Form_Element_Submit('sendButton'); $send->setLabel('Send'); $send->setAttrib('class', 'btn btn-success btn-flat'); $send->setDecorators(array('ViewHelper')); $this->addElement($send, 'sendButton'); }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $danhmuc = new Zend_Form_Element_Text('danhmuc'); $noidung = new Zend_Form_Element_Text('noidung'); $noidung->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Nội dung không được để trống')); $lienket = new Zend_Form_Element_Text('lienket'); $lienket->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Liên kết không được để trống')); $danhmuc->removeDecorator('HtmlTag')->removeDecorator('Label'); $noidung->removeDecorator('HtmlTag')->removeDecorator('Label'); $lienket->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($danhmuc,$noidung,$lienket)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $category_name = new Zend_Form_Element_Text('category_name'); $category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên chuyên mục không được để trống')); $is_active= new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('Are you sure?') ->setMultiOptions(array( "1" => "Có", "0" => "Không")); $category_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($category_name,$is_active)); return $form; }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oSearchedText = new Zend_Form_Element_Text("smart_searched_text"); $oSearchedText->removeDecorator("label"); $oSearchedText->setRequired(FALSE); $oSearchedText->setFilters($this->_aFilters); $this->addElement($oSearchedText); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/smartsearch.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
function setForm($check,$id) { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $category_name = new Zend_Form_Element_Text('category_name'); $category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên chuyên mục không được để trống')); $category_parent_id = new Zend_Form_Element_Select('category_parent_id'); $category_parent_id->addMultiOption('0', ''); if($check==1) { $list = $this->mChuyenmuc->getListParentSubOne($id); } else { $list = $this->mChuyenmuc->getListCmParent(); } foreach($list as $item) { $category_parent_id->addMultiOption($item['category_id'],$item['category_name']); } $is_active= new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('Are you sure?') ->setMultiOptions(array( "1" => "Có", "0" => "Không")); $category_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $category_parent_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($category_name,$category_parent_id,$is_active)); return $form; }
/** * Class constructor * * @return void */ public function __construct($options = null) { parent::__construct($options); $labelCSS = Cible_FunctionsGeneral::getLanguageLabelColor($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; $formItemPrices = new Zend_Form_SubForm(); $formTop = new Zend_Form_SubForm(); $formBottom = new Zend_Form_SubForm(); // $this = new Zend_Form_SubForm(); if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } // hidden specify if new image for the news // $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); // $newImage->removeDecorator('Label'); // $this->addElement($newImage); // Name of the product line $name = new Zend_Form_Element_Text('II_Name'); $name->setLabel($this->getView()->getCibleText('item_label_name') . "<span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $formTop->addElement($name); // List of products $oProducts = new ProductsObject(); $listProd = $oProducts->productsCollection(Zend_Registry::get('currentEditLanguage')); $products = new Zend_Form_Element_Select('I_ProductID'); $products->setLabel($this->getView()->getCibleText('form_item_products_label') . "<span class='field_required'>*</span>")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'largeSelect')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title')))); $products->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); $products->addMultiOptions($listProd); // foreach ($listProd as $data) // { // $products->addMultiOption($data['P_ID'], $data['PI_Name']); // } $formTop->addElement($products); // Product $productCode = new Zend_Form_Element_Text('I_ProductCode'); $productCode->setLabel($this->getView()->getCibleText('form_product_code_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $formTop->addElement($productCode); // Item sequence $sequence = new Zend_Form_Element_Text('I_Seq'); $sequence->setLabel($this->getView()->getCibleText('form_product_sequence_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($sequence); // Detail Price $detailPrice = new Zend_Form_Element_Text('I_PriceDetail'); $detailPrice->setLabel($this->getView()->getCibleText('form_item_pricedetail_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($detailPrice); // Pro price $proPrice = new Zend_Form_Element_Text('I_PricePro'); $proPrice->setLabel($this->getView()->getCibleText('form_item_pricepro_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($proPrice); //******************************************************** //* Sub form containing data defining prices and volumes * //******************************************************** $txtQty = new Cible_Form_Element_Html('lblQty', array('value' => $this->getView()->getCibleText('form_item_qty_label'))); $txtQty->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline left')))); $formItemPrices->addElement($txtQty); $txtPrices = new Cible_Form_Element_Html('lblPrices', array('value' => $this->getView()->getCibleText('form_item_prices_label'))); $txtPrices->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline right')))); $formItemPrices->addElement($txtPrices); // Qty limit 1 $qtyInf = new Zend_Form_Element_Text('I_LimitVol1'); $qtyInf->setLabel($this->getView()->getCibleText('form_item_limitvol1_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColLeft'))))->setAttrib('class', 'smallTextInput left'); $formItemPrices->addElement($qtyInf); // Price Vol 1 $firstPrice = new Zend_Form_Element_Text('I_PriceVol1'); $firstPrice->removeDecorator('Label')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight'))))->setAttrib('class', 'smallTextInput'); $formItemPrices->addElement($firstPrice); // Qty limit 2 $qtyMiddle = new Zend_Form_Element_Text('I_LimitVol2'); $qtyMiddle->setLabel($this->getView()->getCibleText('form_item_limitvol2_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColLeft'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($qtyMiddle); // Price vol 2 $secondPrice = new Zend_Form_Element_Text('I_PriceVol2'); $secondPrice->removeDecorator('Label')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight', 'id' => 'title'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($secondPrice); // Price vol 3 $thirdPrice = new Zend_Form_Element_Text('I_PriceVol3'); $thirdPrice->setLabel($this->getView()->getCibleText('form_item_priceVol3_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($thirdPrice); //******************************************************** $special = new Zend_Form_Element_Checkbox('I_Special'); $special->setLabel($this->getView()->getCibleText('form_item_special_label')); $special->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($special); // Special Price $specialPrice = new Zend_Form_Element_Text('I_PrixSpecial'); $specialPrice->setLabel($this->getView()->getCibleText('form_item_specialPrice_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formBottom->addElement($specialPrice); // Checkbox for tax of the province $taxProv = new Zend_Form_Element_Checkbox('P_TaxProv'); $taxProv->setLabel($this->getView()->getCibleText('form_item_taxprov_label'))->setAttrib('checked', 'checked'); $taxProv->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($taxProv); // Checkbox for federal tax $taxFed = new Zend_Form_Element_Checkbox('P_TaxFed'); $taxFed->setLabel($this->getView()->getCibleText('form_item_taxfed_label'))->setAttrib('checked', 'checked'); $taxFed->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($taxFed); $formItemPrices->setLegend($this->getView()->getCibleText('subform_itemprices_legend')); $formItemPrices->setAttrib('class', 'smallFieldsetBorder'); // $this->setLegend($this->getView()->getCibleText('subform_professional_legend')); // $this->setAttrib('class', 'fieldsetBorder'); // $this->addSubForm($this, 'productFormLeft'); // $this->addSubForm($this, 'productFormRight'); $this->addSubForm($formTop, 'formTop'); $this->addSubForm($formItemPrices, 'formItemPrices'); $this->addSubForm($formBottom, 'formBottom'); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // datum pohovoru $elem = new Zend_Form_Element_Text('datum_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pohovoru'); // Multi select (perzonalista – pokročilé informace) $elem = new Zend_Form_Element_Multiselect('perzonalista_informace'); $elem->removeDecorator('Label'); $elem->setAttrib('placeholder', 'Pick an interviewers…'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'perzonalista_informace'); // vzdělání $elem = new Zend_Form_Element_Text('vzdelani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Education…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'vzdelani'); // motivace $elem = new Zend_Form_Element_Textarea('motivace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Motivation…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'motivace'); // preferovaná práce $elem = new Zend_Form_Element_Textarea('preferovana_prace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Kind of work preferred…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'preferovana_prace'); // ambice $elem = new Zend_Form_Element_Textarea('ambice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ambitions…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'ambice'); // jazyky $elem = new Zend_Form_Element_Text('jazyky'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Languages…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'jazyky'); // cestování $elem = new Zend_Form_Element_Text('cestovani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Travelling…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'cestovani'); // ################## SECOND COLUMN ################### // plusy_minusy $elem = new Zend_Form_Element_Textarea('plusy_minusy'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Pluses/Minuses…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'plusy_minusy'); // zkusenosti_v_tymu $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Team work experience…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'zkusenosti_v_tymu'); // pracovni_misto $elem = new Zend_Form_Element_Textarea('pracovni_misto'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Domain/Areas of work…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'pracovni_misto'); // knowhow $elem = new Zend_Form_Element_Textarea('knowhow'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Skills and technologies…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'knowhow'); // dalsi_informace $elem = new Zend_Form_Element_Textarea('dalsi_informace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Other informations…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'dalsi_informace'); // ################## THIRD COLUMN ################### // shrnuti_pohovoru $elem = new Zend_Form_Element_Textarea('shrnuti_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Summary of the interview…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'shrnuti_pohovoru'); // idealni_pozice $elem = new Zend_Form_Element_Text('idealni_pozice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ideal for position/project…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'idealni_pozice'); // datum_zahajeni $elem = new Zend_Form_Element_Text('datum_zahajeni'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Posible starting date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_zahajeni'); // uvazek $elem = new Zend_Form_Element_Select('id_uvazek'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_uvazek'); // mzda $elem = new Zend_Form_Element_Text('mzda'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Salary…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'mzda'); $elem = new Zend_Form_Element_Select('id_mena'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_mena'); // datum_pristiho_kontaktu $elem = new Zend_Form_Element_Text('datum_pristiho_kontaktu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pristiho_kontaktu'); // ###################### BUTTON ###################### $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); }
/** * To get Zend form element text with date time picker * @param string $id * @param bool $elementequired = true * @return Zend_Form_Element_Text with date picker */ public function getDateTimePicker($id, $value = "", $elementequired = true) { $element = new Zend_Form_Element_Text($id); $element->removeDecorator('HtmlTag'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('Label'); if (empty($value)) { $value = date('Y-m-d H:i'); } $element->setValue(date_format(date_create($value), 'Y-m-d H:i')); if ($elementequired) { $element->setAttribs(array('class' => 'validate[required] text-input')); } Application_Model_GlobalClass::addDateTimeField($id); return $element; }
function setForm($video_id) { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $user_name = new Zend_Form_Element_Text('user_name'); $user_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống')); $pass_word = new Zend_Form_Element_Password('pass_word'); $pass_word->setAttrib('renderPassword', true); $pass_word->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống')); $user_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $pass_word->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($user_name,$pass_word)); return $form; }
function setFormRss() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $link = new Zend_Form_Element_Text('link'); $link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Link không được để trống')); $listCampaign=$this->mRss->getListCampaign(); $campaigns=array(); foreach ($listCampaign as $camp) { $campaigns[$camp['id']]=$camp['name']; } $campaign_id=$form->createElement('select', 'campaign_id', array('multioptions'=>$campaigns)); $status=$form->createElement('select', 'status', array('multioptions'=>array('0'=>'Tạm dừng', '1'=>'Hoạt động'))); $source = new Zend_Form_Element_Text('source'); $source->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'"Nguồn" không được để trống')); $link->removeDecorator('HtmlTag')->removeDecorator('Label'); $campaign_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $status->removeDecorator('HtmlTag')->removeDecorator('Label'); $source->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($link,$campaign_id,$status,$source)); return $form; }
function setForm() { $listQuestions=$this->mThamdo->getListPollsByType('0'); $listQuestionsContent=array(); $listQuestionsContent['0']='Xin chọn ...'; foreach ($listQuestions as $quest) { $listQuestionsContent[$quest['polls_id']]=$quest['polls_content']; } $form=new Zend_Form; $form->setMethod('post')->setAction(''); $noidung = new Zend_Form_Element_Text('polls_content'); $noidung->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Nội dung không được để trống')); $noidung->removeDecorator('HtmlTag')->removeDecorator('Label'); $selector=array("0"=>"Câu hỏi", "1"=>"Trả lời",); $type=$form->createElement("radio", "polls_type", array('multioptions'=>$selector)); $type->setValue("0"); $type->removeDecorator('HtmlTag')->removeDecorator('Label'); $question_id=$form->createElement("select", "question_id", array('multioptions'=>$listQuestionsContent)); $question_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $selector=array("0"=>"Không (Hiển thị radio button)", "1"=>"Có (Hiển thị checkbox)",); $multiselect = $form->createElement("radio", "multiselect", array('multioptions'=>$selector)); $multiselect->removeDecorator('HtmlTag')->removeDecorator('Label'); $multiselect->setValue("0"); $selector=array("0"=>"Không", "1"=>"Có",); $is_active = $form->createElement("radio", "is_active", array('multioptions'=>$selector)); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($noidung,$type,$question_id,$multiselect,$is_active)); return $form; }
/** * Add an input text element to the form. * * @param array $question * * @return void */ private function _addText($question) { $elemName = $question['FQT_TypeName'] . self::UNDERSCORE . $question['FQ_ElementID']; $element = new Zend_Form_Element_Text($elemName); $element->removeDecorator('DtDdWrapper'); $element->addDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'answer-zone')))); $element->setAttrib('class', 'stdTextInput'); $this->_addExtras($element, $question); $this->addElement($element); $this->_displayGroupElements[] = $elemName; }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $comment_name = new Zend_Form_Element_Text('comment_name'); $comment_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập tên người gửi !')); $comment_name->setAttrib('class','n'); $comment_name->setAttrib("onfocus","if (this.value == 'Nhập tên của bạn') {this.value = '';}"); $comment_name->setAttrib("onblur","if (this.value == '') {this.value = 'Nhập tên của bạn';}"); $comment_name->setValue("Nhập tên của bạn"); $comment_email = new Zend_Form_Element_Text('comment_email'); $comment_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ')); $comment_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập địa chỉ email !')); $comment_email->setAttrib('class','e'); $comment_email->setAttrib('onfocus',"if (this.value == 'Nhập địa chỉ email của bạn') {this.value = '';}"); $comment_email->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập địa chỉ email của bạn';}"); $comment_email->setValue('Nhập địa chỉ email của bạn'); $comment_content = new Zend_Form_Element_Textarea('comment_content'); $comment_content->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập nội dung bình luận!')); $comment_content->setAttrib('class','m'); $comment_content->setAttrib('onfocus',"if (this.value == 'Nhập nội dung bình luận') {this.value = '';}"); $comment_content->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập nội dung bình luận';}"); $comment_content->setValue('Nhập nội dung bình luận'); $comment_captcha = new Zend_Form_Element_Captcha('comment_captcha',array( 'label' => 'Captcha_image', 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => APPLICATION_PATH.'/templates/front/fonts/tiennd.TTF', 'imgDir' => APPLICATION_PATH.'/templates/front/captcha/', 'imgUrl' => $this->view->baseUrl().'/application/templates/front/captcha/', 'height' => 100, 'width' => 200, 'fontSize' => 50, ), )); $comment_captcha->setAttrib('class','captcha_image1'); $comment_captcha->setAttrib('onfocus',"if (this.value == 'Nhập hình ảnh xác nhận') {this.value = '';}"); $comment_captcha->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập hình ảnh xác nhận';}"); $comment_captcha->setValue('Nhập hình ảnh xác nhận'); $comment_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_email->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_content->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_captcha->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($comment_name,$comment_email,$comment_content,$comment_captcha)); return $form; }
function formInsert() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $link = new Zend_Form_Element_Text('link'); $link ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Liên kết không được để trống')); $title = new Zend_Form_Element_Text('title'); $title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '5'); $description->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = $form->createElement("radio","is_active",array( "label" => "Kích hoạt", "multioptions"=> array( "1" => "Có", "0" => "Không"))); if($this->role == "0") { $listCategoryId = $this->mVideo->getListCategory(); } else { $listCategoryId = $this->mVideo->getCategoryIdByUserId($this->user_id); } $listCategory = array(); foreach($listCategoryId as $category) { $listCategory[] = $this->mVideo->getCategoryByCategoryId($category['category_id']); } $categoryId = new Zend_Form_Element_Select('category_id'); foreach($listCategory as $category) { $categoryId->addMultiOption($category['category_id'],$category['category_name']); } $link->removeDecorator('HtmlTag')->removeDecorator('Label'); $title->removeDecorator('HtmlTag')->removeDecorator('Label'); $description->removeDecorator('HtmlTag')->removeDecorator('Label'); $categoryId->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($link,$title,$description,$is_active,$categoryId)); return $form; }