public function actionIndex() { $data = Route::find()->andWhere(['status' => 1, 'author_id' => Yii::$app->user->identity->id])->orderBy('id desc'); $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '9']); $model = $data->offset($pages->offset)->limit($pages->limit)->all(); foreach ($model as $item) { $item->status = ucfirst(strtolower(Lookup::item("RouteStatus", $item->status))); } return $this->render('index', ['model' => $model, 'pages' => $pages]); }
/** * Displays a single Route model. * @param integer $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); $model->start_time = date('M d, Y', $model->start_time); $model->end_time = date('M d, Y', $model->end_time); $model->status = ucfirst(strtolower(Lookup::item("RouteStatus", $model->status))); $join = Join::find($id)->joinWith('user')->where(['route_id' => $id])->all(); $join_count = count($join); $comment = new Comment(); return $this->render('view', ['model' => $model, 'join' => $join, 'comment' => $comment, 'join_count' => $join_count]); }
use app\models\Lookup; /* @var $this yii\web\View */ /* @var $model app\models\Post */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => '文章管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="post-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' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', 'content:ntext', 'tags:ntext', ['attribute' => 'status', 'value' => Lookup::item("PostStatus", $model->status)], ['attribute' => 'create_time', 'value' => date("Y-m-d H:i:s", $model->create_time)], ['attribute' => 'update_time', 'value' => date("Y-m-d H:i:s", $model->update_time)], ['attribute' => 'author_id', 'value' => $model->author->username]]]); ?> </div>
/* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '评论管理'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="comment-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php /* echo $this->render('_search', ['model' => $searchModel]); // <p> // <?= Html::a('新增', ['create'], ['class' => 'btn btn-success']) ?> // </p> */ ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'content', 'format' => 'ntext', 'contentOptions' => ['width' => "460px"]], ['attribute' => 'status', 'value' => function ($model) { return Lookup::item("CommentStatus", $model->status); }, 'contentOptions' => function ($model) { return $model->status == Comment::STATUS_PENDING ? ['class' => 'bg-danger'] : []; }], ['attribute' => 'create_time', 'format' => ['date', 'php:Y-m-d H:i:s']], 'author', 'post.title', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {delete} {approve}', 'buttons' => ['approve' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', '审核'), 'aria-label' => Yii::t('yii', '审核'), 'data-pjax' => '0']; return Html::a('<span class="glyphicon glyphicon-check"></span>', $url, $options); }]]]]); ?> </div>
use app\models\Lookup; /* @var $this yii\web\View */ /* @var $searchModel app\models\PostSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '文章管理'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="post-index"> <h1><?php 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 echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'title', 'content:ntext', 'tags:ntext', ['attribute' => 'status', 'value' => function ($model) { return Lookup::item("PostStatus", $model->status); }], 'author.username', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
$this->params['breadcrumbs'][] = $this->title; ?> <div class="row"> <table class="col-md-offset-half"> <tr> <td class="col-md-5"> <h1><?php echo Html::encode($this->title); ?> </h1> <h5><?php echo Lookup::item('WorkDomain', $model->work_domain); ?> | <?php echo Lookup::item('OrganizationType', $model->org_type); ?> </h5> <?php echo Html::a('Follow', [''], ['class' => 'btn btn-default']); ?> <br/><br/> </td> <td class="col-md-2"> <?php if ($model->logo) { echo '<img src=' . Yii::$app->urlManager->createUrl($model->logo) . ' height="116" width="116" alt="Logo">'; } ?> </td>
<h4><b><?php echo Html::a($model['title'], ['view', 'id' => $model['id']], ['title' => $model['title'], 'target' => '_blank']); ?> </b></h4> <p><?php echo $model['description']; ?> </p> <p><?php echo Lookup::item('JobType', $model['job_type']); ?> </p> <hr/> <p><?php echo Lookup::item('EmploymentType', $model['employment_type']); ?> | <?php echo $model['start_date']; ?> to <?php echo $model['end_date']; ?> <?php echo Html::a('Apply', [''], ['class' => 'btn btn-default pull-right']); ?> </p> </div> </div> </div>
public function beforeSave() { if ($this->isNewRecord) { $this->create_time = date('Y-m-d H:i:s'); $this->user_id = Yii::$app->user->id; } $this->org_type_text = Lookup::item("OrganizationType", $this->org_type); $this->work_domain_text = Lookup::item("WorkDomain", $this->work_domain); return true; }
*/ $this->title = Yii::t('app', 'Posts'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="post-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'Post']), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'category_id', 'title', ['attribute' => 'type', 'value' => function ($data) { return Lookup::item("{{post}}type", $data->type); }, 'filter' => Lookup::items("{{post}}type")], 'published_at:date', 'views', 'likes', 'comment_count', ['attribute' => 'status', 'value' => function ($data) { return Lookup::item("{{post}}status", $data->status); }, 'filter' => Lookup::items("{{post}}status")], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
use app\models\Lookup; /** * @var yii\web\View $this * @var app\models\Post $model */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Posts'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="post-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'category_id', 'title', ['label' => Yii::t('app', 'Type'), 'value' => Lookup::item("{{post}}type", $model->type)], 'thumbnail', 'url:url', 'summary', 'source', 'writer', 'content:ntext', 'tags', 'seo_title', 'seo_keywords', 'seo_description', 'published_at', 'views', 'likes', 'comment_count', 'disallow_comment', 'status', ['label' => Yii::t('app', 'Status'), 'value' => Lookup::item("{{post}}status", $model->status)], 'created_by', 'updated_by', 'created_at', 'updated_at']]); ?> </div>
<?php Yii::info(".................................."); Yii::info($model['name']); ?> <h4><b><?php echo Html::a($model['name'], ['view', 'id' => $model['id']], ['title' => $model['name'], 'target' => '_blank']); ?> </b></h4> <p><?php echo $model['description']; ?> </p> <hr/> <p><?php echo Lookup::item('WorkDomain', $model['work_domain']); ?> | <?php echo Lookup::item('OrganizationType', $model['org_type']); ?> <?php echo Yii::$app->user->id == $model['user_id'] ? Html::a('Edit', ['profile', 'id' => $model['id']], ['title' => 'Edit' . $model['name'], 'class' => 'btn btn-default pull-right']) : ''; ?> </p> </div> </div> </div>
use yii\helpers\Html; use yii\widgets\DetailView; use app\models\Lookup; /* @var $this yii\web\View */ /* @var $model app\models\Comment */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => '评论管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="comment-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', 'content:ntext', ['attribute' => 'status', 'value' => Lookup::item("CommentStatus", $model->status)], ['attribute' => 'create_time', 'value' => date("Y-m-d H:i:s", $model->create_time)], 'author', 'email:email', 'url:url', ['attribute' => 'post_id', 'value' => $model->post->title . "(ID:" . $model->post_id . ")"]]]); ?> </div>
<b><?php echo $model->start_date; ?> </b> to <b><?php echo $model->end_date; ?> </b> <br/><br/> <h4 style="font-weight: 600">Where ?</h4> <?php echo $model->location; ?> <br/><br/> <h4 style="font-weight: 600">Engagement ?</h4> <?php echo Lookup::item('EmploymentType', $model->employment_type); ?> </div> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <h4 style="font-weight: 600">Contact Person</h4> </div> </div> </div> </div>
use kartik\tabs\TabsX; /* @var $this yii\web\View */ /* @var $model app\models\Organization */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Organizations', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="organization-view col-md-9 col-md-offset-1-half"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'hAlign' => DetailView::ALIGN_LEFT, 'vAlign' => DetailView::ALIGN_TOP, 'panel' => ['heading' => 'Organization details', 'type' => DetailView::TYPE_INFO], 'buttons1' => '{update}', 'buttons2' => '{reset} {save}', 'attributes' => ['name', 'description', ['attribute' => 'org_type', 'value' => Lookup::item('OrganizationType', $model->org_type), 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Lookup::items('OrganizationType')], ['attribute' => 'work_domain', 'value' => Lookup::item('WorkDomain', $model->work_domain), 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Lookup::items('WorkDomain')], 'website', ['attribute' => 'found_date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]]]]); ?> <br/> <?php echo DetailView::widget(['model' => $workModel, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'hAlign' => DetailView::ALIGN_LEFT, 'vAlign' => DetailView::ALIGN_TOP, 'panel' => ['heading' => 'Work details', 'type' => DetailView::TYPE_INFO], 'buttons1' => '{update}', 'buttons2' => '{reset} {save}', 'attributes' => ['vision', 'mission', 'who', 'what', 'why', 'how', 'short_term_goals', 'long_term_goals']]); ?> <br/> <h2>Locations</h2> <?php echo DetailView::widget(['model' => $addressModel, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'hAlign' => DetailView::ALIGN_LEFT, 'vAlign' => DetailView::ALIGN_TOP, 'hideIfEmpty' => true, 'panel' => ['heading' => 'Add new location', 'type' => DetailView::TYPE_INFO], 'buttons1' => '{update}', 'updateOptions' => ['label' => '<span class="glyphicon glyphicon-plus"></span>'], 'buttons2' => '{reset} {save}', 'attributes' => ['address1', 'address2', 'landmark', 'city', 'state', 'country', 'pincode']]); ?> <?php $i = 1; foreach ($addressDataProvider->models as $address) {