Пример #1
0
 public function tranxbyappsummarysubmitAction()
 {
     $array_of_params = $this->_request->getParams();
     $appserver = new AppInfo();
     $allApps = $appserver->getAllAppInfo();
     $allApps = $this->sortAppByID($allApps);
     $this->view->allApps = $allApps;
     if (!isset($array_of_params['fromdate']) || $array_of_params['fromdate'] == '' || !isset($array_of_params['todate']) || $array_of_params['todate'] == '') {
         $array_of_params['fromdate'] = date('Y-m-d', strtotime("now -1 day"));
         $array_of_params['todate'] = date('Y-m-d', strtotime("now -1 day"));
         $array_of_params['radiogroup'] = 1;
     }
     $this->view->param = $array_of_params;
     $fromdate = $array_of_params['fromdate'] . ' 00:00:00';
     $todate = $array_of_params['todate'] . ' 23:59:59';
     $appIDs = array();
     $appserver = new AppInfo();
     if ($array_of_params['appid'] == '0' || !isset($array_of_params['appid'])) {
         $allApps = $appserver->getAllAppInfo();
         $allApps = $this->sortAppByID($allApps);
         foreach ($allApps as $app) {
             $appIDs['' . $app->appID] = $app->appName;
         }
     } else {
         $appIDs[$array_of_params['appid'] . ''] = $appserver->getAppName($array_of_params['appid']);
     }
     $reporter = new Reporter();
     $result = array();
     $keys = array_keys($appIDs);
     foreach ($keys as $appID) {
         $subresult = array();
         switch ($array_of_params['radiogroup']) {
             case 1:
                 $subresult = $reporter->summaryDaily($appID, $fromdate, $todate);
                 break;
             case 2:
                 $subresult = $reporter->summary($appID, $fromdate, $todate);
                 break;
         }
         if (count($subresult) > 0 && $subresult[0]['appID'] != null) {
             $result[] = $subresult;
         }
     }
     $this->view->data = $result;
     $this->view->frmSearch = $this->view->render('index/app_tranxbyapp_summary.phtml');
     $this->view->container = $this->view->render('index/index.phtml');
 }