/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Specialists::find(); // add conditions that should always apply here $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->joinWith('doctor'); $query->joinWith('occupation'); // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'doctors.name', $this->doctor_id])->andFilterWhere(['like', 'occupations.name', $this->occupation_id]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use frontend\modules\doctors\models\Doctors; use frontend\models\Records; use frontend\models\Specialists; /* @var $this yii\web\View */ /* @var $model frontend\models\records */ /* @var $form ActiveForm */ $record = Records::findOne($id); $spec = Specialists::findOne($record->specialist_id); $doctor = Doctors::findOne($spec->doctor_id); $date = strtotime($record->start_time); $specialist_id = $record->specialist_id; $this->title = 'Регистрация заявки'; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Выбор времени приёма'), 'url' => ['list', 'date' => $date, 'id' => $specialist_id]]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="register"> <div class="jumbotron"> <?php echo '<h2>' . Html::label($doctor->name) . '</h2>'; echo '<h3>' . Html::label($doctor->description) . '</h3>'; echo '</div>'; $form = ActiveForm::begin(); echo $form->field($model, 'name')->input('text', ['value' => '']); echo $form->field($model, 'phone')->input('text', ['value' => '']); echo '<p />'; echo '<h3>' . Html::label('Время приёма:', 'lblTime', ['class' => "control-label"]) . ' ';
/** * @return \yii\db\ActiveQuery */ public function getSpecialist() { return $this->hasOne(Specialists::className(), ['id' => 'specialist_id']); }
/* @var $this yii\web\View */ /* @var $model frontend\models\Specialists */ /* @var $form ActiveForm */ ?> <div class="viewSpec"> <div class="jumbotron"> <p class="lead"> <?php $occupation = Occupations::findOne(['id' => $id]); $this->title = 'Выбор даты приёма'; $this->params['breadcrumbs'][] = $this->title; ?> </p> <?php $models = Specialists::findAll(['occupation_id' => $id]); //setlocale(LC_ALL, 'ru_RU.UTF-8'); //setlocale(LC_TIME, 'ru_RU.CP1251', 'rus_RUS.CP1251', 'Russian_Russia.1251', 'ru_RU.UTF-8'); if (count($models) > 0) { echo '<div class="page-header">'; echo '<h2>' . $occupation->name . ': Выберите дату приёма</h2>'; echo '</div><p />'; $tm = time(); $dt = date("w", $tm); $numberOfDay = date("w", $tm); //echo '<table><tr style="border-bottom: groove; border-top: groove; font-weight: bold;">'; echo '<table><tr style="border-bottom: groove; font-weight: bold;">'; echo '<td style="width: 300px; text-align: justify;">Врач</td>'; for ($i = 0; $i < 7; $i++) { if ($numberOfDay == 0 || $numberOfDay == 6) { $color = 'red';
public static function isDouble($doctor_id, $occupation_id) { $result = false; $model = Specialists::findOne(['doctor_id' => $doctor_id, 'occupation_id' => $occupation_id]); if ($model) { $result = true; } return $result; }
<?php use yii\helpers\Html; use yii\grid\GridView; use frontend\modules\doctors\models\Doctors; use frontend\models\Specialists; use frontend\modules\occupations\models\Occupations; use frontend\models\Records; use yii\helpers\Url; //use Yii; /* @var $this yii\web\View */ /* @var $searchModel frontend\models\RecordsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $dt = date('d-m-Y', $date); $spec = Specialists::findOne($id); $doctor = Doctors::findOne($spec->doctor_id); $occupation = Occupations::findOne($spec->occupation_id); $this->title = 'Выбор времени приёма'; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Выбор даты'), 'url' => ['specialists/viewss', 'id' => $spec->occupation_id]]; $this->params['breadcrumbs'][] = $this->title; echo Html::beginTag('div'); echo Html::beginTag('div', ['class' => "page-header"]); echo Html::tag('h3', Html::encode($this->title)); echo Html::tag('h2', $doctor->name); echo Html::tag('h4', $doctor->description); $month = Records::$monthsFull[(int) date('m', $date) - 1]; echo '<h4><strong>' . date("d", $date) . ' ' . $month . ' ' . date('Y', $date) . '</strong></h4>'; echo Html::endTag('div'); ?> <div class="records-list">
public function actionIsDouble($doctor_id, $occupation_id) { return Specialists::isDouble($doctor_id, $occupation_id); }