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


PHP Vote::setCreationDate方法代码示例

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


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

示例1: loadVotes

 /**
  * @deprecated il voto viene caricato attraverso getAvgVote()
  * Carica in this i voti recuperati dal database per questo post (deve avere un ID!).
  */
 function loadVotes()
 {
     require_once "query.php";
     $db = new DBManager();
     if (!$db->connect_errno()) {
         define_tables();
         defineVoteColumns();
         $table = Query::getDBSchema()->getTable(TABLE_VOTE);
         $rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(VOTE_POST), Operator::EQUAL, $this->getID())), array()), $table->getName(), $this);
         //echo "<p>" . $s . "</p>"; //DEBUG;
         if ($db->num_rows() > 0) {
             $votes = array();
             while ($row = $db->fetch_result()) {
                 require_once "post/PostCommon.php";
                 $vote = new Vote(intval($row[VOTE_AUTHOR]), intval($row[VOTE_POST]), $row[VOTE_VOTE] > 0);
                 $vote->setCreationDate(date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[VOTE_CREATION_DATE])));
                 $votes[] = $vote;
             }
             //echo "<p>" . serialize($votes) . "</p>"; //DEBUG;
             $this->setVotes($votes);
         } else {
             if ($db->errno()) {
                 $db->display_error("Post::loadVotes()");
             }
         }
     } else {
         $db->display_connect_error("Post::loadVotes()");
     }
     return $this;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:34,代码来源:Post.php

示例2: loadFromDatabase

 /**
  * Crea un voto caricando i dati dal database.
  * È come fare una ricerca sul database e poi fare new Vote().
  *
  * @param $id: l'ID del voto da caricare.
  * @return: il voto caricato o FALSE se non lo trova.
  */
 static function loadFromDatabase($author, $post)
 {
     require_once "query.php";
     $db = new DBManager();
     if (!$db->connect_errno()) {
         require_once 'strings/strings.php';
         define_tables();
         defineVoteColumns();
         $table = Query::getDBSchema()->getTable(TABLE_VOTE);
         $rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(VOTE_AUTHOR), Operator::EQUAL, $author), new WhereConstraint($table->getColumn(VOTE_POST), Operator::EQUAL, $post)), array()), $table->getName(), null);
         if ($db->num_rows() == 1) {
             $row = $db->fetch_result();
             $v = new Vote(intval($row[VOTE_AUTHOR]), intval($row[VOTE_POST]), $row[VOTE_VOTE] > 0);
             $v->setCreationDate(date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[VOTE_CREATION_DATE])));
             return $v;
         }
         //else $db->display_error("Vote::loadFromDatabase()");
     } else {
         $db->display_connect_error("Vote::LoadFromDatabase()");
     }
     return false;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:29,代码来源:PostCommon.php


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