/** * Require administrator login * @Developer brandon * @Date Oct 11, 2010 */ public function __construct() { parent::__construct(); $this->template = View::factory('layouts/admin'); meta::set_title(store::name() . ' | Admin | ' . ucwords(Router::$controller)); // Set the route for updating and creating files Kohana::config_set('routes.base_crud_route', 'admin/'); // Require an admin login if we are in production. if (IN_PRODUCTION) { customer::require_admin_login(); } ORM::factory('audit_trail')->create(array('user_id' => customer::current(), 'store_id' => store::get(), 'controller' => Router::$controller, 'method' => Router::$method, 'object_id' => $this->input->post('id'))); }
/** * Get the cart * @Developer brandon * @Date Oct 20, 2010 */ public static function get() { if (customer::logged_in()) { return customer::current()->load_cart(); } else { if (Session::instance()->get('cart_' . store::get())) { return ORM::factory('cart', Session::instance()->get('cart_' . store::get())); } else { $cart = ORM::factory('cart'); $cart->save(); Session::instance()->set('cart_' . store::get(), (string) $cart); return $cart; } } }