<div class="col-xs-12 col-sm-12 col-md-3 col-md-push-6 col-lg-3 col-lg-push-6"> </div> <div class="col-xs-12 col-sm-12 col-md-6 col-md-pull-3 col-lg-6 col-lg-pull-3"> <h4>Exams</h3> <ul class="list-group"> <li class="list-group-item"> <?php foreach ($exams as $exam) { ?> <?php $section = SubjectSection::findOne(['SubjectSectionId' => $exam->SubjectSectionId]); if (Yii::$app->user->identity->ClassSection == $section->SectionName) { if ($exam->IsActive) { echo '<a href="index.php?r=site%2Fexam&id=' . $exam->ExamId . '"><h4>' . $exam->Description . '</h4></a> created by ' . $exam->CreatedBy; } else { echo '<a>' . $exam->Description . '</a>'; } } ?> <br /> <?php } ?> </li> </ul> </div>
/** * Finds the Posts model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Posts the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SubjectSection::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }