get() public method

Fetch an item from the GET array
public get ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $_GET
$xss_clean boolean Whether to apply XSS filtering
return mixed
 public function index()
 {
     $this->load->view('layout/header');
     $error = $this->session->flashdata('message');
     $this->load->view('element/message', ['success' => $error]);
     $filter = $this->input->get(['from', 'till', 'groups']);
     $from = $filter['from'] ?: date('Y-m-01', strtotime('-1 month'));
     $till = $filter['till'] ?: date('Y-m-t');
     $responseData = [];
     $step = 500;
     $offset = 0;
     do {
         $response = $this->moneyzaurus->transactionsList($offset, $step, $from, $till, null, null, null);
         if ($response['code'] == 200 && $response['data']['success']) {
             $count = $response['data']['count'];
             $responseData = array_merge($responseData, $response['data']['data']);
             $offset += $step;
         } else {
             break;
         }
     } while ($count >= $step);
     $filterGroups = $filter['groups'] ?: [];
     $data = $this->prepareChartData($responseData, $filterGroups, $from, $till);
     $this->load->view('page/chart', ['data' => $data, 'from' => $from, 'till' => $till]);
     $this->load->view('layout/footer');
 }
Example #2
0
 public function predictPrice()
 {
     $item = $this->input->get('item');
     $group = $this->input->get('group');
     $response = $this->moneyzaurus->predictPrice($item, $group);
     $this->processResponseData($response);
 }
 function MY_Controller()
 {
     parent::Controller();
     //当前用户信息初始化
     $this->load->library('User', null, 'userLib');
     $userInfo = $this->userLib->getUserInfo();
     $this->user = $userInfo;
     if (!$this->user) {
         showError($this->userLib->error, '/');
     }
     /* if (in_array($this->user['userId'], array(694,3767,3868))) {
            showError('测试账号禁止进去正式地址');
        } */
     //加载菜单,全局使用
     $this->load->library('Navbar', $this->user);
     $this->navbarList = $this->navbar->getNavbarList();
     //公告内容
     $this->load->model('HelperNoticeModel');
     $this->viewData['noticeData'] = $this->HelperNoticeModel->getLatest($this->user['userRole']);
     if ($this->viewData['noticeData']) {
         $this->navbarList[] = array('Help', 'noticeCheck', 'title' => '公告');
     }
     //当前选中菜单默认为当前控制器
     $this->navbarFocus = $this->input->get('c');
     //当前默认选中的菜单项
     $this->navChildFocus = $this->input->get('c') . '_' . $this->input->get('m');
     //当前主题
     $this->theme = $this->config->item('theme');
     //加载认证类,全局可以调用
     $this->load->library('Auth', $this->user);
     //面包屑导航
     $this->viewData['breadcrumb'][] = array('url' => printUrl('Main', 'index'), 'title' => '首页');
     //加载时段模型
     $this->load->model('timeUnitModel');
 }
Example #4
0
 public function index()
 {
     $this->load->view('layout/header');
     $error = $this->session->flashdata('message');
     $this->load->view('element/message', ['success' => $error]);
     $offset = 0;
     $limit = 100;
     $filter = $this->input->get(['item', 'group', 'price', 'from', 'till']);
     $response = $this->moneyzaurus->transactionsList($offset, $limit, $filter['from'], $filter['till'], $filter['item'], $filter['group'], $filter['price'] * 100);
     if ($response['code'] == 200) {
         if ($response['data']['success']) {
             $this->load->view('page/data', ['count' => $response['data']['count'], 'data' => $response['data']['data'], 'filter' => $filter]);
         }
     }
     $this->load->view('layout/footer');
 }
Example #5
0
 /**
  * {@inherit}
  */
 public function get($index = NULL, $xss_clean = NULL)
 {
     if ($this->mock_state) {
         return $this->_fetch_from_array($this->mock_GET, $index, $xss_clean);
     }
     return parent::get($index, $xss_clean);
 }
Example #6
0
 /**
  * @param null $index
  * @param bool $xss_clean
  * @param null $default_value
  * @return array|null|string
  */
 function get($index = NULL, $xss_clean = FALSE, $default_value = NULL)
 {
     $ret_val = parent::get($index, $xss_clean);
     if ($ret_val === false && isset($default_value)) {
         $ret_val = $default_value;
     }
     return $ret_val;
 }
Example #7
0
 public function get($index = NULL, $xss_clean = NULL, $default_value = NULL)
 {
     $value = parent::get($index, $xss_clean);
     if (empty($value) && $default_value !== NULL) {
         $value = $default_value;
     }
     return $value;
 }
