Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Status::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status_value' => $this->status_value]);
     $query->andFilterWhere(['like', 'status_name', $this->status_name]);
     return $dataProvider;
 }
Exemple #2
0
    ?>
</td>
                <td><?php 
    echo $item['label'];
    ?>
</td>
                <td><?php 
    echo $item['sort_order'];
    ?>
</td>
                <td><?php 
    echo \common\models\YesNo::labels()[$item['is_nav']];
    ?>
</td>
                <td><?php 
    echo \common\models\Status::labels()[$item['status']];
    ?>
</td>
                <td>
                    <!--a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['category/create', 'parent_id' => $item['id']]);
    ?>
" title="<?php 
    echo Yii::t('app', 'Add Sub Catalog');
    ?>
" data-pjax="0"><span class="glyphicon glyphicon-plus-sign"></span></a-->
                    <a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['category/view', 'id' => $item['id']]);
    ?>
"" title="<?php 
    echo Yii::t('app', 'View');
Exemple #3
0
    </p>

    <?php 
Pjax::begin();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', 'star', 'content:ntext', ['attribute' => 'type', 'value' => function ($model) {
    return \common\models\Labels::getLabel($model->type, "type");
}, 'filter' => Html::activeDropDownList($searchModel, 'type', Yii::$app->params['type'], ['class' => 'form-control', 'prompt' => Yii::t('app', 'Please Filter')])], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_DELETED) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . Status::labels($model->status) . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], ['attribute' => 'created_by', 'value' => function ($model) {
    return isset($model->user) && $model->user ? $model->user->username : '******';
}], 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]);
Pjax::end();
?>

</div>
<?php 
$url = Yii::$app->urlManager->createUrl(['pinglun/delete-multiple']);
$js = <<<JS
\$(document).ready(function(){
    \$('#MyButton').click(function(){
        var HotId = \$('#w1').yiiGridView('getSelectedRows');
        alert(HotId);
        //return false;
        \$.ajax({
Exemple #4
0
<div class="comment-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create ') . Yii::t('app', 'Comment'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'username', ['attribute' => 'product_id', 'value' => function ($model) {
    return $model->product ? $model->product->name : '-';
}], ['attribute' => 'order_id', 'value' => function ($model) {
    return $model->order ? $model->order->sn : '-';
}], 'star', 'point', 'up', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_INACTIVE) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . Status::labels($model->status) . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Exemple #5
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Brand */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Brands'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="brand-view">

    <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', 'name', 'logo', 'description:ntext', 'url:url', 'sort_order', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:datetime', 'updated_at:datetime']]);
?>

</div>
Exemple #6
0
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'content')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'author')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(Status::labels());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? '新 增' : '修 改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemple #7
0
?>

    <?php 
echo $form->field($model, 'keyword')->textarea(['maxlength' => true]);
?>

     <?php 
echo $form->field($model, 'content')->widget('kucha\\ueditor\\UEditor', []);
?>

    <?php 
echo $form->field($model, 'author')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(\common\models\Status::labels());
?>


    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemple #8
0
<style>
td img{width:100px;}
</style>
<div class="product-view">

    <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', ['attribute' => 'category_id', 'value' => $model->category ? $model->category->name : '-'], 'name', 'sku', 'stock', 'weight', 'market_price', 'price', 'brief', 'content:ntext', ['attribute' => 'thumb', 'format' => 'image', 'value' => isset($data) ? "data:" . $fileType . ";base64," . $data . "" : ($model->thumb ? $model->thumb : ''), 'options' => ['style' => 'width:100px'], 'visible' => isset($model->thumb)], 'image', 'keywords', 'description:ntext', ['attribute' => 'type', 'value' => \common\models\ProductType::labels($model->type)], ['attribute' => 'brand_id', 'value' => $model->brand ? $model->brand->name : '-'], ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]);
?>

</div>

<?php 
foreach ($model->productImagesSort as $item) {
    if (strpos($model->thumb, 'http://') === null) {
        $file = Yii::getAlias('@frontend/web' . $item->thumb);
        $fileType = \yii\helpers\FileHelper::getMimeType($file);
        $data = base64_encode(file_get_contents($file));
        echo "<img src='data:" . $fileType . ";base64," . $data . "' width=100>";
    } else {
        echo "<img src='{$item->thumb}' width=100>";
    }
}
Exemple #9
0
?>
<div class="comment-index">

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

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'post_id', 'value' => function ($model) {
    return $model->post->title;
}], 'content:ntext', 'author', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_INACTIVE) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . $model->getStatus()->label . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => ''])], 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {approve} {delete}', '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>
Exemple #10
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\News */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '资讯管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-view">

    <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', ['attribute' => 'category_id', 'value' => $model->category ? $model->category->name : '-'], 'title', 'thumb', 'keyword', 'description:ntext', 'intro:ntext', 'content:ntext', 'author', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:datetime', 'updated_at:datetime']]);
