/** * This is report index action */ public function actionIndex() { $this->layout = false; $infoType = Yii::app()->request->getParam('type', Info::TYPE_BUG); $productId = Yii::app()->request->getParam('product_id', Yii::app()->user->getState('product')); $color = 'blue'; $selected = Yii::app()->request->getParam('selected', array()); if (Info::TYPE_CASE == $infoType) { $color = 'green'; } else { if (Info::TYPE_RESULT == $infoType) { $color = 'orange'; } } $reportService = new ReportService(); $reports = $reportService->getReports($infoType, $productId, $selected); $this->render('index', array('infoType' => $infoType, 'productId' => $productId, 'color' => $color, 'reports' => $reports, 'selected' => $selected)); }
* $retHeadArray = json_decode($retHead, TRUE); * print("This call cost quota: ".$retHeadArray['quota']."\r\n"); * print("My account has remain quota: ".$retHeadArray['rquota']."\r\n"); * * In the next, we will use the first siteid of retuned site Information * to show: how to call query, getstatus method of report service. * */ $retBodyArray = json_decode($retBody, TRUE); $siteInfo = json_decode($retBodyArray['responseData'], TRUE); if (count($siteInfo['sites']) > 0) { $siteid = $siteInfo['sites'][0]['siteid']; } else { exit; } $report = new ReportService(); //call query method of report service $parameter = $Query_Trans_Parameter; if (!isset($parameter['siteid'])) { $parameter['siteid'] = $siteid; } if (QUERY_TRANS_TYPE == 'url') { $parameter['url'] = TRANS_URL; } else { if (QUERY_TRANS_TYPE == 'name') { $parameter['name'] = TRANS_NAME; } } $parameterJSON = json_encode($parameter); $ret = $report->query_trans($ucid, $st, $parameterJSON); $retHead = $ret['retHead'];
function getAllDBTables() { $dbtbl = array(); foreach ($this->_db->_query("show tables")->fetchAll(PDO::FETCH_NUM) as $table) { $dbtbl[] = $table[0]; } ReportService::$tables = $dbtbl; // $sql = "show tables in " . $this->_db->getDatabase(); // $tbls = $this->_db->sql($sql)->fetch_all(); // if ($tbls) { // foreach ($tbls as $tbl) { // $dbtbl[] = array($tbl['Tables_in_' . $this->_db->getDatabase()], $tbl['Tables_in_' . $this->_db->getDatabase()]); // } // } return $dbtbl; }
* $retHeadArray = json_decode($retHead, TRUE); * print("This call cost quota: ".$retHeadArray['quota']."\r\n"); * print("My account has remain quota: ".$retHeadArray['rquota']."\r\n"); * * In the next, we will use the first siteid of retuned site Information * to show: how to call query, getstatus method of report service. * */ $retBodyArray = json_decode($retBody, TRUE); $siteInfo = json_decode($retBodyArray['responseData'], TRUE); if (count($siteInfo['sites']) > 0) { $siteid = $siteInfo['sites'][0]['siteid']; } else { exit; } $report = new ReportService(); //call query method of report service $parameter = $Query_Parameter; if (!isset($parameter['siteid'])) { $parameter['siteid'] = $siteid; } $parameterJSON = json_encode($parameter); $ret = $report->query($ucid, $st, $parameterJSON); $retHead = $ret['retHead']; $retBody = $ret['retBody']; if (!$retHead || !$retBody) { exit; } /* * Now, you have successfully call query method of * report service. Similarly, you can deal with retHead