public function indexAction() { // Page if (isset($_GET['search'])) { $like = $this->inc->pageWhere(); $where = ''; foreach ($like['data'] as $key => $val) { $where .= $key . " LIKE '%" . $val . "%' AND "; } $where = rtrim($where, 'AND '); $data = LogAdminLogin::find(array($where, 'order' => 'id desc')); $getUrl = $like['getUrl']; } else { $getUrl = ''; $data = LogAdminLogin::find(array('order' => 'id desc')); } $page = $this->inc->getPage(array('data' => $data, 'getUrl' => $getUrl)); $this->view->setVar('Page', $page); // Data $this->view->setVar('Lang', $this->inc->getLang('log/log_login')); $this->view->setVar('LoadJS', array('log/log_admin_login.js')); // Menus $this->view->setVar('Menus', $this->inc->getMenus()); $this->tag->prependTitle($this->inc->Ctitle); // View if ($this->session->get('IsMobile')) { $this->view->setTemplateAfter(APP_THEMES . '/main_m'); $this->view->pick("log/admin/login/index_m"); } else { $this->view->setTemplateAfter(APP_THEMES . '/main'); $this->view->pick("log/admin/login/index"); } }
public function chartAction() { $lang = $this->inc->getLang('welcome/desktop'); $year = date("Y"); $last = $year - 1; for ($i = 1; $i < 13; $i++) { $m = str_pad($i, 2, '0', STR_PAD_LEFT); $data1[] = count(LogAdminLogin::find("uname='" . $_SESSION['Admin']['uname'] . "' AND time LIKE '" . $year . "-" . $m . "%'")); $data2[] = count(LogAdminLogin::find("uname='" . $_SESSION['Admin']['uname'] . "' AND time LIKE '" . $last . "-" . $m . "%'")); $name[] = $lang->_('wel_desktop_m' . $m); } $data = array('labels' => $name, 'datasets' => array(array('label' => 'My First dataset', 'fillColor' => 'rgba(220,220,220,0.2)', 'strokeColor' => 'rgba(220,220,220,1)', 'pointColor' => 'rgba(220,220,220,1)', 'pointStrokeColor' => '#fff', 'pointHighlightFill' => '#fff', 'pointHighlightStroke' => 'rgba(220,220,220,1)', 'data' => $data2), array('label' => 'My Second dataset', 'fillColor' => 'rgba(151,187,205,0.2)', 'strokeColor' => 'rgba(151,187,205,1)', 'pointColor' => 'rgba(151,187,205,1)', 'pointStrokeColor' => '#fff', 'pointHighlightFill' => '#fff', 'pointHighlightStroke' => 'rgba(151,187,205,1)', 'data' => $data1))); return $this->response->setJsonContent($data); }
public function chartAction() { $lang = $this->inc->getLang('welcome/desktop'); $year = date("Y"); $last = $year - 1; for ($i = 1; $i < 13; $i++) { $m = str_pad($i, 2, '0', STR_PAD_LEFT); $data1[] = count(LogAdminLogin::find("uname='" . $_SESSION['Admin']['uname'] . "' AND time LIKE '" . $year . "-" . $m . "%'")); $data2[] = count(LogAdminLogin::find("uname='" . $_SESSION['Admin']['uname'] . "' AND time LIKE '" . $last . "-" . $m . "%'")); $name[] = $lang->_('wel_desktop_m' . $m); } $data = array('labels' => $name, 'datasets' => array(array('label' => 'Now year log', 'backgroundColor' => 'rgba(151,187,205,0.2)', 'borderColor' => 'rgba(151,187,205,1)', 'borderWidth' => 2, 'data' => $data1), array('label' => 'Last year log', 'backgroundColor' => 'rgba(220,220,220,0.2)', 'borderColor' => 'rgba(220,220,220,1)', 'borderWidth' => 2, 'data' => $data2))); return $this->response->setJsonContent($data); }