コード例 #1
0
 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);
 }