/**
  * @Created By : Mahipal Singh Adhikari
  * @Created On : 10-Dec-2010
  * @Description: Used to display more wall on "View More" link from User Travel Wall page
  */
 public function viewMorewallAction()
 {
     $this->view->layout()->disableLayout();
     //get logged in user Id
     $userNs = new Zend_Session_Namespace('members');
     $this->view->userId = $userNs->userId;
     //Get user Id
     $userId = $this->_getParam('user_id');
     $this->view->user_profile_id = $userId;
     //fetch all user friends
     /*
     		$friendM	=	new Application_Model_Friend();
     		$friends	=	$friendM->getUserFriend($userId);
     		$friendStr	=	$userId;
     		if(false!==$friends)
     		{
     			$friendStr = implode(',',$friends);
     			$friendStr = $userId.", ".$friendStr;
     		}*/
     $order = "addedon DESC";
     //$where	=	"active_status=1 AND user_id in ({$friendStr} )";
     $where = "active_status=1";
     $where .= " AND (user_id={$userId} AND profile_id=0)";
     //get user status
     $where .= " OR (user_id={$userId} AND profile_id={$userId})";
     //get user own wall
     $where .= " OR (user_id!={$userId} AND profile_id={$userId})";
     //get walls posted in users profile
     // Fetch all hided post id
     $WallHideUserPostM = new Application_Model_WallHideUserPost();
     $hidedPost = $WallHideUserPostM->getAllHidePostId($userId);
     if (count($hidedPost) > 0) {
         $hidePost = implode(",", $hidedPost);
         $where .= " AND id NOT IN({$hidePost})";
     }
     // Fetch all hided post user id
     $WallHideUserAllM = new Application_Model_WallHideUserAll();
     $hidedAllUsersPost = $WallHideUserAllM->getAllPosterId($userId);
     if (count($hidedAllUsersPost) > 0) {
         $hidedAllUsersPost = implode(",", $hidedAllUsersPost);
         $where .= " AND user_id NOT IN({$hidedAllUsersPost})";
     }
     /*------------------------- Set paging START------------------------*/
     $settings = new Admin_Model_GlobalSettings();
     $page_size = $settings->settingValue('friend_page_size');
     //$page_size	= 10;
     $page = $this->_getParam("page");
     $offset = ($page - 1) * $page_size;
     /*------------------------- Set paging END------------------------*/
     $feeds = new Application_Model_Wall();
     //$data	=	$feeds->fetchAll($where, $order, $limit);
     $data = $feeds->fetchAll($where, $order, $page_size, $offset);
     $this->view->data = $data;
     //if no record found then no need to render view and exit
     if (count($data) == 0) {
         $this->_helper->viewRenderer->setNoRender(true);
         exit("nodata");
     }
 }
Exemplo n.º 2
0
 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 27-Jan-2011
  * @Description	: Report Journal/Wall and other items as abuse to admin
  */
 public function reportAbuseAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     //get request parameters
     $item_id = $this->_getParam('item_id');
     $item_type = $this->_getParam('item_type');
     //get logged in user ID
     $usersNs = new Zend_Session_Namespace('members');
     $user_id = $usersNs->userId;
     if ($user_id == "" || $user_id == 0) {
         $JsonResultArray = array('error' => 1, 'response' => "Please login to report abuse.");
         echo Zend_Json::encode($JsonResultArray);
         exit;
     }
     if ($item_id == "" || $item_id == 0) {
         $JsonResultArray = array('error' => 2, 'response' => "No item is selected to report abuse.");
         echo Zend_Json::encode($JsonResultArray);
         exit;
     }
     if ($item_type == "") {
         $JsonResultArray = array('error' => 2, 'response' => "No item type is selected to report abuse.");
         echo Zend_Json::encode($JsonResultArray);
         exit;
     }
     //Get user report abuse info for item
     $modelM = new Application_Model_ReportAbuse();
     $modelRes = $modelM->fetchRow("item_id={$item_id} AND item_type='{$item_type}' AND user_id={$user_id}");
     if ($modelRes && $modelRes->getStatus() == 1) {
         $JsonResultArray = array('error' => 2, 'response' => "You've already reported this as abuse.");
         echo Zend_Json::encode($JsonResultArray);
         exit;
     } else {
         $params["itemId"] = $item_id;
         $params["itemType"] = $item_type;
         $params["userId"] = $user_id;
         $params["comment"] = "";
         $params["status"] = 1;
         $modelM->setOptions($params);
         $dbRes = $modelM->save();
         if ($dbRes) {
             //get item type information
             $itemTitle = "";
             $authorId = "";
             $author = "";
             if ($item_type == 'blog') {
                 $blogM = new Application_Model_Blog();
                 $blogRes = $blogM->find($item_id);
                 $itemTitle = $blogRes->getTitle();
                 $authorId = $blogRes->getUserId();
                 $blog_url = Zend_Registry::get('siteurl') . "/journal/view-post/blog_id/" . $item_id;
                 $itemTitle = "<a href='" . $blog_url . "' target='_blank'>" . $itemTitle . "</a>";
             } else {
                 if ($item_type == 'wall') {
                     $wallM = new Application_Model_Wall();
                     $wallRes = $wallM->find($item_id);
                     $itemTitle = $wallRes->getStatus();
                     $authorId = $wallRes->getUserId();
                 } else {
                     if ($item_type == 'photo') {
                         $objModelAlbumPhoto = new Album_Model_AlbumPhoto();
                         $albumPhotoRes = $objModelAlbumPhoto->find($item_id);
                         $itemTitle = $albumPhotoRes->getName();
                         $authorId = $albumPhotoRes->getUserId();
                     }
                 }
             }
             //get Blog/Wall owner/author user information
             if ($authorId != "") {
                 $useAuthor = new Application_Model_User();
                 $authorRes = $useAuthor->find($authorId);
                 $author = ucfirst($authorRes->getFirstName()) . " " . ucfirst($authorRes->getLastName()) . " (" . $authorRes->getUsername() . ")";
             }
             //get user information who is reporting abuse item
             $userM = new Application_Model_User();
             $userR = $userM->find($user_id);
             $reporterName = ucfirst($userR->getFirstName()) . " " . ucfirst($userR->getLastName()) . " (" . $userR->getUsername() . ")";
             $reporterEmail = $userR->getEmail();
             //Now send report abuse email to Administrator
             $settings = new Admin_Model_GlobalSettings();
             $admin_email = $settings->settingValue('report_abuse');
             //$admin_email	= "*****@*****.**";
             $mailOptions['receiver_email'] = $admin_email;
             $mailOptions['item_type'] = ucfirst($item_type);
             $mailOptions['item_title'] = $itemTitle;
             $mailOptions['item_author'] = $author;
             $mailOptions['reporter_name'] = $reporterName;
             $mailOptions['reporter_email'] = $reporterEmail;
             //create mail class object and send the email
             $Mail = new Base_Mail();
             $Mail->sendReportAbuseEmail($mailOptions);
             //send response
             $JsonResultArray = array('error' => 3, 'response' => "Consider it reported!");
         } else {
             $JsonResultArray = array('error' => 2, 'response' => "Error occured, please try again later.");
         }
     }
     echo Zend_Json::encode($JsonResultArray);
     exit;
 }
