Пример #1
0
 public function validate_dname($attribute)
 {
     $d = DisciplineList::find()->where(['discipline_name' => $attribute]);
     if (empty($d)) {
         $this->addError($attribute, 'Така дисципліна вже присутня');
     }
 }
Пример #2
0
foreach ($all_faculty as $af) {
    $tmp_cathedra = Cathedra::find()->where(['id_faculty' => $af['faculty_id']])->orderBy('cathedra_name ASC')->all();
    foreach ($tmp_cathedra as $tc) {
        $all_cathedra[$tc['cathedra_id']] = $tc['cathedra_name'] . " / " . $af['faculty_name'];
    }
}
?>

<div class="discipline-form">

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

    <?php 
echo $form->field($model, 'id_discipline')->widget(Select2::classname(), ['data' => ArrayHelper::map(DisciplineList::find()->orderBy('discipline_name ASC')->all(), 'discipline_id', 'discipline_name'), 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Дисципліна');
?>

    <?php 
echo $form->field($model, 'id_cathedra')->widget(Select2::classname(), ['data' => $all_cathedra, 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Кафедра');
?>

    <?php 
echo $form->field($model, 'id_lessons_type')->widget(Select2::classname(), ['data' => ArrayHelper::map(LessonsType::find()->all(), 'id', 'lesson_type_name'), 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Тип заняття');
?>

    <?php 
echo Html::label("Групи");
echo Select2::widget(['model' => $model, 'attribute' => 'id_group', 'language' => 'ru', 'data' => ArrayHelper::map(Groups::find()->all(), 'group_id', 'main_group_name')]);
?>