Exemplo n.º 1
0
 /**
  * @param $id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionStatuses($id)
 {
     $company = Company::findOne(['id' => $id]);
     if (!$company) {
         throw new NotFoundHttpException('Invalid company id');
     }
     if (Yii::$app->request->isAjax) {
         return $this->renderPartial('statuses', ['statusesProvider' => new ActiveDataProvider(['query' => Status::find()->where(['company_id' => $id]), 'sort' => false])]);
     }
 }
Exemplo n.º 2
0
 /**
  * @return Company
  */
 public static function next()
 {
     $company = self::find()->joinWith(['statuses' => function ($query) {
         $query->onCondition(['status' => Status::hasParsed()]);
     }])->where(['company_id' => null])->limit(1)->one();
     return $company;
 }
Exemplo n.º 3
0
<?php

use app\modules\banks\models\Status;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $statusesProvider yii\data\ActiveDataProvider */
echo GridView::widget(['dataProvider' => $statusesProvider, 'summary' => '', 'emptyText' => 'The company have not parsed yet', 'columns' => [['attribute' => 'status', 'options' => ['width' => '150'], 'value' => function ($company) {
    return Status::getInfo($company->status);
}], ['attribute' => 'status_text', 'label' => 'Text'], ['attribute' => 'created_at', 'options' => ['width' => '150'], 'label' => 'Run', 'format' => 'datetime']]]);