コード例 #1
0
ファイル: Account.php プロジェクト: HiLeo1610/tumlumsach
 public function init()
 {
     $this->setMethod('POST');
     $defaultArgs = array('disableLoadDefaultDecorators' => true, 'decorators' => array('ViewHelper'));
     $identity = $this->getAttrib('user_id');
     $user_object = Engine_Api::_()->user()->getUser($identity);
     $user_id = new Zend_Form_Element_Hidden('user_id');
     $user_id->setValue($identity);
     $email = new Zend_Form_Element_Text('email', $defaultArgs);
     $email->addValidator('emailAddress', true)->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'email'));
     $email->setValue($user_object->email);
     $password = new Zend_Form_Element_Password('password', $defaultArgs);
     $password->addValidator('stringLength', false, array(6, 32));
     $passconf = new User_Form_Element_PasswordConfirm('passconf', $defaultArgs);
     //$passconf->addDecorator('ViewHelper');
     if ($settings->getSetting('user.signup.username', 1) > 0) {
         $username = new Zend_Form_Element_Text('username', $defaultArgs);
         $username->setValue($user_object->username);
         $username->addValidator('stringLength', true, array(6, 32))->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'username'));
     }
     $language = new Zend_Form_Element_Select('language', $defaultArgs);
     $language->addMultiOptions(array('English', 'post-English'));
     $language->setValue($user_object->language_id);
     $level_id = new Zend_Form_Element_Select('level_id', $defaultArgs);
     $level_id->setValue($user_object->level_id);
     $levels = Engine_Api::_()->authorization()->getLevelInfo();
     foreach ($levels as $level) {
         $level_id->addMultiOption($level['level_id'], $level['title']);
     }
     $this->addElements(array($user_id, $email, $password, $passconf, $username, $level_id, $language));
 }
コード例 #2
0
 public function frmRetrunIn($data = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     //$db=new Application_Model_DbTable_DbGlobal();
     ////////////////////////////////////////////////////////Purchase*****/////////////////////////////////////////////
     //get sales or purchase id text
     $returnOutValue = $request->getParam('invoice_in');
     $returnOutElement = new Zend_Form_Element_Text('invoice_in');
     $returnOutElement->setValue($returnOutValue);
     $this->addElement($returnOutElement);
     $outValue = $request->getParam('invoice_out');
     $returnInElement = new Zend_Form_Element_Text('invoice_out');
     $returnInElement->setValue($outValue);
     $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);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
     return $this;
 }
コード例 #3
0
ファイル: FrmTable.php プロジェクト: sarankh80/opsstock
 public function FrmProCate($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $id_code = new Zend_Form_Element_Text('id_code');
     $id_code->setAttribs(array('class' => 'form-control', "readonly" => ""));
     $code = table_Model_DbTable_DbTable::getCallteralCode();
     $id_code->setValue($code);
     $cat_name_en = new Zend_Form_Element_Text("name_en");
     $cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)"));
     $cat_name_km = new Zend_Form_Element_Text("name_km");
     $cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)"));
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $icon = new Zend_Form_Element_File("icon");
     $description = new Zend_Form_Element_Textarea("description");
     $this->addElements(array($icon, $status, $cat_name_en, $cat_name_km, $id_code, $description));
     if ($frm != "") {
         $id_code->setValue($frm["code"]);
         $cat_name_en->setValue($frm["name_en"]);
         $cat_name_km->setValue($frm["name_km"]);
         $status->setValue($frm["status"]);
         $description->setValue($frm["description"]);
     }
     return $this;
 }
コード例 #4
0
 /**
  *
  * @param mixed $options
  *
  * @return void
  *
  */
 public function __construct($options = null)
 {
     parent::__construct($options = null);
     $this->setAction('/default/wished-userbook/search-list')->setMethod('get');
     $defaultValue = __("Nom, prénom, email...", "s1b");
     // Email element
     $searchTermElement = new \Zend_Form_Element_Text("wishedListSearchTerm");
     $searchTermElement->class = "input-item";
     $searchTermElement->setValue($defaultValue);
     $searchTermElement->setAttrib("auto-restore", "");
     $searchTermElement->addValidator("stringlength", false, array("min" => 3, "messages" => array(\Zend_Validate_StringLength::TOO_SHORT => __("'%value%' doit faire plus de %min% caractères de long", "s1b"))));
     $this->removeAllDecorators($searchTermElement);
     // Submit button element
     $searchButtonElement = new \Zend_Form_Element_Submit("search");
     $searchButtonElement->setOptions(array('label' => __("Rechercher", "s1b")));
     $searchButtonElement->class = "button bt-red-m";
     $this->removeAllDecorators($searchButtonElement);
     // Email default label element
     $defaultLabelHidden = new \Zend_Form_Element_Hidden("emailDefaultLabel");
     $defaultLabelHidden->setValue($defaultValue);
     $defaultLabelHidden->class = "default-value";
     $this->removeAllDecorators($defaultLabelHidden);
     $this->addElements(array($searchTermElement, $searchButtonElement, $defaultLabelHidden));
     $this->removeDecorator("HtmlTag");
 }
