Пример #1
0
 public function __construct(Request $req)
 {
     parent::__construct($req);
     $m_role = Model::factory('role');
     $this->role_list = $m_role->getAll(array('status' => 'normal'))->as_array('id');
     View::bind_global('role_list', $this->role_list);
 }
Пример #2
0
 public function __construct(Request $request)
 {
     parent::__construct($request);
     if (empty($this->user)) {
         $this->redirect('user/login');
     }
 }
Пример #3
0
 public function before()
 {
     parent::before();
     $lang = $this->request->param('lang');
     // Make sure we have a valid language
     if (!in_array($lang, array_keys(Kohana::config('kohana')->languages))) {
         $this->request->action = 'error';
         throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri (specified language was not found in config)', array(':uri' => $this->request->uri));
     }
     I18n::$lang = $lang;
     if (isset($this->page_titles[$this->request->action])) {
         // Use the defined page title
         $title = $this->page_titles[$this->request->action];
     } else {
         // Use the page name as the title
         $title = ucwords(str_replace('_', ' ', $this->request->action));
     }
     $this->template->title = $title;
     if (!kohana::find_file('views', 'pages/' . $this->request->action)) {
         $this->request->action = 'error';
     }
     $this->template->content = View::factory('pages/' . $this->request->action);
     $this->template->set_global('request', $this->request);
     $this->template->meta_tags = array();
 }
Пример #4
0
 public function before()
 {
     parent::before();
     View::bind_global('types', $this->types);
     View::bind_global('plats', $this->plats);
     View::bind_global('cities', $this->cities);
 }
Пример #5
0
 public function before()
 {
     Request::$theme = 'mobile';
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     $curr_theme = 'cyan-red';
     if (isset($_COOKIE['apptheme']) && in_array($_COOKIE['apptheme'], array_keys($this->theme_list))) {
         $curr_theme = $_COOKIE['apptheme'];
     }
     $theme_color = $this->theme_list[$curr_theme];
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('user', $this->user);
         View::bind_global('theme_list', $this->theme_list);
         View::bind_global('theme_color', $theme_color);
         View::bind_global('curr_theme', $curr_theme);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }
Пример #6
0
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->obj_cart = new Cart();
     if ($this->auto_render === TRUE) {
         $this->cart = $this->obj_cart->contents();
         View::bind_global('cart', $this->cart);
     }
 }
Пример #7
0
 public function __construct(Request $req)
 {
     parent::__construct($req);
     $m_permit = Model::factory('permit');
     $this->permits = $m_permit->getAll()->as_array('id');
     $permits = array();
     foreach ($this->permits as $permit) {
         $cat = $permit['cat'];
         $permits[$cat][] = $permit;
     }
     View::bind_global('permits', $permits);
 }
Пример #8
0
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $city_pinyin = $this->request->param('city_pinyin', 'bj');
     $all_city = Common::$city_list;
     foreach ($all_city as $item) {
         if ($city_pinyin == $item[1]) {
             $this->city_info = array('city_id' => $item[0], 'city_pinyin' => $item[1], 'city_name' => $item[2]);
         }
     }
     if ($this->auto_render === TRUE) {
         View::bind_global('city_info', $this->city_info);
     }
 }
Пример #9
0
 public function before()
 {
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('siteinfo', $this->siteinfo);
         View::bind_global('user', $this->user);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }
Пример #10
0
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->params = $this->request->param();
     //$this->params = $_GET;
     $this->params = array_filter($this->params, 'strlen');
     $this->all_brand_pinyin = SEO::getBrandPinyin();
     $this->all_series_pinyin = SEO::getSeriesPinyin();
     if (!empty($this->params['brand_pinyin'])) {
         $all_brand_pinyin = array_flip($this->all_brand_pinyin);
         if (isset($all_brand_pinyin[$this->params['brand_pinyin']])) {
             $this->params['brand_id'] = $all_brand_pinyin[$this->params['brand_pinyin']];
         }
     }
     if (!empty($this->params['series_pinyin'])) {
         $all_series_pinyin = array_flip($this->all_series_pinyin);
         if (isset($all_series_pinyin[$this->params['series_pinyin']])) {
             $this->params['series_id'] = $all_series_pinyin[$this->params['series_pinyin']];
         }
     }
     $allowed = array('city_pinyin', 'brand_id', 'series_id', 'brand_pinyin', 'series_pinyin', 'price_f', 'price_t', 'mile', 'mile_f', 'mile_t', 'year_f', 'year_t', 'sort_f', 'sort_d', 'format');
     $this->_filter_array = array_intersect_key($this->params, array_flip($allowed));
 }
Пример #11
0
 public function after()
 {
     parent::after();
 }