Example #1
0
 public function testUpdate()
 {
     $news = new model\News();
     $lastNews = $news->createPost($this->title, $this->testedContent[0], $this->testedAccountId);
     $lastNews->setContent($this->testedContent[1]);
     $lastNews->save();
     $this->assertEquals($this->testedContent[1], $lastNews->getContent());
 }
Example #2
0
     // Create new post
     if (!empty($news_content)) {
         try {
             // News Model
             $news = new model\News();
             $me = model\Base::query('Players')->findPK(self_char_id());
             $news->createPost($news_title, $news_content, $me->getAccountss()->getFirst()->getAccountId(), $tag);
             $parts['new_successful_submit'] = true;
         } catch (InvalidArgumentException $e) {
             $parts['new_successful_submit'] = false;
         }
     }
 }
 // Fetch the news
 try {
     $news = new model\News();
     if (in('tag_query')) {
         // Search for specific tag
         $all_news = $news->findByTag(in('tag_query'));
         $parts['search_title'] = 'Result for #' . htmlentities(in('tag_query'));
     } else {
         $all_news = $news->all();
     }
 } catch (InvalidArgumentException $e) {
     $all_news = array();
 }
 $parts['all_news'] = $all_news;
 $template = prep_page($view, 'News Board', $parts, array());
 function to_tags($str_tags)
 {
     $tags = array();