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


PHP Zend_Form_Element_Select::setattribs方法代码示例

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


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

示例1: init

 public function init()
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     //user typefilter
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('All');
     $usertype = $request->getParam('user_type_filter');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_filter = new Zend_Form_Element_Select('user_type_filter');
     $user_type_filter->setMultiOptions($options);
     $user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
     $user_type_filter->setValue($usertype);
     $this->addElement($user_type_filter);
     //uer title
     $user_title = new Zend_Form_Element_Select("title");
     $user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
     $this->addElement($user_title);
     //user full name
     $user_fullname = new Zend_Form_Element_Text("fullname");
     $user_fullname->setAttribs(array('id' => 'fullname', 'class' => 'validate[required]'));
     $this->addElement($user_fullname);
     //user name
     $user_name = new Zend_Form_Element_Text('username');
     $user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
     $this->addElement($user_name);
     //email
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
     $this->addElement($email);
     //password
     $password = new Zend_Form_Element_Password('password');
     $password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
     $this->addElement($password);
     //confirm password
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
     $this->addElement($confirm_password);
     //user type
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('' => $tr->translate('Please_Select'));
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_id = new Zend_Form_Element_Select('user_type_id');
     $user_type_id->setMultiOptions($options);
     $user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
     $this->addElement($user_type_id);
     //location
     $rs = $db->getGlobalDb('SELECT LocationId, Name FROM tb_sublocation WHERE Name!="" AND status=1 ORDER BY LocationId DESC');
     $option = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("Add_New_Location"));
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $option[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('LocationId');
     $locationID->setMultiOptions($option);
     $locationID->setattribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()', 'class' => 'demo-code-language'));
     $this->addElement($locationID);
 }
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:66,代码来源:FrmUser.php

示例2: FrmSearchFromCustomer

 public function FrmSearchFromCustomer()
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     $nameValue = $request->getParam('order');
     $nameElement = new Zend_Form_Element_Text('order');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     $returninValue = $request->getParam('return_in');
     $returninElement = new Zend_Form_Element_Text('return_in');
     $returninElement->setValue($returninValue);
     $this->addElement($returninElement);
     $startDateValue = $request->getParam('search_start_date');
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateValue = $request->getParam('search_end_date');
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     $rowCustomers = $db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 ORDER BY customer_id DESC');
     $agentValue = $request->getParam('customer_id');
     $options = array('' => $tr->translate('Please_Select_Customer'));
     if (!empty($rowCustomers)) {
         foreach ($rowCustomers as $rowCustomer) {
             $options[$rowCustomer['customer_id']] = $rowCustomer['cust_name'];
         }
     }
     $customer_id = new Zend_Form_Element_Select('customer_id');
     $customer_id->setMultiOptions($options);
     $customer_id->setattribs(array('id' => 'customer_id', 'class' => 'validate[required]'));
     $customer_id->setValue($agentValue);
     $this->addElement($customer_id);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
     return $this;
 }
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:37,代码来源:FrmSearch.php

示例3: popupSaleAgent

 public function popupSaleAgent($data = null)
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $db = new Application_Model_DbTable_DbGlobal();
     $agent_Element = new Zend_Form_Element_Text('agent_name');
     $agent_Element->setAttribs(array('placeholder' => 'Enter Agent Name', 'class' => 'validate[required]'));
     $this->addElement($agent_Element);
     $contact_Element = new Zend_Form_Element_Text('contact_phone');
     $contact_Element->setAttribs(array('placeholder' => 'Contact Phone', 'class' => 'validate[required]'));
     $this->addElement($contact_Element);
     $position_Element = new Zend_Form_Element_Text('positon');
     $position_Element->setAttribs(array('placeholder' => 'Enter Positon'));
     $this->addElement($position_Element);
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     $user = $this->GetuserInfo();
     if ($user["level"] != 1 and $user["level"] != 2) {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     //$productValue = $request->getParam('LocationId');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('brand_name');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'brand_name'));
     $this->addElement($locationID);
     $address_Element = new Zend_Form_Element_Textarea('desc_agent');
     $address_Element->setAttribs(array('placeholder' => 'Description Here'));
     $this->addElement($address_Element);
     return $this;
 }
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:37,代码来源:FrmPopup.php

