コード例 #1
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Specialists::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,
        ]);

        $query->andFilterWhere(['ilike', 'place', $this->place])
            ->andFilterWhere(['ilike', 'descr', $this->descr])
            ->andFilterWhere(['ilike', 'specialist', $this->specialist]);

        return $dataProvider;
    }
コード例 #2
0
 /**
  * Finds the Specialists model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Specialists the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Specialists::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: Companies.php プロジェクト: alaevka/reg.npmosk
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSpecialists()
 {
     return $this->hasMany(Specialists::className(), ['C_ID' => 'C_ID']);
 }
コード例 #4
0
ファイル: Attestates.php プロジェクト: alaevka/reg.npmosk
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSpecialist()
 {
     return $this->hasOne(Specialists::className(), ['Specialist_ID' => 'Specialist_ID']);
 }
コード例 #5
0
 /**
  * профмаршрут
  * @param object $model
  * @param array $factors1_arr
  * @param array $factors2_arr
  * @param string $specialists_arr
  * @param array $procedures_arr
  * @param array $againsts_arr
  * @return array
  */
 protected function rout($model, $specialists_arr, $procedures_arr, $againsts_arr)
 {
     $factors_str = '';
     if ($model->factors1) {
         $factors_str .= 'Прил. 1: ' . $model->factors1;
     }
     if ($model->factors2) {
         $factors_str .= 'Прил. 2: ' . $model->factors2;
     }
     foreach ($specialists_arr as $i => $spec) {
         $specialist = Specialists::find()->where(['specialist' => $spec])->one();
         if ($specialist) {
             $specialists_arr[$i] = $spec . ' <b>' . $specialist->place . '</b>';
         }
     }
     foreach ($procedures_arr as $i => $proc) {
         $procedure = Procedures::find()->where(['procedure' => $proc])->one();
         if ($procedure) {
             $procedures_arr[$i] = $proc . ' <b>' . $procedure->place . '</b>';
         }
     }
     return ['html' => $this->renderPartial('rout', ['model' => $model, 'factors_str' => $factors_str, 'specialists_str' => implode('<br>', $specialists_arr), 'procedures_str' => implode('<br>', $procedures_arr), 'againsts_str' => implode('<br>-', $againsts_arr), 'firm' => Yii::$app->user->identity->firm]), 'format' => 'A4-L'];
 }