/**
  * @param $path
  */
 public function actionStart($id)
 {
     $model = Import::findOne($id);
     /* @var Import $model */
     if (!$model) {
         throw new \yii\console\Exception("Import Model not found: {$id}");
     }
     $model->process();
 }
Example #2
0
 */
use yii\bootstrap\Html;
use yii\grid\GridView;
use webtoolsnz\importer\models\Import;
?>

<p class="text-right">
    <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> New Import', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<div class="table-responsive">
    <?php 
\yii\widgets\Pjax::begin();
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [['attribute' => 'filename', 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->filename, [$model->status_id == Import::STATUS_COMPLETE ? 'view' : 'view-progress', 'id' => $model->id], ['data-pjax' => 0]);
}], 'created_at:datetime', ['attribute' => 'status_id', 'filter' => Import::getStatuses(), 'value' => function ($model) {
    return $model->getStatus();
}]]]);
?>
    <?php 
\yii\widgets\Pjax::end();
?>
</div>