示例4: init

 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     //user typefilter
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('All');
     $usertype = $request->getParam('user_type_filter');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_filter = new Zend_Form_Element_Select('user_type_filter');
     $user_type_filter->setMultiOptions($options);
     $user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
     $user_type_filter->setValue($usertype);
     $this->addElement($user_type_filter);
     //uer title
     $user_title = new Zend_Form_Element_Select("title");
     $user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
     $this->addElement($user_title);
     //user full name
     $user_fullname = new Zend_Form_Element_Text("name");
     $user_fullname->setAttribs(array('id' => 'name', 'class' => 'validate[required]'));
     $this->addElement($user_fullname);
     //user cso
     /*$user_cso = new Zend_Form_Element_Select("cso_id");
      	$user_cso->setMultiOptions($db->getOptionCSO());
      	$user_cso->setAttribs(array(
      		'id'=>'cso_id',
      		'class'=>'validate[required]',
      	));
      	$this->addElement($user_cso);*/
     //Select CSO
     $rs = $db->getGlobalDb('SELECT id, name_en FROM fi_cso');
     $options = array('' => 'Please select');
     foreach ($rs as $read) {
         $options[$read['id']] = $read['name_en'];
     }
     $cso_id = new Zend_Form_Element_Select('cso_id');
     $cso_id->setMultiOptions($options);
     $cso_id->setattribs(array('class' => 'validate[required]'));
     $this->addElement($cso_id);
     //user name
     $user_name = new Zend_Form_Element_Text('username');
     $user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
     $this->addElement($user_name);
     //email
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
     $this->addElement($email);
     //password
     $password = new Zend_Form_Element_Password('password');
     $password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
     $this->addElement($password);
     //confirm password
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
     $this->addElement($confirm_password);
     //user type
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('' => 'Please select');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_id = new Zend_Form_Element_Select('user_type_id');
     $user_type_id->setMultiOptions($options);
     $user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
     $this->addElement($user_type_id);
 }
开发者ID:samlanh,项目名称:currencyms,代码行数:71,代码来源:FrmUser.php

