public function actionIndex()
 {
     $currentPsychologistId = Yii::$app->user->id;
     $profile = $this->findModel($currentPsychologistId);
     $directions = new Directions();
     $problems = new Problems();
     $sentDiplomaRequest = Diplomas::findOne(['psychologist_id' => $currentPsychologistId]);
     if ($profile->load(Yii::$app->request->post())) {
         if ($profile->save()) {
             return $this->render('index', ['profileModel' => $profile, 'message' => 'Профиль успешно обновлён', 'psychologistDirections' => $directions->getPsychologistDirections($currentPsychologistId), 'psychologistProblems' => $problems->getPsychologistProblems($currentPsychologistId), 'sentDiplomaRequest' => $sentDiplomaRequest]);
         }
     } else {
         //$this->logo = $imagesModel->getProfilePhoto();
         return $this->render('index', ['profileModel' => $profile, 'psychologistDirections' => $directions->getPsychologistDirections($currentPsychologistId), 'psychologistProblems' => $problems->getPsychologistProblems($currentPsychologistId), 'sentDiplomaRequest' => $sentDiplomaRequest]);
     }
 }
示例#2
0
 public function actionIndex()
 {
     $directions = Directions::find()->all();
     $transferForm = new TransferForm();
     $cards = LoyaltyCard::find()->all();
     return $this->render('index', ['cards' => $cards, 'directions' => $directions, 'transfer' => $transferForm]);
 }
示例#3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Directions::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Directions::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'id_type_country' => $this->id_type_country, 'id_type_car' => $this->id_type_car, 'max_passengers' => $this->max_passengers]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'country', $this->country]);
     return $dataProvider;
 }
 public function getDirections(Request $request, $from_city, $to_city)
 {
     $params = (object) ["from_city" => $from_city, 'to_city' => $to_city];
     $selected_directions = (new Directions())->getDirection($params);
     $directions = Directions::with(["stations", "stations.city"])->whereIn('id', $selected_directions)->get()->filter(function ($item) {
         return $item->stations->count() != 0;
     });
     if ($directions->count() == 0) {
         return Response::HTTP_BAD_REQUEST;
     } else {
         $data['directions'] = $directions;
         $data['providers'] = \App\Models\Providers::all();
         return response()->json($data);
     }
 }
示例#6
0
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use app\models\Directions;
/* @var $this yii\web\View */
/* @var $model app\models\PlaceDestination */
/* @var $form yii\widgets\ActiveForm */
$itemsDirection = ArrayHelper::map(Directions::find()->all(), 'id', 'name');
?>

<div class="place-destination-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'id_direction')->dropDownList($itemsDirection);
?>

    <?php 
echo $form->field($model, 'attribute')->dropDownList($model->getArrayAttributes());
?>

    <div class="form-group">
示例#7
0
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Пункты назначения';
$this->params['breadcrumbs'][] = ['label' => 'Форма заказа трансфера', 'url' => ['/managecontent/order-form']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="place-destination-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Добавить пункт назначения', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id_direction' => ['label' => 'Направление', 'attribute' => 'id_direction', 'content' => function ($model, $key, $index, $column) {
    return \app\models\Directions::find()->where(['id' => $model->id_direction])->one()->name;
}], 'name' => ['label' => 'Пункт назначения', 'attribute' => 'name'], 'attribute' => ['label' => 'Атрибут', 'attribute' => 'attribute', 'content' => function ($model, $key, $index, $column) {
    return $model->getAttributeName();
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
示例#8
0
 public static function getAllDirections()
 {
     return Directions::find()->all();
 }
示例#9
0
 /**
  * Finds the Directions model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Directions the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Directions::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }