Skip to content

Commit

Permalink
Time: showed a current activities list
Browse files Browse the repository at this point in the history
  • Loading branch information
boryashkin committed Mar 18, 2017
1 parent 6a6eac7 commit feb2168
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/time/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public function actionStat()
$sumTimeByAct = new ArrayDataProvider([
'allModels' => $sumTimeByAct->all(),
]);
$activeTracks = TimeTrack::find()->where(['stop' => null])->with(['activity'])->all();

return $this->render('stat', compact('stat', 'sumTimeByAct'));
return $this->render('stat', compact('stat', 'sumTimeByAct', 'activeTracks'));
}
}
7 changes: 7 additions & 0 deletions modules/time/views/index/stat.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/** @var $this yii\web\View */
/** @var $stat array */
/* @var $sumTimeByAct \yii\db\ActiveQuery */
/** @var $activeTracks \app\modules\time\models\TimeTrack[] */
//@todo: get normal dataset from db instead of handling it here
use miloschuman\highcharts\Highcharts;

Expand Down Expand Up @@ -57,6 +58,12 @@
$categories = array_values($categories);
$series = array_values($series);
?>
<?php if ($activeTracks) : ?>
<span>Currently active:</span>
<?php foreach ($activeTracks as $track) : ?>
<label class="label label-success"><?= $track->activity->name ?></label>
<?php endforeach; ?>
<?php endif; ?>
<?= Highcharts::widget([
'options' => [
'title' => ['text' => 'Daily stat'],
Expand Down

0 comments on commit feb2168

Please sign in to comment.