示例5: productOrder

 public function productOrder($data = null)
 {
     //Application_Form_FrmLanguages::getCurrentlanguage();
     $user_info = new Application_Model_DbTable_DbGetUserInfo();
     $result = $user_info->getUserInfo();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     $paymentElement = new Zend_Form_Element_Submit('payment');
     $paymentElement->setAttribs(array('Phone' => 'Phone'));
     $this->addElement($paymentElement);
     $rs = $db->getGlobalDb('SELECT vendor_id, v_name FROM tb_vendor WHERE v_name!="" ORDER BY vendor_id DESC');
     $customerValue = $request->getParam('vendor_id');
     $options = array('' => $tr->translate('Please_Select'), '-1' => $tr->translate('Add_New_Vendor'));
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['vendor_id']] = $read['v_name'];
         }
     }
     $vendor_id = new Zend_Form_Element_Select('v_name');
     $vendor_id->setAttribs(array('class' => 'validate[required]', 'Onchange' => 'getCustomerInfo()'));
     $vendor_id->setMultiOptions($options);
     //$customerID->setattribs(array(id'=>'customer_id','onchange'=>'this.form.submit()',));
     $vendor_id->setValue($customerValue);
     $this->addElement($vendor_id);
     //     	$rowsCategory= $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category ORDER BY CategoryId DESC ');
     //     	$options = "";
     //     	if($result["level"]==1 OR $result["level"]==2){
     //     		$options = array("1"=>"Defaul Catogory","-1"=>"Add New Category");
     //     	}
     //     	if($rowsCategory) {
     //     		foreach($rowsCategory as $readCategory) $options[$readCategory['CategoryId']]=$readCategory['Name'];
     //     	}
     //     	$categoryElement = new Zend_Form_Element_Select('category');
     //     	$categoryElement->setAttribs(array('class' => 'validate[required] demo-code-language',"Onchange"=>"showPopupCategory()"));
     //     	$categoryElement->setMultiOptions($options);
     //     	$this->addElement($categoryElement);
     $roder_element = new Zend_Form_Element_Text("txt_order");
     $roder_element->setAttribs(array('placeholder' => 'Optional', "onblur" => "CheckPOInvoice();"));
     $this->addElement($roder_element);
     $contactElement = new Zend_Form_Element_Text('contact');
     $contactElement->setAttribs(array('placeholder' => 'Enter Contact Name'));
     $this->addElement($contactElement);
     $orderElement = new Zend_Form_Element_Text('order');
     $orderElement->setAttribs(array('placeholder' => 'Enter Order'));
     $this->addElement($orderElement);
     $phoneElement = new Zend_Form_Element_Text('txt_phone');
     $phoneElement->setAttribs(array('placeholder' => 'Enter Phone Number'));
     $this->addElement($phoneElement);
     //     	$option_loc = 'SELECT LocationId, Name FROM tb_sublocation WHERE Name!="" ';
     //     	if($result['level']!=1 || $result['level']!=2){//if this isn't super user or inventory manager
     //     		$option_loc .= " AND LocationId = ".$result['location_id'];//select only this user location
     //     	}
     //     	$option_loc .= ' ORDER BY LocationId DESC';
     //     	$rs=$db->getGlobalDb($option_loc);
     //     	$productValue = $request->getParam('LocationId');
     //     	$option =array();
     //     	if($result['level']==1 || $result['level']==2){//if this is super user
     //    			$option =array("1"=>"Defaul Location","-1"=>"Add New Location");
     //     	}
     //     	if(!empty($rs)) foreach($rs as $read) $option[$read['LocationId']]=$read['Name'];
     //     	$locationID=new Zend_Form_Element_Select('LocationId');
     //     	$locationID->setMultiOptions($option);
     //     	$locationID->setattribs(array('id'=>'LocationId',
     //     			'Onchange'=>'AddLocation()',
     //     			'class'=>'demo-code-language'
     //     			));
     //     	$locationID->setValue($productValue);
     //     	$this->addElement($locationID);
     $user = $this->GetuserInfo();
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     if ($user["level"] == 1 or $user["level"] == 2) {
         $options = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("ADD_NEW_LOCATION"));
     } else {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     $productValue = $request->getParam('LocationId');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('LocationId');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()'));
     $locationID->setValue($productValue);
     $this->addElement($locationID);
     $rowspayment = $db->getGlobalDb('SELECT * FROM tb_paymentmethod');
     if ($rowspayment) {
         foreach ($rowspayment as $readCategory) {
             $options_cg[$readCategory['payment_typeId']] = $readCategory['payment_name'];
         }
     }
     $paymentmethodElement = new Zend_Form_Element_Select('payment_name');
     $paymentmethodElement->setMultiOptions($options_cg);
     $this->addElement($paymentmethodElement);
//.........这里部分代码省略.........
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:101,代码来源:purchase.php

示例6: init

 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     /////////////Filter stock/////////////////
     $nameValue = $request->getParam('s_name');
     $nameElement = new Zend_Form_Element_Text('s_name');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     /////////////Date of lost item		/////////////////
     $startDateValue = $request->getParam('search_start_date');
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateValue = $request->getParam('search_end_date');
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     /////////////	Search subject in Lost Item		/////////////////
     $subjectValue = $request->getParam('subject');
     $subjectElement = new Zend_Form_Element_Text('subject');
     $subjectElement->setValue($subjectValue);
     $this->addElement($subjectElement);
     //Product Name
     $rs = $db->getGlobalDb('SELECT pro_id,item_name FROM tb_product');
     $productValue = $request->getParam('pro_id');
     $options = array('' => 'Please Select Product');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['pro_id']] = $read['item_name'];
         }
     }
     $product_id = new Zend_Form_Element_Select('pro_id');
     $product_id->setMultiOptions($options);
     $product_id->setattribs(array('id' => 'pro_id', 'onchange' => 'this.form.submit()'));
     $product_id->setValue($productValue);
     $this->addElement($product_id);
     //location
     $rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ');
     $productValue = $request->getParam('LocationId');
     $options = array('' => 'Please Select Product');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $product_id = new Zend_Form_Element_Select('LocationId');
     $product_id->setMultiOptions($options);
     $product_id->setattribs(array('id' => 'LocationId', 'onchange' => 'this.form.submit()'));
     $product_id->setValue($productValue);
     $this->addElement($product_id);
     //Vendor of purchase
     if (!empty($session_stock->stockID)) {
         $session_stock = new Zend_Session_Namespace('stock');
         $rs = $db->getGlobalDb('SELECT id, name FROM rsmk_stock WHERE id!=' . $session_stock->stockID);
         $providerValue = $request->getParam('stock_sale_id');
         $optionsProvider = array('' => 'Please Select Product');
         if (!empty($rs)) {
             foreach ($rs as $read) {
                 $optionsProvider[$read['id']] = $read['name'];
             }
         }
         $provider = new Zend_Form_Element_Select('stock_sale_id');
         $provider->setMultiOptions($optionsProvider);
         $provider->setattribs(array('id' => 'stock_sale_id', 'onchange' => 'this.form.submit()'));
         $provider->setValue($providerValue);
         $this->addElement($provider);
     }
     //status of purchase
     $statusValue = $request->getParam('status');
     $optionsStatus = array('' => 'Please Select', 1 => 'Created', 2 => 'Approve', 3 => 'Deliver', 4 => 'Cancel', 5 => 'Recieve Shipping');
     $status = new Zend_Form_Element_Select('status');
     $status->setMultiOptions($optionsStatus);
     $status->setattribs(array('id' => 'status', 'onchange' => 'this.form.submit()'));
     $status->setValue($statusValue);
     $this->addElement($status);
     //Sale Agent
     $rowAgents = $db->getGlobalDb('SELECT id, name FROM rsmk_sale_agent');
     $agentValue = $request->getParam('sale_agent_id');
     $options = array('' => 'Please Select Sale Agent');
     if (!empty($rowAgents)) {
         foreach ($rowAgents as $rowAgent) {
             $options[$rowAgent['id']] = $rowAgent['name'];
         }
     }
     $agent_id = new Zend_Form_Element_Select('sale_agent_id');
     $agent_id->setMultiOptions($options);
     $agent_id->setattribs(array('id' => 'sale_agent_id', 'onchange' => 'this.form.submit()'));
     $agent_id->setValue($agentValue);
     $this->addElement($agent_id);
     //status of purchase
     $statusCOValue = $request->getParam('status');
     $optionsCOStatus = array('' => 'Please Select', 1 => 'Request', 2 => 'Offer', 3 => 'Reject', 4 => 'Debt', 5 => 'Paid');
     $statusCO = new Zend_Form_Element_Select('status');
     $statusCO->setMultiOptions($optionsCOStatus);
     $statusCO->setattribs(array('id' => 'status', 'onchange' => 'this.form.submit()'));
     $statusCO->setValue($statusCOValue);
     $this->addElement($statusCO);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
 }
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:100,代码来源:FrmAdjustFilter.php