コード例 #5
0
ファイル: FrmVendor.php プロジェクト: sarankh80/opsstock
 public function FrmProCate($frm = null)
 {
     $vendor_name = new Zend_Form_Element_Text("vendor_name");
     $vendor_name->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'ឈ្មោះអ្នផ្ឌត់ផ្ឌង់'));
     $phone = new Zend_Form_Element_Text("phone");
     $phone->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
     $contact = new Zend_Form_Element_Text("contact");
     $contact->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
     $email = new Zend_Form_Element_Text("email");
     $email->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
     $address = new Zend_Form_Element_Textarea("address");
     $address->setAttribs(array('class' => '', 'placeholder' => ''));
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $this->addElements(array($vendor_name, $phone, $contact, $email, $address, $status));
     if ($frm != "") {
         $vendor_name->setValue($frm["v_name"]);
         $phone->setValue($frm["phone"]);
         $contact->setValue($frm["contact_name"]);
         $email->setValue($frm["email"]);
         $address->setValue($frm["vendor_remark"]);
         $status->setValue($frm["is_active"]);
     }
     return $this;
 }
コード例 #6
0
ファイル: ValueDomain.php プロジェクト: rollxx/iso
 public function init()
 {
     if (get_class($this) === 'Default_Form_ValueDomain') {
         $err = new Zend_Form_Element_Text('err');
         $err->setValue('Please use the subclass...')->setAttrib('readonly', true)->setDecorators($this->decorators);
         $this->addElement($err);
         return;
     }
     parent::init();
     $this->setMethod('post');
     $this->addElement('hidden', 'idVD');
     $name = new Zend_Form_Element_Text('Name');
     $name->setLabel('Name:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
     $this->addElement($name);
     $dataType = new Zend_Form_Element_Text('Data_type');
     $dataType->setLabel('Data_Type:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
     $this->addElement($dataType);
     $precision = new Zend_Form_Element_Text('Precision');
     $precision->setLabel('Precision:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators);
     $this->addElement($precision);
     $cd = new Zend_Form_Element_Select('idCD');
     $cd->setLabel('Conceptual Domain:')->addMultiOptions($this->_getDependentSelect('Default_Model_ConceptualDomain'))->setDecorators($this->decorators);
     $this->addElement($cd);
     $uom = new Zend_Form_Element_Select('idUOM');
     $uom->setLabel('Unite of Measure:')->addMultiOptions($this->_getDependentSelect('Default_Model_UnitOfMeasure'))->setDecorators($this->decorators);
     $this->addElement($uom);
     $this->addDisplayGroup(array('Name', 'Data_type', 'Precision', 'idCD', 'idUOM'), 'groups', array("legend" => "Value Domain"));
 }
コード例 #7
0
 function __construct($user)
 {
     parent::__construct();
     $this->setName('Registration');
     $this->setMethod('POST');
     $this->setAction('/user/update');
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender');
     $gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
     $gender->setValue($user->gender);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setValue($user->email);
     $email->setRequired(true);
     $email->addValidator('NotEmpty', true);
     $email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail = new Zend_Form_Element_Text('paymentEmail');
     $paymentEmail->setLabel('Payment Email');
     $paymentEmail->setRequired(true);
     $paymentEmail->addValidator('NotEmpty', true);
     $paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail->setValue($user->paymentEmail);
     $countries = new Zend_Form_Element_Select('country');
     $countries->setMultiOptions(self::getCountries());
     $countries->setLabel('Country');
     $countries->addValidator('NotEmpty');
     $countries->setValue($user->country);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Update');
     $this->addElements(array($gender, $email, $paymentEmail, $countries, $submit));
 }
コード例 #8
0
ファイル: InstallForm.php プロジェクト: josephsnyder/Midas
 /** create  form */
 public function createDBForm()
 {
     $form = new Zend_Form();
     $form->setAction($this->webroot . '/install/step2')->setMethod('post');
     $type = new Zend_Form_Element_Hidden('type');
     $host = new Zend_Form_Element_Text('host');
     $host->setValue('localhost');
     $port = new Zend_Form_Element_Text('port');
     $port->addValidator('Digits', true);
     $unixsocket = new Zend_Form_Element_Text('unix_socket');
     $dbname = new Zend_Form_Element_Text('dbname');
     $dbname->setRequired(true)->addValidator('NotEmpty', true)->setValue('midas');
     $username = new Zend_Form_Element_Text('username');
     $username->setRequired(true)->addValidator('NotEmpty', true);
     $password = new Zend_Form_Element_Password('password');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setRequired(true)->addValidator('NotEmpty', true);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setRequired(true)->addValidator('NotEmpty', true);
     $email = new Zend_Form_Element_Text('email');
     $email->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress');
     $userpassword1 = new Zend_Form_Element_Password('userpassword1');
     $userpassword1->addValidator('NotEmpty', true)->setRequired(true);
     $userpassword2 = new Zend_Form_Element_Password('userpassword2');
     $userpassword2->addValidator('NotEmpty', true)->setRequired(true);
     $gravatar = new Zend_Form_Element_Checkbox('gravatar');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Setup database and account');
     $form->addElements(array($type, $host, $port, $unixsocket, $dbname, $username, $password, $firstname, $lastname, $email, $userpassword1, $userpassword2, $gravatar, $submit));
     return $form;
 }
コード例 #9
0
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     /////////////Filter stock/////////////////
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $nameElement = new Zend_Form_Element_Text('s_name');
     $nameValue = $request->getParam('s_name');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     $phonevalue = $request->getParam('phone');
     $phoneElement = new Zend_Form_Element_Text('phone');
     $phoneElement->setValue($phonevalue);
     $this->addElement($phoneElement);
     $rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ORDER BY LocationId DESC ');
     $options = array('' => $tr->translate('Please_Select'));
     $agentValue = $request->getParam('stock_location');
     foreach ($rs as $read) {
         $options[$read['LocationId']] = $read['Name'];
     }
     $sale_agent = new Zend_Form_Element_Select('stock_location');
     $sale_agent->setMultiOptions($options);
     $sale_agent->setAttribs(array('id' => 'LocationId', 'class' => 'demo-code-language'));
     $sale_agent->setValue($agentValue);
     $this->addElement($sale_agent);
     return $this;
 }
コード例 #10
0
 public function setValue($value)
 {
     if ($value) {
         $date = new Zend_Date($value, $this->_db_format);
         return parent::setValue($date->toString($this->_format));
     }
 }
コード例 #11
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     parent::__construct($options);
     $this->setName('comments');
     $comment_author = new Zend_Form_Element_Text('comment_author');
     $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid name!')->setDescription('If you are offering us SEO services, you will be added to the akismet spam list.');
     $comment_author_email = new Zend_Form_Element_Text('comment_author_email');
     $comment_author_email->setLabel('Enter your email address: ')->setRequired(true)->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public.');
     $comment_author_url = new Zend_Form_Element_Text('comment_author_url');
     $comment_author_url->setLabel('Enter your web address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid address!')->setDescription('Not compulsory');
     $comment_content = new Pas_Form_Element_CKEditor('comment_content');
     $comment_content->setLabel('Enter your comment: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->addErrorMessage('Please enter something in the comments box!');
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Please fill in this reCaptcha to prove human life exists at your end!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $this->_privateKey, 'pubKey' => $this->_pubKey, 'theme' => 'clean', 'ssl' => true)));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large')->setLabel('Submit your query');
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $captcha, $submit, $hash));
         $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'captcha'), 'details');
         $this->details->setLegend('Enter your comments: ');
     } else {
         $user = $auth->getIdentity();
         $comment_author->setValue($user->fullname);
         $comment_author_email->setValue($user->email);
         $this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $submit, $hash));
         $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content'), 'details');
         $this->details->setLegend('Enter your comments: ');
     }
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
コード例 #12
0
 /**
  * 一覧をフォーム形式で取得
  */
 public function getAllAsForm($delivery_id, $form, $order_id = 0)
 {
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $models = $db->fetchAll("SELECT * FROM `dtb_delivery_detail` WHERE `delivery_id` = ? ORDER BY size", $delivery_id);
     if (!$models) {
         $size_order = $db->fetchAll("SELECT * FROM `dtb_order_detail` WHERE `order_id` = ? ORDER BY size ASC", $order_id);
         $models = array();
         $total = 0;
         foreach ($size_order as $pair) {
             $size_delivery = $db->fetchOne("SELECT SUM(`detail`.`quantity`) as quantity \n                    FROM dtb_delivery delivery, dtb_delivery_detail detail \n                    WHERE delivery.id = detail.delivery_id AND order_id = ? AND `size` = ? \n                    GROUP BY size ORDER BY size ASC", array($order_id, $pair['size']));
             $pair['quantity'] -= $size_delivery;
             $total += $pair['quantity'];
             array_push($models, $pair);
         }
         $form->setDefault('quantity', $total);
         $form->setDefault('quantity_ori', $total);
     }
     foreach ($models as $model) {
         $id = $model['id'];
         $elem = new Zend_Form_Element_Text("quantity_{$id}");
         $elem->setOptions(array('size' => '3', 'onkeyup' => 'sum()', 'style' => 'text-align:right'));
         $elem->setValue($model['quantity']);
         $form->addElement($elem);
     }
     return $form;
 }
