/**
  * Finds the Callback model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Callback the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Callback::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #2
0
use yii\helpers\Html;
use yii\helpers\Url;
use common\themes\admin\widgets\ActiveForm;
use common\modules\callback\models\backend\Callback;
/* @var $this yii\web\View */
/* @var $model common\modules\callback\models\Callback */
/* @var $form yii\widgets\ActiveForm */
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'boxTitle' => $options['title'], 'buttonUndo' => $options['buttonUndo']]]);
?>

<?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
echo $form->field($model, 'adress')->textInput(['maxlength' => 255]);
echo $form->field($model, 'email')->textInput(['maxlength' => 255]);
echo $form->field($model, 'phone')->textInput(['maxlength' => 255]);
echo $form->field($model, 'content')->textarea(['rows' => 6]);
echo $form->field($model, 'status')->dropDownList(Callback::getStatusArray());
echo $form->field($model, 'data')->textInput(['maxlength' => 255]);
echo $form->field($model, 'url')->textInput(['maxlength' => 255]);
echo $form->field($model, 'createdby')->textInput();
echo $form->field($model, 'createdon')->textInput();
echo $form->field($model, 'editedby')->textInput();
echo $form->field($model, 'editedon')->textInput();
?>

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

Beispiel #3
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use common\themes\admin\widgets\GridView;
use yii\grid\CheckboxColumn;
use common\modules\callback\models\backend\Callback;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\callback\models\CallbackSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Callbacks';
$this->params['breadcrumbs'][] = $this->title;
?>
    <?php 
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create']), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete']), 'ajax' => $ajax], 'id' => 'main-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'name', 'phone', 'content', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Callback::STATUS_FINISHED) {
        $class = 'label-success';
        $lable = Callback::getStatusArray()[Callback::STATUS_FINISHED];
    } elseif ($model->status === Callback::STATUS_NEW) {
        $class = 'label-danger';
        $lable = Callback::getStatusArray()[Callback::STATUS_NEW];
    } elseif ($model->status === Callback::STATUS_DELETED) {
        $class = 'label-warning';
        $lable = Callback::getStatusArray()[Callback::STATUS_DELETED];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Callback::getStatusArray(), ['class' => 'form-control', 'prompt' => 'Выберите статус'])], 'createdon', ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);