本文整理汇总了PHP中Comments::getComments方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::getComments方法的具体用法?PHP Comments::getComments怎么用?PHP Comments::getComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::getComments方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: imadeAction
/** Comments made my user
*/
public function imadeAction()
{
$params = $this->_getAllParams();
$this->view->params = $params;
$comments = new Comments();
$this->view->comments = $comments->getComments($params, $this->getIdentityForForms());
}
示例2: indexAction
public function indexAction()
{
// Get, check and setup the parameters
$source_id = $this->getRequest()->getParam("source");
$item_id = $this->getRequest()->getParam("item");
//Verify if the requested item exist
$data = new Data();
if (!($item = $data->getItem($source_id, $item_id))) {
return;
}
// Get the source
$sources = new Sources();
$source = $sources->getSource($source_id);
// Are we the owner of these comments ?
$owner = $this->_application->user && $source['user_id'] == $this->_application->user->id ? true : false;
// Reset to the system timezone; just in case
$config = Zend_Registry::get("configuration");
$server_timezone = $config->web->timezone;
date_default_timezone_set($server_timezone);
// Get the comments
$c = new Comments();
$comments = $c->getComments($source_id, $item_id);
foreach ($comments as &$comment) {
$comment['when'] = strtotime($comment['timestamp']);
$comment['comment'] = str_replace("\n", " <br />", $comment['comment']);
$comment['delete'] = $owner;
}
// Set the timezone to the user timezone
$timezone = $this->_properties->getProperty('timezone');
date_default_timezone_set($timezone);
// Prepare the view
$this->view->comments = $comments;
}
示例3: _getCommentByIri
/**
* Get comment by IRI
*
* @param string $iri
* @return Comment
*/
protected function _getCommentByIri($iri)
{
$id = explode('_', $iri, 4);
$source_id = @$id[0];
$item_id = @$id[1];
$comment_id = @$id[2];
$item_type = @$id[3];
// Gets the comment
$comments = new Comments();
foreach ($comments->getComments($source_id, $item_id) as $comment) {
if ($comment['id'] == $comment_id) {
return new Comment($comment);
}
}
}
示例4: getComments
protected function getComments($id_article, $start, $step)
{
$result = Comments::getComments($id_article, $start, $step);
echo "<hr/><div class='comments'>";
foreach ($result as $key => $value) {
printf("\n <div class='comment'>\n <span class='date'>%s</span>\n <h4 class='author'>%s</h4>\n <p class='text'>%s</p>\n </div>\n ", $value[date], $value[author], $value[text]);
}
echo "</div>";
echo "<button class='btn btn-primary btn-lg next-comments'>Показать еще</button>";
if ($_SESSION['result']) {
echo $_SESSION['result'];
unset($_SESSION['result']);
}
self::printFormNewComment();
}
示例5: indexAction
public function indexAction()
{
if (!$this->_authenticateUser(true)) {
return;
}
// Get the item
$item = $this->_getItemByIri($this->_getItemIri('item'));
if (!$this->_isItemExists($item)) {
return;
}
// Get the comments
$comments = new Comments();
$comments->setUser($this->_application->user);
// Build the Activities Feed from the latest items
$atomProcessor = new AtomProcessor();
$feed = $atomProcessor->buildCommentsFeed($comments->getComments($item->getSource(), $item->getID()), $item);
// Set responses and response code
$this->_buildResponse(Api_BaseController::HTTP_SUCCESS, $feed->getXml(), Api_BaseController::CONTENT_TYPE_ATOM);
}
示例6: saveComment
/**
* Save a user's comment to the database.
*
* @param object $user User whose comment is being saved.
*
* @return bool True for success, false for failure.
* @access public
*/
public static function saveComment($user)
{
// What record are we operating on?
if (!isset($_GET['id'])) {
return false;
}
if ($_REQUEST['commentId'] == 0) {
$searchObject = SearchObjectFactory::initSearchObject();
$query = 'local_ids_str_mv:"' . addcslashes($_GET['id'], '"') . '"';
$searchObject->disableLogging();
$searchObject->setQueryString($query);
$result = $searchObject->processSearch();
$searchObject->close();
if (PEAR::isError($result)) {
PEAR::raiseError($result->getMessage());
}
if ($result['response']['numFound'] == 0) {
$idArray = array($_GET['id']);
} else {
$idArray = $result['response']['docs'][0]["local_ids_str_mv"];
}
if ($_REQUEST['type'] == 1) {
$commentsByUser = new Comments();
$commentList = $commentsByUser->getComments($_REQUEST['recordId']);
foreach ($commentList as $comment) {
if ($comment->user_id == $user->id) {
return false;
}
}
}
$comments = new Comments();
$comments->user_id = $user->id;
$rating = isset($_REQUEST['rating']) ? (double) $_REQUEST['rating'] : 0;
$comments->rating = $rating > 0 && $rating <= 5 ? $rating : null;
$comments->comment = $_REQUEST['comment'];
$comments->type = $_REQUEST['type'];
$comments->created = date('Y-m-d H:i:s');
$comments->insert();
$comments->addLinks($idArray);
return true;
} else {
$comments = new Comments();
$comments->get($_REQUEST['commentId']);
if ($comments->user_id == $user->id) {
$comments->comment = $_REQUEST['comment'];
$comments->rating = $_REQUEST['rating'];
$comments->updated = date('Y-m-d H:i:s');
$comments->update();
return true;
}
return false;
}
}
示例7: imadeAction
/** Comments made my user
* @access public
* @return void
*/
public function imadeAction()
{
$this->view->params = $this->getParams();
$this->view->comments = $this->_comments->getComments($this->getParams(), $this->getIdentityForForms());
}
示例8: array
<?php
/**
* Created by PhpStorm.
* User: Vladislav
* Date: 23.11.2015
* Time: 20:05
*/
require_once "classes/articles.class.php";
require_once "classes/Comments.class.php";
try {
$response = array();
$start = $_GET[start];
$step = $_GET[step];
if (isset($_GET[id])) {
$id_article = $_GET[id];
}
switch ($_GET['action']) {
case 'get_next_articles':
$response = Articles::getArticles($start, $step);
break;
case 'get_next_comments':
$response = Comments::getComments($id_article, $start, $step);
break;
default:
throw new Exception('Wrong action');
}
echo json_encode($response);
} catch (Exception $e) {
die(json_encode(array('error' => $e->getMessage())));
}
示例9: viewComments
function viewComments($idpincho)
{
$c = new Comments();
$array = $c->getComments($idpincho);
if ($array == false) {
$msg = "Not comments for this Pincho yet.";
header("Location: ../views/commentsAdd.php?msg={$msg}&idpincho={$idpincho}");
} else {
$datos = array();
$i = 0;
foreach ($array as $comment) {
$datos[$i][0] = $comment["Message"];
$datos[$i][1] = $comment["Pincho_code"];
$datos[$i][2] = $comment["Pincho_Establishment_idEstablishment"];
$popid = $comment["Popular_idPopular"];
$popular = new Popular();
$popname = $popular->selectName($popid);
$datos[$i][3] = $popname[0]["name"];
$i = $i + 1;
}
$arraysend = base64_encode(serialize($datos));
header("Location: ../views/commentsAdd.php?arraysend={$arraysend}&idpincho={$idpincho}");
}
}
示例10: Comments
<?php
/**
* Created by PhpStorm.
* User: dan
* Date: 7/13/15
* Time: 11:23 AM
*/
include 'config/config.php';
include 'classes/Comments.php';
include 'classes/Replies.php';
$obj1 = new Comments();
$obj2 = new Replies();
$data1 = $obj1->getComments();
$data2 = $obj2->getReplies();
?>
<div class="post-comments">
<h1>Comments</h1>
<div class="comments-listing">
<ul>
<?php
if (isset($data1) && !empty($data1)) {
foreach ($data1 as $comm) {
?>
<li id="">
<div class="comment hidden-wrap">
<div class="avatar-container">
<div class="bordered-image">
<a href="">
<img alt="aaa" src="<?php
示例11: runMiddle
public function runMiddle()
{
$comments = Comments::getComments($this->params[0]);
include dirname(__FILE__) . "/../views/comments_list.php";
}
示例12: Comments
<?php
include_once 'config/config.php';
include_once 'classes/comments.php';
include_once 'classes/replies.php';
$title = 'Comments';
$comm = new Comments();
$q = $comm->getComments();
$reply = new Replies();
$s = $reply->getReplies();
?>
<!DOCTYPE html>
<html>
<head>
<?php
include 'includes/head.php';
?>
</head>
<body>
<?php
include 'includes/header.php';
include 'includes/sub_header.php';
?>
<div class="site-wrap">
<div class="main-content">
<?php
include 'includes/comm_page.php';
?>
</div>
<?php
include 'includes/footer.php';
示例13: header
exit;
}
$dreams->addDream($_POST);
header('location: /get-lucid/dreams/' . $url);
}
case 'dreams':
// Include database connection
$db = new PDO(DB_INFO, DB_USER, DB_PASS);
$dreams = new Dreams($db);
$comments = new Comments($db);
if ($url == NULL) {
$d = $dreams->getDreams();
include_once 'views/list.php';
} else {
$d = $dreams->getDream($url);
$c = $comments->getComments($d['id']);
include_once 'views/dream.php';
}
break;
case 'adduser':
if (isset($_GET['action'])) {
include_once 'views/adduser.php';
} else {
if ($_POST['submit'] == "Cancel") {
// Check if the user clicked cancel, if so don't submit
header('location: ' . $loc);
exit;
}
// Include database connection
$db = new PDO(DB_INFO, DB_USER, DB_PASS);
$users = new Users($db);
示例14: showAction
/**
* Информация о соискателе
* @return void
*/
public function showAction()
{
if ($this->_authorize('applicants', 'view')) {
$applicantId = $this->getRequest()->getParam('applicantId');
if ($applicantId != '') {
$objApplicants = new Applicants();
$objApplicant = $objApplicants->getObjectById($applicantId);
if ($objApplicant) {
$this->view->applicant = $objApplicant;
$comments = new Comments();
if ($this->isAllowed('comments', 'add')) {
$form = new Form_Applicant_Comment();
$this->view->commentForm = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$comment = $comments->createRow();
$comment->user_id = Auth::getInstance()->getIdentity();
$comment->applicant_id = $applicantId;
$comment->comment = $form->Comment->getValue();
$comment->save();
$this->_helper->redirector('show', 'applicant', 'default', array('applicantId' => $applicantId));
}
}
}
if ($this->isAllowed('comments', 'view')) {
$this->view->comments = $comments->getComments($applicantId);
}
}
}
}
}
示例15:
<h3 class="who-says"><span>Says:</span> Niall O' Connor</h3>
<div class="comment-insert-container">
<label for="comment-post-text">
<textarea id="comment-post-text" class="comment-insert-text"></textarea>
</label>
</div>
<div class="comment-post-btn-wrapper" id="comment-post-btn">
Post
</div>
</div>
<div class="comments-list">
<ul class="comments-holder-ul">
<?php
$comments = Comments::getComments();
?>
<?php
require_once 'includes/comment_box.php';
?>
</ul>
</div>
</div>
</div>
<input type="hidden" id="userId" name = 'userId' value="<?php
echo $user_id;
?>
"/>
<input type="hidden" id="username" value="Niall"/>
</body>