public function before() { parent::before(); $user = Auth::instance()->get_user(); $db = new Model_Stanki(); $user = Auth::instance()->get_user(); $res_user = $db->get_user($user); if (isset($res_user[0]['username'])) { $seller = 'Вы зашли под именем:' . $res_user[0]['username'] . ' <span class="label label-warning"> Выйти</span>'; } else { $seller = 'Гость'; } View::set_global('title', 'Админ'); View::set_global('description', 'Самый лучший сайт'); $this->template->content = ''; $this->template->styles = array('bootstrap.min', 'style'); $this->template->scripts = array('jquery', 'bootstrap.min', 'scrollTo', 'script'); $menu = View::factory('menu')->bind('seller', $seller); $this->template->menu = $menu; }
public function action_dell() { if (Request::initial()->is_ajax()) { $ajax = new Model_Stanki(); $password = Arr::get($_POST, 'password', ''); $db_pass = $ajax->get_pass(); if ($password == $db_pass[0]['password']) { $result = $ajax->del_all(); echo 'OK'; } else { echo 'error'; } } }
public function action_users() { if (!Auth::instance()->logged_in('admin')) { $this->redirect('http://localhost/login'); } else { $this->template->scripts = array('jquery', 'bootstrap.min', 'scrollTo', 'script', 'admin'); $content = View::factory('admin/users'); $db = new Model_Stanki(); $res_user = $db->get_all_user(); $content->users = $res_user; $this->template->content = $content; } }