public function deleteCommentsByEntry($id)
 {
     //create comment Table and delete comments
     include_once "models/Comment_Table.class.php";
     $commentsTable = new Comment_Table($this->db);
     $commentsTable->deleteCommentsByEntry($id);
 }
Esempio n. 2
0
<?php

//include Comment_Table class
include_once "models/Comment_Table.class.php";
//set up comment table object
$commentTable = new Comment_Table($db);
//save new input comment through comment form
//check input, take care of empty entry case
if (!empty($_POST['new-comment'])) {
    //save input
    $commentTable->saveComment($_POST['entry-id'], $_POST['user-name'], $_POST['new-comment']);
    unset($_POST['submit-form']);
}
//display comment form
$comment = (include_once "views/comment-form-html.php");
//display input comment
$commentObject = $commentTable->getAllById($entryId);
//display cooments at the end
$comment .= (include_once "views/comments-html.php");
return $comment;
Esempio n. 3
0
<?php

//include class definition
include_once "models/Comment_Table.class.php";
//create a new object, pass it a PDO database connection object
$commentTable = new Comment_Table($db);
$newCommentSubmitted = isset($_POST['new-comment']);
if ($newCommentSubmitted) {
    $whichEntry = $_POST['entry-id'];
    $user = $_POST['user-name'];
    $comment = $_POST['new-comment'];
    $commentTable->saveComment($whichEntry, $user, $comment);
}
$comments = (include_once "views/comment_form_html.php");
$allComments = $commentTable->getAllById($entryId);
$comments .= (include_once "views/comments_html.php");
// hooking up view and model
return $comments;
 public function deleteCommentsByID($id)
 {
     include_once "models/Comment_Table.class.php";
     $comments = new Comment_Table($this->db);
     $comments->deleteByEntryId($id);
 }