/**
  * Sets up the test fixture.
  *
  * @return void
  *
  * @global string The script name.
  * @global string The URL of the current page.
  * @global array  The configuration of the plugins.
  * @global array  The localization of the plugins.
  * @global Realblog_Controller The plugin controller.
  */
 public function setUp()
 {
     global $sn, $su, $plugin_cf, $plugin_tx, $_Realblog_controller;
     $sn = '/xh/';
     $su = 'Blog';
     $plugin_cf['realblog'] = array('comments_plugin' => '');
     $plugin_tx['realblog'] = array('blog_back' => 'Overview', 'comment_edit' => 'Edit comments', 'entry_edit' => 'Edit entry');
     $this->_defineConstant('XH_ADM', false);
     $article = Realblog_Article::makeFromRecord(['1', '1405548000', '1405548000', '1405548000', '1', '', 'Heading', '<p>Teaser</p>', '<p>Article</p>', '', '']);
     $_Realblog_controller = new Realblog_Controller();
     $this->_subject = new Realblog_ArticleView('1', $article, '1');
 }
 /**
  * Renders the article form.
  *
  * @param string $id     An article ID.
  * @param string $action An action.
  *
  * @return string (X)HTML.
  *
  * @global string              The page title.
  * @global array               The configuration of the plugins.
  * @global array               The localization of the plugins.
  * @global Realblog_Controller The plugin controller.
  */
 protected function form($id, $action)
 {
     global $title, $plugin_cf, $plugin_tx, $_Realblog_controller;
     if ($action == 'add_realblog') {
         $article = Realblog_Article::makeFromRecord(array(REALBLOG_ID => 0, REALBLOG_DATE => time(), REALBLOG_STARTDATE => time(), REALBLOG_ENDDATE => 2147483647, REALBLOG_STATUS => 0, REALBLOG_FRONTPAGE => '', REALBLOG_TITLE => '', REALBLOG_HEADLINE => '', REALBLOG_STORY => '', REALBLOG_RSSFEED => '', REALBLOG_COMMENTS => ''));
         $title = $plugin_tx['realblog']['tooltip_add'];
     } else {
         $article = Realblog_Article::findById($id);
         if ($action == 'modify_realblog') {
             $title = $plugin_tx['realblog']['tooltip_modify'] . ' [ID: ' . $id . ']';
         } elseif ($action == 'delete_realblog') {
             $title = $plugin_tx['realblog']['tooltip_delete'] . ' [ID: ' . $id . ']';
         }
     }
     $view = new Realblog_ArticleAdminView($article, $action);
     return $view->render();
 }
Beispiel #3
0
 /**
  * Finds an article by ID.
  *
  * @param int $id An ID.
  *
  * @return Realblog_Article
  */
 public static function findById($id)
 {
     $db = Realblog_DB::getConnection();
     $record = $db->selectUnique('realblog.txt', REALBLOG_ID, $id);
     if (!empty($record)) {
         return Realblog_Article::makeFromRecord($record);
     } else {
         return null;
     }
 }