コード例 #1
0
ファイル: view.php プロジェクト: hanxiao84322/coach_system
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Train */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '培训课程管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="train-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' => 'category', 'label' => '级别', 'value' => app\models\TrainCategory::getNameById($model->category)], ['attribute' => 'train_land_id', 'label' => '培训地', 'value' => app\models\TrainLand::getNameById($model->train_land_id)], ['attribute' => 'level_id', 'label' => '级别', 'value' => app\models\Level::getOneLevelNameById($model->level_id)], 'code', 'recruit_count', 'sign_up_begin_time', 'sign_up_end_time', 'begin_time', 'end_time', ['attribute' => 'status', 'label' => '状态', 'value' => app\models\Train::getStatusName($model->status)], 'district', 'period_num', 'create_time', 'create_user', 'update_time', 'update_user']]);
?>

</div>
コード例 #2
0
ファイル: index.php プロジェクト: hanxiao84322/coach_system
    <?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/train/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' => 'category', 'value' => function ($searchModel) {
    return app\models\TrainCategory::getNameById($searchModel->category);
}], 'period_num', ['attribute' => 'level_id', 'value' => function ($searchModel) {
    return app\models\Level::getOneLevelNameById($searchModel->level_id);
}], ['attribute' => 'status', 'value' => function ($searchModel) {
    return app\models\Train::getStatusName($searchModel->status);
}], ['label' => '管理', 'format' => 'html', 'value' => function ($searchModel) {
    $url = Html::a('讲师管理', ['Admin/train-teachers', 'TrainTeachersSearch[train_id]' => $searchModel->id]);
    $url .= '&nbsp;' . Html::a('添加讲师', ['Admin/train-teachers/create', 'train_id' => $searchModel->id]);
    $url .= '&nbsp;' . Html::a('学员', ['Admin/train-users/', 'TrainUsersSearch[train_id]' => $searchModel->id]);
    $url .= '&nbsp;' . Html::a('考勤', ['Admin/train-users/attendance', 'train_id' => $searchModel->id]) . '<br>';
    return $url;
}], 'create_time', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    <input name="update_status" type="submit" value="删除">
    <?php 
ActiveForm::end();