Commit ef9ee814 by san58

Статистика по TIX

1 parent f695cd54
......@@ -67,17 +67,22 @@ class SiteController extends Controller
{
//var_dump(Yii::$app->user->isGuest);
//var_dump(Yii::$app->user->identity);
$statistics = ['csv_date' => ''];
$statistics['c_status'] = (new yii\db\Query())
$statistics = ['csv_date' => '', 'whois_status'=>[], 'itx_status'=>[]];
$statistics['whois_status'] = (new yii\db\Query())
->select(['COUNT(*) AS cnt', 'wis_status', 'status'])
->from('{{%host}}')
->groupBy(['wis_status', 'status'])
->all();
$statistics['itx_status'] = (new yii\db\Query())
->select(['COUNT(*) AS cnt', 'tix_status', 'status'])
->from('{{%host}}')
->groupBy(['tix_status', 'status'])
->all();
$csv = Host::find()->select(['csv_date'])->orderBy('csv_date ASC')->one();
if ($csv) {
if ($csv)
$statistics['csv_date'] = $csv['csv_date'];
}
return $this->render('index', ['statistics'=>$statistics]);
}
......
......@@ -10,20 +10,24 @@ MainAsset::register($this);
print_r($statistics);
echo '</pre>';
*/
?>
<h2>Statistics</h2>
<dl class="dl-horizontal">
<dt>Datatime of CSV-file </dt>
<dd><?php echo $statistics['csv_date']; ?></dd>
</dl>
<?php
$domain_count = [
Host::STATUS_WIS_NONE=>[0,0],
Host::STATUS_WIS_NONE=>[0,0],
Host::STATUS_WIS_FREE=>[0,0],
Host::STATUS_WIS_BUSY=>[0,0]
];
foreach($statistics['c_status'] as $st_value)
foreach($statistics['whois_status'] as $st_value)
$domain_count[$st_value['wis_status']][(int)$st_value['status']] = (int)$st_value['cnt'];
unset($st_value);
?>
<h3>Statistics</h3>
<dl class="dl-horizontal">
<dt>Datatime of CSV-file </dt>
<dd><?php echo $statistics['csv_date']; ?></dd>
</dl>
<h2>WHO IS</h2>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<tr>
......@@ -54,7 +58,55 @@ unset($st_value);
<th class="text-right">All count</th>
<td><?php echo $domain_count[Host::STATUS_WIS_NONE][0]+$domain_count[Host::STATUS_WIS_BUSY][0]+$domain_count[Host::STATUS_WIS_FREE][0]; ?></td>
<td><?php echo $domain_count[Host::STATUS_WIS_NONE][1]+$domain_count[Host::STATUS_WIS_BUSY][1]+$domain_count[Host::STATUS_WIS_FREE][1]; ?></td>
<td><?php echo $domain_count[Host::STATUS_WIS_NONE][0]+$domain_count[Host::STATUS_WIS_NONE][1]+$domain_count[Host::STATUS_WIS_BUSY][0]+$domain_count[Host::STATUS_WIS_BUSY][1]+$domain_count[Host::STATUS_WIS_FREE][0]+$domain_count[Host::STATUS_WIS_FREE][1]; ?></td>
<td><?php
echo $domain_count[Host::STATUS_WIS_NONE][0]+$domain_count[Host::STATUS_WIS_NONE][1]+
$domain_count[Host::STATUS_WIS_BUSY][0]+$domain_count[Host::STATUS_WIS_BUSY][1]+
$domain_count[Host::STATUS_WIS_FREE][0]+$domain_count[Host::STATUS_WIS_FREE][1];
?></td>
</tr>
</table>
</div>
<?php
$domain_count = [
Host::STATUS_TIX_UNCHECK=>[0,0],
Host::STATUS_TIX_CHECK=>[0,0],
];
foreach($statistics['itx_status'] as $st_value)
$domain_count[$st_value['tix_status']][(int)$st_value['status']] = (int)$st_value['cnt'];
unset($st_value);
?>
<h2>TIX</h2>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<tr>
<th width="40%">Status TIX checked</th>
<th width="20%">Count of Disabled</th>
<th width="20%">Count of Enabled</th>
<th width="20%">Count of All</th>
</tr>
<tr>
<td>No checked</td>
<td><?php echo $domain_count[Host::STATUS_TIX_UNCHECK][0]; ?></td>
<td><?php echo $domain_count[Host::STATUS_TIX_UNCHECK][1]; ?></td>
<td><?php echo $domain_count[Host::STATUS_TIX_UNCHECK][0]+$domain_count[Host::STATUS_TIX_UNCHECK][1]; ?></td>
</tr>
<tr>
<td>Checked</td>
<td><?php echo $domain_count[Host::STATUS_TIX_CHECK][0]; ?></td>
<td><?php echo $domain_count[Host::STATUS_TIX_CHECK][1]; ?></td>
<td><?php echo $domain_count[Host::STATUS_TIX_CHECK][0]+$domain_count[Host::STATUS_TIX_CHECK][1]; ?></td>
</tr>
<tr>
<th class="text-right">All count</th>
<td><?php echo $domain_count[Host::STATUS_TIX_UNCHECK][0]+$domain_count[Host::STATUS_TIX_CHECK][0]; ?></td>
<td><?php echo $domain_count[Host::STATUS_TIX_UNCHECK][1]+$domain_count[Host::STATUS_TIX_CHECK][1]; ?></td>
<td><?php
echo $domain_count[Host::STATUS_TIX_UNCHECK][0]+$domain_count[Host::STATUS_TIX_UNCHECK][1]+
$domain_count[Host::STATUS_TIX_CHECK][0]+$domain_count[Host::STATUS_TIX_CHECK][1];
?></td>
</tr>
</table>
</div>
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!