?>

</div>
 /**
  * Finds the Status model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Status the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Status::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #12
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Resource */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '学习资料管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="resource-view">

    <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', ['attribute' => 'type', 'value' => \common\models\Labels::getLabel($model->type, "resource")], ['attribute' => 'class', 'value' => \common\models\Labels::getLabel($model->class, "class")], ['attribute' => 'course', 'value' => \common\models\Labels::getLabel($model->course, "course")], 'title', 'thumb', 'keyword', 'content:ntext', 'author', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'views', 'downtime:datetime', 'star', 'pinglunnum', 'created_at:datetime', 'updated_at:datetime']]);
?>

</div>
Exemple #13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatus()
 {
     return $this->hasOne(Status::className(), ['id' => 'status_id']);
 }
Exemple #14
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Consultation */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Consultations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="consultation-view">

    <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', 'username', ['attribute' => 'product_id', 'value' => $model->product ? $model->product->name : '-'], 'question:ntext', 'answer:ntext', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:date', 'updated_at:date', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]);
?>

</div>
Exemple #15
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Comment */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Comments'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="comment-view">

    <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', 'username', ['attribute' => 'product_id', 'value' => $model->product ? $model->product->name : '-'], ['attribute' => 'order_id', 'value' => $model->order ? $model->order->sn : '-'], 'star', 'content:ntext', 'point', 'up', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]);
?>

</div>
Exemple #16
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Categories'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-view">

    <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', '确定要删除吗?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'parent_id', 'value' => $model->parent_id ? $model->parent->name : "根目录"], 'name', 'brief', ['attribute' => 'is_nav', 'value' => \common\models\YesNo::labels($model->is_nav)], 'banner', 'keywords', 'description:ntext', 'redirect_url:url', 'sort_order', ['attribute' => 'status', 'value' => \common\models\Status::labels($model->status)], 'created_at:datetime', 'updated_at:datetime', 'created_by', 'updated_by']]);
?>

</div>
Exemple #17
0
/* @var $searchModel common\models\FaqSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Faqs';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="faq-index">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => '', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'question:html', 'answer:html', 'faq_order', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_INACTIVE) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . $model->getStatus()->label . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => 'Please Select'])], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {delete} {inactive}', 'buttons' => ['inactive' => function ($url, $model) {
    if ($model->status != Status::STATUS_INACTIVE) {
        return Html::a('<span class="glyphicon glyphicon-ok"></span>', ['inactive', 'id' => $model->id], ['title' => 'Inactive', 'data' => ['confirm' => 'Are you sure you want to inactive this user?', 'method' => 'post']]);
    } else {
        if ($model->status == Status::STATUS_INACTIVE) {
            return Html::a('<span class="glyphicon glyphicon-remove"></span>', ['active', 'id' => $model->id], ['title' => 'Active', 'data' => ['confirm' => 'Are you sure you want to actived this user?', 'method' => 'post']]);
        } else {
            return '<span class="glyphicon glyphicon-eye-close "></span>';
        }
    }
}]]]]);
?>

</div>
Exemple #18
0
use common\models\Category;
use common\models\Image;
use common\models\Status;
use kartik\widgets\FileInput;
use kartik\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use vova07\imperavi\Widget as Imperavi;
use kartik\widgets\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
/* @var $form yii\widgets\ActiveForm */
$category_models = Category::find()->all();
$categories = ArrayHelper::map($category_models, 'id', 'name');
$status_models = Status::find()->all();
$statuses = ArrayHelper::map($status_models, 'id', 'name');
$image_models = Image::findAll(['model_id' => $model->id]);
$images = [];
foreach ($image_models as $image) {
    $images[] = Html::img(Yii::$app->urlManagerFrontEnd->baseUrl . '/uploads/product/' . $model->id . '/' . $image->id . '.jpg', ['class' => 'file-preview-image']);
}
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php