Exemplo n.º 3
0
 public function userLikeThisAction()
 {
     $this->_helper->layout->setLayout('journal-layout-2column');
     //$item_id = $this->_getParam("blog_id");
     $item_id = $this->_getParam("item_id");
     $item_type = $this->_getParam("type");
     //$userNs = new Zend_Session_Namespace('members');
     //$this->view->userId = $userNs->userId;
     $item = false;
     $itemTypeText = "";
     if ($item_type != "") {
         if ($item_type == 'blog') {
             $blogM = new Application_Model_Blog();
             $this->view->blog = $item = $blogM->find($item_id);
             $itemTypeText = "Journal Post";
         }
         if ($item_type == 'status_comment' || $item_type == 'blog_comment') {
             $commentM = new Application_Model_Comment();
             $item = $commentM->find($item_id);
             $itemTypeText = "Comment";
             $item_type = "comment";
         }
         if ($item_type == 'status') {
             $wallM = new Application_Model_Wall();
             $item = $wallM->find($item_id);
             $itemTypeText = "Wall Post";
         }
         $this->view->itemTypeText = $itemTypeText;
     }
     //if item is not exists then redirect to Journal home page
     if (false === $item) {
         $this->_helper->redirector()->gotoUrl('/journal/index/');
         exit;
     }
     //Now get all positive votes of item
     //$where		= "item_id = $item_id AND vote=1 AND item_type='blog'";
     $where = "item_id = {$item_id} AND vote=1";
     if ($item_type == 'comment') {
         $where .= " AND (item_type='status_comment' OR item_type='blog_comment')";
     } else {
         $where .= " AND item_type='{$item_type}'";
     }
     $voteM = new Application_Model_Vote();
     $rawdata = $voteM->fetchAll($where);
     //Get all users ID voted on an item
     if (false !== $rawdata) {
         $user_array = array();
         foreach ($rawdata as $row) {
             $user_array[] = $row->getUserId();
         }
     }
     //get all users information from above User Ids
     $this->view->totalUsers = 0;
     if (count($user_array) > 0) {
         $usrstr = implode(",", $user_array);
         $userM = new Application_Model_User();
         $whereuser = "******";
         $userData = $userM->fetchAll($whereuser, "first_name ASC");
         $this->view->userData = $userData;
         $settings = new Admin_Model_GlobalSettings();
         $page_size = $settings->settingValue('pagination_size');
         //$page_size = 1;
         $page = $this->_getParam('page', 1);
         $pageObj = new Base_Paginator();
         $paginator = $pageObj->fetchPageData($userM, $page, $page_size, $whereuser);
         $this->view->totalUsers = $pageObj->getTotalCount();
         $this->view->paginator = $paginator;
     }
 }
Exemplo n.º 4
0
 public function removeTravelWallPostAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $params = $this->getRequest()->getParams();
     $postId = $params['postId'];
     $objModelWall = new Application_Model_Wall();
     $objModelVote = new Application_Model_Vote();
     $objModelComment = new Application_Model_Comment();
     $whereWall = "id='{$postId}'";
     $whereVote = "item_id='{$postId}' AND item_type='status'";
     $whereComment = "item_id='{$postId}' AND item_type='status'";
     $arrComment = $objModelComment->fetchAll($whereComment);
     if (!empty($arrComment)) {
         foreach ($arrComment as $cmt) {
             $whereVt = "item_id='{$cmt->id}' AND item_type='status_comment'";
             $objModelVote->delete($whereVt);
         }
     }
     $objModelVote->delete($whereVote);
     $objModelComment->delete($whereComment);
     $objModelWall->delete($whereWall);
     exit;
 }
Exemplo n.º 5
0
 private function setModel($row)
 {
     $parent = $row->findParentRow('Application_Model_DbTable_User', 'User');
     $model = new Application_Model_Wall();
     $model->setId($row->id)->setStatus($row->status)->setFacebook($row->facebook)->setAddedon($row->addedon)->setUpdatedon($row->updatedon)->setUserId($row->user_id)->setProfileId($row->profile_id)->setUser($parent)->setActiveStatus($row->active_status);
     return $model;
 }