/** * Admin dashboard view * * @access public * @return void */ public function action_dashboard($type = 'm') { $orders = \Dashboard::get_order($type); $visitors = \Dashboard::get_visits($type); $c_orders = \Dashboard::get_chart_order($type); $co_html = ''; foreach ($c_orders as $order) { $co_html .= '[' . (int) $order['MNTH'] . ', ' . (double) $order['total_price'] . ']'; $co_html .= ','; } $c_visits = \Dashboard::get_chart_visits(); $visits_html = ''; foreach ($c_visits as $order) { $visits_html .= '[' . (int) $order['MNTH'] . ', ' . (double) $order['visits'] . ']'; $visits_html .= ','; } if ($type == 'd') { $type = 'Today'; } elseif ($type == 'm') { $type = 'This Month'; } elseif ($type == 'y') { $type = 'This Year'; } else { $type = 'This Week'; } $users = \Sentry::user()->all('front'); // if(!empty($users)) // { // foreach($users as $key => $item) // { // $user_tmp = \Sentry::user((int)$item['id']); // if($user_tmp->get('metadata.guest') == 1) // unset($users[$key]); // else // $users[$key] = $user_tmp; // } // } $items['orders'] = $orders[0]['total_order']; $items['sales'] = $orders[0]['total_sales']; $items['visits'] = $visitors[0]['visits']; $items['users'] = count($users); $items['chart_orders'] = $co_html; $items['chart_visits'] = $visits_html; $items['type'] = $type; //\View::set_global('full_page', true); \View::set_global('title', 'Dashboard'); \Theme::instance()->set_partial('content', $this->view_dir . 'dashboard')->set('items', $items); }