コード例 #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;
 }
コード例 #2
0
ファイル: manage.php プロジェクト: mrhat24/site-for-pm
</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();
コード例 #3
0
ファイル: _form.php プロジェクト: mrhat24/site-for-pm
    <?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