コード例 #13
0
ファイル: FrmBrand.php プロジェクト: sarankh80/opsstock
 public function FrmBrand($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $parent = new Zend_Form_Element_Select("parent_id");
     $parent->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
     $category = $db->getAllBrand();
     if (empty($category)) {
         $option_category = array('0' => 'No Brand To Select');
     } else {
         $option_category = array('0' => 'Choose Brand');
         foreach ($category as $row_cat) {
             $option_category[$row_cat["brand_id"]] = $row_cat["name_kh"];
         }
     }
     $parent->setMultiOptions($option_category);
     $brand_en = new Zend_Form_Element_Text("name_en");
     $brand_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In English', "OnChange" => "GetBrandName(1)"));
     $brand_km = new Zend_Form_Element_Text("name_km");
     $brand_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In Khmer', "OnChange" => "GetBrandName(2)"));
     $icon = new Zend_Form_Element_File("icon");
     $this->addElements(array($icon, $status, $brand_en, $brand_km, $parent));
     if ($frm != "") {
         $parent->setValue($frm["parent_id"]);
         $brand_en->setValue($frm["name_en"]);
         $brand_km->setValue($frm["name_kh"]);
         $status->setValue($frm["status"]);
     }
     return $this;
 }
コード例 #14
0
ファイル: Password.php プロジェクト: ncsuwebdev/otframework
 public function renderFormElement()
 {
     $elm = new Zend_Form_Element_Text($this->getName(), array('label' => $this->getLabel() . ':', 'class' => 'mask'));
     $elm->setDescription($this->getDescription());
     $elm->setValue($this->getValue());
     $elm->setRequired($this->getRequired());
     return $elm;
 }
コード例 #15
0
ファイル: Mail.php プロジェクト: uglide/zfcore-transition
 protected function _port()
 {
     $element = new Zend_Form_Element_Text('port');
     $element->setLabel('Port')->addDecorators($this->_decorators)->setRequired(true)->setAttrib('class', 'span2');
     $element->setValue(25);
     $element->addValidator(new Zend_Validate_Int());
     return $element;
 }
