示例#1
0
 public function action_dashboard($page_id)
 {
     //Update Page token
     if (!Libs\Helper\Features::update_page_token($page_id, Session::get('user_token'))) {
         Session::set_flash('warning', 'There is an error when update page token');
     }
     // Get post list of this page:
     $data['post_list'] = Model_Posts::find('all', array('where' => array('page_id' => $page_id), 'order_by' => array('date_modified' => 'desc')));
     //Convert to json string to array
     foreach ($data['post_list'] as $item) {
         $item->content = json_decode($item->content);
         $item->author = $item->_user->fullname;
         $item->modifier = Model_Users::get_user_name($item->modifier);
         $item->date_modified = date('d-M-Y - H:m', $item->date_modified);
     }
     $data['page_id'] = $page_id;
     $this->template->header = View::forge('header.twig', $data);
     $this->template->content = View::forge('contents/page_dashboard.twig', $data);
 }