Exemplo n.º 1
0
 public function execute($user, $item, $params)
 {
     if (Yii::$app->user->isGuest) {
         return false;
     }
     $role = Yii::$app->user->identity->role;
     if ($role == User::ROLE_ADMIN) {
         return true;
     } elseif (!isset($params['id_program'])) {
         return false;
     } elseif ($role == User::ROLE_STUDENT) {
         $model = StudentEducation::find()->where(['id_student' => Yii::$app->user->identity->id_student, 'year' => YearHelper::getYear()])->one();
         if (!$model) {
             return false;
         } else {
             return $params['id_program'] == $model->id_program;
         }
     } elseif ($role == User::ROLE_LOCAL_ADMIN || $role == User::ROLE_INSPECTOR) {
         $model = Program::findOne($params['id_program']);
         if (!$model) {
             return false;
         } else {
             return Yii::$app->user->identity->id_faculty == $model->id_faculty;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 public function actionIndex($id_program)
 {
     $program = Program::findOne($id_program);
     $searchModel = new DisciplineSearch();
     $dataProvider = $searchModel->search($id_program, Yii::$app->request->queryParams);
     Yii::$app->session->set('disciplinePage', Yii::$app->request->get('page'));
     return $this->render('index', ['program' => $program, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Exemplo n.º 3
0
 public function actionIndex($id_program)
 {
     $id_student = Yii::$app->user->identity->id_student;
     $program = Program::findOne($id_program);
     $searchModel = new StudentSearch();
     $dataProvider = $searchModel->search($id_program, $id_student, Yii::$app->request->queryParams);
     Yii::$app->session->set('studentPage', Yii::$app->request->get('page'));
     return $this->render('index', ['program' => $program, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Exemplo n.º 4
0
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         return $id;
     } else {
         $model = Program::findOne($id);
         return $model->id_faculty;
     }
 }
Exemplo n.º 5
0
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         $model = Program::findOne($id);
         return $model->id_faculty;
     } else {
         $model = ProgramFile::find()->where(['id_file' => $id])->one();
         return $this->getIdFaculty($model->id_program, true);
     }
 }
Exemplo n.º 6
0
 public function items($id_faculty)
 {
     $items = [];
     $models = Program::find()->where(['id_faculty' => $id_faculty])->orderBy('code')->all();
     foreach ($models as $model) {
         $this->model = $model;
         $items[] = ['header' => $this->disciplinesLink(), 'content' => $this->programContent()];
     }
     return $items;
 }
Exemplo n.º 7
0
 public function actionProgram($id)
 {
     /* @var $model \common\models\Program */
     Yii::$app->response->format = Response::FORMAT_JSON;
     $programs = [];
     $models = Program::find()->where(['id_faculty' => $id])->all();
     foreach ($models as $model) {
         $programs[] = $model->toArray(['id'], ['fullName']);
     }
     ArrayHelper::multisort($programs, 'fullName');
     return $programs;
 }
Exemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProgram()
 {
     return $this->hasOne(Program::className(), ['id' => 'id_program']);
 }
Exemplo n.º 9
0
<?php

use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
use common\models\Program;
use common\models\Discipline;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $program Program */
/* @var $idParent integer */
require Yii::$app->basePath . '/views/grid/index.php';
$program = Program::findOne($idParent);
$this->title = 'Дисциплины';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Дисциплины</h2>
<h3>
    Образовательная программа: <?php 
echo "{$program->fullName}";
?>
</h3>

<p>
    <?php 
echo Html::a('Новая дисциплина', ['create', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);
?>
    <?php 
if (Discipline::find()->where(['block' => Discipline::DISCIPLINE_CHOICE])->exists()) {
    echo Html::a('Дополнительная дисциплина по выбору', ['create-additive', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);
Exemplo n.º 10
0
<?php

use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
use common\models\Program;
use common\models\Discipline;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $program Program */
/* @var $discipline Discipline */
/* @var $idParent integer */
require Yii::$app->basePath . '/views/grid/index.php';
$discipline = Discipline::findOne($idParent);
$program = Program::findOne($discipline->id_program);
$this->title = 'Семестры';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = ['label' => 'Дисциплины', 'url' => ['/discipline', 'idParent' => $discipline->id_program, 'page' => Yii::$app->session->get('disciplinePage')]];
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Семестры</h2>
<h3>
    Дисциплина: <?php 
echo $discipline->fullName;
?>
</h3>

<p>
    <?php 
echo Html::a('Новый семестр', ['create', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);
?>
Exemplo n.º 11
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Program;
/* @var $this yii\web\View */
/* @var $model common\models\ProgramHeader */
/* @var $form yii\widgets\ActiveForm */
$program = new Program();
$attributes = $program->availableAttributes();
$labels = $program->attributeLabels();
$fields = [];
foreach ($attributes as $attribute) {
    $fields[$attribute] = $labels[$attribute];
}
?>

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

<?php 
echo $form->field($model, 'field_shown')->dropDownList($fields);
?>


<div class="form-group submitBlock">
    <?php 
echo Html::submitButton('Сохранить', ['class' => 'btn btn-success', 'name' => 'submitButton']);
?>
</div>
Exemplo n.º 12
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use common\models\Faculty;
use common\models\Program;
$facultyList = Faculty::getFacultyList();
if ($model->isNewRecord) {
    $program = Program::find()->joinWith('idFaculty')->orderBy('faculty.name')->one();
    $model->id_program = $program->id;
}
?>

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

<?php 
echo $form->field($model, 'year')->textInput();
echo $form->field($model, 'course')->textInput();
echo $form->field($model, 'group')->textInput(['maxlength' => true]);
echo $form->field($model, 'idFaculty')->dropDownList($facultyList, ['id' => 'faculties', 'data-url' => Url::to(['/student/history/program'])]);
echo $form->field($model, 'id_program')->dropDownList([], ['id' => 'program']);
?>

<?php 
// Факультет
// Программа
?>
Exemplo n.º 13
0
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Отображение наименования</h2>
<h3>
    Образовательная программа: <?php 
echo $program->fullName;
?>
</h3>
<p>
    <?php 
echo $program->fullContent;
?>
</p>

<p>
    <?php 
echo Html::a('Новое поле в наименовании', ['create', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);
?>
</p>

<?php 
Pjax::begin(['options' => ['id' => 'pjaxWrap']]);
echo GridView::widget(['dataProvider' => $provider, 'columns' => [['attribute' => 'field_shown', 'format' => 'text', 'value' => function ($model, $key, $index, $column) {
    $program = new Program();
    $labels = $program->attributeLabels();
    return $labels[$model->field_shown];
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}', 'buttons' => ['update' => 'actionUpdate', 'delete' => 'actionDelete']]]]);
?>

<?php 
Pjax::end();
Exemplo n.º 14
0
<?php

/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $student \common\models\StudentEducation */
use common\models\Program;
use yii\widgets\Pjax;
use yii\grid\GridView;
use common\models\Discipline;
use yii\helpers\Html;
use yii\helpers\Url;
use backend\assets\GridAsset;
GridAsset::register($this);
/* @var $program Program */
$program = Program::findOne($student->id_program);
$this->title = 'Результаты';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = ['label' => 'Студенты', 'url' => ['main/index', 'idParent' => $student->id_program, 'page' => Yii::$app->session->get('studentPage')]];
$this->params['breadcrumbs'][] = $this->title;
?>

<h2>Результаты</h2>
<h3>
Студент: <?php 
echo $student->studentName;
?>
 Курс: <?php 
echo $student->course;
?>
</h3>
Exemplo n.º 15
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProgram()
 {
     return $this->hasOne(Program::className(), ['id' => 'program_id']);
 }
Exemplo n.º 16
0
 public function getFieldShownLabel()
 {
     $program = new Program();
     $labels = $program->attributeLabels();
     return $labels[$this->field_shown];
 }
Exemplo n.º 17
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPrograms()
 {
     return $this->hasMany(Program::className(), ['id_faculty' => 'id']);
 }