public static function Instance() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
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); } }
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; }
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); }
public function action_delete() { M_Posts::Instance()->delete($_GET['param']) === true; $url = M_Link::ToAdminPosts('all'); $this->redirect($url); }
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; }