public function p($action = null, $id = null)
 {
     switch ($action) {
         case 'news':
             if (is_post()) {
                 $gbn = new \app\models\GbNews();
                 $data = array('title' => $_POST['title'], 'content' => $_POST['content']);
                 if ($_POST['active'] === 'on') {
                     $data['active'] = 1;
                 } else {
                     $data['active'] = 0;
                 }
                 if (!empty($_POST['action'])) {
                     $data['id'] = $_POST['id'];
                     $gbn->update($data);
                     cache_forgot('home.gbnews');
                     cache_forgot('p.gbn.' . $data['id']);
                 } else {
                     $gbn->create($data);
                     cache_forgot('home.gbnews');
                 }
                 return redirect('admin/p/news');
             } else {
                 $gbn = new \app\models\GbNews();
                 $gbn = $gbn->all();
                 $data = empty($gbn) ? array() : $gbn;
                 return $this->view('admin/gbnews', compact('data'));
             }
             break;
         case 'write':
             if (!empty($id)) {
                 $id = intval($id);
                 $news = new \app\models\GbNews();
                 $news = $news->getNews($id);
                 if (empty($news)) {
                     return $this->view('errors/404');
                 }
                 return $this->view('admin/gbnews_write', compact('news'));
             }
             return $this->view('admin/gbnews_write');
             break;
         case 'destroy':
             echo $_POST['id'];
             if (is_post()) {
                 $news = new \app\models\GbNews();
                 $news->remove($_POST['id']);
             }
             break;
         default:
             return redirect('admin');
             break;
     }
 }