protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         $model = DisciplineName::findOne($id);
         return $model->idProgram->id_faculty;
     } else {
         $model = DisciplineFile::find()->where(['id_file' => $id])->one();
         return $this->getIdFaculty($model->id_discipline_name, true);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($id_program, $params)
 {
     $query = DisciplineName::find()->where(['id_program_main' => $id_program]);
     $subQueryDiscipline = Discipline::find()->select('*,
                       cast([[code_last]] as decimal(10,3)) as [[code_last_num]]');
     $subQuerySemester = DisciplineSemester::find()->select('id_discipline, MIN(semester) as min_semester')->groupBy('id_discipline');
     $query->innerJoin(['discMain' => $subQueryDiscipline], 'discMain.id = discipline_name.id_discipline')->leftJoin(['discSemester' => $subQuerySemester], 'discSemester.id_discipline = discipline_name.id_discipline');
     $provider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10, 'pageSizeParam' => false]]);
     $provider->setSort(['attributes' => ['name', 'disciplineCode' => ['asc' => ['discMain.code_first' => SORT_ASC, 'discMain.code_last_num' => SORT_ASC, 'suffix' => SORT_ASC], 'desc' => ['discMain.code_first' => SORT_DESC, 'discMain.code_last_num' => SORT_DESC, 'suffix' => SORT_DESC], 'label' => 'DisciplineCode'], 'kind', 'block', 'disciplineSemesters' => ['asc' => ['discSemester.min_semester' => SORT_ASC], 'desc' => ['discSemester.min_semester' => SORT_DESC], 'label' => 'DisciplineSemester']], 'defaultOrder' => ['disciplineCode' => SORT_ASC]]);
     if (!($this->load($params) && $this->validate())) {
         return $provider;
     }
     $query->andWhere('name LIKE "%' . $this->name . '%" ');
     $query->andWhere('discMain.code_first LIKE "%' . $this->disciplineCode . '%" ');
     if (is_numeric($this->kind)) {
         $query->andWhere('discMain.kind = ' . $this->kind);
     }
     if (is_numeric($this->block)) {
         $query->andWhere('discMain.block = ' . $this->block);
     }
     return $provider;
 }
Beispiel #3
0
 public function actionDiscipline($id)
 {
     $id_program = DisciplineName::findOne($id)->idProgram->id;
     $allowed = Yii::$app->user->can('viewProgramFiles', ['id_program' => $id_program]);
     return $this->renderFiles('common\\models\\DisciplineName', $id, $allowed);
 }
Beispiel #4
0
 /**
  * @return string
  */
 public function getFullName()
 {
     if ($this->block == self::DISCIPLINE_CHOICE) {
         return "{$this->code} Дисциплина по выбору";
     } else {
         /* @var $disciplineName DisciplineName */
         $disciplineName = DisciplineName::findOne(['id_discipline' => $this->id]);
         return $disciplineName ? "{$this->code} {$disciplineName->name}" : 'Not found';
     }
 }
Beispiel #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdDisciplineName()
 {
     return $this->hasOne(DisciplineName::className(), ['id' => 'id_discipline_name']);
 }
Beispiel #6
0
echo $discipline->fullName;
?>
</h4>

<?php 
$form = ActiveForm::begin(['id' => 'updateForm']);
?>

<!-- Для первой строки массива моделей вводим
название ДПВ, дату сдачи и экзаменатора -->

<?php 
if ($discipline->block == Discipline::DISCIPLINE_CHOICE) {
    ?>
    <?php 
    $disciplineList = DisciplineName::getDisciplineList($discipline->id);
    ?>

    <?php 
    echo $form->field($model, "[0]id_discipline_name", ['inputOptions' => ['class' => 'disciplineName']])->dropDownList($disciplineList);
} else {
    ?>
    <?php 
    echo $form->field($model, "[0]id_discipline_name", ['inputOptions' => ['class' => 'disciplineName']])->hiddenInput()->label(false);
}
?>


<?php 
echo $form->field($model, "[0]passing_date")->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'options' => ['class' => 'passingDate']]);
echo $form->field($model, "[0]examiner", ['inputOptions' => ['class' => 'examiner', 'style' => 'width:60%;']]);
Beispiel #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDisciplineNames()
 {
     return $this->hasMany(DisciplineName::className(), ['id_program_main' => 'id']);
 }
Beispiel #8
0
<?php

use common\models\Program;
use common\models\DisciplineName;
use common\models\Discipline;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $program Program */
/* @var $disciplineName DisciplineName */
/* @var $discipline Discipline */
/* @var $idParent integer */
$disciplineName = DisciplineName::findOne($idParent);
$discipline = $disciplineName->idDiscipline;
$program = Program::findOne($discipline->id_program);
$code = $disciplineName->disciplineCode;
$this->title = 'Файлы';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = ['label' => 'Дисциплины', 'url' => ['/discipline', 'idParent' => $disciplineName->id_program_main, 'page' => Yii::$app->session->get('disciplinePage')]];
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Файлы</h2>
<h3>
    Дисциплина: <?php 
echo "{$code} {$disciplineName->name}";
?>
</h3>

<?php 
require Yii::$app->basePath . '/views/gridFile/index.php';
?>
Beispiel #9
0
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         $model = Program::findOne($id);
         return $model->id_faculty;
     } else {
         $model = DisciplineName::findOne($id);
         return $model->idProgram->id_faculty;
     }
 }