public function run($id) { $model = $this->findModel($id); if ($this->checkAccess) { call_user_func($this->checkAccess, $this->id, $model); } $model->scenario = $this->scenario; /* @var $modelClass ActiveRecordInterface */ $modelClass = $this->modelClass; $statusArray = $modelClass::statusLabels(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { if ($model->save(false)) { return $this->refresh(); } else { Yii::$app->session->setFlash('danger', Module::t('admin', 'BACKEND_FLASH_FAIL_ADMIN_UPDATE')); return $this->refresh(); } } elseif (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } } return $this->render('update', ['model' => $model, 'statusArray' => $statusArray]); }
/** * Update comment page. * * @param integer $id Comment ID * * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $model->setScenario('admin-update'); $statusArray = Comment::getStatusArray(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { if ($model->save(false)) { return $this->refresh(); } else { Yii::$app->session->setFlash('danger', Module::t('comments', 'BACKEND_FLASH_FAIL_ADMIN_UPDATE')); return $this->refresh(); } } elseif (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } } return $this->render('update', ['model' => $model, 'statusArray' => $statusArray]); }
<?php use yii\helpers\Html; use simplator\medialib\FilemanagerAsset; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Picture */ $fm = FilemanagerAsset::register($this); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Medialib'), 'url' => ['index']]; echo Html::a(Module::t('app', 'Pictures'), ['/medialib/picture'], ['class' => 'btn btn-primary']); ?> <div class="medialib-default-index"> <h1><?php echo $this->context->action->uniqueId; ?> </h1> <div><iframe width="100%" height="500px" src="<?php echo $fm->baseUrl; ?> /index.html"></iframe></div> </div>
<?php use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Config */ $this->title = Module::t('app', 'Create {modelClass}', ['modelClass' => 'Config']); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Configs'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="config-create"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'model')->dropDownList(['picture' => 'Picture', 'video' => 'Video'], ['prompt' => '']); ?> <?php echo $form->field($model, 'item')->textInput(['maxlength' => 25]); ?> <?php echo $form->field($model, 'variant')->textInput(['maxlength' => 25]); ?> <?php echo $form->field($model, 'value')->textInput(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('app', 'Create') : Module::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
*/ use yii\helpers\Html; use kartik\grid\GridView; use yii\widgets\Pjax; /** @var IdentityInterface|ActiveRecord $identity */ $identity = Yii::$app->getUser()->identityClass; $this->title = Module::t('Requests'); echo Breadcrumbs::widget(['links' => [$this->title]]); ?> <div class="request-log-default-index"> <h3><?php echo Html::encode($this->title); ?> </h3> <?php Pjax::begin(); echo GridView::widget(['filterModel' => $searchModel, 'dataProvider' => $dataProvider, 'columns' => [['attribute' => 'id', 'value' => function ($model, $index, $dataColumn) { /** @var RequestLog $model */ return $model->id; }, 'filter' => false], 'app_id', 'route', 'params', ['attribute' => 'user_id', 'value' => function ($model, $index, $dataColumn) { return $model->user ? $model->user->{Module::getInstance()->usernameAttribute} : Module::t('Guest'); }, 'filter' => ArrayHelper::map($identity::find()->all(), 'id', Module::getInstance()->usernameAttribute)], 'ip', ['attribute' => 'datetime', 'value' => function ($model, $index, $dataColumn) { return $model->datetime; }, 'filter' => false], ['attribute' => 'user_agent', 'value' => function ($model, $index, $dataColumn) { return $model->user_agent; }, 'filter' => false]]]); Pjax::end(); ?> </div>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('app', 'ID'), 'folder' => Module::t('app', 'Folder'), 'name' => Module::t('app', 'Name'), 'filetype' => Module::t('app', 'Filetype'), 'sizex' => Module::t('app', 'Sizex'), 'sizey' => Module::t('app', 'Sizey'), 'createtime' => Module::t('app', 'Createtime'), 'updatetime' => Module::t('app', 'Updatetime'), 'comment' => Module::t('app', 'Comment')]; }
public function adminMenu($route, $module) { return [['label' => isset($module['title']) ? $module['title'] : Module::t('articles', 'Articles'), 'url' => ['/' . $route], 'items' => [['label' => Module::t('articles', 'Summary'), 'url' => ['/' . $route . '/summary']], ['label' => Module::t('articles', 'Categories'), 'url' => ['/' . $route . '/category']], ['label' => Module::t('articles', 'Articles'), 'url' => ['/' . $route . '/article']]]]]; }
public function actionCreate2() { $model = new \vova07\comments\models\frontend\Comment(['scenario' => 'create']); Yii::$app->response->format = Response::FORMAT_JSON; if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { if ($model->save(false)) { return $this->tree($model); } else { Yii::$app->response->setStatusCode(500); return Module::t('comments', 'FRONTEND_FLASH_FAIL_CREATE'); } } elseif (Yii::$app->request->isAjax) { Yii::$app->response->setStatusCode(400); return ActiveForm::validate($model); } } }
<ul class="dropdown-menu dropdown-menu-default"> <li> <a href="<?php echo Url::toRoute('/admin/user/profile'); ?> "> <i class="icon-user"></i><?php echo Module::t('user.info'); ?> </a> </li> <li> <a href="<?php echo Url::toRoute('/admin/default/logout'); ?> "> <i class="icon-key"></i><?php echo Module::t('user.logout'); ?> </a> </li> </ul> </li> <!-- END USER LOGIN DROPDOWN --> </ul> </div> <!-- END TOP NAVIGATION MENU --> </div> <!-- END HEADER INNER --> </div> <!-- END HEADER -->
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('labels', 'ID'), 'accountId' => Module::t('labels', 'Account ID'), 'type' => Module::t('labels', 'Type'), 'token' => Module::t('labels', 'Token'), 'createdAt' => Module::t('labels', 'Created At'), 'status' => Module::t('labels', 'Status')]; }
/** * @param string $message error message. * @throws HttpException when called. */ public function fatalError($message = null) { throw new ServerErrorHttpException($message === null ? Module::t('errors', 'Something went wrong.') : $message); }
/* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('app', 'Pictures'); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'MediaLib'), 'url' => ['/medialib']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="picture-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('app', 'Create {modelClass}', ['modelClass' => 'Picture']), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php // Ajax uploads with drag and drop feature. Enable AJAX uploads by setting the `uploadUrl` property // in pluginOptions. You can also pass extra data to your upload URL via `uploadExtraData`. Refer // [plugin documentation and demos](http://plugins.krajee.com/file-input/demo) for more details // and options on using AJAX uploads. echo \kartik\file\FileInput::widget(['name' => 'Picture[file]', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['/medialib/picture/upload']), 'uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 100]]); ?> <div class="mlpicture"> <?php echo ListView::widget(['dataProvider' => $dataProvider, 'itemView' => '_preview']); ?> </div>
echo $form->field($model, 'sizex')->textInput(); ?> <?php echo $form->field($model, 'sizey')->textInput(); ?> <?php echo $form->field($model, 'createtime')->textInput(); ?> <?php echo $form->field($model, 'updatetime')->textInput(); ?> <?php echo $form->field($model, 'comment')->textInput(['maxlength' => 250]); ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('medialib', 'Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Picture */ $this->title = Module::t('app', 'Update {modelClass}: ', ['modelClass' => 'Picture']) . ' ' . $model->name; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Pictures'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Module::t('app', 'Update'); ?> <div class="picture-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
$this->params['breadcrumbs'][] = ['label' => Module::t('app', 'MediaLib'), 'url' => ['/medialib']]; $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Pictures'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="picture-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Html::img(File::picture($model->id, 'preview')), File::picture($model->id, 'full'), ['class' => 'box']); ?> </p> <p> <?php echo Html::a(Module::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'folder', 'name', 'type', 'sizex', 'sizey', 'createtime:datetime', 'updatetime:datetime', 'comment']]); ?> </div>
<?php echo $form->field($model, 'id'); ?> <?php echo $form->field($model, 'section'); ?> <?php echo $form->field($model, 'key'); ?> <?php echo $form->field($model, 'value'); ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('settings', 'Search'), ['class' => 'btn btn-primary']); ?> <?php echo Html::resetButton(Module::t('settings', 'Reset'), ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?> </div>