コード例 #1
0
 public function createAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $parent_node_id = $this->_getParam('parent_node_id');
     $child_master_value = $this->_getParam('node_title');
     $arrNode = explode("_", $parent_node_id);
     $parent_master_code = $arrNode[0];
     $parent_master_id = $arrNode[1];
     $model = new Security_Model_SystemMaster();
     if ($parent_master_code == "noderoot") {
         // create group
         $child_master_code = "fdUserGroup";
     } else {
         if ($parent_master_code == "fdUserGroup") {
             //create sub group
             $child_master_code = "fdUserSubGroup";
             $map_code = "fdGroupSubGroupMap";
         } else {
             if ($parent_master_code == "fdUserSubGroup") {
                 //create new role
                 $child_master_code = "fdUserRole";
                 $map_code = "fdSubGroupRoleMap";
             }
         }
     }
     $model->setMasterCode($child_master_code);
     $model->setMasterValue($child_master_value);
     $node_id = $model->save();
     if ($parent_master_code !== "noderoot") {
         //mapping start
         $objMapping = new Security_Model_SystemMapping();
         $objMapping->setMapId1($parent_master_id);
         $objMapping->setMapId2($node_id);
         $objMapping->setMapCode($map_code);
         if (true === $objMapping->save()) {
             $result = Zend_Json::encode(array("status" => true, "node_id" => $child_master_code . "_" . $node_id));
         } else {
             $result = Zend_Json::encode(array("status" => false));
         }
     } else {
         if ($node_id) {
             $result = Zend_Json::encode(array("status" => true, "node_id" => $child_master_code . "_" . $node_id));
         } else {
             $result = Zend_Json::encode(array("status" => false));
         }
     }
     echo $result;
 }
コード例 #2
0
 public function editBookmarkAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $request = $this->getRequest();
     $usersNs = new Zend_Session_Namespace("members");
     $mapCode = "fdUserBookmark";
     $mapId1 = $usersNs->userId;
     if ($request->isPost()) {
         $model1 = new Security_Model_SystemMapping();
         $rows = $model1->fetchAll("map_code='{$mapCode}' and map_id1='{$mapId1}'");
         $model1->delete("map_code='{$mapCode}' and map_id1='{$mapId1}'");
         // $model2=new Security_Model_SystemMapping();
         // $model2->delete("map_code='{$mapCode}' and map_id1='{$mapId1}'");
         foreach ($rows as $_row) {
             $mapID2 = $_row->getMapId2();
             if (!empty($mapID2)) {
                 $ordC = "order" . $mapID2;
                 $orderval = $_POST[$ordC];
                 if (empty($orderval)) {
                     $orderval = 1;
                 } else {
                     $orderval = (int) $orderval;
                 }
                 $model1->setMapId1($mapId1);
                 //user id
                 $model1->setMapId2($mapID2);
                 //master id
                 $model1->setMapId3($orderval);
                 //order value
                 $model1->setMapCode($mapCode);
                 //map code
                 $model1->save();
                 //echo $_row->getMapId2()."----".$orderval;
                 //echo "<br>";
             }
         }
         $this->_flashMessenger->addMessage(array('success' => 'Bookmark order updated successfully!'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/bookmark/index'));
     }
 }
コード例 #3
0
 public function addBookMarkAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $menu_id = $this->_getParam('id');
     $limit = Zend_Registry::get('bookMark_limit');
     $usersNs = new Zend_Session_Namespace("members");
     $user_id = $usersNs->userId;
     $security = new Base_Security_Menu();
     $bookmarkAdd = $security->isBookMarked($menu_id);
     $model = new Security_Model_SystemMapping();
     if ($bookmarkAdd == false) {
         $count = $model->getCount("map_code='fdUserBookmark' and map_id1='{$user_id}'");
         if ($count >= $limit) {
             $arrResult = array("result" => 1);
             //if more than 15
         } else {
             $mapCode = "fdUserBookmark";
             $model->setMapCode($mapCode);
             $model->setMapId1($user_id);
             $model->setMapId2($menu_id);
             $model->save();
             $arrResult = array("result" => 2);
             //added into bookmark
         }
     } else {
         if ($bookmarkAdd == true) {
             $arrResult = array("result" => 3);
             //All ready added into bookmark
         } else {
             $arrResult = array("result" => 4);
             //// Problem in Parameter
         }
     }
     echo Zend_Json::encode($arrResult);
 }
コード例 #4
0
 public function createAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $parent_node_id = $this->_getParam('parent_node_id');
     //print_r ($parent_node_id);
     $child_master_value = $this->_getParam('node_title');
     $arrNode = explode("_", $parent_node_id);
     $parent_master_code = $arrNode[0];
     $parent_master_id = $arrNode[1];
     $model = new Security_Model_SystemMaster();
     $entry_in_master_tbl = 'Yes';
     if ($parent_master_code == "noderoot") {
         // create group
         $child_master_code = "fdAnimal";
         $where = "master_value = '{$child_master_value}'";
         $already_exists_validation = $model->fetchRow($where);
         if ($already_exists_validation) {
             return 0;
         }
     } else {
         if ($parent_master_code == "fdAnimal") {
             //create sub group
             $parent_master_id = $arrNode[1];
             $child_master_code = "fdAnimalType";
             $map_code = "fdAnimalAnimalTypeAnimalColorMap";
             $where = "master_value = '{$child_master_value}'";
             $already_exists_validation = $model->fetchRow($where);
             if ($already_exists_validation) {
                 $entry_in_master_tbl = 'No';
             }
         } else {
             if ($parent_master_code == "fdAnimalType") {
                 //create new role
                 $parent_master_id = $arrNode[2];
                 $child_master_id = $arrNode[1];
                 $child_master_code = "fdAnimalColor";
                 $map_code = "fdAnimalAnimalTypeAnimalColorMap";
                 $where = "master_value = '{$child_master_value}'";
                 $already_exists_validation = $model->fetchRow($where);
                 if ($already_exists_validation) {
                     $entry_in_master_tbl = 'No';
                 }
             }
         }
     }
     echo $entry_in_master_tbl;
     if ($entry_in_master_tbl == 'Yes') {
         $model->setMasterCode($child_master_code);
         $model->setMasterValue($child_master_value);
         $node_id = $model->save();
     } else {
         if ($entry_in_master_tbl == 'No') {
             $node_id = $already_exists_validation->masterId;
         }
     }
     //echo $node_id ;
     if ($parent_master_code !== "noderoot") {
         //mapping start
         $objMapping = new Security_Model_SystemMapping();
         $objMapping->setMapId1($parent_master_id);
         if ($child_master_id) {
             $objMapping->setMapId2($child_master_id);
             $objMapping->setMapId3($node_id);
             $objMapping->setMapCode($map_code);
             //$objMapping->UpdateMapId3_MapId2($map_code,$parent_master_id,$child_master_id,$node_id);
             $objMapping->save();
             $result = Zend_Json::encode(array("status" => true, "node_id" => $child_master_code . "_" . $node_id));
         } else {
             $objMapping->setMapId2($node_id);
             $objMapping->setMapCode($map_code);
             if (true === $objMapping->save()) {
                 $result = Zend_Json::encode(array("status" => true, "node_id" => $child_master_code . "_" . $node_id));
             } else {
                 $result = Zend_Json::encode(array("status" => false));
             }
         }
     } else {
         if ($node_id) {
             $result = Zend_Json::encode(array("status" => true, "node_id" => $child_master_code . "_" . $node_id));
         } else {
             $result = Zend_Json::encode(array("status" => false));
         }
     }
     return $result;
 }