/**
  * IS: Parameter reviewId terdeklarasi
  * FS: Mengirimkan ke viewer: author, pageTitle, review, comments, 
  *     commentForm, enable, sessUserId
  * Desc: Fungsi untuk menampilkan detail review
  */
 public function detailAction()
 {
     // Variable
     $contentType = 3;
     // Untuk comment
     // Param
     $reviewId = $this->_getParam('reviewId');
     // Form
     $commentForm = new Form_CommentForm();
     $commentForm->setAttrib('action', $this->view->currentUrl());
     // Model
     $reviewDb = new Model_DbTable_Review();
     $commentDb = new Model_DbTable_Comment();
     // Request dari Comment Form
     if ($this->getRequest()->isPost()) {
         if ($commentForm->isValid($this->getRequest()->getPost())) {
             // Insert
             $commentId = $commentDb->insertComment($reviewId, $contentType, $this->getRequest()->getPost(), $this->_sess->userId, $this->_sess->fbname);
             // Reset form
             $commentForm->reset();
             // Redirect
             $this->_redirector->gotoUrl($this->view->currentUrl() . '#comment-' . $commentId);
         }
     }
     // Data
     $review = $reviewDb->get($reviewId);
     $author = '';
     if ($review['isfb']) {
         /*$fbInfo = $this->_fb->api_client->users_getInfo($review['username'],
           array('name', 'pic_square'));*/
         $fbInfo = $this->_fb->api('/' . $review['username']);
         $author = $fbInfo['name'];
         //$this->view->fbImageUrl = $fbInfo[0]['pic_square'];
     } else {
         $author = $review['username'];
     }
     // Cek cookie thumb
     $enable = false;
     if ($this->_sess->userId and !isset($_COOKIE["thumb" . $reviewId . '_' . $this->_sess->userId])) {
         $enable = true;
     }
     $comments = $commentDb->getAllByContentType($reviewId, $contentType);
     // Breadcrumb
     $pageTitle = $review['review_title'];
     $this->_generateDetailBreadcrumb($pageTitle);
     // View
     $this->view->author = $author;
     $this->view->pageTitle = $pageTitle;
     $this->view->review = $review;
     $this->view->comments = $comments;
     $this->view->commentForm = $commentForm;
     $this->view->enable = $enable;
     $this->view->sessUserId = $this->_sess->userId;
 }
 public function replycommentAction()
 {
     $this->_helper->layout->disableLayout();
     //$this->_helper->viewRenderer->setNoRender(true);
     //form
     $commentForm = new Form_CommentForm();
     $commentForm->init();
     $commentForm->setAttrib('action', $this->view->currentUrl());
     //model
     $commentDb = new Model_DbTable_Comment();
     //parameter
     $id = $this->_getParam('id');
     $contentType = 3;
     //cek id parent comment
     if ($this->_getParam('id_par')) {
         $id_parent = $this->_getParam('id_par');
     } else {
         $id_parent = 0;
     }
     //cek id child comment
     if ($this->_getParam('id_child')) {
         $id_child = $this->_getParam('id_child');
     } else {
         $id_child = 0;
     }
     //echo $id .'-'.$id_parent.'-'.$id_child;
     // Request dari Comment Form
     if ($this->getRequest()->isPost()) {
         if ($commentForm->isValid($this->getRequest()->getPost())) {
             $autor = isset($_POST['author']) ? $_POST['author'] : "";
             $email = isset($_POST['email']) ? $_POST['email'] : "";
             $website = isset($_POST['website']) ? $_POST['website'] : "";
             if ($id_parent != null and $id_child != null) {
                 $input = array('author' => $autor, 'email' => $email, 'website' => $website, 'comment' => $_POST['comment'], 'parent_id' => $id_parent, 'level' => $id_child);
             } else {
                 $input = array('author' => $autor, 'email' => $email, 'website' => $website, 'comment' => $_POST['comment'], 'parent_id' => $id_parent, 'level' => 0);
             }
             // Insert
             $commentId = $commentDb->insertCommentUsercon($id, $contentType, $input, $this->_sess->userId, $this->_sess->fbname);
             // Reset form
             $commentForm->reset();
             $this->view->commentForm = $this->view->translate('id_thanks_comment');
             // Redirect
             echo "<script type=text/javascript> window.parent.location.href = window.parent.location.href;</script>";
             //$this->_redirector->gotoUrl($this->view->currentUrl());
         } else {
             echo 'tidak valid';
         }
     } else {
         $this->view->commentForm = $commentForm;
     }
 }