public static function instance() { if (self::$instance == null) { self::$instance = new M_Items(); } return self::$instance; }
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)); }