Ejemplo n.º 1
0
                            <?php 
    }
    ?>
                    <?php 
}
?>
                    </div>
                </div>
                <div class="jarviswidget">
                    <header></header>
                    <div class="widget-body">
                        <?php 
$form = ActiveForm::begin(['action' => ['update-status', 'id' => $review->id]], ['id' => 'review-form']);
?>
                        <?php 
echo $form->field($review, 'status')->dropDownList(Review::getStatuses());
?>
                        <div class="form-group no-margin">
                            <?php 
if ($review->submission->spam == 1) {
    ?>
                                <?php 
    echo Html::a(Icon::show('check-square-o') . Yii::t('app', 'Not spam'), ['mark-spam', 'id' => $review->submission_id, 'spam' => 0], ['class' => 'btn btn-success']);
    ?>
                            <?php 
} else {
    ?>
                                <?php 
    echo Html::a(Icon::show('minus-square') . Yii::t('app', 'Mark spam'), ['mark-spam', 'id' => $review->submission_id], ['class' => 'btn btn-danger']);
    ?>
                            <?php 
Ejemplo n.º 2
0
<div class="reviews-index">
    <?php 
echo DynaGrid::widget(['options' => ['id' => 'reviews-grid'], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => Html::tag('h3', $this->title, ['class' => 'panel-title']), 'after' => $this->blocks['add-button']]], 'columns' => [['class' => \kartik\grid\CheckboxColumn::className(), 'options' => ['width' => '10px']], 'id', 'author_email', ['attribute' => 'submission.form.name', 'label' => Yii::t('app', 'Form name')], ['attribute' => 'object_id', 'filter' => \app\components\Helper::getModelMap(\app\models\Object::className(), 'id', 'name'), 'label' => Yii::t('app', 'Object'), 'value' => function ($data) {
    $obj = \app\models\Object::findById($data->object_id);
    return is_null($obj) ? Yii::t('yii', '(not set)') : $obj->name;
}], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'object_model_id', 'value' => function ($data) {
    /** @var $object \app\models\Object*/
    if (null !== ($object = \app\models\Object::findById($data->object_id))) {
        $class = $object->object_class;
        $resource = $class::findById($data->object_model_id);
        if (null !== $resource) {
            return $resource->name;
        }
        return null;
    }
}], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'processed_by_user_id', 'value' => function ($data) {
    if (isset($data->submission)) {
        if (null !== $data->submission->processed_by_user_id) {
            /** @var $user \app\modules\user\models\User */
            $user = \app\modules\user\models\User::findIdentity($data->submission->processed_by_user_id);
            return $user->getDisplayName();
        } else {
            return Yii::t('app', 'Guest');
        }
    }
    return null;
}], 'submission.date_received', ['attribute' => 'status', 'class' => \kartik\grid\EditableColumn::className(), 'editableOptions' => ['inputType' => \kartik\editable\Editable::INPUT_DROPDOWN_LIST, 'placement' => \kartik\popover\PopoverX::ALIGN_LEFT, 'data' => Review::getStatuses(), 'formOptions' => ['action' => ['update-status']]], 'filter' => Review::getStatuses(), 'format' => 'raw'], ['class' => 'app\\backend\\components\\ActionColumn', 'buttons' => function ($model, $key, $index, $parent) {
    return [['url' => 'view', 'icon' => 'eye', 'class' => 'btn-info', 'label' => Yii::t('app', 'View')], ['url' => 'delete', 'icon' => 'trash-o', 'class' => 'btn-danger', 'label' => 'Delete', 'options' => ['data-action' => 'delete']]];
}]]]);
?>
</div>