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;
 }
 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 = "fdAction";
     }
     $model->setMasterCode($child_master_code);
     $model->setMasterValue($child_master_value);
     $node_id = $model->save();
     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;
 }
Beispiel #3
0
 public function setModel($row)
 {
     $model = new Security_Model_SystemMaster();
     $model->setMasterCode($row->master_code)->setMasterId($row->master_id)->setMasterValue($row->master_value)->setStatus($row->status)->setIntval1($row->intval1)->setIntval2($row->intval2)->setStrval1($row->strval1)->setStrval2($row->strval2)->setBlnval1($row->blnval1)->setBlnval2($row->blnval2)->setDblval1($row->dblval1)->setDblval2($row->dblval2)->setCreatedOn($row->created_on)->setCreatedBy($row->created_by)->setUpdatedOn($row->updated_on)->setUpdatedBy($row->updated_by)->setRowGuid($row->row_guid)->setRowVersion($row->row_version);
     return $model;
 }
Beispiel #4
0
 public function deleteMenuItemAction()
 {
     $id = $this->_getParam('id');
     $menu = new Base_Security_Menu();
     $pages = $menu->getChildPages($id, 0);
     $arrChild[] = $id;
     for ($i = 0; $i < count($pages); $i++) {
         $arrChild[] = $pages[$i]['menu_id'];
     }
     $strMenuIds = implode(',', $arrChild);
     $model1 = new Security_Model_SystemMaster();
     $model1->setMasterCode("fdMenu");
     $model1->delete("master_id IN ({$strMenuIds}) AND master_code ='" . $model1->getMasterCode() . "'");
     $this->_flashMessenger->addMessage(array('success' => 'Menu item deleted successfully!'));
     $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/menu/'));
 }
 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;
 }