Exemplo n.º 1
0
 /**
  * Displays homepage.
  *
  * @return mixed
  */
 public function actionIndex()
 {
     $query = Faculty::find();
     $provider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['name' => SORT_ASC]], 'pagination' => false]);
     $images = Faculty::find()->where(['is not', 'filename', null])->all();
     $images = ArrayHelper::map($images, 'id', 'filename');
     return $this->render('index', ['provider' => $provider, 'images' => $images]);
 }
Exemplo n.º 2
0
$form = ActiveForm::begin(['id' => 'updateForm']);
?>

<?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
echo $form->field($model, 'password')->passwordInput();
echo $form->field($model, 'repassword')->passwordInput();
?>

<?php 
if (Yii::$app->user->identity->role == User::ROLE_ADMIN) {
    ?>
    <?php 
    // Список факультетов
    $faculties = ArrayHelper::map(Faculty::find()->orderBy('name')->all(), 'id', 'name');
    ?>
    <?php 
    echo $form->field($model, 'id_faculty')->dropDownList($faculties);
}
?>

<?php 
// массив для списка выбора ролей. Оставляем только роли с ключами 1 и 2
// (инспектор и локальный администратор)
$roles = array_slice(Yii::$app->params['decode']['user.role'], 1, 2, true);
echo $form->field($model, 'role')->dropDownList($roles);
echo $form->field($model, 'sendMail')->checkbox();
?>

<div class="form-group submitBlock">
Exemplo n.º 3
0
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $idParent integer */
/* @var $fileControllerName string */
require Yii::$app->basePath . '/views/grid/index.php';
$this->title = 'Образовательные программы';
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Образовательные программы</h2>
<h3>
    Факультет: <?php 
echo \common\models\Faculty::findOne($idParent)->name;
?>
</h3>

<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' => 'code', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    return Html::a(Html::encode($model->code), ['/student', 'idParent' => $model->id], ['data-pjax' => '0', 'data-toggle' => 'tooltip', 'title' => 'Перейти к студентам']);
}], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    return Html::a(Html::encode($model->name), ['/discipline', 'idParent' => $model->id], ['data-pjax' => '0', 'data-toggle' => 'tooltip', 'title' => 'Перейти к дисциплинам']);
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdFaculty()
 {
     return $this->hasOne(Faculty::className(), ['id' => 'id_faculty']);
 }
Exemplo n.º 5
0
 public function actionIndex($id_faculty)
 {
     $faculty = Faculty::findOne($id_faculty);
     return $this->render('index', ['faculty' => $faculty]);
 }
Exemplo n.º 6
0
<?php

use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
use common\models\Faculty;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $idParent integer */
require Yii::$app->basePath . '/views/grid/index.php';
/* @var $faculty Faculty */
$faculty = Faculty::findOne($idParent);
$this->title = 'Управление пользователями';
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Управление пользователями</h2>
<?php 
if ($faculty) {
    ?>
<h3>
    Факультет: <?php 
    echo $faculty->name;
    ?>
</h3>
<?php 
}
?>

<p>
    <?php 
echo Html::a('Новый пользователь', ['create', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);
Exemplo n.º 7
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 
// Факультет
// Программа
?>