public function genSystemMasterId($master_code) { $model = new Security_Model_SystemMaster(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->from(array("a" => 'system_master'), array('max_id' => 'MAX(master_id)'))->where("master_code='{$master_code}'"); $row = $table->fetchRow($select); $max_id = $row->max_id + 1; return $max_id; //echo $select->__toString(); exit; }
public function getMasterValuesArr($code) { $model = new Security_Model_SystemMaster(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'system_master'))->order("master_value")->where("status='1' and master_code='{$code}'"); $sql = $select->__toString($select); $rows = $model->fetchAll($select); foreach ($rows as $row) { $arr[$row->getMasterId()] = $row->getMasterValue(); } return $arr; }
public function manageAction() { $code = "fdWidget"; $usersNs = new Zend_Session_Namespace("members"); $mapId1 = $usersNs->userId; $where = "s.master_code='{$code}'"; $model = new Security_Model_SystemMaster(); $table = $model->getMapper()->getDbTable(); /*SELECT s.master_value,s.master_code,sm.map_id1 from system_master s,system_mapping sm where sm.map_code='fdWidget' and s.master_code=sm.map_code and s.master_id=sm.map_id2*/ $model2 = new Security_Model_SystemMapping(); $exist = $model2->isExist("map_code='{$code}' and map_id1='{$mapId1}'"); if ($exist) { $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'system_master'), array("master_value"))->join(array("sm" => "system_mapping"), "sm.map_code='fdWidget' and sm.map_id1='{$mapId1}' and s.master_code=sm.map_code and s.master_id=sm.map_id2", array("master_id" => 'map_id2', "intval1" => 'intval1', "intval2" => 'intval2'))->order("sm.map_id3"); // echo $sql = $select->__toString(); exit; } else { $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'system_master'))->where($where); } $sql = $select->__toString(); $this->view->widgets = $table->fetchAll($select); }
public function dashboardAction() { //Start Dashboard bookmark listing $code1 = "fdUserBookmark"; $usersNs = new Zend_Session_Namespace("members"); $mapId1 = $usersNs->userId; $model = new Security_Model_SystemMapping(); $strOrderBy = "s.map_id3"; $this->view->sortOptions = array(); $this->view->linkArray = array(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("sm" => 'system_master'), array("master_value", "strval1", "strval3"))->join(array("s" => "system_mapping"), "s.map_code='{$code1}' and s.map_id1='{$mapId1}' and sm.master_code='fdMenu' and sm.strval1!='' and sm.master_id=s.map_id2", array("map_id1" => 'map_id1', "map_id2" => 'map_id2', "map_id3" => 'map_id3'))->group("s.map_id2")->order($strOrderBy); $this->view->bookmarks = $table->fetchAll($select); //End Dashboard bookmark listing //start dashboard Widgets $code2 = "fdWidget"; $model = new Security_Model_SystemMaster(); $table2 = $model->getMapper()->getDbTable(); $select = $table2->select()->setIntegrityCheck(false)->from(array("s" => 'system_master'), array("master_value"))->join(array("sm" => "system_mapping"), "sm.map_code='{$code2}' and sm.map_id1='{$mapId1}' and s.master_code=sm.map_code and s.master_id=sm.map_id2 and sm.intval1=1", array("master_id" => 'map_id2', "intval1" => 'intval1', "intval2" => 'intval2'))->order("sm.map_id3"); $this->view->widgets = $table2->fetchAll($select); //End widgets listing $this->view->pageHeading = "Dashboard"; }
public function listSystemMasterAction() { /*--search---*/ $this->view->pageHeading = "List System Master"; $search = trim($this->_getParam('master_code')); $this->view->assign('searchText', $search); //$status = trim($this->_getParam('status')); /*---sorting ----*/ $order = trim($this->_getParam('order', "")); $col = trim($this->_getParam('col', "")); if ($order != "" && $col != "") { if ($col == "master_code") { $strOrderBy = "s.master_code {$order}"; } else { if ($col == "master_id") { $strOrderBy = "s.master_id {$order}"; } else { if ($col == "master_value") { $strOrderBy = "s.master_value {$order}"; } else { if ($col == "status") { $strOrderBy = "s.status {$order}"; } } } } } else { $strOrderBy = "s.master_code"; } $this->view->sortOptions = array(); /*-----sorting----------*/ $where = "1"; $groupby = "s.master_code"; $this->view->linkArray = array(); $this->view->search = ""; if ($search != "") { $where = "(master_code like '%{$search}%')and {$where} "; //$where="(master_code like '%{$search}%') and status='1'"; $this->view->linkArray = array('search' => $search); $this->view->search = $search; $this->view->sortOptions['master_code'] = $search; } $page_size = Zend_Registry::get('page_size'); $page = $this->_getParam('page', 1); $model = new Security_Model_SystemMaster(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'system_master'))->order("{$strOrderBy}")->where($where)->group($groupby); $sql = $select->__toString(); $paginator = Base_Paginator::factory($select); $paginator->setItemCountPerPage($page_size); $paginator->setCurrentPageNumber($page); $this->view->totalItems = $paginator->getTotalItemCount(); $this->view->paginator = $paginator; }