本文整理汇总了PHP中Comment::getComments方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::getComments方法的具体用法?PHP Comment::getComments怎么用?PHP Comment::getComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::getComments方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommentsAction
/**
* Ajax call to return the comments for the relevant recipe
*/
public function getCommentsAction()
{
$items_per_page = $this->session->pagination['items_per_page'] ? $this->session->pagination['items_per_page'] : 5;
$page = $this->_getParam('page');
$offset = $items_per_page * ($page - 1);
$c = new Comment();
$rowset = $c->getComments($this->recipe->id, $items_per_page, $offset);
$this->view->pagination_config = array('total_items' => $this->recipe->comments_count, 'items_per_page' => $items_per_page, 'style' => 'digg_with_jquery');
echo $this->view->partial('partials/comments.phtml', array('comments' => $rowset, 'pagination_config' => $this->view->pagination_config));
}
示例2: actionGetComment
public function actionGetComment()
{
$page = $_GET['page'];
$mid = $_POST['mid'];
$id = $_POST['id'];
$type = $_POST['type'];
$object_id = $_POST['id'];
$model = new Comment();
$comments = $model->getComments($type, $object_id);
$data = array('comments' => $comments);
$this->renderPartial('list', $data);
}
示例3: getCragJson
/**
* hakee haettavan cragin cragId:n crag taulusta sekä cragiin liittyvät kommentit annetun cragid:n mukaan
* @param integer $_cragid haettavan cragin cragId
* @return array palauttaa kaiken datan json enkoodattuna ajax kutsua varten
*/
public function getCragJson($_cragid)
{
require '/var/www/db-init-climb.php';
require 'Comment.class.php';
$comment = new Comment();
$stmt = $db->prepare("SELECT CragId, Name \n FROM Crag\n WHERE CragId=:cragid");
$stmt->execute([':cragid' => $_cragid]);
$data = $stmt->fetch(PDO::FETCH_ASSOC);
$muuttuja = $comment->getComments($_cragid, 'crag');
$muuttuja = $muuttuja->fetchAll();
$data['Image'] = $this->loadCragPic($_cragid);
$data['Comments'] = $muuttuja;
return json_encode($data);
}
示例4: html_display
public function html_display($result)
{
$result = parent::html_display($result);
if (Value::get(get_class($this) . '_commented', true) && Component::isActive('Comment')) {
if ($result instanceof DBObject) {
$comments = Comment::getComments($result->getMeta('table'), $result->getMeta('id'));
Backend::addContent(Render::renderFile('comments.tpl.php', array('comment_list' => $comments)));
if (Permission::check('create', 'comment')) {
$values = array('foreign_table' => $result->getMeta('table'), 'foreign_id' => $result->getMeta('id'));
Backend::addContent(Render::renderFile('comment.add.tpl.php', $values));
}
}
}
return $result;
}
示例5: getRoutejson
public function getRoutejson($_routeid)
{
require '/var/www/db-init-climb.php';
require 'Comment.class.php';
$comment = new Comment();
$stmt = $db->prepare("SELECT RouteId, Name, Grade, Description \n FROM Route \n WHERE RouteId=:routeid");
$stmt->execute([':routeid' => $_routeid]);
$data = $stmt->fetch(PDO::FETCH_ASSOC);
$data['Grade'] = preg_replace('/-/', '', parent::unConvert($data['Grade']));
$muuttuja = $comment->getComments($_routeid, 'route');
$muuttuja = $muuttuja->fetchAll();
$data['Image'] = $this->loadRoutePic($_routeid);
$data['Comments'] = $muuttuja;
echo json_encode($data);
}
示例6: echoComment
public function echoComment($news_id)
{
$comments = Comment::getComments($news_id);
echo '<div class="comment-list">';
if (count($comments) > 0) {
foreach ($comments as $c) {
$name = htmlspecialchars($c->name);
$msg = htmlspecialchars($c->msg);
echo <<<EOF
<div class="clearfix">
<strong>{$name}:</strong>
<span class="msg">{$msg}</span>
<span class="time">{$c->time}</span>
</div>
EOF;
}
}
echo '</div>';
}
示例7: run
public function run()
{
$data = $this->items;
$role = $data['role'];
$type = $data['type'];
$object_id = $data['object_id'];
switch ($role) {
case 2:
echo "您无法评论,日志发布者设置好友可评论";
exit;
break;
case 3:
echo "您无法评论,日志发布者已经关闭评论";
exit;
break;
}
$model = new Comment();
$comments = $model->getComments($type, $object_id);
$data['icon_list'] = Smile::model()->findAll();
$data['comments'] = $comments;
$this->render('WComment', $data);
}
示例8: jQuery
<div class="col-md-3 no-padd">
<button onclick="antiSpam();" type="button" name="send" class="btn btn-sm btn-primary btn-block" style="margin-top: 10px;"><span class="glyphicon glyphicon-send"></span> Envoyer</button>
</div>
<input type="text" name="gallery" value="<?php
echo $gallery;
?>
" hidden >
<input type="text" name="pics" value="<?php
echo $pics;
?>
" hidden >
</form>
<div class="col-md-12 sep"></div>
<div class="col-md-12">
<?php
$comment->getComments($gallery, $pics);
?>
</div>
<div class="col-md-12 sep"></div>
<div class="col-md-12">
<a href="#" onclick="window.close();" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-chevron-left"></span> Retourner à la galerie</a>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="style/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery-ui.js"></script>
示例9: main
//.........这里部分代码省略.........
$user_id = $_SESSION['user_id'];
$user_fav_yet = Query::query('SELECT COUNT(user_id) FROM favorites WHERE user_id=' . $user_id . ' AND game_id=' . $id)->fetch_row()[0];
if ($user_fav_yet >= 1) {
$this->set('fav_game', '<a id="favo" href="' . $_SERVER['REQUEST_URI'] . '#" onclick="EditFav(' . $row2['GameID'] . ', 1,\'' . Settings::Get('site_url') . '\', \'<img src="/boxarcade/img/tool-unfavorite.jpg" />\', \'<img src="/boxarcade/img/tool-favorite.jpg" />\', ' . $user_id . ' ); return false"><img src="/boxarcade/img/tool-unfavorite.jpg"/></a>');
} else {
$this->set('fav_game', '<a id="favo" href="' . $_SERVER['REQUEST_URI'] . '#" onclick="EditFav(' . $row2['GameID'] . ', 0,\'' . Settings::Get('site_url') . '\', \'<img src="/boxarcade/img/tool-unfavorite.jpg" />\', \'<img src="/boxarcade/img/tool-favorite.jpg" />\', ' . $user_id . ' ); return false"><img src="/boxarcade/img/tool-favorite.jpg"/></a>');
}
} else {
$this->set('fav_game', '<a href="' . Settings::Get('site_url') . '/index.php?task=login"><img src="/boxarcade/img/tool-favorite.jpg"/></a>');
}
// Report game button
if (Settings::Get('report_permissions') == "1" || Settings::Get('report_permissions') == "2") {
//&& $user['login_status'] == 1) {
$this->set('report_game', '<a href="' . $_SERVER['REQUEST_URI'] . '#" onclick="ShowPopup(\'ava-popup\', \'' . Settings::Get('site_url') . '/includes/overlays/report.php?id=' . $row2['GameID'] . '\', \'' . GAME_REPORT . '\'); return false"><img src="/boxarcade/img/tool-report.png"/></a>');
}
$this->set('report_bug', '<a href="' . $_SERVER['REQUEST_URI'] . '#" onclick="ShowPopup(\'ava-popup\', \'' . Settings::Get('site_url') . '/includes/overlays/report.php?id=' . $row2['GameID'] . '\', \'Bug Report\'); return false"><img src="/boxarcade/img/tool-bug.jpg"/></a>');
$this->set('send', '<a href="' . $_SERVER['REQUEST_URI'] . '#" onclick="ShowPopup(\'ava-popup\', \'' . Settings::Get('site_url') . '/includes/overlays/send_game.php?id=' . $row2['GameID'] . '\', \'Send Game\'); return false"><img src="/boxarcade/img/tool-send.jpg"/></a>');
// Define the overall rating for use in the template
$this->set('rating_image', '');
//GenerateRating(3); //$row2['rating']);
// Define the 'new rating' section for the template
if (isset($_COOKIE["ava_username"]) || 42 == 42) {
} else {
$this->set('new_rating_form', GAME_LOGIN_TO_RATE);
}
// If admin is logged in, show admin options
//if ($user['admin'] == 1) {
if (1 == 0) {
$this->set('admin_options', '<a href="' . $setting['site_url'] . '/admin/?task=manage_games#id=' . $id . '"><img src=".' . $setting['template_url'] . '/images/edit.gif"/></a>');
} else {
$this->set('admin_options', '');
}
$did = $row2['DevID'];
$usr = Query::query('SELECT username, id, usrAvatarType, seo_url FROM tbl_users WHERE id=' . $did . ' LIMIT 1')->fetch_assoc();
$this->set('user_avatar', Utils::getAvatar($usr['id'], $usr['usrAvatarType']));
//'uploads/avatars/' . $usr['id'] . $usr['usrAvatarType'];
$this->set('user_name', $usr['username']);
$this->set('profile', Utils::ProfileUrl($usr['id'], $usr['seo_url']));
$this->set('show', '$show');
$this->set('admin', '');
//$user['admin'];
$this->set('login_status', '');
//$user['login_status'];
//EmbedGame
// Does this game have an advert set?
/*if (/* $row2['advert_id'] *42 == 1)
$ad_id = $setting['default_ad'];
else
$ad_id = 2; //$row2['advert_id'];*/
$ad_id = 2;
// Is the user supposed to see the ad?
if (Settings::Get('user_ads') == 1) {
if ($user['login_status'] == 1) {
$user_show_ad = 0;
} else {
$user_show_ad = 1;
}
} else {
if (Settings::Get('user_ads') == 2) {
if ($user['admin'] == 1) {
$user_show_ad = 0;
} else {
$user_show_ad = 1;
}
} else {
$user_show_ad = 1;
}
}
if (defined("PRELOAD_INFO")) {
$plm = PRELOAD_INFO;
$cts = CLICK_TO_SKIP;
} else {
$plm = 'Advertisement: Your game is loading';
$cts = 'click here to skip';
}
$this->set('ad_id', $ad_id);
$this->set('skip_ads', Settings::Get('skip_ads'));
$this->set('user_show_ad', $user_show_ad);
$this->set('plm', $plm);
$this->set('cts', $cts);
// Resize flash if required
if (isset($template['max_game_width']) && $width > $template['max_game_width']) {
$gWidth = $row2['Width'];
$gHeight = $row2['Height'];
$h1 = $template['max_game_width'] / $gWidth;
$h2 = $gHeight * $h1;
$width = $template['max_game_width'];
$height = $h2;
} else {
$width = $row2['Width'];
$height = $row2['Height'];
}
$this->set('width', $width);
$this->set('height', $height);
//$this->set('type', $this->request['type']);
//$this->set('title', $this->request['title']);
$this->set('relgames', Game::getRelatedGames($id));
$this->set('comments', Comment::getComments($id));
$this->render("Pages/View");
}
示例10: foreach
echo $arrComponent['id'];
?>
][component_comments]" placeholder="Comments"><?php
echo !empty($arrCompletedComponents[$arrComponent['id']]['comments']) ? $arrCompletedComponents[$arrComponent['id']]['comments'] : '';
?>
</textarea>
</div>
</div>
<div class="row">
<div class="columns">
</div>
</div>
<?php
foreach ($arrCommentTypes as $arrCommentType) {
$arrCommentsWithSubTypes = $objComment->getComments($arrComponent['id'], $arrCommentType['id'], NULL);
?>
<div class="row">
<div class="columns">
<h5><?php
echo $arrCommentType['title'];
?>
<small><?php
echo $arrCommentType['sub_title'];
?>
</small></h5>
</div>
</div>
<?php
foreach ($arrCommentsWithSubTypes as $iSubTypeId => $arrCommentsWithSubType) {
if (!empty($iSubTypeId) && $iSubTypeId > 0) {
示例11: getComments
/**
* @var args[0] product ID, args[1] comment ID
* for multiselect use ',' in @var, exp args[0] = 123,143
*/
public function getComments($args = null)
{
include_once ENGINE_PATH . 'class/classComment.php';
$comments = new Comment();
$result = $comments->getComments($args);
if (count($result)) {
return $result;
}
return null;
}
示例12: get
public static function get($id)
{
$nextid = Image::getNext($id);
$previousid = Image::getPrevious($id);
$image = Image::find($id);
$user = BaseController::get_user_logged_in();
$content['rated'] = $image->isRated($user);
$content['rating'] = $image->getRating();
$content['image'] = $image;
$content['nextid'] = $nextid;
$content['previousid'] = $previousid;
$content['comments'] = Comment::getComments($image);
return $content;
}
示例13: actionShowComments
function actionShowComments()
{
$this->view->render('adminLayout', 'admin/comments', Comment::getComments());
}
示例14: User
require_once 'core/tag.inc.php';
$user = new User();
$post = new Post();
$comment = new Comment();
$tag = new Tag();
$post_cur = $post->getPost($pid);
$loggedIn = 0;
$name;
if ($post_cur->num_rows == 0) {
$app->notFound();
} else {
session_start();
if ($user->isLoggedIn()) {
$loggedIn = 1;
}
$comments = $comment->getComments($pid);
$tag_result = $tag->getTagsByPostId($pid);
$post = $post_cur->fetch_assoc();
$name = $user->getName($post['author_id'])->fetch_assoc()['name'];
$app->render('post.php', array('post' => $post, 'name' => $name, 'loggedIn' => $loggedIn, 'comment' => $comments, 'user' => $user, 'tag_result' => $tag_result));
}
});
$app->post('/post/:id', function ($pid) use($app) {
require_once 'core/post.inc.php';
$post = new Post();
$req = $app->request();
if ($req->post('upvote')) {
$post->upVote($pid);
$app->redirect('/Blog-It/post/' . $pid . '#up');
} elseif ($req->post('downvote')) {
$post->downVote($pid);
示例15: Practice
?>
&page=pictures">Kuvat</a></li>
</ul>
<?php
if (isset($_GET['user'])) {
$practice = new Practice();
$exercise = new Exercise();
$converter = new Converter();
switch ($_GET['page']) {
case "feed":
$comments = new Comment();
if (isset($_SESSION['user_is_logged'])) {
echo $comments->printCommentBox($_GET['user']);
}
//tulostetaan kaikki kommentit
$result = $comments->getComments($_GET['user']);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$date = strtotime($row['DateTime']);
echo "<div class='comment'>" . "<a href='profile.php?user=" . $comments->getCommenter($row['CommenterId']) . "'><span class='commenter'>" . $comments->getCommenter($row['CommenterId']) . ":</span></a>" . "<span class='comment_text'>" . $row['Comment'] . "</span>" . "<span class='comment_date'>" . date("d.m.Y", $date) . "<br>" . date("H:i:s", $date) . "</span>" . "</div>";
}
//jos ollaan kirjauduttu sisään, näkyy kommentointiboxi
break;
case "profile":
if (isset($_GET['edit']) && isset($_SESSION['user_is_logged'])) {
echo $user->editForm();
} else {
echo $user->printTable();
if ($_GET['user'] == $_SESSION['logged_user_email']) {
echo "<a href='profile.php?user={$_SESSION["logged_user_email"]}&edit=1'>Muokkaa</a>";
}
}