示例#1
0
echo Html::encode($this->title);
?>
</h1>
    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('新建讲师', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
$form = ActiveForm::begin(['action' => \yii\helpers\Url::to('/Admin/teachers/del')]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'header' => Html::checkBox('selection_all', false, ['class' => 'select-on-check-all'])], 'name', ['attribute' => 'sex', 'value' => function ($searchModel) {
    return app\models\Teachers::getSexName($searchModel->sex);
}], 'age', ['attribute' => 'level', 'value' => function ($searchModel) {
    return app\models\TeachersLevel::getNameById($searchModel->level);
}], ['attribute' => 'status', 'value' => function ($searchModel) {
    return app\models\Teachers::getStatusName($searchModel->status);
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    <input name="update_status" type="submit" value="删除">
    <?php 
ActiveForm::end();
?>
</div>
示例#2
0
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Teachers */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '讲师管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="teachers-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('更新讲师', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('删除讲师', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => '确认删除吗?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', ['attribute' => 'sex', 'label' => '性别', 'value' => app\models\Teachers::getSexName($model->sex)], 'age', ['attribute' => 'level', 'label' => '级别', 'value' => app\models\TeachersLevel::getNameById($model->level)], ['attribute' => 'status', 'value' => app\models\Users::getStatusName($model->status)], 'phone', 'email', 'lesson', ['attribute' => 'photo', 'format' => 'html', 'value' => $model->photo ? '<img src="/upload/images/teachers/photo/' . $model->photo . '">' : '无'], 'score', 'register_district', 'certificate_number', 'create_time', 'create_user', 'update_time', 'update_user']]);
?>

</div>