示例7: transferItem

 public function transferItem($data = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     // $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $invoiceElement = new Zend_Form_Element_Text('invoce_num');
     $invoiceElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($invoiceElement);
     $date = new Zend_Date();
     $transfer_dateElement = new Zend_Form_Element_Text('transfer_date');
     $transfer_dateElement->setValue($date->get('YYYY-MM-dd'));
     $transfer_dateElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($transfer_dateElement);
     $remark_element = new Zend_Form_Element_Textarea("remark_transfer");
     $this->addElement($remark_element);
     $user = $this->GetuserInfo();
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!=''  ";
     if ($user["level"] == 1 or $user["level"] == 2) {
         $options = array("1" => "Defaul Location", "-1" => "Add New Location");
     } else {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('from_location');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'from_location', 'Onchange' => 'AddLocation()'));
     $this->addElement($locationID);
     ////////////////////////////////////
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $to_locationID = new Zend_Form_Element_Select('to_location');
     $to_locationID->setAttribs(array('class' => 'validate[required]'));
     $to_locationID->setMultiOptions($options);
     $to_locationID->setattribs(array('id' => 'to_location'));
     $this->addElement($to_locationID);
     Application_Form_DateTimePicker::addDateField(array('transfer_date'));
     //set value when edit
     if ($data != null) {
         $idElement = new Zend_Form_Element_Hidden('transfer_id');
         $idElement->setValue($data["transfer_id"]);
         $this->addElement($idElement);
         $fromElement = new Zend_Form_Element_Hidden('old_from_location');
         $fromElement->setValue($data["from_location"]);
         $this->addElement($fromElement);
         $toElement = new Zend_Form_Element_Hidden('old_to_location');
         $toElement->setValue($data["to_location"]);
         $this->addElement($toElement);
         $invoiceElement->setValue($data["invoice_num"]);
         $invoiceElement->setAttribs(array("readonly" => "readonly"));
         $transfer_dateElement->setValue($data["transfer_date"]);
         $remark_element->setValue($data["remark"]);
         $locationID->setValue($data["from_location"]);
         $to_locationID->setValue($data["to_location"]);
     }
     return $this;
 }
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:70,代码来源:FrmTransfer.php

