Esempio n. 1
0
 public function preDispatch()
 {
     parent::preDispatch();
     $blockM = new Base_View_Block();
     $path = "/layouts/scripts/page/blocks/advice";
     $blocks = array("name" => "search-advice", "order" => "10", "path" => $path);
     $blockM->addBlock($blocks, 'advice');
     $blocks = array("name" => "right-banner", "order" => "9", "path" => $path);
     $blockM->addBlock($blocks, 'advice');
     $blocks = array("name" => "advice-categories", "order" => "7", "path" => $path);
     $blockM->addBlock($blocks, 'advice');
     $this->_helper->layout->setLayout('journal-layout-2column');
     //$this->_helper->layout->setLayout('advice-layout-2column');
 }
 public function articleDetailAction()
 {
     //$this->_helper->viewRenderer->setNoRender(true);
     $blockM = new Base_View_Block();
     $path = "/layouts/scripts/page/blocks/work-study-volunteer";
     $blockM->removeBlock("work-study-volunteer-categories", 'work-study-volunteer');
     $params = $this->getRequest()->getParams();
     $article_id = $params['id'];
     $preview = false;
     $preview = $this->_getParam("preview");
     $categoryM = new Application_Model_Category();
     $articleM = new Application_Model_Articles();
     $data = $articleM->find($article_id);
     if (false != $data) {
         $this->view->article = $data;
         $this->view->preview = $preview;
         $this->view->categoryId = $categoryId = $data->getCategoryId();
         $this->view->categoryM = $categoryM->find($categoryId);
         $allarticles = $articleM->fetchAll("category_id = {$categoryId} and id != {$article_id}");
         /**
          * @Added By: Mahipal Adhikari
          * @Added On: 29-Dec-2010
          * @Description: get Article user information to display as Author
          */
         $userM = new Application_Model_User();
         $userRes = $userM->find($data->getUserId());
         $Author = "Admin";
         if (false !== $userRes) {
             $Author = $userRes->getFirstName() . " " . $userRes->getLastName();
             $this->view->author = $Author;
             $this->view->author_username = $userRes->getUsername();
         }
         if (count($allarticles) > 0) {
             $this->view->allarticles = $allarticles;
             $blocks = array("name" => "work-study-volunteer-articles", "order" => "8", "path" => $path);
             $blockM->addBlock($blocks, 'work-study-volunteer');
         }
     }
 }
Esempio n. 3
0
 public function myTravelWallAction()
 {
     $userNs = new Zend_Session_Namespace('members');
     //get particular wall information to display, added by mahipal on 10-Dec-2010
     $wall_id = "";
     $wall_id = $this->_getParam('wall_id');
     if (isset($wall_id) && $wall_id != "") {
         $this->view->wall_id = $wall_id;
     }
     $blockM = new Base_View_Block();
     $blockM->removeBlock("weather", "myaccount");
     $blockM->removeBlock("time", "myaccount");
     $blockM->removeBlock("whats-going-on", "myaccount");
     $blockM->removeBlock("journal", "myaccount");
     $user = new Application_Model_User();
     $user = $user->find($userNs->userId);
     $this->view->loginUrl = "";
     $facebook = $this->view->facebook();
     if ($user->getFacebookId() == "" || is_null($user->getFacebookId())) {
         //$return_url=Zend_Registry::get('siteurl')."/index/facebook-connect/";
         $return_url = Zend_Registry::get('siteurl') . "/index/do-fb-return/";
         $cancel_url = Zend_Registry::get('siteurl') . "/index/cancel-facebook";
         $this->view->loginUrl = $loginUrl = $facebook->getLoginUrl(array("cancel_url" => $cancel_url, "next" => $return_url, "req_perms" => "offline_access,publish_stream,read_stream,email,user_birthday,user_location", "display" => "popup"));
     }
     //get user facebook friend list, for testing
     //$statusUpdate = $facebook->api('/'.$user->getFacebookId().'/friends', 'get');
     ///https://api.facebook.com/method/liveMessage.send?recipient=qa&event_name=asdfads&message=asdfdasfadsf&access_token=...
     //$statusUpdate = $facebook->api('/100001442260018/feed', 'post', array('message'=> "please join gd", 'cb' => ''));
     //var_dump($statusUpdate );
     /*----facebook----*/
     /*$me=array();
     		$facebook=$this->view->facebook();
     		$session=$facebook->getSession();
     		if ($session) 
     		{
     		  try {
     		    $me = $facebook->api('/me');
     		  	} catch (FacebookApiException $e) {
     		    error_log($e);
     		  	}
     		}
     		if($me){
     	  		$this->view->loginUrl="";
     	  	}else{
     	  		$this->view->loginUrl = $facebook->getLoginUrl();
     	  	}*/
     /*-----------------*/
     if ($this->getRequest()->isPost()) {
         $userId = $user->getId();
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         $params = $this->getRequest()->getParams();
         $params['userId'] = $userId;
         //Added by Mahipal Adhikari on 28-Jan-2011, to save user profile id in which wall is posted
         $profileId = 0;
         //if($params["wall_flag"] != "my-travel-feed")
         $profileId = $userId;
         //posting on own wall
         $params['profileId'] = $profileId;
         $params['status'] = nl2br($params['status']);
         $wall = new Application_Model_Wall($params);
         $id = $wall->save();
         if ($id > 0) {
             $arrayResult = array("id" => $id, 'error' => 0);
             //insert into feeds for logged in user
             $userM = new Application_Model_User();
             $userM = $userM->find($userId);
             $feed = "<b>" . $userM->getFirstName() . " " . $userM->getLastName() . "</b> | " . $params['status'] . "<br>";
             $feed .= "<span>1 Min ago</span> | <span>Comment</span> | <span><b>Like</b>";
             $feeds = new Application_Model_Feeds();
             $feeds->setUserId($userId);
             $feeds->setType('wall');
             $feeds->setFeed($feed);
             $feeds->save();
             //------------------------
         } else {
             $arrayResult = array('error' => 1);
         }
         if (isset($params['facebook'])) {
             if ($user->getFacebookId() != "" && !is_null($user->getFacebookId())) {
                 $statusUpdate = $facebook->api('/' . $user->getFacebookId() . '/feed', 'post', array('message' => $params['status'], 'cb' => ''));
             }
         }
         echo Zend_Json::encode($arrayResult);
     }
 }