当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::setDate方法代码示例

本文整理汇总了PHP中Comment::setDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::setDate方法的具体用法?PHP Comment::setDate怎么用?PHP Comment::setDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment::setDate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadAll

 /**
  * @return array
  */
 public static function loadAll()
 {
     $dbWrapper = new DatabaseWrapper();
     $connection = $dbWrapper->getConnection();
     $query = "SELECT * FROM temos;";
     $temos = [];
     foreach ($connection->query($query) as $row) {
         $tema = new Tema($connection);
         $tema->setId($row['id']);
         $tema->setDate($row['subject_date']);
         $tema->setName($row['name']);
         $query = 'SELECT * FROM comments INNER JOIN temos ON comments.subjectId = ' . $row['id'] . " AND temos.id = " . $row['id'] . ";";
         $comments = [];
         foreach ($connection->query($query) as $i) {
             $comment = new Comment($connection);
             $comment->setId($i['id']);
             $comment->setsubjectId($i['subjectId']);
             $comment->setText($i['text']);
             $comment->setDate($i['date']);
             $comment->setAuthor($i['author']);
             $comments[] = $comment;
         }
         foreach ($comments as $comment) {
             $tema->setComments($comment);
         }
         $temos[] = $tema;
     }
     return $temos;
 }
开发者ID:einorler,项目名称:DB-namu-darbai,代码行数:32,代码来源:Tema.php

示例2: 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;
}
开发者ID:laiello,项目名称:dp-navigator,代码行数:10,代码来源:saveComment.php

示例3: makeComment

 private function makeComment(CommentFO $fo, $type, $typeId)
 {
     $user = Session::get('user');
     $comment = new Comment();
     $comment->setContent($fo->getComment());
     $comment->setType($type);
     $comment->setTypeId($typeId);
     $comment->setDate(null);
     $comment->setUserId($user->getId());
     return $comment;
 }
开发者ID:anzasolutions,项目名称:simlandia,代码行数:11,代码来源:commentmodel.class.php

示例4: getAllBySubjectId

 public function getAllBySubjectId($subId)
 {
     $query = "SELECT * FROM comments WHERE subjectId = {$subId}";
     $comments = [];
     foreach ($this->connection->query($query) as $row) {
         $comment = new Comment();
         $comment->setSubjectId($row['subjectId']);
         $comment->setDate($row['date']);
         $comment->setText($row['text']);
         $comment->setAuthor($row['author']);
         $comments[] = $comment;
     }
     return $comments;
 }
开发者ID:einorler,项目名称:DB-namu-darbai,代码行数:14,代码来源:CommentRepository.php

示例5: controlerJob

 public function controlerJob($maincont)
 {
     if (isset($_POST["author"])) {
         //print_r($_POST);
         $p = new Comment();
         $p->setAuthor($_POST["author"]);
         $p->setBody($_POST["body"]);
         $p->setHour(date("h:i:s"));
         $p->setDate(date("Y-m-d"));
         $p->setPublished("0");
         $p->setPostid($_POST["postid"]);
     }
     $maincont->goModule("home", "display");
 }
开发者ID:rogerwilko,项目名称:Yet-Another-Blog,代码行数:14,代码来源:controler.php

示例6: add

 /**
  * Metodo del controlador Comments cuya funcionalidad es insertar un comentario
  * en un post.
  * Verifica que el usuario ha iniciado sesion y que el post existe
  *
  * @throws Exception Si el usuario no inicio sesion
  * @return void
  */
 public function add()
 {
     if (!isset($this->currentUser)) {
         throw new Exception("Not in session. Adding comments requires login");
     }
     if (isset($_GET["id"])) {
         // reaching via HTTP Post...
         // Se obtiene el post de la BD
         $idPost = $_GET["id"];
         $post = $this->postDAO->findByIdPost($idPost);
         // Si no existe el post lanza una excepcion
         if ($post == NULL) {
             throw new Exception("no such post with id: " . $idPost);
         }
         // Crea el objeto Comment
         $comment = new Comment();
         $comment->setDate(date("Y-m-d H:i:s"));
         $comment->setContent($_POST["content"]);
         $comment->setAuthor($this->currentUser->getEmail());
         $comment->setIdPost($post->getIdPost());
         try {
             // Valida el comentario, si falla lanza una excepcion
             $comment->checkIsValidForCreate();
             // Guarda el comentario en la BD
             $this->commentDAO->save($comment);
             // Redirige al post
             $this->view->redirect("posts", "viewPosts", "id=" . $post->getIdPost());
         } catch (ValidationException $ex) {
             $errors = $ex->getErrors();
             $this->view->setVariable("comment", $comment, true);
             $this->view->setVariable("errors", $errors, true);
             $this->view->redirect("posts", "viewPosts", "id=" . $post->getIdPost());
         }
     } else {
         throw new Exception("No such post id");
     }
 }
开发者ID:adri229,项目名称:TSW_Proyect,代码行数:45,代码来源:CommentsController.php

示例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;
         }
     }
 }
开发者ID:GiGis971,项目名称:evoyage,代码行数:24,代码来源:comments.php

示例8: dbConnection

<?php

namespace Akademija\ActiveRecord;

include_once 'Theme.php';
include_once 'Comment.php';
include_once 'dbConnection.php';
if (isset($_POST["themeId"])) {
    $db = new dbConnection('localhost', 'root', '', 'akademija-nd');
    $db = $db->connect();
    $themeId = (int) $_POST["themeId"];
    $theme = new Theme($db);
    $theme = $theme->load($themeId);
    $comment = new Comment($db);
    $comment->setThemeId($themeId);
    $comment->setDate(date("Y-m-d H:i:s"));
    $comment->setAuthor($_POST["author"]);
    $comment->setComment($_POST["comment"]);
    $theme->addComments($comment);
    echo "<h2>Komentaras pridetas!</h2>";
} else {
    echo "<h2>Klaida!</h2>";
}
//header( "Refresh:15; url=List.php", true, 303);
echo '<a href="List.php"><- Atgal</a>';
开发者ID:semaska-tomas,项目名称:mysql-nd3,代码行数:25,代码来源:Add.php

示例9: 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.';
}
开发者ID:sedvis,项目名称:mysql-nd,代码行数:23,代码来源:add.php

示例10: loadComments

	public function loadComments($survey, $arrayComments){

		/* TODO START */
		/* TODO END */
		
		$comments = array();

		for($i=0; $i < count($arrayComments) ; $i++ ){	
			 $comment = new Comment($arrayComments[$i]['id_survey'],$arrayComments[$i]['message'],$arrayComments[$i]['owner']);
			 $comment->setId($arrayComments[$i]['ID']);
			 $comment->setDate($arrayComments[$i]['date']);
			 $comments[] = $comment;
		}
		
		return $comments;
	}
开发者ID:amirdine,项目名称:academic-projects,代码行数:16,代码来源:Database.inc.php


注:本文中的Comment::setDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。