コード例 #16
0
 public function Frm_table_type($data = null)
 {
     $menu_code = new Zend_Form_Element_Text('type_code');
     $menu_code->setAttribs(array('class' => 'form-control', 'required' => true));
     $description = new Zend_Form_Element_Text('description');
     $description->setAttribs(array('class' => 'form-control'));
     $lang_1 = new Zend_Form_Element_Text('lang_1');
     $lang_1->setAttribs(array('class' => 'form-control'));
     $lang_2 = new Zend_Form_Element_Text('lang_2');
     $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control'));
     $lang_3 = new Zend_Form_Element_Text('lang_3');
     $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control'));
     if ($data != null) {
         // 			print_r($data);
     }
     $show_description = new Zend_Form_Element_Select('show_description');
     $show_description->setAttribs(array('class' => 'form-control'));
     $description_opt = array("" => $this->tr->translate("SELECT_DESCRIPTION"));
     $show_description->setMultiOptions($description_opt);
     $photo = new Zend_Form_Element_File('photo');
     $background = new Zend_Form_Element_Text('background');
     $background->setAttribs(array('class' => 'form-control color-picker-rgba'));
     $font_color = new Zend_Form_Element_Text('font_color');
     $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1"));
     $font_size = new Zend_Form_Element_Text('demo3');
     $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12'));
     $apply = new Zend_Form_Element_Select('apply');
     $apply->setAttribs(array('class' => 'form-control'));
     $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"));
     $apply->setMultiOptions($apply_opt);
     $combo = new Zend_Form_Element_Checkbox('combo');
     $combo->setAttribs(array('class' => 'red'));
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setAttribs(array('class' => 'red'));
     $format = new Zend_Form_Element_Text('demo4');
     $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12'));
     $setting = new Zend_Form_Element_Select('setting');
     $setting->setAttribs(array('class' => 'form-control'));
     $setting_opt = array("" => $this->tr->translate("SELECT_SETTING"));
     $setting->setMultiOptions($setting_opt);
     $arrange = new Zend_Form_Element_Text('arrange');
     $arrange->setAttribs(array('class' => 'form-control'));
     $resize = new Zend_Form_Element_Text('resize');
     $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12'));
     $note = new Zend_Form_Element_Textarea('note');
     $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;"));
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $id->setValue($data['id']);
         $menu_code->setValue($data['code']);
         $description->setValue($data['description']);
         $lang_1->setValue($data['lang1']);
         $lang_2->setValue($data['lang2']);
         $note->setValue($data['note']);
     }
     $this->addElements(array($id, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $lang_3, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note));
     return $this;
 }
コード例 #17
0
 public function frm_table_time_charge($data = null)
 {
     $menu_code = new Zend_Form_Element_Text('menu_code');
     $menu_code->setAttribs(array('class' => 'form-control'));
     $description = new Zend_Form_Element_Text('description');
     $description->setAttribs(array('class' => 'form-control', 'required' => true));
     $amount_to_charge = new Zend_Form_Element_Text('amount_to_charge');
     $amount_to_charge->setAttribs(array('class' => 'form-control'));
     $free_amt = new Zend_Form_Element_Text('free_amt');
     $free_amt->setAttribs(array('class' => 'form-control'));
     $child = new Zend_Form_Element_Text('child');
     $child->setAttribs(array('checked' => 'checked', 'class' => 'form-control'));
     $show_description = new Zend_Form_Element_Text('show_description');
     $show_description->setAttribs(array('class' => 'form-control'));
     $photo = new Zend_Form_Element_File('photo');
     $background = new Zend_Form_Element_Text('background');
     $background->setAttribs(array('class' => 'form-control color-picker-rgba'));
     $font_color = new Zend_Form_Element_Text('font_color');
     $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1"));
     $interval_time = new Zend_Form_Element_Text('interval_time');
     $interval_time->setAttribs(array('class' => 'form-control'));
     $apply = new Zend_Form_Element_Select('apply');
     $apply->setAttribs(array('class' => 'form-control'));
     $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"));
     $apply->setMultiOptions($apply_opt);
     $combo = new Zend_Form_Element_Checkbox('combo');
     $combo->setAttribs(array('class' => 'red'));
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setAttribs(array('class' => 'form-control'));
     $execute_number = new Zend_Form_Element_Text('execute_number');
     $execute_number->setAttribs(array('class' => 'form-control'));
     $setting = new Zend_Form_Element_Select('setting');
     $setting->setAttribs(array('class' => 'form-control'));
     $setting_opt = array("" => $this->tr->translate("SELECT_SETTING"));
     $setting->setMultiOptions($setting_opt);
     $arrange = new Zend_Form_Element_Text('arrange');
     $arrange->setAttribs(array('class' => 'form-control'));
     $resize = new Zend_Form_Element_Text('resize');
     $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12'));
     $note = new Zend_Form_Element_Textarea('note');
     $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;"));
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         // 			print_r($data);
         $id->setValue($data['id']);
         $description->setValue($data['description']);
         $interval_time->setValue($data['time_interval']);
         $execute_number->setValue($data['execute_amount']);
         $amount_to_charge->setValue($data['fee_charge']);
         $free_amt->setValue($data['free_amount']);
         $child->setValue($data['chil_per']);
         $active->setValue($data['nul_mul']);
     }
     $this->addElements(array($id, $apply, $active, $combo, $menu_code, $description, $amount_to_charge, $free_amt, $child, $show_description, $background, $font_color, $interval_time, $execute_number, $setting, $arrange, $resize, $note));
     return $this;
 }
