本文整理汇总了PHP中Comment::setComment方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::setComment方法的具体用法?PHP Comment::setComment怎么用?PHP Comment::setComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::setComment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add()
{
$response = new Response();
try {
$workOrderId = $this->input->post("workOrderId");
$commentText = $this->input->post("comment");
$workOrder = $this->findById("Workorder", $workOrderId);
$loggedInUser = $this->getLoggedInUser();
$comment = new Comment();
$comment->setCreated(new DateTime());
$comment->setCommentedBy($loggedInUser);
$comment->setComment($commentText);
$workOrder->getComments()->add($comment);
$this->save($workOrder);
$cmt = new Commentdto();
$cmt->setId($comment->getId());
$cmt->setComment($comment->getComment());
$cmt->setCommentedBy($comment->getCommentedBy()->getFirstName() . " " . $comment->getCommentedBy()->getLastName());
$cmt->setCreated(date_format($comment->getCreated(), "d-M-Y"));
$response->setData($cmt);
} catch (Exception $e) {
$response->setStatus(false);
$response->setErrorMessage($e->getMessage());
}
$this->output->set_content_type('application/json')->set_output(json_encode($response));
}
示例2: testAddComment
public function testAddComment()
{
$comment = new Comment();
$comment->id_user = $this->user->id;
$errors = $comment->validateController();
$this->assertEquals(3, sizeof($errors));
// username, repository, comment required
$nbComments = sizeof($comments = $this->user->comments());
$this->assertEquals(0, $nbComments);
$comment->setUsername("jessylenne");
$comment->setRepository("jessylenne");
$this->setExpectedExceptionRegExp('Exception', '/Veuillez fournir un commentaire valide/');
$comment->setComment('<script type="text/javascript">console.log("Yeah Fail!")</script>');
$this->assertFalse($comment->save());
$comment->setComment("comment");
$this->assertTrue($comment->save());
$this->assertEquals($nbComments + 1, sizeof($this->user->comments()));
$comment->delete();
}
示例3: saveComment
function saveComment($comment)
{
$dpComment = new Comment();
$dpComment->setDp($comment['dp']);
$dpComment->setComment($comment['comment']);
$dpComment->setAutor($comment['autor']);
$dpComment->setDate(time());
$commentId = $dpComment->saveDpComment();
return $commentId;
}
示例4: map
public static function map(Comment $comment, array $properties)
{
if (array_key_exists('comment_id', $properties)) {
$comment->setComment_id((int) $properties['comment_id']);
}
if (array_key_exists('comment', $properties)) {
$comment->setComment($properties['comment']);
}
if (array_key_exists('user_id', $properties)) {
$comment->setUser_id((int) $properties['user_id']);
}
if (array_key_exists('item_id', $properties)) {
$comment->setItem_id((int) $properties['item_id']);
}
}
示例5: update
public static function update($values, $user)
{
$comment = new Comment();
$comment->setComment(substr($values['comment'], 0, 5000));
if ($values['application_id']) {
$comment->setApplicationId($values['application_id']);
}
if ($values['module_id']) {
$comment->setMaduleId($values['module_id']);
}
if ($values['theme_id']) {
$comment->setThemeId($values['theme_id']);
}
$comment->setUserId($user->getId());
$comment->save();
return $comment;
}
示例6: handleRequest
public function handleRequest($command, $comment)
{
switch ($command) {
case 'set':
$response = Comment::setComment($comment);
break;
case 'delete':
$response = Comment::deleteComment($comment);
break;
default:
throw new Exception("Unsupported property!");
break;
}
if (empty($response)) {
$response = false;
}
$formattedResponse = Comment::formatResponse($response);
render('comment', array('comments' => $formattedResponse));
}
示例7: addComment
public function addComment($id_membre, $id_salle)
{
$msg = "";
if ($_POST) {
$comment = htmlentities($_POST['comment'], ENT_QUOTES, "utf-8");
$note = htmlentities($_POST['note'], ENT_QUOTES, "utf-8");
$dateNow = new DateTime("now");
$date = $dateNow->format('Y-m-d H:i:s');
$commentaire = new Comment();
$commentaire->setIdMembre($id_membre);
$commentaire->setIdSalle($id_salle);
$commentaire->setComment($comment);
$commentaire->setNote($note);
$commentaire->setDate($date);
//Vérifications si besoin avant entrée en base
$msgError = "";
//Entrée en base
if ($msgError == "") {
$commentaire->addComment();
} else {
$msg .= $msgError;
}
}
}
示例8: CommentRepository
<?php
namespace sql_nd_3\DDD;
require_once "Comment.php";
require_once "CommentRepository.php";
require_once "TopicRepository.php";
$commentRepository = new CommentRepository();
$topicRepository = new TopicRepository();
$bla = "blablablabla";
$comment = new Comment();
$comment->setAuthor('Author' . rand(0, 1000));
$comment->setTopicID($topicRepository->getRandomId());
$comment->setComment(substr($bla, 0, rand(12, strlen($bla))));
$commentRepository->saveComment($comment);
echo "<div>" . $comment->getTopicID() . "</div>";
echo "<div>" . $comment->getAuthor() . "</div>";
echo "<div>" . $comment->getComment() . "</div>";
示例9: Comment
<?php
$model = $_REQUEST['model'];
$action = $_REQUEST['action'];
include_once MODELS_ADMIN . "/" . $model . "_model.php";
switch (strtoupper($action)) {
case 'VIEW':
$objComment = new Comment();
$datum = $objComment->getComment($_REQUEST['id']);
break;
case 'UPDATE':
if (isset($_REQUEST['btn_submit']) && $_REQUEST['btn_submit'] == 'Update') {
$objComment = new Comment();
$objComment->setComment($_REQUEST);
$objComm->redirect('index.php?model=' . $model);
}
break;
default:
$objComment = new Comment();
$data = $objComment->getAllComment();
break;
}
示例10: Comment
<?php
require_once '../entity/CommentRep.php';
require_once '../entity/ThemeRep.php';
if (isset($_GET['theme_id']) && is_numeric($_GET['theme_id'])) {
$comment = new Comment();
$comment->setDate((new DateTime('now'))->format('Y-m-d H:i:s'));
$comment->setAuthor(isset($_GET['author']) ? $_GET['author'] : 'bet koks autorius');
$comment->setComment(isset($_GET['comment']) ? $_GET['comment'] : 'bet koks komentaras');
$comment->setThemeId($_GET['theme_id']);
$themeRep = new ThemeRep();
$theme = $themeRep->findById($_GET['theme_id']);
if (empty($theme)) {
echo 'Tema su id ' . $_GET['theme_id'] . ' neegzistuoja';
return;
}
$themeRep->increaseCommentCount($theme);
$commentRep = new CommentRep();
$commentRep->save($comment);
echo 'Komentaras pridetas.';
} else {
echo 'Reikalingas temos id.';
}
示例11: Comment
//Look for and detect IPv4/IPv6 addresses in comment text, and warn the commenter.
if ((preg_match('/\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/', $_POST['comment']) || preg_match('/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/', $_POST['comment'])) && $_POST['privpol-check-override'] != "override") {
BootstrapSkin::displayAlertBox("IP address detected in comment text. Warning acknowledgement checkbox must be checked.", "alert-error", "Error", true, false);
$smarty->assign("request", $request);
$smarty->assign("comment", $_POST['comment']);
$smarty->assign("actionLocation", "comment-quick");
$smarty->display("privpol-warning.tpl");
BootstrapSkin::displayInternalFooter();
die;
}
$comment = new Comment();
$comment->setDatabase(gGetDb());
$comment->setRequest($request->getId());
$comment->setVisibility($visibility);
$comment->setUser(User::getCurrent()->getId());
$comment->setComment($_POST['comment']);
$comment->save();
Notification::commentCreated($comment);
header("Location: acc.php?action=zoom&id=" . $request->getId());
} elseif ($action == "changepassword") {
if (!isset($_POST['oldpassword']) || $_POST['oldpassword'] == "") {
//Throw an error if old password is not specified.
BootstrapSkin::displayAlertBox("You did not enter your old password.", "alert-error", "Error", true, false);
BootstrapSkin::displayInternalFooter();
die;
}
if (!isset($_POST['newpassword']) || $_POST['newpassword'] == "") {
//Throw an error if new password is not specified.
BootstrapSkin::displayAlertBox("You did not enter your new password.", "alert-error", "Error", true, false);
BootstrapSkin::displayInternalFooter();
die;
示例12: addComment
protected function addComment($worklist_id, $user_id, $comment_text, $parent_comment_id)
{
// in case the comment is a reply to another comment,
// we'll fetch the original comment's email <mikewasmike>
$comment = new Comment();
$comment->setWorklist_id((int) $worklist_id);
$comment->setUser_id((int) $user_id);
$correspondent = null;
if (isset($parent_comment_id)) {
$comment->setComment_id((int) $parent_comment_id);
$originalComment = new Comment();
$originalComment->findCommentById((int) $parent_comment_id);
$cuser = new User();
$cuser->findUserById($originalComment->getUser_id());
// add the author of the parent comment, as long as it's not the
// same as the logged in user, in order to prevent email notification
// to the author of the new comment
if ($cuser->isActive() && $cuser->getId() != Session::uid()) {
$correspondent = array($cuser->getUsername());
} else {
$correspondent = array();
}
}
$comment->setComment($comment_text);
try {
$id = $comment->save();
} catch (Exception $e) {
error_log("Failure saving comment:\n" . $e);
}
$redirectToDefaultView = true;
$result = array('correspondent' => $correspondent, 'id' => $id);
return $result;
}
示例13: Comment
<?php
require_once '../model/Comment.php';
require_once '../model/Theme.php';
if (isset($_GET['theme_id']) && is_numeric($_GET['theme_id'])) {
$comment = new Comment();
$comment->setDate((new DateTime('now'))->format('Y-m-d H:i:s'));
$comment->setAuthor(isset($_GET['author']) ? $_GET['author'] : 'nežinomas autorius');
$comment->setComment(isset($_GET['comment']) ? $_GET['comment'] : 'nežinomas komentaras');
$comment->setThemeId($_GET['theme_id']);
$theme = Theme::findById($_GET['theme_id']);
if (empty($theme)) {
echo 'Tema ' . $_GET['theme_id'] . ' neegzistuoja';
return;
}
$theme->increaseCommentsCount();
$comment->save();
echo 'Komentaras pridetas.';
} else {
echo 'Reikalingas temos id.';
}
示例14: Comment
<?php
/**
* Created by PhpStorm.
* User: Florent
* Date: 18/02/2015
* Time: 15:11
*/
require_once '../class/Comment.php';
require_once '../manager/CommentManager.php';
require_once '../bdd/pdo.php';
session_start();
/** Vérification */
if (isset($_POST['produit']) && isset($_POST['note']) && isset($_POST['comment']) && $_POST['produit'] != "" && $_POST['note'] != "" && $_POST['comment'] != "") {
/** Premiere partie formulaire $monnouveaucomment */
$monnouveaucomment = new Comment();
$monnouveaucomment->setArticleid($_POST['produit']);
$monnouveaucomment->setNote($_POST['note']);
$monnouveaucomment->setComment($_POST['comment']);
/** Insertion en base $monManagerUtilisateur */
$monManagerComment = new CommentManager($bdd);
$monManagerComment->insertion($monnouveaucomment);
/** Redirection */
header('Location:../main/comment.php');
} else {
echo "Un des champs est incorrect";
header('Location:../main/comment.php');
}
示例15: search
public function search($marecherche)
{
$requete = $this->_db->prepare('select c.comment_id , u.name , u.first_name , c.comment , a.nom , c.note from commentaire c inner join utilisateur u on u.id=c.profile_id inner join article a on a.id=c.article_id where a.nom like "%":search"%"');
$requete->execute(array(':search' => $marecherche));
$results = $requete->fetchAll();
$tabobject = array();
if (empty($results)) {
/** Si pas de resultat alors faux */
return false;
} else {
/** Sinon parcours et stocke dans un tableau les commentaires */
foreach ($results as $result) {
$monretourcomment = new Comment();
$monretourcomment->setId($result['comment_id']);
$monretourcomment->setPid($result['name'] . " " . $result['first_name']);
$monretourcomment->setComment($result['comment']);
$monretourcomment->setArticleid($result['nom']);
$monretourcomment->setNote($result['note']);
array_push($tabobject, $monretourcomment);
// Push l'objet $article dans le tableau $tabobject
}
}
return $tabobject;
}