Ejemplo n.º 1
0
 /**
  * @Created By : Mahipal Adhikari
  * @Created On : 29-Oct-2010
  * @Description: Used to save/update map location permission from where-i-am page
  */
 function updateLocationPermissionAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->getRequest()->getParam('perm_id');
     $friend_group_id = $this->getRequest()->getParam('friend_group_id');
     $response = "";
     $UserPermissionObj = new Application_Model_UserPermission();
     $UserPermissionObj = $UserPermissionObj->find($id);
     if (false !== $UserPermissionObj) {
         $UserPermissionObj->setFriendGroupId($friend_group_id);
         $respPermission = $UserPermissionObj->save();
         //set confirmation message to display
         if ($respPermission) {
             //get permission name to set selected
             $FriendGroupObj = new Application_Model_FriendGroup();
             $whereCond = "id='{$friend_group_id}'";
             $FriendGroup = $FriendGroupObj->fetchRow($whereCond);
             $PermissionName = $FriendGroup->getName();
             $response .= "<span style='color:#EF4733;'>Location permission has been saved.</span>";
             $JsonResultArray = array('msg' => $response, 'set_permission' => $PermissionName);
         } else {
             $response = "<span style='color:#EF4733;'>Error occured. Please try again later.</span>";
             $JsonResultArray = array('msg' => $response);
         }
     } else {
         $response = "<span style='color:#EF4733;'>Invalid request.</span>";
         $JsonResultArray = array('msg' => $response);
     }
     //sleep(5);
     echo Zend_Json::encode($JsonResultArray);
     exit;
 }