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); }
public function init() { $this->tr = Application_Form_FrmLanguages::getCurrentlanguage(); $this->tvalidate = 'dijit.form.ValidationTextBox'; $this->filter = 'dijit.form.FilteringSelect'; $this->text = 'dijit.form.TextBox'; }
public function AllAction($data = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $newElement = new Zend_Form_Element_Submit('New'); $newElement->setLabel($tr->translate("NEW")); $this->addElement($newElement); $saveElement = new Zend_Form_Element_Submit('Save'); $saveElement->setAttribs(array('class' => 'save')); $saveElement->setLabel($tr->translate("SAVE_CLOSE")); $this->addElement($saveElement); $saveNewElement = new Zend_Form_Element_Submit('SaveNew'); $saveNewElement->setAttribs(array('class' => 'savenew')); $saveNewElement->setLabel($tr->translate("SAVE_NEW")); $this->addElement($saveNewElement); $updateElement = new Zend_Form_Element_Submit('Update'); $updateElement->setAttribs(array('class' => 'update')); $updateElement->setLabel($tr->translate("UPDATE")); $this->addElement($updateElement); $deactiveElement = new Zend_Form_Element_Submit('Deactive'); $deactiveElement->setAttribs(array('class' => 'deactive')); $deactiveElement->setLabel($tr->translate("DEACTIVE")); $this->addElement($deactiveElement); $activeElement = new Zend_Form_Element_Submit('Active'); $activeElement->setAttribs(array('class' => 'activate')); $activeElement->setLabel($tr->translate("ACTIVE")); $this->addElement($activeElement); $CancelElement = new Zend_Form_Element_Submit('Cancel'); $CancelElement->setAttribs(array('class' => 'cancel')); $this->addElement($CancelElement); return $this; }
public function init() { $this->tr=Application_Form_FrmLanguages::getCurrentlanguage(); /* Initialize action controller here */ header('content-type: text/html; charset=utf8'); defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl()); }
public function addBrand($data = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $db = new Application_Model_DbTable_DbGlobal(); $rowsbrand = $db->getGlobalDb('SELECT branch_id, Name FROM tb_branch WHERE Name!="" '); $options = array('' => $tr->translate('Please_Select')); if ($rowsbrand) { foreach ($rowsbrand as $readBrand) { $options[$readBrand['branch_id']] = $readBrand['Name']; } } $brandElement = new Zend_Form_Element_Select('Parent brand'); $brandElement->setAttribs(array('class' => 'demo-code-language')); $brandElement->setMultiOptions($options); $this->addElement($brandElement); $b_nameElement = new Zend_Form_Element_Text('brand Name'); $b_nameElement->setAttribs(array('class' => 'validate[required]')); $this->addElement($b_nameElement); $optionsStatus = array(1 => $tr->translate("ACTIVE"), 2 => $tr->translate('DEACTIVE')); $statusElement = new Zend_Form_Element_Select('status'); $statusElement->setAttribs(array('class' => 'demo-code-language')); $statusElement->setMultiOptions($optionsStatus); $this->addElement($statusElement); if ($data != null) { $idElement = new Zend_Form_Element_Hidden('id'); $this->addElement($idElement); $statusElement->setValue($data["IsActive"]); $idElement->setValue($data['branch_id']); $b_nameElement->setValue($data['Name']); $brandElement->setValue($data['parent_id']); } return $this; }
/** * Get Datepicker with event Onselect * @param array() $date_fields * @example * addDateFieldCalDOB(array(array('dob_1','age_1'), array('dob_2','age_2'))); */ public static function addDateFieldCalDOB($date_fields) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $template = '$("#template").datepicker({"changeYear":"true","changeMonth":"true","yearRange":"-40:+100","dateFormat":"dd-mm-yy" , onslect});'; $script = '<script language="javascript"> $(document).ready(function() { #template# });</script>'; $onselect = 'onSelect: function(dateText, inst) { var prefix = " ' . $tr->translate("YEARS") . '"; var _d = dateText.split("-"); var d = new Date(_d[2], _d[1], _d[0]); var now = new Date(); var age = now.getFullYear() - d.getFullYear(); $("#dob_id").val(age + " " + prefix); }'; $value = ''; if (is_array($date_fields)) { foreach ($date_fields as $read) { $tmpsel = str_replace('#dob_id', '#' . $read[1], $onselect); $tmptem = str_replace('onslect', $tmpsel, $template); $value .= str_replace('#template', '#' . $read[0], $tmptem); } } else { $tmpsel = str_replace('#dob_id', '#' . $read[1], $onselect); $tmptem = str_replace('onslect', $tmpsel, $template); $value .= str_replace('#template', '#' . $read[0], $tmptem); } echo str_replace('#template#', $value, $script); }
public function indexAction() { $formfilter = new RsvAcl_Form_FrmUser(); $this->view->formfilter = $formfilter; $where = ""; // action body $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $getUser = new RsvAcl_Model_DbTable_DbUser(); if ($this->getRequest()->getParam('user_type_filter')) { $user_type_id = $this->getRequest()->getParam('user_type_filter'); $where = " where user_type_id=" . $user_type_id; } $userQuery = "select \n \t\t\t\t\tu.`user_id`,\n \t\t\t\t\tu.`username`,\n \t\t\t\t\tu.`created_date`,\n \t\t\t\t\tu.`modified_date`, \n \t\t\t\t\t(SELECT ut.`user_type` FROM `rsv_acl_user_type` AS ut WHERE ut.`user_type_id` = u.`user_type_id`) as u_type,\n \t\t\t\t\t(SELECT c.`name_sh` FROM `fi_cso` AS c WHERE c.`id` = \n \t\t\t\t\t\t(SELECT i.`cso_id` FROM `fi_users_info` AS i WHERE i.`id` = u.`user_id`)\n \t\t\t\t\t) as cso_name,\n \t\t\t\t\tu.`status` \n \t\t\t from rsv_acl_user as u"; $userQuery = $userQuery . $where; $rows = $getUser->getUserInfo($userQuery); if ($rows) { $imgnone = '<img src="' . BASE_URL . '/images/icon/none.png"/>'; $imgtick = '<img src="' . BASE_URL . '/images/icon/tick.png"/>'; foreach ($rows as $i => $row) { if ($row['status'] == 1) { $rows[$i]['status'] = $imgtick; } else { $rows[$i]['status'] = $imgnone; } } $link = array("rsvAcl", "user", "view-user"); $links = array('username' => $link); $list = new Application_Form_Frmlist(); $columns = array('NAME', 'CREATED_DATE', 'MODIFIED_DATE', 'TYPE_OF', 'CSO', 'STATUS'); $this->view->form = $list->getCheckList('radio', $columns, $rows, $links); } else { $this->view->form = $tr->translate('NO_RECORD_FOUND'); } Application_Model_Decorator::removeAllDecorator($formfilter); }
public static function message($msg) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); echo '<script language="javascript"> alert("' . $tr->translate($msg) . '"); </script>'; }
public function editUserTypeAction() { $user_type_id = $this->getRequest()->getParam('id'); if (!$user_type_id) { $user_type_id = 0; } $form = new RsvAcl_Form_FrmUserType(); $db = new RsvAcl_Model_DbTable_DbUserType(); $rs = $db->getUserTypeInfo('SELECT * FROM rsv_acl_user_type where user_type_id=' . $user_type_id); Application_Model_Decorator::setForm($form, $rs); $this->view->form = $form; $this->view->user_id = $user_type_id; $tr = Application_Form_FrmLanguages::getCurrentlanguage(); if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if ($rs[0]['user_type'] == $post['user_type']) { Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); $db->updateUserType($post, $rs[0]['user_type_id']); Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index'); } else { if (!$db->isUserTypeExist($post['user_type'])) { $db->updateUserType($post, $rs[0]['user_type_id']); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index'); } else { Application_Form_FrmMessage::message('User had existed already'); } } } }
public function editAclAction() { $acl_id = $this->getRequest()->getParam('id'); if (!$acl_id) { $acl_id = 0; } $form = new RsvAcl_Form_FrmAcl(); $db = new RsvAcl_Model_DbTable_DbAcl(); $rs = $db->getUserInfo('SELECT * FROM rsv_acl_acl where acl_id=' . $acl_id); Application_Model_Decorator::setForm($form, $rs); $this->view->form = $form; $this->view->acl_id = $acl_id; if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if ($rs[0]['action'] == $post['action']) { $db->updateAcl($post, $rs[0]['acl_id']); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/acl/index'); } else { if (!$db->isActionExist($post['action'])) { $db->updateAcl($post, $rs[0]['acl_id']); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/acl/index'); } else { Application_Form_FrmMessage::message('Action had existed already'); } } } }
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; }
public static function messageError($sms, $err) { Application_Model_DbTable_DbGlobal::writeMessageErr($err); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); echo '<script language="javascript"> alert("' . $tr->translate("{$sms}") . '"); </script>'; }
public function indexAction() { $this->_helper->layout()->disableLayout(); ///sopharat disablelayout to display login $tr = Application_Form_FrmLanguages::getCurrentlanguage(); if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); $db_user = new Application_Model_DbTable_DbUsers(); $email = $formdata['txt_email']; $password = $formdata['txt_password']; if ($db_user->checkEmail($email)) { if ($db_user->userAuthenticate($email, $password)) { $user_id = $db_user->getUserID($email); $user_info = $db_user->getUserInfo($user_id); $arr_acl = $db_user->getArrAcl($user_info['user_type_id']); //in case user have no right to access any module of the system if (!$arr_acl) { $this->view->msg = $tr->translate('LOGIN_FAIL_NO_MODULE'); } else { $session_user = new Zend_Session_Namespace('auth'); $session_user->unlock(); $session_user->user_id = $user_id; $session_user->fullname = $user_info['fullname']; $session_user->user_name = $user_info['username']; $session_user->level = $user_info['user_type_id']; $session_user->user_type = $user_info['user_type']; $session_user->location_id = $user_info['LocationId']; $session_user->email = $email; for ($i = 0; $i < count($arr_acl); $i++) { $arr_module[$i] = $arr_acl[$i]['module']; } $arr_module = array_unique($arr_module); $session_user->arr_acl = $arr_acl; $session_user->arr_module = $arr_module; $session_user->lock(); //echo $session_user->user_name;sales/sales-order //echo $session_user->user_id=$user_id;exit(); //$_url=($arr_acl[0]!=='')? '/'.$arr_acl[0]['module']:'/default/index/home' ;//before //$_url=($arr_acl[0]!=='')? '/default/index/dashboad':'/default/index/home' ;//after //print_r($arr_acl[0]); //exit(); //$this->_redirect("/sales/sales-order"); $_url = $arr_acl[0] !== '' ? '/default/index/dashboad' : '/sales/sales-order'; //after $this->_redirect($_url); } } elseif (!$db_user->checkStatusByEmail($email)) { $this->view->msg = $tr->translate('LOGIN_FAIL_COMFIRM'); } else { $this->view->msg = $tr->translate('LOGIN_FAIL'); } } else { $this->view->msg = $tr->translate('EMAIL_NOT'); } } }
public function getAllDegree($id = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $opt_degree = array(1 => $this->tr->translate("Diploma"), 2 => $this->tr->translate("Associate"), 3 => $this->tr->translate("Bechelor"), 4 => $this->tr->translate("Master"), 5 => $this->tr->translate("PhD")); if ($id == null) { return $opt_degree; } else { return $opt_degree[$id]; } }
public function getAllMonths($id = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $opt_month = array('' => '----ជ្រើសរើស----', 1 => 'មករា', 2 => 'កុម្ភះ', 3 => 'មីនា', 4 => 'មេសា', 5 => 'ឧសភា', 6 => 'មិថុនា', 7 => 'កក្តដា', 8 => 'សីហា', 9 => 'កញ្ញា', 10 => 'តុលា', 11 => 'វិចិ្ឆកា', 12 => 'ធ្នូ'); if ($id == null) { return $opt_month; } else { return $opt_month[$id]; } }
public function init() { $this->tr = Application_Form_FrmLanguages::getCurrentlanguage(); $this->tvalidate = 'dijit.form.ValidationTextBox'; $this->filter = 'dijit.form.FilteringSelect'; $this->t_date = 'dijit.form.DateTextBox'; //$this->t_num = 'dijit.form.NumberTextBox'; $this->text = 'dijit.form.TextBox'; //$this->check='dijit.form.CheckBox'; }
public function AddDropStudent() { $name = new Zend_Dojo_Form_Element_TextBox('Name'); $name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside')); //$this->addElements(array($name)); $_type = new Zend_Dojo_Form_Element_FilteringSelect('type'); $_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside')); $_type_opt = array(1 => Application_Form_FrmLanguages::getCurrentlanguage()->translate("Suspended"), 2 => Application_Form_FrmLanguages::getCurrentlanguage()->translate("Drop")); $_type->setMultiOptions($_type_opt); $date = new Zend_dojo_form_element_datetextbox('txtdate'); $date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside')); $reason = new Zend_Dojo_Form_Element_Textarea('reason'); $reason->setAttribs(array('dojoType' => 'dijit.form.Textarea', 'rows' => '4', 'style' => 'border:1px solid #ccc')); $calldate = new Zend_Dojo_Form_Element_dateTextBox('calldate'); $calldate->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside')); $this->addElements(array($name, $_type, $date, $reason, $calldate)); return $this; }
public function init() { $this->tr = Application_Form_FrmLanguages::getCurrentlanguage(); $this->tvalidate = 'dijit.form.ValidationTextBox'; $this->filter = 'dijit.form.FilteringSelect'; $this->t_date = 'dijit.form.DateTextBox'; $this->t_num = 'dijit.form.NumberTextBox'; $this->text = 'dijit.form.TextBox'; $this->_khname = new Zend_Dojo_Form_Element_TextBox('kh_name'); $this->_khname->setAttribs(array('dojoType' => $this->text, 'class' => 'fullside')); $this->_enname = new Zend_Dojo_Form_Element_TextBox('en_name'); $this->_enname->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside')); $this->_dob = new Zend_Dojo_Form_Element_DateTextBox('dob'); $date = date("Y-m-d") - 20; $this->_dob->setAttribs(array('data-dojo-Type' => "dijit.form.DateTextBox", 'data-dojo-props' => "value:'{$date}','class':'fullside','name':'dob'", 'required' => true)); $this->_dob->setValue($date); $this->_phone = new Zend_Dojo_Form_Element_TextBox('phone'); $this->_phone->setAttribs(array('data-dojo-Type' => $this->tvalidate, 'data-dojo-props' => "regExp:'[0-9]{9,10}',\r\n\t\t\t\t 'name':'phone',\r\n\t\t\t\t\t'class':'fullside',\r\n\t\t\t\t \t'placeHolder': '012345678',\r\n\t\t\t\t \t'invalidMessage':'មិនមាន ចន្លោះ ឬ សញ្ញាពិសេស រឺលើសចំនួនឡើយ'")); $this->_degree = new Zend_Dojo_Form_Element_FilteringSelect('degree'); $this->_degree->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'getTuitionFee();')); $arr_opt = Application_Model_DbTable_DbGlobal::getAllDegreeById(); // $arr_opt = array( // 1=>$this->tr->translate("ASSOCIATE"), // 2=>$this->tr->translate("BACHELOR"), // 3=>$this->tr->translate('MASTER'), // 4=>$this->tr->translate('DOCTORATE')); $this->_degree->setMultiOptions($arr_opt); $this->_batch = new Zend_Dojo_Form_Element_NumberTextBox("batch"); $this->_batch->setAttribs(array('onclick' => 'alert(3)', 'data-dojo-Type' => $this->tvalidate, 'onclick' => 'alert(2)', 'data-dojo-props' => "regExp:'[0-9]{1,2}','required':true,\r\n\t\t\t\t'name':'batch',\r\n\t\t\t\t'onclick':'alert(1)',\r\n\t\t\t\t'class':'fullside',\r\n\t\t\t\t'invalidMessage':'អាចបញ្ជូលពី 1 ដល់ 99'")); $this->_year = new Zend_Dojo_Form_Element_TextBox("year"); $this->_year->setAttribs(array('data-dojo-Type' => $this->tvalidate, 'data-dojo-props' => "regExp:'[0-5]{1}',\r\n\t\t\t\t'name':'year',\r\n\t\t\t\t'required':true,'class':'fullside',\r\n\t\t\t\t'invalidMessage':'អាចបញ្ជូលពី 1 ដល់ 5'")); $this->_session = new Zend_Dojo_Form_Element_FilteringSelect("session"); $opt_session = array(1 => $this->tr->translate('MORNING'), 2 => $this->tr->translate('AFTERNOON'), 3 => $this->tr->translate('EVERNING'), 4 => $this->tr->translate('WEEKEND')); $this->_session->setMultiOptions($opt_session); $this->_session->setAttribs(array('dojoType' => $this->filter, 'required' => 'true', 'class' => 'fullside')); // $pay_date = date('Y-m-d', mktime(date('h'), date('i'), date('s'), date('m'), date('d')+45, date('Y'))); $this->_pay_date = new Zend_Dojo_Form_Element_DateTextBox('dob'); $this->_pay_date->setAttribs(array('dojoType' => $this->t_date, 'class' => 'fullside', 'constraints' => '{datePattern:"dd/MM/yyyy"')); $this->_remark = new Zend_Dojo_Form_Element_TextBox('remark'); $this->_remark->setAttribs(array('dojoType' => $this->text, 'class' => 'fullside')); $this->_pay_date = new Zend_Dojo_Form_Element_TextBox('pay_date'); $this->_pay_date->setAttribs(array('dojoType' => $this->t_date, 'class' => 'fullside')); }
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; }
public function addUserAction() { if ($this->getRequest()->isPost()) { $db = new RsvAcl_Model_DbTable_DbUser(); $post = $this->getRequest()->getPost(); if (!$db->ifUserExist($post['username'])) { $id = $db->insertUser($post); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $this->_redirect('/rsvAcl/user/index'); } else { Application_Form_FrmMessage::message('User had existed already'); } } $form = new RsvAcl_Form_FrmUser(); $this->view->form = $form; Application_Model_Decorator::removeAllDecorator($form); $items = new Application_Model_GlobalClass(); $locationRows = $items->getLocationAssign(); $this->view->locations = $locationRows; $popup = new Application_Form_FrmPopup(); $frm_poup = $popup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($frm_poup); $this->view->popup_location = $frm_poup; }
public function searchPriceType() { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $request = Zend_Controller_Front::getInstance()->getRequest(); $priceElement = new Zend_Form_Element_Text('price_type'); $pricevalue = $request->getParam("price_type"); $priceElement->setValue($pricevalue); $this->addElement($priceElement); $optionsStatus = array(1 => $tr->translate("ACTIVE"), 0 => $tr->translate("DEACTIVE")); $statusElement = new Zend_Form_Element_Select('status'); $statusvalue = $request->getParam("status"); $statusElement->setValue($statusvalue); $statusElement->setMultiOptions($optionsStatus); $this->addElement($statusElement); return $this; }
function changelangeAction() { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); $session_lang = new Zend_Session_Namespace('lang'); $session_lang->lang_id = $data['lange']; Application_Form_FrmLanguages::getCurrentlanguage($data['lange']); print_r(Zend_Json::encode(2)); exit; } }
public function getCheckList($type, $columns, $rows, $link = null, $class = 'items', $textalign = "left", $report = false, $id = "table") { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); /* * Define string of pagination Sophen 27 June 2012 */ $stringPagination = '<script type="text/javascript"> $(document).ready(function(){ $("#' . $id . '").tablesorter(); $("#' . $id . '").tablesorter().tablesorterPager({container: $("#pagination_' . $id . '")}); $("input:.pagedisplay").focus(function(){ this.blur(); }); function changeColor(){ alert("change color on mouse over"); } }); </script> <div id="pagination_' . $id . '" class="pager" > <form > <table style="width: 200px;border: 0px;background-color: #EDF7F8;margin: 0px"><tr> <td><img src="' . BASE_URL . '/images/first.gif" class="first"/></td> <td><img src="' . BASE_URL . '/images/previous.gif" class="prev"/></td> <td><input type="text" style="margin-bottom: 5px;" class="pagedisplay"/></td> <td><img src="' . BASE_URL . '/images/next.gif" class="next"/></td> <td><img src="' . BASE_URL . '/images/last.gif" class="last"/></td> <td><select class="pagesize" > <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> <option value="100">100</option> </select> </td> </tr> </table> </form> </div> '; /* end define string*/ $head = '<table class="collape tablesorter" id="' . $id . '" width="100%">'; $col_str = ''; if ($type != null) { $col_str = '<thead><tr><th class="tdheader">' . $tr->translate("NUM") . '</th>'; } //add columns foreach ($columns as $column) { if ($column == "DELETE") { $col_str = $col_str . '<th class="tdheader-delete">' . $tr->translate($column) . '</th>'; } else { $col_str = $col_str . '<th class="tdheader">' . $tr->translate($column) . '</th>'; } } $col_str .= '</tr></thead>'; $row_str = '<tbody>'; //add element rows if ($rows == NULL) { return $head . $col_str . '</table><center style="font-size:18pt;">No record</center></form>'; } $temp = 0; /*------------------------Check param id----------------------------------*/ /*------------------------End check---------------------------------------*/ $r = 0; foreach ($rows as $row) { if ($r % 2 == 0) { $attb = 'normal'; } else { $attb = 'alternate'; } $r++; //-------------------check select----------------- //-------------------end check select----------------- $row_str .= '<tr class="' . $attb . '"> '; $i = 0; foreach ($row as $key => $read) { if ($read == null) { $read = ' '; } if ($i == 0) { $temp = $read; if ($type != null) { $row_str .= '<td class="items-no" style="padding:7px" align="center">' . $r . '</td>'; } } else { if ($link != null) { foreach ($link as $column => $url) { if ($key == $column) { //$img='<img src="'.BASE_URL.'/css/link.png"/> '; $img = ''; $array = array('tag' => 'a', 'attribute' => array('href' => Application_Form_FrmMessage::redirectorview($url) . '/id/' . $temp)); $read = $this->formSubElement($array, $img . $read); } } } //$link==null $text = ''; if ($i != 0) { $text = $this->textAlign($read); $read = $this->checkValue($read); if ($textalign !== 'left') { $text = " align=" . $textalign; } } if ($i === 1) { $text = " align=" . $textalign; } $row_str .= '<td class="' . $class . '" ' . $text . '>' . $read . '</td>'; } //$i==0 $i++; } $row_str .= '</tr>'; } $counter = '<strong style="float:right;padding-right:5px">' . $tr->translate('NUM-RECORD') . count($rows) . '</strong>'; $row_str .= '</tbody>'; $footer = '</table>' . $counter . '<br/>'; if (!$report) { $footer .= $stringPagination; } return $head . $col_str . $row_str . $footer; }
public function getCheckList($delete = 0, $columns, $rows, $link = null, $editLink = "", $class = 'items', $textalign = "left", $report = false, $id = "table") { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); /* * Define string of pagination Sophen 27 June 2012 */ $stringPagination = '<script type="text/javascript"> $(document).ready(function(){ $("#' . $id . '").tablesorter(); $("#' . $id . '").tablesorter().tablesorterPager({container: $("#pagination_' . $id . '")}); $("input:.pagedisplay").focus(function(){ this.blur(); }); function changeColor(){ alert("change color on mouse over"); } }); </script> <div id="pagination_' . $id . '" class="pager" > <form > <table style="width: 200px;"><tr> <td><img src="' . BASE_URL . '/images/first.gif" class="first"/></td> <td><img src="' . BASE_URL . '/images/previous.gif" class="prev"/></td> <td><input type="text" class="pagedisplay"/></td> <td><img src="' . BASE_URL . '/images/next.gif" class="next"/></td> <td><img src="' . BASE_URL . '/images/last.gif" class="last"/></td> <td><select class="pagesize" > <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> <option value="100">100</option> </select> </td> </tr> </table> </form> </div> '; /* end define string*/ $head = '<form name="list"><div style="overflow:scroll; max-height: 300px; overflow-x:hidden;" ><table class="collape tablesorter" id="' . $id . '" width="100%">'; $col_str = ''; $col_str .= '<thead><tr>'; if ($delete == 1) { $col_str .= '<th class="tdheader tdcheck"></td>'; } $col_str .= '<th class="tdheader">' . $tr->translate("NUM") . '</th>'; //add columns foreach ($columns as $column) { $col_str = $col_str . '<th class="tdheader">' . $tr->translate($column) . '</th>'; } if ($editLink != "") { $col_str .= '<th class="tdheader tdedit">' . $tr->translate('EDIT_CAP') . '</th>'; } $col_str .= '</tr></thead>'; $row_str = '<tbody>'; //add element rows if ($rows == NULL) { return $head . $col_str . '</table></div><center style="font-size:18pt;">No record</center></form>'; } $temp = 0; /*------------------------Check param id----------------------------------*/ /*------------------------End check---------------------------------------*/ $r = 0; foreach ($rows as $row) { if ($r % 2 == 0) { $attb = 'normal'; } else { $attb = 'alternate'; } $r++; //-------------------check select----------------- //-------------------end check select----------------- $row_str .= '<tr class="' . $attb . '"> '; $i = 0; foreach ($row as $key => $read) { if ($read == null) { $read = ' '; } if ($i == 0) { $temp = $read; if ($delete == 1) { $row_str .= '<td><input type="checkbox" name="del[]" id="del[]" value="' . $temp . '" /></td>'; } $row_str .= '<td class="items-no">' . $r . '</td>'; } else { if ($link != null) { foreach ($link as $column => $url) { if ($key == $column) { $img = ''; $array = array('tag' => 'a', 'attribute' => array('href' => Application_Form_FrmMessage::redirectorview($url) . '?id=' . $temp)); $read = $this->formSubElement($array, $img . $read); } } } $text = ''; if ($i != 1) { $text = $this->textAlign($read); $read = $this->checkValue($read); if ($textalign != 'left') { $text = " align=" . $textalign; } } $row_str .= '<td class="' . $class . '" ' . $text . '>' . $read . '</td>'; if ($i == count($columns)) { if ($editLink != "") { $row_str .= '<td class="' . $class . '"><a class="edit" href="' . $editLink . '?id=' . $temp . '">' . '</a></td>'; } } } $i++; } $row_str .= '</tr>'; } $counter = '<span class="row_num">' . $tr->translate('NUM-RECORD') . count($rows) . '</span>'; $row_str .= '</tbody>'; $footer = '</table></div></form>'; if (!$report) { $footer .= '<div class="footer_list">' . $stringPagination . $counter . '</div>'; } return $head . $col_str . $row_str . $footer; }
public function grideView($edit_url, $url, $collumn, $result = null, $start, $limit, $record_count) { //$page = $this->getPagine($url,$start,$limit,$recount_count); $frm_list = new Application_Model_GlobalClass(); $page = $frm_list->getList($url, "list", $start, $limit, $record_count); $result_row = $page["result_row"]; $rows_per_page = $page["rows_per_page"]; $nevigation = $page["nevigation"]; $stringPagination = '<style> #grid{ margin: 0 auto; } .dojoxGridSortNode{ text-align: center; height: 30px;line-height:27px; } .height-text{height:30px; min-width: 350px; } </style>'; $stringPagination .= '<script> dojo.require("dojox.grid.DataGrid"); dojo.require("dijit.Dialog"); dojo.require("dojo.data.ItemFileWriteStore"); dojo.require("dojo.store.Memory");'; $rs = Zend_Json::encode($result); $stringPagination .= "var tran_store = getDataStorefromJSON('id','name',{$rs})"; $stringPagination .= ';dojo.ready(function(){ grid = new dojox.grid.DataGrid({ store: tran_store, autoHeight: true, structure: [ { name: "N.", field: "num", width: "40px", cellStyles: "text-align: center;" }, { name: "id", field: "id", hidden: "true" },'; if (!empty($result['err'])) { echo '<script>alert("មិនទាន់មានទន្និន័យទេ!");</script>'; } $key_col = @array_keys(@$result[0]); $key_index = 2; $tr = Application_Form_FrmLanguages::getCurrentlanguage(); for ($i = 0; $i < count($collumn); $i++) { $stringPagination .= "{ name:'" . $tr->translate($collumn[$i]) . "',field: '" . $key_col[$key_index] . "', width: 'auto'},"; $key_index++; } $stringPagination .= "]\r\n \t\t\t}, 'grid');\r\n \t\t\tgrid.startup();\r\n \t\r\n \t\t\tdojo.connect(grid, 'onRowClick', grid, function(evt){\r\n \t\t\t\tvar idx = evt.rowIndex,\r\n \t\t\t\t\titem = this.getItem(idx);\r\n \t\t\t\twindow.location = '" . $edit_url . "/id/' + this.store.getValue(item, 'id');\r\n \t\t\t});\r\n \t\t});\t\r\n \t</script>"; $stringPagination .= '<table class="full"> <tr> <td colspan="2"> <div id="grid" ></div> </td> </tr> <tr> <td>' . $result_row . '</td> <td align="right" >' . $rows_per_page . '</td> </tr> <tr> <td colspan="2" align="center"> <div id="navigetion" style="margin: 0 auto;">' . $nevigation . '</div> </td> </tr> </table>'; return $stringPagination; }
public function popupCategory() { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $db = new Application_Model_DbTable_DbGlobal(); $rowscate = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category WHERE Name!="" ORDER BY Name '); $options = array("" => "No Parent Category"); if ($rowscate) { foreach ($rowscate as $readcate) { $options[$readcate['CategoryId']] = $readcate['Name']; } } $catelsElement = new Zend_Form_Element_Select('main_category'); $catelsElement->setMultiOptions($options); $this->addElement($catelsElement); $category_Element = new Zend_Form_Element_Text('cate_name'); $category_Element->setAttribs(array('placeholder' => 'Enter Category Name', 'class' => 'validate[required]')); $this->addElement($category_Element); return $this; }
public function indexAction() { // action body /* set this to login page to change the character charset of browsers to Utf-8 ...*/ $this->_helper->layout()->disableLayout(); $form = new Application_Form_FrmLogin(); $form->setAction('index'); $form->setMethod('post'); $form->setAttrib('accept-charset', 'utf-8'); $this->view->form = $form; $key = new Application_Model_DbTable_DbKeycode(); $this->view->data = $key->getKeyCodeMiniInv(TRUE); if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); if ($form->isValid($formdata)) { $session_lang = new Zend_Session_Namespace('lang'); $session_lang->lang_id = $formdata["lang"]; //for creat session Application_Form_FrmLanguages::getCurrentlanguage($formdata["lang"]); //for choose lang for when login $user_name = $form->getValue('txt_user_name'); $password = $form->getValue('txt_password'); $db_user = new Application_Model_DbTable_DbUsers(); if ($db_user->userAuthenticate($user_name, $password)) { // $this->view->msg = 'Authentication Sucessful!'; // $this->view->err="0"; $session_user = new Zend_Session_Namespace('auth'); $user_id = $db_user->getUserID($user_name); $user_info = $db_user->getUserInfo($user_id); $arr_acl = $db_user->getArrAcl($user_info['user_type']); $session_user->user_id = $user_id; $session_user->user_name = $user_name; $session_user->pwd = $password; $session_user->level = $user_info['user_type']; $session_user->last_name = $user_info['last_name']; $session_user->first_name = $user_info['first_name']; $a_i = 0; $arr_actin = array(); for ($i = 0; $i < count($arr_acl); $i++) { $arr_module[$i] = $arr_acl[$i]['module']; if ($arr_acl[$i]['module'] == 'exchange') { if ($arr_acl[$i]['action'] == "index" || $arr_acl[$i]['action'] == "add" || $arr_acl[$i]['action'] == "edited") { continue; } $arr_actin[$a_i++] = $arr_acl[$i]['action']; } } // print_r($arr_module); exit; $arr_module = $this->sortMenu($arr_module); // print_r($arr_module); exit; $session_user->arr_acl = $arr_acl; $session_user->arr_module = $arr_module; $session_user->arr_actin = $arr_actin; $session_user->lock(); $log = new Application_Model_DbTable_DbUserLog(); $log->insertLogin($user_id); foreach ($arr_module as $i => $d) { if ($d !== 'user') { $url = '/' . $arr_module[2]; } else { $url = self::REDIRECT_URL; break; } } Application_Form_FrmMessage::redirectUrl("/home"); exit; } else { $this->view->msg = 'ឈ្មោះអ្នកប្រើប្រាស់ និង ពាក្យសំងាត់ មិនត្រឺមត្រូវទេ '; } } else { $this->view->msg = 'លោកអ្នកមិនមានសិទ្ធិប្រើប្រាស់ទេ!'; } } }
public function init() { /* Initialize action controller here */ defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl()); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); }
public function init() { $this->tr = Application_Form_FrmLanguages::getCurrentlanguage(); }
/** * Get all Hour per day * @param int $key * @return multitype:string |Ambigous <string> * @var $key = [0-23] */ public function getHours($key = '') { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $am = $tr->translate('AM'); $pm = $tr->translate('PM'); $hours = array('12:00 ' . $pm, '01:00 ' . $am, '02:00 ' . $am, '03:00 ' . $am, '04:00 ' . $am, '05:00 ' . $am, '06:00 ' . $am, '07:00 ' . $am, '08:00 ' . $am, '09:00 ' . $am, '10:00 ' . $am, '11:00 ' . $am, '12:00 ' . $am, '01:00 ' . $pm, '02:00 ' . $pm, '03:00 ' . $pm, '04:00 ' . $pm, '05:00 ' . $pm, '06:00 ' . $pm, '07:00 ' . $pm, '08:00 ' . $pm, '09:00 ' . $pm, '10:00 ' . $pm, '11:00 ' . $pm); if (empty($key)) { return $hours; } return $hours[$key]; }