Example #8
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('user_model');
     $this->load->helper('url_helper');
     $input = new CI_Input();
     $this->params = array_merge($input->get(), $input->post());
     $this->checkLogin();
 }
 private function getAllTransactions($months)
 {
     $filter = $this->input->get(['from', 'till', 'groups']);
     $from = $filter['from'] ?: date('Y-m-01', strtotime('-' . (int) $months . ' month'));
     $till = $filter['till'] ?: date('Y-m-t');
     $responseData = [];
     $step = 500;
     $offset = 0;
     do {
         $response = $this->moneyzaurus->transactionsList($offset, $step, $from, $till, null, null, null);
         if ($response['code'] == 200 && $response['data']['success']) {
             $count = $response['data']['count'];
             $responseData = array_merge($responseData, $response['data']['data']);
             $offset += $step;
         } else {
             break;
         }
     } while ($count >= $step);
     return $responseData;
 }
 function __construct($menu_item = null)
 {
     parent::__construct();
     $this->menu_item = $menu_item;
     $this->load->model('languages_model');
     $get_lang = $this->input->get('l');
     //        dump($this->lang->language);die;
     if ($get_lang && array_key_exists($get_lang, $this->long_to_short)) {
         $this->current_language = $get_lang;
         $this->session->set_userdata('language', $get_lang);
     } else {
         if (!$this->session->userdata('language')) {
             $this->session->set_userdata('language', $this->getLanguage());
         } else {
             $this->current_language = $this->session->userdata('language');
         }
     }
     $this->lang->load("main", $this->current_language);
     $this->current_language_short = $this->long_to_short[$this->current_language];
     $this->menus = ['home' => ['url' => base_url(''), 'title' => lang('home'), 'additional_params' => 'data-href="1"'], 'contacts' => ['url' => base_url('contacts'), 'title' => lang('contacts'), 'additional_params' => 'data-href="11"'], 'about_me' => ['url' => base_url('about'), 'title' => lang('about_me'), 'additional_params' => ''], 'portfolio' => ['url' => base_url('portfolio'), 'title' => lang('portfolio'), 'additional_params' => '']];
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
     //$this->load = load_class('Loader', 'core');
     //$this->load->initialize();
     $this->load->model('user_model');
     //$/this->load->helper('url_helper');
     //$this->user_model = new User_Model();
     //load_class('');
     $input = new CI_Input();
     $this->params = array_merge($input->get(), $input->post());
 }
 public function delete()
 {
     $id = $this->input->get('id');
     $response = $this->moneyzaurus->transactionsRemove($id);
     if ($response['code'] == 200) {
         if (!$response['data']['success']) {
             $this->session->set_flashdata('message', $response['data']['message']);
         } else {
             $this->session->set_flashdata('message', 'Deleted');
         }
     }
     redirect('/data');
 }
Example #13
0
 /**
  * Added one condition from send $ajax_data parameter to page, if in page there $ajax_data, loaded script.
  * This condition was added because script called 2 times, and will now be called 1 times
  * @param boolean $ajax_data
  * @return rendering page
  * @author Max Kavelin
  */
 protected function render($template = 'main')
 {
     $is_admin = $this->ion_auth->is_admin();
     $uinfo = $this->users_model->getUsersData($this->ion_auth->get_user_id());
     if ($is_admin) {
         $this->data['is_admin'] = true;
     } else {
         $this->load->model('users_model');
         if (!empty($uinfo[0]->is_supplier)) {
             $this->data['is_supplier'] = true;
         } else {
             $this->data['is_supplier'] = false;
         }
     }
     $this->data['user_email'] = $uinfo[0]->email;
     //save the controller and action names in session
     if ($this->save_previous_url) {
         $this->session->set_flashdata('previous_controller_name', $this->previous_controller_name);
         $this->session->set_flashdata('previous_action_name', $this->previous_action_name);
     } else {
         $this->session->set_flashdata('previous_controller_name', $this->controller_name);
         $this->session->set_flashdata('previous_action_name', $this->action_name);
     }
     // difference old render and new render function  is this condition
     if ($this->input->get("ajax", false) == true) {
         $this->data['ajax_data'] = true;
         //send parameter ajax_data to view page
     }
     $view_path = $this->controller_name . '/' . $this->action_name . '.php';
     //set the path off the view
     if (file_exists(APPPATH . 'views/' . $view_path)) {
         $this->data['content'] .= $this->load->view($view_path, $this->data, true);
         //load the view
     }
     if ($this->input->get("ajax", false) == true) {
         $this->load->view("layouts/ajax.tpl.php", $this->data);
         //load the template
     } else {
         $this->load->view("layouts/{$template}.tpl.php", $this->data);
         //load the template
     }
 }
Example #14
0
 /**
  * parse query string and json in query string
  */
 function get($index = NULL, $xss_clean = FALSE)
 {
     $get = parent::get($index, $xss_clean);
     if (is_array($get)) {
         array_walk($get, function (&$value) {
             if (!is_string($value)) {
                 throw new Exception('URI params should be string, JSON is supported.', 400);
             }
             $decoded = json_decode($value, JSON_OBJECT_AS_ARRAY);
             !is_null($decoded) && ($value = $decoded);
         });
     } else {
         $decoded = json_decode($get, JSON_OBJECT_AS_ARRAY);
         !is_null($decoded) && ($get = $decoded);
     }
     if (is_null($index) && $get === false) {
         $get = array();
     }
     return $get;
 }
 function MY_Controller()
 {
     parent::Controller();
     $this->load->model('timeUnitModel');
     $this->load->library('User', null, 'userLib');
     $this->user = $this->userLib->getUserInfo();
     if (!$this->user) {
         showError($this->userLib->error, '/');
     }
     //加载菜单,全局使用
     $this->load->library('Navbar', $this->user);
     $this->navbarList = $this->navbar->getNavbarList();
     //当前选中菜单默认为当前控制器
     $this->navbarFocus = $_GET['c'] . '_' . $_GET['m'];
     //当前默认选中的菜单项
     $this->navChildFocus = $this->input->get('c') . '_' . $this->input->get('m');
     //当前主题
     $this->theme = $this->config->item('theme');
     //加载认证类,全局可以调用
     $this->load->library('Auth', $this->user);
     //面包屑导航
     $this->viewData['breadcrumb'][] = array('url' => printUrl('Main', 'index'), 'title' => '首页');
 }
Example #16
0
 /**
  * 重写Input的GET方法
  *
  * @param null $index
  * @param bool $xss_clean
  * @return string
  */
 public function get($index, $xss_clean = FALSE)
 {
     $this->set_urls();
     return parent::get($index, $xss_clean);
 }