Ejemplo n.º 1
0
 public function editWidgetAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $request = $this->getRequest();
     $usersNs = new Zend_Session_Namespace("members");
     $mapCode = "fdWidget";
     $mapId1 = $usersNs->userId;
     if ($request->isPost()) {
         $model1 = new Security_Model_SystemMaster();
         $model = $model1->fetchAll("master_code='fdWidget'");
         $model2 = new Security_Model_SystemMapping();
         $model2->delete("map_code='{$mapCode}' and map_id1='{$mapId1}'");
         foreach ($model as $_row) {
             $disC = "display" . $_row->getMasterId();
             $ordC = "order" . $_row->getMasterId();
             $intval1 = $_POST[$disC];
             $intval2 = $_POST[$ordC];
             if (empty($intval2)) {
                 $intval2 = 0;
             }
             if (empty($intval1)) {
                 $intval1 = 0;
             } else {
                 $intval1 = 1;
             }
             $mapId2 = $_row->getMasterId();
             $model2->setMapCode($mapCode)->setMapId1($mapId1)->setMapId2($mapId2)->setIntval1($intval1)->setIntval2($intval2)->save();
         }
         $this->_flashMessenger->addMessage(array('success' => 'Widgets updated successfully!'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/widget/manage'));
     }
 }
Ejemplo n.º 2
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;
 }
 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'));
     }
 }
Ejemplo n.º 4
0
 public function setModel($row)
 {
     $model = new Security_Model_SystemMapping();
     $model->setMapCode($row->map_code)->setMapId1($row->map_id1)->setMapId2($row->map_id2)->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);
     return $model;
 }
Ejemplo n.º 5
0
 public function savePermissionAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $params = $this->_getAllParams();
     $rdo = $params['rdo'];
     //groupId, subGroupId, roleId, userId
     $mapId2 = $params[$rdo];
     $arrMapId1 = array();
     $mapCode = "";
     $arrResult = array("status" => 0);
     if ($rdo == "groupId") {
         $mapCode = "fdMenuGroupMap";
     } else {
         if ($rdo == "subGroupId") {
             $mapCode = "fdMenuSubGroupMap";
         } else {
             if ($rdo == "roleId") {
                 $mapCode = "fdMenuRoleMap";
             } else {
                 if ($rdo == "userId") {
                     $mapCode = "fdMenuUserMap";
                 }
             }
         }
     }
     foreach ($params as $k => $v) {
         if (stristr($k, "check_") !== false) {
             $arr = explode("_", $k);
             if ($arr[1] !== "noderoot") {
                 $arrMapId1[] = $arr[1];
             }
         }
     }
     if (count($arrMapId1) > 0) {
         $model = new Security_Model_SystemMapping();
         $model->delete("map_code='{$mapCode}' and map_id2='{$mapId2}'");
         foreach ($arrMapId1 as $mapId1) {
             $model->setMapCode($mapCode)->setMapId1($mapId1)->setMapId2($mapId2)->save();
         }
         $arrResult = array("status" => 1);
     } else {
         $arrResult = array("status" => 0);
     }
     echo Zend_Json::encode($arrResult);
 }
 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);
 }
Ejemplo n.º 7
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;
 }