<?php $this->pageTitle = 'Список дисциплин'; ?> <h1><?php echo $this->pageTitle; ?> </h1> <?php echo CHtml::link('Назначить дисциплину для преподавателя', array("discipline/changediscip")); $this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $discipline->search(), 'filter' => $discipline, 'emptyText' => 'В базе нет дисциплин', 'columns' => array('id_discipline' => array('name' => 'id_discipline', 'value' => '$data->discipline->title'), 'id_group' => array('name' => 'id_group', 'value' => '$data->group->title', 'filter' => Group::getAll()), 'id_teacher' => array('name' => 'id_teacher', 'value' => '$data->teacher->surname." ".$data->teacher->firstname." ".$data->teacher->middlename', 'filter' => User::getAllTeacher()), 'sem' => array('name' => 'sem', 'value' => '$data->sem', 'filter' => DisciplineToTeacher::getAllSem()), array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'updateButtonUrl' => 'Yii::app()->createUrl("discipline/changediscip", array("id"=>$data->id_notice))', 'deleteButtonUrl' => 'Yii::app()->createUrl("discipline/deletediscip", array("id"=>$data->id_notice))'))));
public function actionDeletediscip($id) { if (Yii::app()->request->isPostRequest) { DisciplineToTeacher::model()->findByPk($id)->delete(); if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('listdiscip')); } } else { throw new CHttpException(400, 'Запрос не корректен. Пожалуйста не повторяйте этот запрос сново.'); } }
</div> <div id="forSpecialty"> <?php if (!$model->isNewRecord) { $this->renderPartial('_forSpecialty', array('model' => $model, 'form' => $form, 'groups' => $groups, 'disciplins' => $disciplins)); } ?> </div> <div class="row id_discipline"> <?php echo $form->labelEx($model, 'sem'); ?> <?php echo $form->dropDownList($model, 'sem', DisciplineToTeacher::getAllSem(), array('empty' => 'Выбирите семестр')); ?> <?php echo $form->error($model, 'sem'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_teacher'); ?> <?php echo $form->dropDownList($model, 'id_teacher', User::getAllTeacher(), array('empty' => 'Выбирите преподователя')); ?> <?php echo $form->error($model, 'id_teacher');