예제 #1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new M_Categories();
     }
     return self::$instance;
 }
예제 #2
0
 protected function before()
 {
     $mCats = M_Categories::instance();
     $navbar = $mCats->all_cats_subcats();
     $this->navbar = $this->Template('view/v_navbar.php', array('navbar' => $navbar));
     $this->title = 'Tempo';
     $this->content = '';
 }
예제 #3
0
 public function action_add()
 {
     $this->title .= ' add';
     $this->navbar = '';
     // Получение экземпляра модели.
     $mUsers = M_Users::instance();
     // Проверка авторизации.
     if (!$mUsers->checkAuth()) {
         header("Location: index.php?c=user&act=auth");
         exit;
     }
     // Получение экземпляра модели.
     $mItems = M_Items::instance();
     $mCats = M_Categories::instance();
     $categories = $mCats->all_cats_subcats();
     if ($this->IsPost()) {
         if ($mItems->add($category, $_POST['title'], $_POST['desc'], $img)) {
             header("Location: index.php?c=item&act=get&");
             die;
         }
     }
     $categories = $mCats->all_cats_subcats();
     $this->content = $this->Template('view/v_add.php', array('categories' => $categories));
 }