コード例 #1
0
ファイル: DB.php プロジェクト: bbfriend/realblog_xh
 /**
  * Returns the connection.
  *
  * @return flatfile
  */
 public static function getConnection()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance->connection;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: bbfriend/realblog_xh
 /**
  * Displays the archived realblog topics.
  *
  * @param mixed $showSearch Whether to show the search form.
  *
  * @return string (X)HTML.
  */
 public function archive($showSearch = false)
 {
     $realblogID = $this->getPgParameter('realblogID');
     $db = Realblog_DB::getConnection();
     $html = '';
     if (!isset($realblogID)) {
         if ($showSearch) {
             $view = new Realblog_SearchFormView($this->getYear());
             $html .= $view->render();
         }
         if ($this->getPgParameter('realblog_search')) {
             $compArchiveClause = new SimpleWhereClause(REALBLOG_STATUS, '=', 2, INTEGER_COMPARISON);
             $compClause = $this->searchClause();
             if (isset($compClause)) {
                 $compClause = new AndWhereClause($compArchiveClause, $compClause);
             }
             $articles = Realblog_Article::makeArticlesFromRecords($db->selectWhere('realblog.txt', $compClause, -1, array(new OrderBy(REALBLOG_DATE, DESCENDING, INTEGER_COMPARISON), new OrderBy(REALBLOG_ID, DESCENDING, INTEGER_COMPARISON))));
             $db_search_records = count($articles);
             $html .= $this->renderSearchResults('archive', $db_search_records);
         } else {
             $articles = Realblog_Article::findArticles(2, DESCENDING);
         }
         $view = new Realblog_ArchiveView($articles);
         $html .= $view->render();
     } else {
         $html .= $this->renderArticle($realblogID);
     }
     return $html;
 }
コード例 #3
0
ファイル: Article.php プロジェクト: bbfriend/realblog_xh
 /**
  * Deletes the article from the database.
  *
  * @return void
  */
 public function delete()
 {
     $db = Realblog_DB::getConnection();
     $db->deleteWhere('realblog.txt', new SimpleWhereClause(REALBLOG_ID, '=', $this->id), INTEGER_COMPARISON);
 }