예제 #1
0
 /**
  * Finds the Page model based on alias value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $alias
  * @return Page the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($alias)
 {
     $model = Page::find()->where(['alias' => $alias, 'published' => Page::PUBLISHED_YES])->one();
     if ($model !== null) {
         return $model;
     }
     throw new NotFoundHttpException(Module::t('PAGE_NOT_FOUND'));
 }
예제 #2
0
 /**
  * Finds the Page model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Page the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Page::findOne($id)) !== null) {
         return $model;
     }
     throw new NotFoundHttpException(Module::t('PAGE_NOT_FOUND'));
 }
예제 #3
0
파일: _form.php 프로젝트: dyar74/yii2-admin
$settings = ['lang' => $lang, 'minHeight' => 200, 'plugins' => ['fullscreen']];
if ($module->addImage || $module->uploadImage) {
    $settings['plugins'][] = 'imagemanager';
}
if ($module->addImage) {
    $settings['imageManagerJson'] = Url::to(['images-get']);
}
if ($module->uploadImage) {
    $settings['imageUpload'] = Url::to(['image-upload']);
}
if ($module->addFile || $module->uploadFile) {
    $settings['plugins'][] = 'filemanager';
}
if ($module->addFile) {
    $settings['fileManagerJson'] = Url::to(['files-get']);
}
if ($module->uploadFile) {
    $settings['fileUpload'] = Url::to(['file-upload']);
}
echo $form->field($model, 'content')->widget(Imperavi::className(), ['settings' => $settings]);
echo $form->field($model, 'title_browser')->textInput(['maxlength' => 255]);
echo $form->field($model, 'meta_keywords')->textInput(['maxlength' => 200]);
echo $form->field($model, 'meta_description')->textInput(['maxlength' => 160]);
?>
<div class="form-group">
    <?php 
echo Html::submitButton($model->isNewRecord ? Module::t('CREATE') : Module::t('UPDATE'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php 
ActiveForm::end();
예제 #4
0
파일: create.php 프로젝트: bupy7/yii2-pages
<?php

use yii\helpers\Html;
use bupy7\pages\Module;
/* @var $this yii\web\View */
/* @var $model bupy7\pages\models\Page */
$this->title = Module::t('CREATE');
$this->params['breadcrumbs'][] = ['label' => Module::t('MODULE_NAME'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="page-header">
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
</div>
<?php 
echo $this->render('_form', ['model' => $model, 'module' => $module]);
예제 #5
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('ID'), 'title' => Module::t('TITLE'), 'alias' => Module::t('ALIAS'), 'published' => Module::t('PUBLISHED'), 'content' => Module::t('CONTENT'), 'title_browser' => Module::t('TITLE_BROWSER'), 'meta_keywords' => Module::t('META_KEYWORDS'), 'meta_description' => Module::t('META_DESCRIPTION'), 'created_at' => Module::t('CREATED_AT'), 'updated_at' => Module::t('UPDATED_AT')];
 }
예제 #6
0
파일: index.php 프로젝트: bupy7/yii2-pages
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use bupy7\pages\Module;
use bupy7\pages\models\Page;
/* @var $this yii\web\View */
/* @var $searchModel bupy7\pages\models\PageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('MODULE_NAME');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="page-header">
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
</div>
<p>
    <?php 
echo Html::a(Module::t('CREATE'), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php 
echo GridView::widget(['tableOptions' => ['class' => 'table table-striped'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'title', 'alias', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'published', 'filter' => Page::publishedDropDownList(), 'value' => function ($model) {
    return Yii::$app->formatter->asBoolean($model->published);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => "{update}\n{delete}"]]]);