$this->title = 'Портфолио'; if (Yii::$app->user->identity->role != User::ROLE_STUDENT) { $this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $student->idProgram->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; ?> Программа: <?php echo $student->idProgram->fullName; ?> </h3> <?php echo TreeView::widget(['options' => ['id' => 'idPortfolio'], 'query' => StudentPortfolio::find()->where(['id_student' => $id])->addOrderBy('root, lft'), 'showIDAttribute' => false, 'nodeFormOptions' => ['name' => 'nodeForm', 'enctype' => 'multipart/form-data'], 'displayValue' => $beginNodeId, 'isAdmin' => false, 'softDelete' => false, 'multiple' => false, 'rootOptions' => ['label' => ''], 'iconEditSettings' => ['show' => 'none'], 'mainTemplate' => '<div class="row"> <div class="col-sm-5"> {wrapper} </div> <div class="col-sm-7"> {detail} </div> </div>', 'wrapperTemplate' => '{tree}{footer}', 'nodeAddlViews' => [Module::VIEW_PART_2 => '@backend/modules/student/views/portfolio/_file'], 'cacheSettings' => ['enableCache' => true], 'showTooltips' => false]);
public function actionIndex($id) { // $id - in Student $beginNodeId = StudentPortfolio::find()->where(['id_student' => $id])->min('id'); $beginNodeId = $beginNodeId == null ? 0 : $beginNodeId; Yii::$app->session['id_student'] = $id; return $this->render('index', ['id' => $id, 'beginNodeId' => $beginNodeId]); }
/** * @return \yii\db\ActiveQuery */ public function getStudentPortfolios() { return $this->hasMany(StudentPortfolio::className(), ['id_file' => 'id']); }
?> <h2>Портфолио</h2> <h3> Студент: <?php echo $student->studentName; ?> Курс: <?php echo $student->course; ?> Программа: <?php echo $student->idProgram->fullName; ?> </h3> <?php FontAwesomeAsset::register($this); echo TreeView::widget(['options' => ['id' => 'idPortfolio'], 'query' => StudentPortfolio::find()->where(['id_student' => $id])->addOrderBy('root, lft'), 'displayValue' => 0, 'fontAwesome' => true, 'nodeView' => '@frontend/modules/student/views/portfolio/_view', 'mainTemplate' => '<div class="row"> <div class="col-sm-6"> {wrapper} </div> <div class="col-sm-6"> {detail} </div> </div>', 'wrapperTemplate' => '{tree}', 'rootOptions' => ['label' => ''], 'showFormButtons' => false, 'multiple' => false, 'iconEditSettings' => ['show' => 'none'], 'emptyNodeMsg' => ' ', 'showTooltips' => false]); $script = <<<JS \$('#idPortfolio').treeview("collapseAll"); JS; $this->registerJs($script);