示例#1
0
文件: view.php 项目: ClarkLusm/htdocs
                    <?php 
echo Html::a('Cập nhật', ['update', 'id' => $model->id, 'skill_id' => $model->skill_id], ['class' => 'btn btn-primary']);
?>
                    <?php 
echo Html::a('Xóa', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Bạn có chắc muốn xóa Quiz này?', 'method' => 'post']]);
?>
                </p>
            </div>
        </header>
        <div class="body">
            <?php 
$skillName = Skill::findOne($model->skill_id)->title;
if ($created_by = AdminUser::findOne($model->created_by)) {
    $created_by = $created_by->fullname != '' ? $created_by->fullname : $created_by->username;
}
if ($updated_by = AdminUser::findOne($model->updated_by)) {
    $updated_by = $updated_by->fullname != '' ? $updated_by->fullname : $updated_by->username;
}
switch ($model->difficulty) {
    case '0':
        $difficulty = '<span class="btn-success label">Dễ</span>';
        break;
    case '1':
        $difficulty = '<span class="btn-warning label">Trung bình</span>';
        break;
    default:
        $difficulty = '<span class="btn-danger label">Khó</span>';
        break;
}
?>
            <?php 
示例#2
0
 /**
  * Finds the AdminUser model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AdminUser the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AdminUser::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }