public function testGetArticle() { /* @var $object \fpcm\model\articles\article */ $object = new fpcm\model\articles\article($GLOBALS['objectId']); $this->assertTrue($object->exists()); $this->assertEquals($GLOBALS['article_title'], $object->getTitle()); $this->assertEquals($GLOBALS['article_content'], $object->getContent()); $this->assertEquals(1, $object->getPinned()); $this->assertEquals(1, $object->getComments()); $this->assertEquals(1, $object->getCreateuser()); }
/** * Controller ausführen * @return boolean */ public function process() { switch ($this->action) { case 'page': $page = $this->getRequestVar('page'); if (is_null($page)) { return; } $content = ' ' . $this->param . ' ' . $page; print $this->isUtf8 ? $content : utf8_decode($content); break; case 'title': if ($this->getRequestVar('module') != 'fpcm/article' || is_null($this->getRequestVar('id'))) { return; } $article = new \fpcm\model\articles\article($this->getRequestVar('id')); $content = ' ' . $this->param . ' ' . $article->getTitle(); print $this->isUtf8 ? $content : utf8_decode($content); break; } }
public function import() { $items = $this->getItems(); foreach ($items as $item) { if (!in_array(md5($item->guid), $this->feedIds)) { continue; } $article = new \fpcm\model\articles\article(); $article->setTitle((string) $item->title); $article->setContent((string) $item->content); $article->setCreatetime(strtotime((string) $item->published)); $article->setChangetime(time()); $article->setChangeuser($this->session->getUserId()); $article->setCreateuser($this->userId); $article->setCategories($this->categories); $res = $article->save(); if ($res === false) { trigger_error("Error while import of article with title '{$article->getTitle()}'. Cancel import process."); return false; } } return true; }