Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 15
ChooseHostAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 15
 run
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 15
<?php
namespace backend\controllers\meeting;
use Yii;
use backend\models\ParticipantSearch;
use common\models\Organization;
use common\models\Participant;
use common\models\Meeting;
use common\models\Supervisor;
use yii\base\Action;
use yii\web\BadRequestHttpException;
use yii\web\ForbiddenHttpException;
use yii\web\NotFoundHttpException;
/**
 * Creates a new Meeting model.
 * If creation is successful, the browser will be redirected to the 'view' page.
 * @param integer $participant
 * @return mixed
 */
class ChooseHostAction extends Action
{
    public function run()
    {
        $searchModel = new ParticipantSearch();
        $dataProvider = $searchModel->search(
            Yii::$app->request->queryParams
        );
        if(!Yii::$app->user->can('admin')){
            $dataProvider->query
                ->joinWith('organization')->joinWith('organization.supervisor')
                ->andWhere(['{{%supervisor}}.[[user_id]]' => Yii::$app->user->id]);
        }
        return $this->controller->render('choose_host', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
}