コード例 #18
0
 public function FrmMenu($data = null)
 {
     //$db = new menu_Model_DbTable_DbMenuGroup();
     $menu_code = new Zend_Form_Element_Text('menu_code');
     $menu_code->setAttribs(array('class' => 'form-control', "data-required" => "1", 'aria-describedby' => 'name-error name-error', 'aria-invalid' => 'true'));
     $description = new Zend_Form_Element_Text('description');
     $description->setAttribs(array('class' => 'form-control', "data-required" => "1"));
     $lang_1 = new Zend_Form_Element_Text('lang_1');
     $lang_1->setAttribs(array('class' => 'form-control', "data-required" => "1"));
     $lang_2 = new Zend_Form_Element_Text('lang_2');
     $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control'));
     if ($data != null) {
         // 			print_r($data);
     }
     $show_description = new Zend_Form_Element_Select('show_description');
     $show_description->setAttribs(array('class' => 'form-control'));
     $description_opt = array(0 => $this->tr->translate("SELECT_DESCRIPTION"), 1 => $this->tr->translate("CODE"), 2 => $this->tr->translate("DESCRIPTION"), 3 => $this->tr->translate("LANG_ONE"), 4 => $this->tr->translate("LANG_TWO"));
     $show_description->setMultiOptions($description_opt);
     $photo = new Zend_Form_Element_File('photo');
     $background = new Zend_Form_Element_Text('background');
     $background->setAttribs(array('class' => 'form-control color-picker-rgba'));
     $font_color = new Zend_Form_Element_Text('font_color');
     $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1"));
     $font_size = new Zend_Form_Element_Text('demo3');
     $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12'));
     $apply = new Zend_Form_Element_Select('apply');
     $apply->setAttribs(array('class' => 'form-control'));
     $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"));
     $apply->setMultiOptions($apply_opt);
     $combo = new Zend_Form_Element_Checkbox('combo');
     $combo->setAttribs(array('class' => 'red'));
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setAttribs(array('class' => 'red'));
     $format = new Zend_Form_Element_Text('demo4');
     $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12'));
     $setting = new Zend_Form_Element_Select('setting');
     $setting->setAttribs(array('class' => 'form-control'));
     $setting_opt = array("" => $this->tr->translate("SELECT_SETTING"));
     $setting->setMultiOptions($setting_opt);
     $arrange = new Zend_Form_Element_Text('arrange');
     $arrange->setAttribs(array('class' => 'form-control'));
     $resize = new Zend_Form_Element_Text('resize');
     $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12'));
     $note = new Zend_Form_Element_Textarea('note');
     $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;"));
     $this->addElements(array($apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note));
     if ($data != "") {
         $menu_code->setValue($data['menu_group_code']);
         $description->setValue($data['menu_group']);
         $lang_1->setValue($data['menu_group2']);
         $lang_2->setValue($data['menu_group3']);
         $show_description->setValue($data['show_group']);
     }
     return $this;
 }
コード例 #19
0
 public function init()
 {
     parent::init();
     $this->setName('add_rss');
     $this->setMethod('post');
     //get drop down list for autopost config
     $autopost_configs_db = HTS_Util::getDbTable("autopostconfigs");
     $autopost_configs = $autopost_configs_db->getList();
     $autopost_configs_drop_down = array();
     foreach ($autopost_configs as $config) {
         $autopost_configs_drop_down[$config["id"]] = $config["name"];
     }
     $id_category = new Zend_Form_Element_Select('id_category');
     $id_category->setLabel('CATEGORY');
     $new_category = new Zend_Form_Element_Text('new_category');
     $new_category->setLabel('');
     if (!empty($this->_params['id_category'])) {
         $new_category->setValue("");
     } else {
         $new_category->setValue($this->getTranslator()->translate('CATEGORY_GENERAL'));
     }
     $new_category->addValidator('StringLength', false, array('max' => 200, 'encoding' => 'UTF-8'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('TITLE');
     $title->addValidator('StringLength', false, array('max' => 200, 'encoding' => 'UTF-8'));
     $id_rss = new Zend_Form_Element_Hidden('id_rss');
     $link = new Zend_Form_Element_Text('link');
     $link->setLabel('RSS_URL')->setRequired(true)->addValidator('NotEmpty', true);
     $num_stories = new Zend_Form_Element_Text('num_stories');
     $num_stories->setLabel('NUM_OF_ITEMS')->setValue(5)->addValidator(new Zend_Validate_Digits())->addValidator(new Zend_Validate_Between(array('min' => 5, 'max' => 100)))->setRequired(true);
     $is_allow_comment = new Zend_Form_Element_Checkbox("is_allow_comment");
     $is_allow_comment->setLabel("Allow comment")->setCheckedValue(1)->setUncheckedValue(0)->setValue(1);
     $is_autopost = new Zend_Form_Element_Checkbox("is_autopost");
     $is_autopost->setLabel("Allow auto post")->setCheckedValue(1)->setUncheckedValue(0);
     $id_autopost_config = new Zend_Form_Element_Select("id_autopost_config");
     $id_autopost_config->setLabel("Frequency")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'ERR_AUTO_POST_EMPTY')))->addMultiOptions($autopost_configs_drop_down);
     $max_news_post = new Zend_Form_Element_Text("max_news_post");
     $max_news_post->setLabel("Max news post")->setValue(5)->setRequired(true)->addValidator('lessThan', true, array('max' => 20, 'messages' => array(Zend_Validate_LessThan::NOT_LESS => 'ERR_MAX_NEW_POSTED_NOT_BETWEEN')));
     $this->addElements(array($id_rss, $link, $title, $id_category, $new_category, $num_stories, $is_allow_comment, $is_autopost, $id_autopost_config, $max_news_post));
     $this->setElementDecorators($this->_element_decorators);
     $id_rss->setDecorators($this->_hidden_decorators);
 }
コード例 #20
0
 public function init()
 {
     //$session = new Zend_Session_Namespace('auth');
     //$cso_id =$session->cso_id;
     $request = Zend_Controller_Front::getInstance()->getRequest();
     //$db=new Application_Model_DbTable_DbGlobal();
     /////////////Filter case hotline/////////////////
     //case no
     $nameValue = $request->getParam('v_name');
     $nameElement = new Zend_Form_Element_Text('v_name');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
 }
