Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = LessonType::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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
</h1>
   <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
 
   <div class="btn-group">
    <?php 
echo Html::button('Добавить занятие', ['value' => Url::to(['//lesson/create']), 'class' => 'btn btn-success modalButton']);
?>
     
    <?php 
echo Html::button('Управление типами', ['value' => Url::to(['//lesson-type/index']), 'class' => 'btn btn-primary modalButton']);
?>
         
   </div>
   <?php 
Pjax::begin(['enablePushState' => false]);
?>
   <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'groupName', 'disciplineName', ['attribute' => 'lessonTypeName', 'filter' => ArrayHelper::map(\common\models\LessonType::find()->all(), 'name', 'name')], 'teacherFullname', ['attribute' => 'week', 'filter' => [1 => 1, 2 => 2]], ['attribute' => 'day', 'value' => function ($model) {
    return $model->dayRealName;
}, 'filter' => Lesson::getDaysList()], ['attribute' => 'time', 'filter' => ArrayHelper::map(Lesson::find()->select('time')->distinct()->all(), 'time', 'time')], 'auditory', ['class' => 'common\\components\\ActionColumn']]]);
?>
   <?php 
Pjax::end();
?>
</div>
<?php 
Modal::begin(['header' => '', 'id' => 'modal', 'size' => 'modal-lg']);
echo "<div id='modalContent'></div>";
Modal::end();
Ejemplo n.º 3
0
 /**
  * @get teacher
  */
 public function getLessonType()
 {
     return $this->hasOne(LessonType::className(), ['id' => 'lesson_type_id']);
 }
Ejemplo n.º 4
0
 /**
  * Finds the LessonType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return LessonType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = LessonType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 5
0
    <?php 
$form = ActiveForm::begin();
?>
 
    
    <?php 
echo $model->isNewRecord ? $form->field($model, 'ghd_id')->dropDownList(ArrayHelper::map(GroupHasDiscipline::find()->all(), 'id', 'groupSemDisc'), ['prompt' => '--Выберите дисциплину--']) : "";
?>
    

    <?php 
echo $model->isNewRecord ? $form->field($model, 'thd_id')->widget(DepDrop::classname(), ['options' => ['id' => 'thd_id-id'], 'pluginOptions' => ['depends' => ['lesson-ghd_id'], 'placeholder' => '...', 'url' => Url::to(['/lesson/thd'])]]) : $form->field($model, 'thd_id')->dropDownList(ArrayHelper::map($model->groupHasDiscipline->teacherHasDiscipline, 'teacher.id', 'teacher.user.fullname'));
?>
    
    <?php 
echo $form->field($model, 'lesson_type_id')->dropDownList(ArrayHelper::map(LessonType::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'week')->dropDownList(['1' => 1, '2' => 2]);
?>

    <?php 
echo $form->field($model, 'day')->dropDownList(Lesson::getDaysList());
?>

    <?php 
echo $form->field($model, 'time')->widget(TimePicker::classname(), ['pluginOptions' => ['defaultTime' => '8:30:00', 'showSeconds' => true, 'showMeridian' => false, 'minuteStep' => 5]]);
?>

    <?php