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);
 }
Esempio n. 2
0
 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);
 }
 public function DataAction($type = '')
 {
     if ($this->request->isPost()) {
         // Delete
         if ($type == 'delete') {
             $id = $this->request->getPost('id');
             $arr = json_decode($id);
             foreach ($arr as $val) {
                 $data = LogAdminLogin::findFirst('id=' . $val);
                 if ($data->delete() == FALSE) {
                     $this->response->redirect('Result/err');
                 }
             }
             $this->response->redirect('Result/suc/LogAdminLogin');
         }
     } else {
         return FALSE;
     }
 }
Esempio n. 4
0
 private function loginLog($type, $uname)
 {
     $data = array('type' => $type, 'uname' => $uname, 'ip' => $this->request->getClientAddress(), 'time' => date('Y-m-d H:i:s'), 'agent' => $this->request->getUserAgent());
     $DB = new LogAdminLogin();
     $DB->save($data);
 }