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.º 2
0
 public function countBookmark($menu_id)
 {
     $usersNs = new Zend_Session_Namespace("members");
     $user_id = $usersNs->userId;
     $model = new Security_Model_SystemMapping();
     $rows = $model->getCount("map_code='fdUserBookmark' and map_id1='{$user_id}'");
     return $rows;
 }