/** * 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 actionAction() { //form submit ke sini //di sini ditentukan aksi2 apa aja yg dilakukan //tergantung SUATU variabel: $_POST["actionnya"] $table_comment = new Model_DbTable_Comment(); if ($_POST['actionnya'] && $_POST['comment_item']) { switch ($_POST['actionnya']) { case 'delete_selected': $id = $_POST['comment_item']; //print_r ($id); foreach ($id as $commentID) { $this->loggingaction('comment', 'delete', $commentID); $this->_flash->addMessage("1\\Comment Delete Success!"); $table_comment->deleteComment($commentID); } $this->_redirect($this->view->rootUrl('/admin/comment/')); break; case '': $this->_redirect($this->view->rootUrl('/admin/comment/')); } } }
public function contestmoreAction() { $uid = Zend_Registry::get('uid'); $id = $this->_request->getParam('id'); $this->view->dugaar = $id; $q = $this->_request->getParam('q'); if ($q == 'signup') { $this->view->is = 'signup'; } if ($q == 'rating') { $this->view->is = 'rating'; } if ($q == 'davaa') { $this->view->is = 'davaa'; } $tmp = 0; $davaas = new Model_DbTable_Davaa(); $this->view->davaa = $davaas->fetchAll($davaas->select()->where('fantasy_id =' . $id . ' AND active =' . $tmp)); $tmp = 1; $this->view->davaaduussan = $davaas->fetchAll($davaas->select()->where('fantasy_id =' . $id . ' AND active =' . $tmp)); $fantasys = new Model_DbTable_Fantasy(); $fantasy = $fantasys->fetchAll($fantasys->select()->where('id=' . $id)); foreach ($fantasy as $key => $value) { $this->view->fantasyname = $value['name']; } $users = new Model_DbTable_Users(); $this->view->user = $users->fetchAll($users->select()); $gals = new Model_DbTable_Gal(); $this->view->galuud = $gals->fetchAll($gals->select()); $this->view->gal = $gals->fetchAll($gals->select()->where('ezen_id =' . $uid)); $gald = $gals->fetchAll($gals->select()->where('ezen_id =' . $uid)); $gid = 0; foreach ($gald as $key => $value) { $gid = $value['id']; } $scores = new Model_DbTable_Score(); $this->view->rating = $scores->fetchAll($scores->select()->where('fantasyid =' . $id)->order('total_score DESC')); $this->view->score = $scores->fetchAll($scores->select()->where('galid =' . $gid . ' AND fantasyid=' . $id)); $form = new Form_Comment(); $request = $this->getRequest(); if ($request->isPost()) { if ($form->isValid($this->_request->getPost())) { $content = $this->_request->getParam('commentbody'); $content = $this->check($content); $uid = Zend_Registry::get('uid'); $date = date("Y-m-d H:i:s"); $uri = 'index/index/id/' . $id; $comments = new Model_DbTable_Comment(); $comments->insert(array('uri' => $uri, 'content' => $content, 'uid' => $uid, 'date' => $date)); $this->_redirect('news/more/id/' . $id); } } $form->setAction('../../index/index'); $this->view->form = $form; $news = new Model_DbTable_News(); $this->view->news = $news->fetchAll($news->select()->where('isactive = 1')->order('isping DESC')->order('date DESC')); $this->view->news1 = $news->fetchAll($news->select()->where('isactive = 0')->order('date DESC')); $page = 0; if ($this->_request->getParam("page") != null) { $page = $this->_request->getParam("page"); } $this->view->page = $page; $q = $news->fetchAll($news->select()->where('isactive = 1')->order('isping DESC')->order('date DESC')); $id = $this->_request->getParam('id'); $this->view->dugaar = $id; $paginator = Zend_Paginator::factory($q); $paginator->setItemCountPerPage("6")->setCurrentPageNumber($this->_getParam('page', 1)); $this->view->medee = $paginator; $comments = new Model_DbTable_Comment(); $this->view->comment = $comments->fetchAll($comments->select()->order('date DESC')); }
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; } }