Exemplo n.º 1
0
 public function likeAction()
 {
     $this->_disableRender();
     $json = new ZendT_Json_Result();
     try {
         $id = $this->getRequest()->getParam('id');
         $_conteudo = $this->getMapper();
         $result = $_conteudo->like($id, $this->getRequest()->getParam('onlyLoad'));
         if ($result) {
             $comments = $_conteudo->getLikes($id);
         }
         $qtd = count($comments);
         $html = Cms_Helper_Likes::likes($id);
         $json->setResult(array('qtd' => $qtd, 'html' => $html));
     } catch (Exception $ex) {
         $json->setException($ex);
     }
     echo $json->render();
 }