コード例 #1
0
 public function insert($fieldsCols = NULL)
 {
     for ($c = 1; $c <= 10; $c++) {
         $fieldName = 'date' . $c;
         $date = $this->{$fieldName};
         $fieldName = 'kurs' . $c;
         $kurs = $this->{$fieldName};
         if ($date != '' && $kurs != '') {
             StockPrognosis::insert(['stock_id' => $this->stock_id, 'date' => $date->format('Ymd'), 'kurs' => $kurs]);
         }
     }
     return true;
 }
コード例 #2
0
 public function actionPrognosis_edit($id)
 {
     return $this->render(['items' => \app\models\StockPrognosis::query(['stock_id' => $id])->orderBy(['date' => SORT_DESC])->all(), 'item' => \app\models\Stock::find($id)]);
 }
コード例 #3
0
ファイル: graph.php プロジェクト: CAPITALOV/capitalov
<?php

use yii\helpers\Url;
use yii\helpers\Html;
/* @var $this \yii\web\View */
/* @var $item  \app\models\Stock */
$this->title = $item->getField('name');
?>

<h1 class="page-header"><?php 
echo $this->title;
?>
</h1>



<?php 
echo \cs\Widget\ChartJs\Line::widget(['width' => 800, 'lineArray' => \app\service\GraphExporter::convert(['rows' => [\app\models\StockKurs::query(['stock_id' => $item->getId()])->all(), \app\models\StockPrognosis::query(['stock_id' => $item->getId()])->all()]])]);