예제 #1
0
 public function Delete()
 {
     global $obj, $model, $param1;
     include_once 'Model/newscomments.php';
     $model = new Newscomments();
     $model->Id = $param1;
     if ($model->Delete()) {
         print '<span class="success">Newscomments Updated</span>';
     } else {
         print '<span class="error">' . $model->Error . '</span>';
     }
     include_once 'View/Newscomments/index.php';
 }
예제 #2
0
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
require "../libraries/common.inc.php";
uses("newscomment");
require LIB_PATH . 'page.class.php';
require "session_cp.inc.php";
$newscomment = new Newscomments();
$page = new Pages();
$conditions = array();
$tpl_file = "newscomment";
$amount = $newscomment->findCount(null, $conditions);
$page->setPagenav($amount);
$joins[] = "LEFT JOIN {$tb_prefix}newses n ON n.id=Newscomment.news_id";
$newscomment_list = $newscomment->findAll("Newscomment.id,Newscomment.news_id,Newscomment.message,Newscomment.cache_username as username,Newscomment.date_line AS pubdate,n.title", $joins, $conditions, "id DESC", $page->firstcount, $page->displaypg);
setvar("Items", $newscomment_list);
uaAssign(array("ByPages" => $page->pagenav));
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $newscomment->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
template($tpl_file);
예제 #3
0
파일: singleNews.php 프로젝트: csebubt/news
    
    
    <?php 
include_once "Model/user.php";
$usr = new User();
$usr->Id = $_SESSION['userid'];
$usr->SelectById();
include_once "Model/newscomments.php";
$nwc = new Newscomments();
if (isset($_POST['btnComments'])) {
    $nwc->NewsId = $model->Id;
    $nwc->UserId = $_SESSION['userid'];
    $nwc->Comments = $_POST['comments'];
    $nwc->Date = date('Y-m-d');
    if ($nwc->Insert()) {
        $nwc = new Newscomments();
    }
}
?>
    <div class="user_pic"><?php 
print '<img width="80" src="' . baseurl . 'images/user_images/' . $usr->Id . $usr->Image . '" />';
?>
</div>
    <div class="comment_box">
      <form method="post" action="">
        <textarea placeholder="Give your comments" rows="6" cols="80" name="comments" id="comment_input"><?php 
print $nwc->Comments;
?>
</textarea>
        <input type="submit" name="btnComments" value="submit"  />
      </form>