本文整理汇总了PHP中Application_Model_DbTable_DbGlobal::getGlobalDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_DbTable_DbGlobal::getGlobalDb方法的具体用法?PHP Application_Model_DbTable_DbGlobal::getGlobalDb怎么用?PHP Application_Model_DbTable_DbGlobal::getGlobalDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_DbTable_DbGlobal
的用法示例。
在下文中一共展示了Application_Model_DbTable_DbGlobal::getGlobalDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchPrice
function searchPrice()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$db = new Application_Model_DbTable_DbGlobal();
/////////////Filter Product/////////////////
$tr = Application_Form_FrmLanguages::getCurrentlanguage();
$nameValue = $request->getParam('g_name');
$nameElement = new Zend_Form_Element_Text('g_name');
$nameElement->setValue($nameValue);
$this->addElement($nameElement);
$rs = $db->getGlobalDb('SELECT type_id, price_type_name FROM tb_price_type WHERE public = 1 AND price_type_name!=""');
$options = array('' => $tr->translate('Please_Select_Type_Price'));
$pricetypeValue = $request->getParam('type_id');
if (!empty($rs)) {
foreach ($rs as $read) {
$options[$read['type_id']] = $read['price_type_name'];
}
}
$pricetype_id = new Zend_Form_Element_Select('type_id');
$pricetype_id->setMultiOptions($options);
$pricetype_id->setAttribs(array('id' => 'type_id', 'onchange' => 'this.form.submit()'));
$pricetype_id->setValue($pricetypeValue);
$this->addElement($pricetype_id);
$nameValue = $request->getParam('p_name');
$nameElement = new Zend_Form_Element_Text('p_name');
$nameElement->setValue($nameValue);
$this->addElement($nameElement);
$nameValue = $request->getParam('p_price');
$nameElement = new Zend_Form_Element_Text('p_price');
$nameElement->setValue($nameValue);
$this->addElement($nameElement);
$rs = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category WHERE Name!="" ');
$options = array('Please Select Product');
$cateValue = $request->getParam('category_id');
foreach ($rs as $read) {
$options[$read['CategoryId']] = $read['Name'];
}
$cate_element = new Zend_Form_Element_Select('category_id');
$cate_element->setMultiOptions($options);
$cate_element->setAttribs(array('id' => 'category_id', 'class' => 'demo-code-language', 'onchange' => 'this.form.submit()'));
$cate_element->setValue($cateValue);
$this->addElement($cate_element);
$codeValue = $request->getParam('p_code');
$codeElement = new Zend_Form_Element_Text('p_code');
$codeElement->setValue($codeValue);
$this->addElement($codeElement);
$_arroption = array(1 => $tr->translate("ACTIVE"), 0 => $tr->translate("DEACTIVE"));
$_var = $request->getParams("status");
$statusElement = new Zend_Form_Element_Select("status");
$statusElement->setMultiOptions($_arroption);
$statusElement->setAttribs(array('id' => 'status', 'onchange' => 'this.form.submit()'));
$statusElement->setValue($_var);
$this->addElement($statusElement);
return $this;
}
示例2: addBrand
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;
}
示例3: indexAction
public function indexAction()
{
$formFilter = new sales_Form_FrmStockFilter();
$this->view->formFilter = $formFilter;
Application_Model_Decorator::removeAllDecorator($formFilter);
$list = new Application_Form_Frmlist();
$db = new Application_Model_DbTable_DbGlobal();
$sales_agent_sql = "SELECT sg.agent_id, sg.name, sg.phone, sg.email, sg.address, sg.job_title, l.Name, sg.description\n FROM tb_sale_agent AS sg \n INNER JOIN tb_sublocation As l ON l.LocationId = sg.stock_id WHERE 1 ";
if ($this->getRequest()->isPost()) {
$search = $this->getRequest()->getPost();
if ($search["s_name"] != '') {
$sales_agent_sql .= " AND sg.name LIKE '%" . $search['s_name'] . "%'";
$sales_agent_sql .= " OR sg.phone LIKE '%" . $search['s_name'] . "%'";
}
if ($search["stock_location"] != '' and $search["stock_location"] != 0) {
$sales_agent_sql .= " AND sg.stock_id = " . $search['stock_location'];
}
}
$sales_agent_sql .= " ORDER BY sg.agent_id DESC";
$rows = $db->getGlobalDb($sales_agent_sql);
$columns = array("SALE-AGENT", "CONTACT_NUM_CAP", "EMAIL_CAP", "ADDRESS_CAP", "POSTION_CAP", "LOCATION_NAME_CAP", "DESC_CAP");
$link = array('module' => 'sales', 'controller' => 'sale-agent', 'action' => 'update-sale-agent');
$urlEdit = BASE_URL . "/sales/sale-agent/update-sale-agent";
$glClass = new Application_Model_GlobalClass();
$this->view->list = $list->getCheckList(1, $columns, $rows, array('name' => $link), $urlEdit);
}
示例4: frmSearchTeacher
public function frmSearchTeacher($_data = null)
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$_title = new Zend_Dojo_Form_Element_TextBox('title');
$_title->setAttribs(array('dojoType' => $this->text, 'placeholder' => $this->tr->translate("SEARCH_BY_TEACHER_NAME")));
$_title->setValue($request->getParam('title'));
$_db = new Application_Model_DbTable_DbGlobal();
$rows = $_db->getGlobalDb("SELECT DISTINCT subject_name_en FROM rms_teacher WHERE teacher_name_en!='' AND subject_name_en!=''");
$opt = array(-1 => $this->tr->translate("CHOOSE_SUJECT"));
if (!empty($rows)) {
foreach ($rows as $row) {
$opt[$row['subject_name_en']] = $row['subject_name_en'];
}
}
$_subject = new Zend_Dojo_Form_Element_FilteringSelect('subjec_name');
$_subject->setMultiOptions($opt);
$_subject->setAttribs(array('dojoType' => $this->filter, 'required' => 'true', 'placeholder' => $this->tr->translate("INPUT_VALUE_SETTING")));
$_subject->setValue($request->getParam('subjec_name'));
$_status = new Zend_Dojo_Form_Element_FilteringSelect('status_search');
$_status->setAttribs(array('dojoType' => $this->filter));
$_status_opt = array(-1 => $this->tr->translate("ALL_STATUS"), 1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$_status->setMultiOptions($_status_opt);
$_status->setValue($request->getParam("status_search"));
$this->addElements(array($_title, $_subject, $_status));
if (!empty($_data)) {
}
return $this;
}
示例5: FrmAddSchool
public function FrmAddSchool($data = null)
{
$_classname = new Zend_Dojo_Form_Element_TextBox('schoolname');
$_classname->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
$_province = new Zend_Dojo_Form_Element_FilteringSelect('province');
$_province->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
$_db = new Application_Model_DbTable_DbGlobal();
$rows_school = $_db->getGlobalDb("SELECT province_id,province_en_name FROM rms_province ");
$opt_school = "";
if (!empty($rows_school)) {
foreach ($rows_school as $row) {
$opt_school[$row['province_id']] = $row['province_en_name'];
}
}
$_province->setMultiOptions($opt_school);
$_status = new Zend_Dojo_Form_Element_FilteringSelect('status');
$_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
$_status_opt = array(1 => $this->tr->translate("ACTIVE"), 2 => $this->tr->translate("DACTIVE"));
$_status->setMultiOptions($_status_opt);
$_submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
$_submit->setLabel("save");
$id = new Zend_Form_Element_Hidden('id');
if (!empty($data)) {
$_classname->setValue($data['school_name']);
$_status->setValue($data['status']);
$_province->setValue($data['province_id']);
$id->setValue($data['id']);
}
$this->addElements(array($_classname, $_status, $_submit, $_province, $id));
return $this;
}
示例6: init
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;
}
示例7: getDataAutocompleteData
public static function getDataAutocompleteData($sql)
{
$gb_db = new Application_Model_DbTable_DbGlobal();
$rs = $gb_db->getGlobalDb($sql);
//echo Zend_Json::encode($rs);
$data = Zend_Json::encode($rs);
return $data;
}
示例8: init
public function init()
{
/* Initialize action controller here */
header('content-type: text/html; charset=utf8');
defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());
$db = new Application_Model_DbTable_DbGlobal();
$sql = "SELECT u.user_type_id,u.user_type FROM `rms_acl_user_type` u where u.`status`=1";
$results = $db->getGlobalDb($sql);
foreach ($results as $key => $r) {
$this->user_typelist[$r['user_type_id']] = $r['user_type'];
}
}
示例9: getOption
/**
* create option for setMultiOption in select box
* @param string $value
* @param string $label
* @param string $sql
* @return array('id'=>'label')
*/
public function getOption($value, $label, $sql)
{
$db = new Application_Model_DbTable_DbGlobal();
$rs = $db->getGlobalDb($sql);
$options = array();
if ($rs) {
foreach ($rs as $read) {
$options[$read[$value]] = $read[$label];
}
}
return $options;
}
示例10: getfillteraddAction
public function getfillteraddAction()
{
if ($this->getRequest()->IsPost()) {
$data = $this->getRequest()->getPost();
$user_type = $data['user_type'];
$sql = "SELECT user_type FROM tbwu_acl_user_type WHERE user_type = '{$user_type}'";
$db = new Application_Model_DbTable_DbGlobal();
$row = $db->getGlobalDb($sql);
echo Zend_Json::encode($row);
exit;
}
}
示例11: init
public function init()
{
/* Initialize action controller here */
header('content-type: text/html; charset=utf8');
//clear all other sessions
Application_Form_FrmSessionManager::clearSessionSearch();
$db = new Application_Model_DbTable_DbGlobal();
$sql = "SELECT u.user_type_id,u.user_type FROM `rsv_acl_user_type` u where u.`status`=1";
$results = $db->getGlobalDb($sql);
foreach ($results as $key => $r) {
$this->user_typelist[$r['user_type_id']] = $r['user_type'];
}
}
示例12: init
public function init()
{
//user name
$user_type = new Zend_Form_Element_Text('user_type');
$user_type->setAttribs(array('id' => 'user_type'));
$this->addElement($user_type);
//Main parent of user type
$db = new Application_Model_DbTable_DbGlobal();
$rs = $db->getGlobalDb("SELECT ut.user_type_id,ut.user_type FROM rsv_acl_user_type AS ut");
$options = array();
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);
$this->addElement($user_type_id);
$rs = $db->getGlobalDb("SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access FROM rsv_acl_acl AS acl");
$options = array();
foreach ($rs as $read) {
$options[$read['acl_id']] = $read['user_access'];
}
$user_access_id = new Zend_Form_Element_Select('acl_id');
$user_access_id->setMultiOptions($options);
$this->addElement($user_access_id);
//Project assignment
//Sophen add here to assign project
$user_session_id = new Zend_Session_Namespace('auth');
$id = $user_session_id->user_type_id;
//echo $user_id;exit;
$db_user = new Application_Model_DbTable_DbGlobal();
if ($id == 1) {
$sql = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access from rsv_acl_acl as acl";
} else {
$sql = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rsv_acl_user_access AS ua \r\n\t\t INNER JOIN rsv_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\r\n\t\t\t INNER JOIN rsv_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ut.user_type_id =" . $id;
}
//print_r($sql); exit;
$project = $db_user->getGlobalDb($sql);
if ($project) {
$i = 0;
foreach ($project as $read) {
//print_r($read);exit;
$i++;
$check_fund = new Zend_Form_Element_Checkbox('acl_id_' . $i, array('label' => $read['user_access']));
$check_fund->setUncheckedValue('')->setCheckedValue($read['acl_id']);
$this->addElement($check_fund);
}
$this->plus = $i;
}
//remove decorator
Application_Model_Decorator::removeAllDecorator($this);
}
示例13: getPurchaseidAction
public function getPurchaseidAction()
{
if ($this->getRequest()->isPost()) {
$db = new Application_Model_DbTable_DbGlobal();
$post = $this->getRequest()->getPost();
$invoice = $post['invoice_id'];
$sqlinfo = "SELECT * FROM `tb_purchase_order` WHERE order_id = {$invoice} LIMIT 1";
$rowinfo = $db->getGlobalDbRow($sqlinfo);
$sql = "SELECT pui.qty_order,pui.pro_id,pui.price,pui.sub_total\n\t\t\t\t\t,(SELECT pur.order FROM tb_purchase_order as pur WHERE pur.order_id = pui.order_id ) as order_no\n\t\t\t\t\t,(SELECT pur.all_total FROM tb_purchase_order as pur WHERE pur.order_id = pui.order_id ) as all_total\n\t\t\t\t\t,(SELECT pr.qty_perunit FROM tb_product AS pr WHERE pr.pro_id = pui.pro_id LIMIT 1) AS qty_perunit\n \t\t\t\t,(SELECT pr.item_name FROM tb_product AS pr WHERE pr.pro_id = pui.pro_id LIMIT 1) AS item_name\n\t\t\t\t\t,(SELECT pr.pro_id FROM tb_product AS pr WHERE pr.pro_id = pui.pro_id LIMIT 1) AS pro_id\n \t\t\t\t,(SELECT `label` FROM tb_product AS pr WHERE pr.pro_id = pui.pro_id LIMIT 1) AS label\n \t\t\t\t ,(SELECT `measure_name` FROM `tb_measure` AS ms WHERE ms.id=(SELECT measure_id FROM tb_product WHERE pro_id=pui.`pro_id`)) AS measure_name\n \t\t\tFROM `tb_purchase_order_item` AS pui WHERE pui.order_id = " . $invoice;
$rows = $db->getGlobalDb($sql);
$result = array('poinfo' => $rowinfo, 'item' => $rows);
echo Zend_Json::encode($result);
exit;
}
}
示例14: FrmGeneraljurnal
public function FrmGeneraljurnal($data = null)
{
$Brance = new Zend_Dojo_Form_Element_FilteringSelect('brance');
$Brance->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
$db = new Application_Model_DbTable_DbGlobal();
$rows = $db->getAllBranchName();
$options = '';
if (!empty($rows)) {
foreach ($rows as $row) {
$options[$row['br_id']] = $row['branch_namekh'];
}
}
$Brance->setMultiOptions($options);
$Add_Date = new Zend_Dojo_Form_Element_DateTextBox('add_date');
$Add_Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
$Add_Date->setValue(date('Y-m-d'));
$Account_Number = new Zend_Dojo_Form_Element_FilteringSelect('account_number');
$Account_Number->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true'));
$db = new Application_Model_DbTable_DbGlobal();
$sql = "SELECT id,account_name_en,account_code FROM ln_account_name WHERE status=1";
$rows = $db->getGlobalDb($sql);
$opt = '';
if (!empty($rows)) {
foreach ($rows as $row) {
$opt[$row['id']] = $row['account_code'];
}
}
$Account_Number->setMultiOptions($opt);
$Account_name = new Zend_Dojo_Form_Element_FilteringSelect('account_name');
$Account_name->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
$opt = '';
if (!empty($rows)) {
foreach ($rows as $row) {
$opt[$row['id']] = $row['account_name_en'];
}
}
$Account_name->setMultiOptions($opt);
$Note = new Zend_Dojo_Form_Element_TextBox('note');
$Note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
$Debit = new Zend_Dojo_Form_Element_TextBox('debit');
$Debit->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
$Debit->setValue(0);
$Credit = new Zend_Dojo_Form_Element_TextBox('credit');
$Credit->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
$Credit->setValue(0);
$this->addElements(array($Add_Date, $Account_Number, $Account_name, $Note, $Debit, $Credit, $Brance));
return $this;
}
示例15: indexAction
public function indexAction()
{
$formFilter = new Product_Form_FrmProductFilter();
$this->view->formFilter = $formFilter;
//$cate = $formFilter->listCategory();
//$this->view->cate = $cate;
$list = new Application_Form_Frmlist();
$user_info = new Application_Model_DbTable_DbGetUserInfo();
$result = $user_info->getUserInfo();
$db = new Application_Model_DbTable_DbGlobal();
// $productSql = "SELECT p.pro_id,p.item_name,p.item_code,g.Name As cate_name, b.Name as LocationName, lo.Name, pl.qty
// FROM tb_product AS p
// INNER JOIN tb_prolocation AS pl ON pl.pro_id = p.pro_id
// INNER JOIN tb_category AS g ON g.CategoryId = p.cate_id
// INNER JOIN tb_branch as b ON b.branch_id = p.brand_id
// INNER JOIN tb_sublocation AS lo ON lo.LocationId = pl.LocationId WHERE 1 ";
$productSql = "SELECT \n\t\t\t\tp.pro_id \n\t\t\t\t,p.item_name\n\t\t\t\t,p.item_code\n\t\t\t\t,(SELECT g.Name FROM tb_category AS g WHERE g.CategoryId = (SELECT cate_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1)) AS Cate_name\n\t\t\t\t,(SELECT b.Name FROM tb_branch AS b WHERE b.branch_id = (SELECT brand_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1 )) AS Branch\n\t\t\t\t,(SELECT lo.Name FROM tb_sublocation AS lo WHERE lo.LocationId = pl.LocationId LIMIT 1) AS LocationName\n\t\t\t\t,pl.qty\n\t\t\tFROM tb_prolocation AS pl,tb_product AS p WHERE pl.`pro_id`=p.pro_id ";
$str_condition = " AND pl.LocationId";
$productSql .= $db->getAccessPermission($result["level"], $str_condition, $result["location_id"]);
if ($this->getRequest()->isPost()) {
$post = $this->getRequest()->getPost();
$productName = $this->getRequest()->getParam('s_name');
if ($post['LocationId'] !== '' and $post['LocationId'] != 0) {
$productSql .= " AND pl.LocationId = " . trim($post['LocationId']);
}
if ($post['p_name'] != '') {
$productSql .= " AND p.item_name LIKE '%" . trim($post['p_name']) . "%'";
$productSql .= " OR p.item_code LIKE '%" . trim($post['p_name']) . "%'";
}
if ($post['category_id'] !== '' and $post['category_id'] != 0) {
//echo $post['category_id']; exit();
$productSql .= " AND p.cate_id =" . trim($post['category_id']);
}
if ($post['branch_id'] !== '' and $post['branch_id'] != 0) {
$productSql .= " AND p.brand_id =" . trim($post['branch_id']);
}
}
//echo $productSql;exit();
$productSql .= " ORDER BY p.item_name,p.cate_id DESC";
$rows = $db->getGlobalDb($productSql);
$link = array('module' => 'product', 'controller' => 'index', 'action' => 'update');
$columns = array("ITEM_NAME_CAP", "item_code", "CATEGORY_CAP", "BRAND_CAP", "LOCATION_NAME_CAP", "QTY_HAND_CAP");
$urlEdit = BASE_URL . "/distributor/index/update";
$urlEdit = BASE_URL . "/product/index/update";
$this->view->list = $list->getCheckList(1, $columns, $rows, array('item_name' => $link), $urlEdit);
Application_Model_Decorator::removeAllDecorator($formFilter);
}