當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。