Beispiel #1
0
 public function after($response)
 {
     View::set_global('__header__', View::forge('partials/header', $this->template->get()));
     View::set_global('__footer__', View::forge('partials/footer', $this->template->get()));
     //        View::set_global('__alertbox__', View::forge('partials/alertbox', array('_alert'=>\Messages::get())) );
     return parent::after($response);
 }
Beispiel #2
0
 public function action_category($category_id = null)
 {
     if (empty($category_id) || !Model_Base_Category::valid_field('id', $category_id)) {
         Response::redirect('/admin/category');
     }
     $total_page = ceil(Model_Base_Product::admin_count_by_category($category_id) / _DEFAULT_LIMIT_);
     View::set_global('total_page', $total_page);
     $this->data['product'] = Model_Base_Product::admin_get_by_category($category_id);
     $this->template->content = View::forge($this->layout . '/product/index', $this->data);
 }
Beispiel #3
0
 public function init()
 {
     View::set_global('base_url', Config::get('base_url'));
     View::set_global('controller', Request::active()->controller);
     View::set_global('action', Request::active()->action);
     View::set_global('category', Model_Base_Category::get_all(array('where' => array(array('status', '=', 1)))));
     View::set_global('head', View::forge($this->layout . '/global/head'));
     View::set_global('header', View::forge($this->layout . '/global/header'));
     View::set_global('footer', View::forge($this->layout . '/global/footer'));
     View::set_global('script', View::forge($this->layout . '/global/script'));
 }
Beispiel #4
0
 public function action_index($code = null)
 {
     if (empty($code) || !Model_Base_Category::valid_by(array(array('code' => $code), array('status' => 1)))) {
         Response::redirect('/');
     }
     $category_id = Model_Base_Category::get_id_by_code($code);
     $total_page = ceil(Model_Base_Product::count_by_category($category_id) / _DEFAULT_LIMIT_);
     View::set_global('total_page', $total_page);
     $this->data['products'] = Model_Base_Product::get_by_category($category_id);
     $this->template->title = 'Category Page';
     $this->template->content = View::forge($this->layout . '/category/list', $this->data);
 }
Beispiel #5
0
 public function action_detail($code = null)
 {
     $this->data['product'] = Model_Base_Product::get_by_code($code, array('where' => array(array('status', '=', 1))));
     if (empty($this->data['product']['id'])) {
         Response::redirect('/');
     }
     $this->data['product']['sub_photo'] = Model_Base_Product::get_sub_photo($this->data['product']['id']);
     $category_ids = Model_Base_ProductCategory::get_by('category_id', 'product_id', $this->data['product']['id']);
     if (!empty($category_ids)) {
         $this->data['products'] = Model_Base_Product::get_by_category_ids($category_ids, 0, 5);
     }
     View::set_global('product', $this->data['product']);
     $this->template->title = 'Product List';
     $this->template->content = View::forge($this->layout . '/product/detail', $this->data);
 }
Beispiel #6
0
 public function init()
 {
     View::set_global('controller', $this->controller);
     View::set_global('action', $this->action);
     if (Model_Base_User::is_login()) {
         View::set_global('head', View::forge($this->layout . '/global/head'));
         View::set_global('header', View::forge($this->layout . '/global/header'));
         View::set_global('sidebar', View::forge($this->layout . '/global/sidebar'));
         View::set_global('script', View::forge($this->layout . '/global/script'));
         list(, $auth_id) = Auth::get_user_id();
         $this->user_id = $auth_id;
         $this->user_info = Model_Base_User::get_user_info($auth_id);
         $this->user_fb = Model_Base_User::get_user_fb($auth_id);
         View::set_global('user', $this->user_info);
         View::set_global('user_fb', $this->user_fb);
         View::set_global('base_url', Config::get('base_url'));
     }
 }
Beispiel #7
0
 /**
  * @param Response $response
  * @return mixed
  */
 public function after($response)
 {
     View::set_global('__header__', View::forge('partials/header', array()));
     View::set_global('__footer__', View::forge('partials/footer', array()));
     return parent::after($response);
 }
Beispiel #8
0
 public function after($response)
 {
     View::set_global('__sidebar__', View::forge('partials/sidebar', $this->formatData($this->side_data)));
     View::set_global('__footer__', View::forge('partials/footer', $this->formatData($this->side_data)));
     return parent::after($response);
 }