Пример #1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 protected function On_Input()
 {
     parent::On_Input();
     $this->site_title .= " :: Новости";
     $m_posts = M_Posts::Instance();
     if (isset($_GET['new'])) {
         $this->post = $m_posts->Define_Post($_GET['new']);
     } else {
         $this->posts = $m_posts->Show_Posts('news', 'published', true);
     }
 }
Пример #3
0
 public function delete($pk)
 {
     $link = parent::get($pk);
     if (empty($link)) {
         return false;
     }
     parent::delete($pk);
     M_Posts::Instance()->unlink_menu($pk);
     $obj = array('plid' => $link['plid']);
     $where = 'plid = ? ';
     $this->db->Update($this->table, $obj, $where, array($pk));
     $this->listItems = array();
     $this->treeArray = array();
     return true;
 }
Пример #4
0
 public function action_page()
 {
     $mPosts = M_Posts::Instance();
     $post_id = isset($_GET['param']) ? $_GET['param'] : 0;
     $this->page = $mPosts->get($post_id);
     if (empty($this->page)) {
         $this->p404();
     }
     $this->title = $this->page['post_title'];
     $this->breadCrambsActive = $this->title;
     $this->menuLinkId = $this->page['mlid'];
     $this->page['children'] = array();
     //$mPosts->upPostViews($post_id);
     if ($this->page['mlid'] > 0 && $this->page['post_type'] == 'parent') {
         $this->page['children'] = M_MenuLink::Instance()->getTopChildren($this->page['mlid']);
     }
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_page.php');
     // Формирование контента страницы
     $this->blocks['_content_page'] = $this->Template($templateName, $this);
 }
Пример #5
0
 public function action_delete()
 {
     M_Posts::Instance()->delete($_GET['param']) === true;
     $url = M_Link::ToAdminPosts('all');
     $this->redirect($url);
 }
Пример #6
0
 public function getPostMostViews()
 {
     $posts = M_Posts::Instance()->getPostMostViews(5);
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_posts_most_views.php');
     $_posts = $this->Template($templateName, array('posts' => $posts));
     return $_posts;
 }