コード例 #21
0
ファイル: UploadForm.php プロジェクト: josephsnyder/Midas
 /** create upload link form */
 public function createUploadLinkForm()
 {
     $form = new Zend_Form();
     $form->setAction($this->webroot . '/upload/savelink')->setMethod('post');
     $validator = new Zend_Validate_Callback(array('Zend_Uri', 'check'));
     $name = new Zend_Form_Element_Text('name');
     $name->setRequired(true);
     $url = new Zend_Form_Element_Text('url');
     $url->setValue('http://')->setRequired(true)->addValidator($validator)->addValidator('NotEmpty', true);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->t('Save Link'))->setAttrib('class', 'globalButton');
     $form->addElements(array($name, $url, $submit));
     return $form;
 }
コード例 #22
0
ファイル: Task.php プロジェクト: tests1/zendcasts
 public function __construct($formState = "create", $currentTask = null)
 {
     $this->formState = $formState;
     $id = new Zend_Form_Element_Hidden("id");
     $name = new Zend_Form_Element_Text("name");
     $name->setLabel("Task Name:");
     $submit = new Zend_Form_Element_Submit($formState);
     if ($this->formState == "update") {
         $id->setValue($currentTask[0]->id);
         $name->setValue($currentTask[0]->name);
     }
     $this->addElements(array($id, $name, $submit));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'dl')), 'Form'));
 }
コード例 #23
0
 public function FrmCurrency($data = null)
 {
     $currency_code = new Zend_Form_Element_Text('currency_code');
     $currency_code->setAttribs(array('class' => 'form-control', 'required' => true));
     $currency_text = new Zend_Form_Element_Text('currency_text');
     $currency_text->setAttribs(array('class' => 'form-control'));
     $currency_sy = new Zend_Form_Element_Text('currency_sy');
     $currency_sy->setAttribs(array('class' => 'form-control'));
     $decimal = new Zend_Form_Element_Text('decimal ');
     $decimal->setAttribs(array('class' => 'form-control'));
     $exchange = new Zend_Form_Element_Text('exchange');
     $exchange->setAttribs(array('class' => 'form-control'));
     $combo = new Zend_Form_Element_Checkbox('combo');
     $combo->setAttribs(array('class' => 'red'));
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setAttribs(array('class' => 'yellow'));
     $photo = new Zend_Form_Element_File('photo');
     $background = new Zend_Form_Element_Text('background');
     $background->setAttribs(array('class' => 'form-control color-picker-rgba'));
     $phone_2 = new Zend_Form_Element_Text('$phone_2');
     $phone_2->setAttribs(array('class' => 'form-control'));
     $radio1 = new Zend_Form_Element_Checkbox('radio1');
     $radio1->setAttribs(array());
     $base = new Zend_Form_Element_Checkbox('base');
     $base->setAttribs(array('class' => 'red'));
     $format = new Zend_Form_Element_Text('demo4');
     $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12'));
     $setting = new Zend_Form_Element_Select('setting');
     $setting->setAttribs(array('class' => 'form-control'));
     $setting_opt = array("" => $this->tr->translate("SELECT_SETTING"));
     $setting->setMultiOptions($setting_opt);
     $arrange = new Zend_Form_Element_Text('arrange');
     $arrange->setAttribs(array('class' => 'form-control'));
     $resize = new Zend_Form_Element_Text('resize');
     $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12'));
     $note = new Zend_Form_Element_Textarea('note');
     $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;"));
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $id->setValue($data['id']);
         $currency_code->setValue($data['curr_code']);
         $currency_text->setValue($data['curr_title']);
         $currency_sy->setValue($data['symbol']);
         $decimal->setValue($data['decimal_place']);
         $exchange->setValue($data['exchange_rate']);
     }
     $this->addElements(array($id, $radio1, $currency_code, $currency_text, $currency_sy, $decimal, $exchange, $base, $format, $setting, $arrange, $resize, $note));
     return $this;
 }
コード例 #24
0
ファイル: Frmproduct.php プロジェクト: sarankh80/opsstock
 public function FrmProCate($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $id_code = new Zend_Form_Element_Text('id_code');
     $id_code->setAttribs(array('class' => 'form-control', "readonly" => ""));
     $code = product_Model_DbTable_DbProduct::getCallteralCode();
     $id_code->setValue($code);
     $cat_id = new Zend_Form_Element_Select("cat_id");
     $cat_id->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
     $category = $db->getAllProCategories();
     $option_category = array(0 => 'Choose Category');
     foreach ($category as $row_cat) {
         $option_category[$row_cat["cat_id"]] = $row_cat["cat_name_km"] . " - " . $row_cat["cat_name_en"];
     }
     $cat_id->setMultiOptions($option_category);
     $cat_name_en = new Zend_Form_Element_Text("name_en");
     $cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)"));
     $currency = new Zend_Form_Element_Select("currency");
     $currency->setAttribs(array('class' => 'form-control validate[required]'));
     $dbp = new product_Model_DbTable_DbProduct();
     $currencys = $dbp->getAllPro();
     $option_currency = array(0 => 'Choose Currency');
     foreach ($currencys as $row_currency) {
         $option_currency[$row_currency["cu_id"]] = $row_currency["cu_name_km"] . " - " . $row_currency["cu_name_en"];
     }
     $currency->setMultiOptions($option_currency);
     $price = new Zend_Form_Element_Text("price");
     $price->setAttribs(array('class' => 'validate[required]'));
     $description = new Zend_Form_Element_Textarea("description");
     $cat_name_km = new Zend_Form_Element_Text("name_km");
     $cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)"));
     $icon = new Zend_Form_Element_File("icon");
     $this->addElements(array($description, $price, $icon, $status, $cat_name_en, $cat_name_km, $cat_id, $id_code, $currency));
     if ($frm != "") {
         $cat_id->setValue($frm["cat_id"]);
         $cat_name_en->setValue($frm["pro_name_en"]);
         $cat_name_km->setValue($frm["pro_name_km"]);
         $status->setValue($frm["status"]);
         $currency->setValue($frm["cu_id"]);
         $price->setValue($frm["price_out"]);
         $description->setValue($frm["description"]);
     }
     return $this;
 }
