Exemple #1
0
 public function hasMeritTemplate()
 {
     $uniqueId = Yii::$app->controller->action->uniqueId;
     // 必须是 GET 或者 POST 请求
     if (!in_array(Yii::$app->request->method, MeritTemplate::getMethods())) {
         return false;
     }
     $method = array_flip(MeritTemplate::getMethods())[Yii::$app->request->method];
     // 支持同一个 $uniqueId 不同 Type
     $meritTemplates = MeritTemplate::find()->where(['unique_id' => $uniqueId, 'status' => MeritTemplate::STATUS_ACTIVE, 'method' => $method])->all();
     if (!$meritTemplates) {
         return false;
     }
     return $meritTemplates;
 }
Exemple #2
0
?>

    <?php 
echo $form->field($model, 'type')->dropDownList(MeritTemplate::getTypes());
?>

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

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

    <?php 
echo $form->field($model, 'method')->dropDownList(MeritTemplate::getMethods());
?>

    <?php 
// echo  $form->field($model, 'event')->textInput()
?>

    <?php 
echo $form->field($model, 'action_type')->dropDownList(MeritTemplate::getActionTypes());
?>

    <?php 
echo $form->field($model, 'increment')->textInput();
?>

    <?php 
Exemple #3
0
use yii\helpers\Html;
use yii\widgets\DetailView;
use yiier\merit\models\MeritTemplate;
/* @var $this yii\web\View */
/* @var $model yiier\merit\models\MeritTemplate */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Merit Templates'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="merit-template-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', 'title', ['attribute' => 'type', 'value' => MeritTemplate::getTypes()[$model->type]], 'unique_id', ['attribute' => 'method', 'value' => MeritTemplate::getMethods()[$model->method]], ['attribute' => 'action_type', 'value' => MeritTemplate::getActionTypes()[$model->action_type]], 'increment', ['attribute' => 'rule_key', 'value' => MeritTemplate::getRuleKeys()[$model->rule_key]], 'rule_value', ['attribute' => 'status', 'value' => MeritTemplate::getStatuses()[$model->status]], 'created_at:datetime', 'updated_at:datetime']]);
?>

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

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

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['title', ['attribute' => 'type', 'value' => function ($data) {
    return MeritTemplate::getTypes()[$data->type];
}], 'unique_id', ['attribute' => 'method', 'value' => function ($data) {
    return MeritTemplate::getMethods()[$data->method];
}], ['attribute' => 'action_type', 'value' => function ($data) {
    return MeritTemplate::getActionTypes()[$data->action_type];
}], 'increment', ['attribute' => 'rule_key', 'value' => function ($data) {
    return MeritTemplate::getRuleKeys()[$data->rule_key];
}], 'rule_value', ['attribute' => 'status', 'value' => function ($data) {
    return MeritTemplate::getStatuses()[$data->status];
}], 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>