Example #1
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'));
 }
Example #2
0
 public function action_edit($id = null)
 {
     if (empty($id) || !Model_Base_Product::valid_field('id', $id)) {
         Response::redirect('/admin/product');
     }
     $this->data['category'] = Model_Base_Category::get_all();
     $this->data['product'] = Model_Base_Product::get_one($id);
     $this->data['product']['category'] = Model_Base_ProductCategory::get_by('category_id', 'product_id', $id);
     $this->data['product']['sub_photo'] = Model_Base_Product::get_sub_photo($id);
     $this->template->content = View::forge($this->layout . '/product/edit', $this->data);
 }
Example #3
0
 public function action_home()
 {
     $this->data['highlight_product'] = Model_Base_Product::get_by(array('where' => array(array('highlight', '=', 1), array('status', '=', 1)), 'limit' => 5));
     $this->data['new_product'] = Model_Base_Product::get_by(array('where' => array(array('status', '=', 1)), 'limit' => 8));
     $this->data['product_category'] = Model_Base_Category::get_all(array('where' => array(array('parent_category_id', '=', 0), array('status', '=', 1))));
     foreach ($this->data['product_category'] as $key => $value) {
         $this->data['product_category'][$key]['product'] = Model_Base_Product::get_by_category($value['id'], 0, 4);
     }
     $this->template->title = 'Home Page';
     $this->template->content = View::forge($this->layout . '/home/home', $this->data);
 }
Example #4
0
 public function action_index()
 {
     $this->data['category'] = Model_Base_Category::get_all();
     $this->template->content = View::forge($this->layout . '/category/index', $this->data);
 }