コード例 #25
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li')));
     $this->setName('comments');
     $comment_author_IP = new Zend_Form_Element_Hidden('comment_author_IP');
     $comment_author_IP->removeDecorator('HtmlTag')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setValue($_SERVER['REMOTE_ADDR'])->addValidator('Ip');
     $comment_agent = new Zend_Form_Element_Hidden('comment_agent');
     $comment_agent->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setValue($_SERVER['HTTP_USER_AGENT'])->setRequired(false);
     $comment_author = new Zend_Form_Element_Text('comment_author');
     $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid name!')->setDecorators($decorators)->setDescription('If you are offering us SEO services, you will be added to the akismet spam list.');
     $comment_author_email = new Zend_Form_Element_Text('comment_author_email');
     $comment_author_email->setLabel('Enter your email address: ')->setDecorators($decorators)->setRequired(true)->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public.');
     $comment_author_url = new Zend_Form_Element_Text('comment_author_url');
     $comment_author_url->setLabel('Enter your web address: ')->setDecorators($decorators)->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('NotEmpty')->addErrorMessage('Please enter a valid address!')->setDescription('Not compulsory');
     $comment_content = new Pas_Form_Element_RTE('comment_content');
     $comment_content->setLabel('Enter your comment: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->addErrorMessage('Please enter something in the comments box!');
     $privateKey = $this->_config->webservice->recaptcha->privatekey;
     $pubKey = $this->_config->webservice->recaptcha->pubkey;
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Please fill in this reCaptcha to prove human life exists at your end!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean')));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large')->setLabel('Submit your query');
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->addElements(array($comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $captcha, $submit));
         $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'captcha'), 'details')->removeDecorator('HtmlTag');
         $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
         $this->details->removeDecorator('DtDdWrapper');
         $this->details->removeDecorator('HtmlTag');
         $this->details->setLegend('Enter your comments: ');
     } else {
         $user = $auth->getIdentity();
         $comment_author->setValue($user->fullname);
         $comment_author_email->setValue($user->email);
         $this->addElements(array($comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $submit));
         $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content'), 'details')->removeDecorator('HtmlTag');
         $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
         $this->details->removeDecorator('DtDdWrapper');
         $this->details->removeDecorator('HtmlTag');
         $this->details->setLegend('Enter your comments: ');
     }
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
コード例 #26
0
 /**
  * 一覧をフォーム形式で取得
  */
 public function getAllAsForm($order_id, $form)
 {
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $models = $db->fetchAll("SELECT * FROM `dtb_order_detail` WHERE `order_id` = ? ORDER BY size", $order_id);
     if (!$models) {
         return;
     }
     foreach ($models as $model) {
         $id = $model['id'];
         $elem = new Zend_Form_Element_Text("quantity_{$id}");
         $elem->setOptions(array('size' => '3', 'onkeyup' => 'sum()'));
         $elem->setValue($model['quantity']);
         $form->addElement($elem);
     }
     return $form;
 }
コード例 #27
0
ファイル: GoogleMaps.php プロジェクト: lstaszak/zf_zk_aleph
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oApiKey = new Zend_Form_Element_Text("api_key");
     $oApiKey->setLabel("Google Maps API key:");
     $oApiKey->setRequired(FALSE);
     $oApiKey->setAttrib("class", "valid");
     $oApiKey->setValue($this->_sApiKey);
     $this->addElement($oApiKey);
     $oTitle = new Zend_Form_Element_Text("unique_title");
     $oTitle->setLabel("Identyfikator punktu:");
     $oTitle->setAttrib("disabled", "disabled");
     $this->addElement($oTitle);
     $oLng = new Zend_Form_Element_Text("lng");
     $oLng->setLabel("Współrzędna X (longitude):");
     $oLng->setRequired(TRUE);
     $oLng->setAttrib("class", "valid");
     $this->addElement($oLng);
     $oLat = new Zend_Form_Element_Text("lat");
     $oLat->setLabel("Współrzędna Y (latitude):");
     $oLat->setRequired(TRUE);
     $oLat->setAttrib("class", "valid");
     $this->addElement($oLat);
     $oDesc = new Zend_Form_Element_Textarea("desc");
     $oDesc->setLabel("Opis:");
     $oDesc->setRequired(FALSE);
     $oDesc->setAttrib("class", "ckeditor");
     $this->addElement($oDesc);
     $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/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