示例8: init

 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     ////////////////////////////////////////////////////////Purchase*****/////////////////////////////////////////////
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     //get sales or purchase id text
     $nameValue = $request->getParam('order');
     $nameElement = new Zend_Form_Element_Text('order');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     //get phone text
     $phoneElement = new Zend_Form_Element_Text('phone');
     $this->addElement($phoneElement);
     $rs = $db->getGlobalDb('SELECT vendor_id, v_name FROM tb_vendor WHERE v_name!="" AND is_active=1 ');
     $options = array($tr->translate('Please_Select'));
     $vendorValue = $request->getParam('vendor_name');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['vendor_id']] = $read['v_name'];
         }
     }
     $vendor_element = new Zend_Form_Element_Select('vendor_name');
     $vendor_element->setMultiOptions($options);
     $vendor_element->setAttribs(array('id' => 'vendor_id'));
     $vendor_element->setValue($vendorValue);
     $this->addElement($vendor_element);
     $rs = $db->getGlobalDb('SELECT agent_id, name FROM tb_sale_agent WHERE name!="" ORDER BY agent_id DESC');
     $options = array($tr->translate('Please_Select'));
     $agentValue = $request->getParam('sale_agent_id');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['agent_id']] = $read['name'];
         }
     }
     $sale_agent = new Zend_Form_Element_Select('sale_agent_id');
     $sale_agent->setMultiOptions($options);
     $sale_agent->setAttribs(array('id' => 'sale_agent_id', 'class' => 'validate[required]'));
     $sale_agent->setValue($agentValue);
     $this->addElement($sale_agent);
     /////////////Date of lost item		/////////////////
     $startDateValue = $request->getParam('search_start_date');
     $endDateValue = $request->getParam('search_end_date');
     if ($endDateValue == "") {
         $endDateValue = date("Y-m-d");
         $startDateValue = date("Y-m-d");
     }
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     //status of purchase or sales
     // 		$statusValue = $request->getParam('status');
     // 		$optionsStatus=array(''=>'Please Select',1=>'Quote',2=>'Open',3=>'In Progress',4=>'Invoice',5=>'Paid',6=>"Cancel");
     // 		$status=new Zend_Form_Element_Select('status');
     // 		$status->setMultiOptions($optionsStatus);
     // 		$status->setattribs(array(
     // 				'id'=>'status',
     // 			//	'onchange'=>'this.form.submit()',
     // 		));
     // 		$status->setValue($statusValue);
     // 		$this->addElement($status);
     $rs = $db->getGlobalDb('SELECT DISTINCT Name,LocationId FROM tb_sublocation WHERE Name!="" AND status=1 ');
     $options = array($tr->translate('Please_Select'));
     $locationValue = $request->getParam('LocationId');
     foreach ($rs as $read) {
         $options[$read['LocationId']] = $read['Name'];
     }
     $location_id = new Zend_Form_Element_Select('LocationId');
     $location_id->setMultiOptions($options);
     $location_id->setAttribs(array('id' => 'LocationId', 'onchange' => 'this.form.submit()'));
     $location_id->setValue($locationValue);
     $this->addElement($location_id);
     ////////////////////////////////////////////////*******////////////////////////////////
     //Customer
     $rowCustomers = $db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 ORDER BY customer_id DESC');
     $agentValue = $request->getParam('customer_id');
     $optionsCUS = array($tr->translate('Please_Select_Customer'));
     if (!empty($rowCustomers)) {
         foreach ($rowCustomers as $rowCustomer) {
             $optionsCUS[$rowCustomer['customer_id']] = $rowCustomer['cust_name'];
         }
     }
     $customer_id = new Zend_Form_Element_Select('customer_id');
     $customer_id->setMultiOptions($optionsCUS);
     $customer_id->setattribs(array('id' => 'customer_id', 'class' => 'validate[required]'));
     $customer_id->setValue($agentValue);
     $this->addElement($customer_id);
     //status of purchase
     $statusCOValue = 4;
     $statusCOValue = $request->getParam('status');
     $optionsCOStatus = array('' => $tr->translate('ALL'), 2 => $tr->translate('OPEN'), 3 => $tr->translate('IN_PROGRESS'), 4 => $tr->translate('PAID'), 5 => $tr->translate('RECEIVED'), 6 => $tr->translate('MENU_CANCEL'));
     $statusCO = new Zend_Form_Element_Select('status');
     $statusCO->setMultiOptions($optionsCOStatus);
     $statusCO->setattribs(array('id' => 'status'));
     if ($statusCOValue == "") {
         //$statusCOValue=4;
     }
//.........这里部分代码省略.........
开发者ID:pingitgroup,项目名称:stockpingitgroup,代码行数:101,代码来源:Frmsearch.php


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