コード例 #28
0
ファイル: FrmUser.php プロジェクト: sarankh80/opsstock
 public function frmuser($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $id_code = new Zend_Form_Element_Text('id_code');
     $id_code->setAttribs(array('class' => 'form-control validate[required]'));
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setAttribs(array('class' => 'form-control validate[required]'));
     $username = new Zend_Form_Element_Text('username');
     $username->setAttribs(array('class' => 'form-control validate[required]', 'Onkeyup' => 'getfillterUserType()'));
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('class' => 'validate[required,custom[email]] form-control', 'Onkeyup' => 'getfillterUserType()'));
     $old_password = new Zend_Form_Element_Password('old_password');
     $old_password->setAttribs(array('class' => 'validate[required,minSize[5]] form-control'));
     $password = new Zend_Form_Element_Password('password');
     $password->setAttribs(array('class' => 'validate[required,minSize[5]] form-control'));
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setAttribs(array('class' => 'validate[required,equals[password]] form-control'));
     $rs = $db->getGlobalDb('SELECT user_type_id,user_type FROM tb_user_type where user_type_id');
     $options = array('' => '--- ជ្រើសរើសប្រភេទអ្នកប្រើប្រាស់ ---');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_id = new Zend_Form_Element_Select('user_type');
     $user_type_id->setMultiOptions($options);
     $user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'form-control chzn-select validate[required]'));
     $id = new Zend_Form_Element_Hidden('id');
     $photo = new Zend_Form_Element_File('photo');
     $this->addElements(array($status, $id_code, $photo, $id, $fullname, $username, $email, $password, $confirm_password, $user_type_id, $old_password));
     if ($frm != "") {
         $id->setValue($frm['user_id']);
         $fullname->setValue($frm['name']);
         $username->setValue($frm['user_name']);
         $email->setValue($frm['email']);
         $id_code->setValue($frm['user_code']);
         //     		$password->setValue($frm['password']);
         $user_type_id->setValue($frm['user_type']);
         $photo->setValue($frm['photo']);
         $status->setValue($frm['status']);
     }
     return $this;
 }
コード例 #29
0
ファイル: FeedWidget.php プロジェクト: tlandn/akvo-web
 public function init()
 {
     $this->setAttrib('id', 'feedWidget');
     $oSelectFeedName = new \Zend_Form_Element_Select('selectFeedName');
     $aKeys = array();
     $aValues = array();
     $aFeedNames = $this->_getFeedNames();
     $aFeedNameOptions = array('0' => 'Select data feed');
     foreach ($aFeedNames as $aFeedName) {
         $aFeedNameOptions[$aFeedName['feed_slug']] = $aFeedName['feed_name'];
     }
     $oSelectFeedName->addMultiOptions($aFeedNameOptions);
     //		$oSelectFeedName->addMultiOptions($aFeedNameSlug);
     $oSelectFeedName->setLabel('');
     $oSelectFeedName->setAttrib('class', 'cSelectFeedName');
     $oSelectFeedName->setValue('0');
     switch ($this->_sContext) {
         case self::CONTEXT_SELECT_FEED:
             $aFeedParameters = $this->_aParameters['feed_parameters'];
             $aElements[] = $oSelectFeedName;
             foreach ($aFeedParameters as $sFieldName => $sDefaultValue) {
                 $oParameterField = new \Zend_Form_Element_Text($sFieldName);
                 $oParameterField->setValue($sDefaultValue);
                 //					$oParameterField->setLabel(ucfirst($sFieldName));
                 $aElements[] = $oParameterField;
             }
             $this->addElements($aElements);
             break;
         case self::CONTEXT_SELECT_FEED_WIDGET:
             $aElements[] = $oSelectFeedName;
             $this->addElements($aElements);
             $this->_sViewScript = '/forms/generic_two_column_widget.phtml';
             break;
         default:
             $sAdminUrl = admin_url('admin-ajax.php');
             $this->setAction($sAdminUrl);
             $aElements = array($oSelectFeedName);
             $this->addElements($aElements);
             break;
     }
     if ($this->_sViewScript == '') {
         $this->_sViewScript = '/forms/generic_two_column_custom.phtml';
     }
     $this->setDecorators(array(array('ViewScript', array('viewScript' => $this->_sViewScript))));
 }
コード例 #30
0
ファイル: FrmCustomer.php プロジェクト: sarankh80/opsstock
 public function FrmCustomer($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $Customer_code = new Zend_Form_Element_Text("customer_code");
     $Customer_code->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Customer Code'));
     $Customer_en = new Zend_Form_Element_Text("name_en");
     $Customer_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Customer Name In English', "OnChange" => "GetCustomerName(1)"));
     $Customer_km = new Zend_Form_Element_Text("name_km");
     $Customer_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Customer Name In Khmer', "OnChange" => "GetCustomerName(2)"));
     $icon = new Zend_Form_Element_File("icon");
     $tel = new Zend_Form_Element_Text("tel");
     $tel->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Phone Number'));
     $fax = new Zend_Form_Element_Text("fax");
     $fax->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Fax Number'));
     $contact = new Zend_Form_Element_Text("contact");
     $contact->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Contact Name'));
     $email = new Zend_Form_Element_Text("email");
     $email->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Email address'));
     $address = new Zend_Form_Element_Text("address");
     $address->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Address'));
     $company = new Zend_Form_Element_Text("company");
     $company->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Company Name'));
     $description = new Zend_Form_Element_Text("description");
     $description->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Contact Name'));
     $this->addElements(array($Customer_code, $tel, $fax, $description, $email, $address, $company, $contact, $icon, $status, $Customer_en, $Customer_km));
     if ($frm != "") {
         $Customer_code->setValue($frm["customer_code"]);
         $Customer_en->setValue($frm["name_en"]);
         $Customer_km->setValue($frm["name_kh"]);
         $status->setValue($frm["status"]);
         $tel->setValue($frm["phone"]);
         $fax->setValue($frm["fax"]);
         $email->setValue($frm["email"]);
         $company->setValue($frm["company"]);
         $contact->setValue($frm["contact"]);
         $address->setValue($frm["address"]);
         $description->setValue($frm["description"]);
     }
     return $this;
 }