/**
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionMain()
 {
     /* @var $module \pavlinter\admpages\Module */
     $module = Module::getInstance();
     /* @var $model \pavlinter\admpages\models\Page */
     $model = $module->manager->createPageQuery('get', null, ['where' => ['type' => 'main'], 'orderBy' => ['weight' => SORT_ASC]]);
     if (!$model) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     if (isset($module->pageRedirect[$model->layout])) {
         $params = $module->pageRedirect[$model->layout];
         if ($params instanceof \Closure) {
             $params = call_user_func($params, $model, $module);
         } else {
             $params['modelPage'] = $model;
         }
         $route = ArrayHelper::remove($params, 0);
         $parts = Yii::$app->createController($route);
         if (is_array($parts)) {
             /* @var $controller Controller */
             list($controller, $actionID) = $parts;
             $result = $controller->runAction($actionID, $params);
         } else {
             $id = Yii::$app->getUniqueId();
             throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
         }
         if ($result instanceof \yii\web\Response) {
             return $result;
         } else {
             $response = Yii::$app->getResponse();
             if ($result !== null) {
                 $response->data = $result;
             }
             return $response;
         }
     }
     return $this->render('@vendor/pavlinter/yii2-adm-pages/admpages/views/default/' . $model->layout, ['model' => $model]);
 }
Exemplo n.º 2
0
<?php

use pavlinter\admpages\Module;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Page */
/* @var $id_parent integer */
Yii::$app->i18n->disableDot();
$this->title = Module::t('', 'Update Page: ') . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Module::t('', 'Pages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = Module::t('', 'Update');
Yii::$app->i18n->resetDot();
?>
<div class="page-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model, 'id_parent' => $id_parent]);
?>

</div>
Exemplo n.º 3
0
<?php

use app\assets_b\AppAsset;
use pavlinter\admpages\Module;
/* @var $this yii\web\View */
/* @var $model \pavlinter\admpages\models\Page */
Module::getInstance()->layout = Module::getInstance()->pageLayout;
$this->title = $model->title;
$appAsset = AppAsset::register($this);
Yii::$app->params['html.canonical'] = Yii::$app->homeUrl;
?>
<div class="main-page">
    <h1><?php 
echo $model->title;
?>
</h1>
    <div><?php 
echo $model->text();
?>
</div>
</div>
Exemplo n.º 4
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 string $id
  * @return \pavlinter\admpages\models\Page the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = Module::getInstance()->manager->createPageQuery('find')->with(['translations'])->where(['id' => $id])->one();
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 5
0
    $url = ['delete', 'id' => $model->id];
    if ($model->id_parent) {
        $url['id_parent'] = $model->id_parent;
    } else {
        $url['id_parent'] = 0;
    }
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Module::t('title', 'Delete', ['dot' => false]), 'data-confirm' => Module::t('', 'Are you sure you want to delete this item?', ['dot' => false]), 'data-method' => 'post', 'data-pjax' => '0']);
}, 'view' => function ($url, $model) {
    if ($model->alias) {
        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $model->url(), ['title' => Module::t('title', 'View', ['dot' => false]), 'data-pjax' => '0', 'target' => '_blank']);
    }
}, 'copy' => function ($url, $model) {
    $url = ['create', 'id' => $model->id];
    if ($model->id_parent) {
        $url['id_parent'] = $model->id_parent;
    } else {
        $url['id_parent'] = 0;
    }
    return Html::a('<span class="fa fa-copy"></span>', $url, ['title' => Module::t('title', 'Copy', ['dot' => false]), 'data-pjax' => '0']);
}, 'subpages' => function ($url, $model) {
    return Html::a('<span class="fa fa-plus-circle"></span>', ['', 'id_parent' => $model->id], ['title' => Module::t('title', 'Sub pages', ['dot' => false]), 'data-pjax' => '0']);
}, 'files' => function ($url, $model) {
    if (!isset(Module::getInstance()->files[$model->type])) {
        return null;
    }
    return Html::a('<span class="fa fa-cloud-download"></span>', ['files', 'id' => $model->id], ['title' => Module::t('title', 'Files', ['dot' => false]), 'data-pjax' => '0']);
}]]]]);
?>

</div>
Exemplo n.º 6
0
<?php

use pavlinter\admpages\Module;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Page */
/* @var $id_parent integer */
Yii::$app->i18n->disableDot();
$this->title = Module::t('', 'Create Page');
$this->params['breadcrumbs'][] = ['label' => Module::t('', 'Pages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="page-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model, 'id_parent' => $id_parent]);
?>

</div>
Exemplo n.º 7
0
Assets::addLangFile(Yii::$app->language, $this);
$this->registerJs('
    var btn = $.fn.button.noConflict();
    $.fn.btn = btn;
    $("#elfinder").elfinder({
        url  : "' . Url::to(ArrayHelper::merge(['/adm/elfinder/connect', 'startPath' => $startPath], $elfinderData)) . '",
        lang : "' . Yii::$app->language . '",
        customData: {"' . Yii::$app->request->csrfParam . '":"' . Yii::$app->request->csrfToken . '"},
        rememberLastDir : false,
    });
');
?>
<div class="product-files">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Module::t('', 'Update'), ['update', 'id' => $model->id, 'id_parent' => $id_parent], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Module::t('', 'Delete'), ['delete', 'id' => $model->id, 'id_parent' => $id_parent], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('', 'Are you sure you want to delete this item?', ['dot' => false]), 'method' => 'post']]);
?>
    </p>

    <div id="elfinder"></div>
</div>
Exemplo n.º 8
0
?>

    <div class="row">
        <div class="col-xs-12 col-sm-6 col-md-3">
            <?php 
echo $form->field($model, 'id_parent')->widget(\kartik\widgets\Select2::classname(), ['data' => $parentsData, 'options' => ['placeholder' => Module::t('', 'Select ...', ['dot' => false])], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-xs-12 col-sm-6 col-md-3">
        <?php 
echo $form->field($model, 'layout')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInstance()->pageLayouts]);
?>
        </div>
        <div class="col-xs-12 col-sm-6 col-md-3">
            <?php 
echo $form->field($model, 'type')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInstance()->pageTypes]);
?>
        </div>

        <div class="col-xs-12 col-sm-6 col-md-3">
            <?php 
echo $form->field($model, 'date')->widget(\kartik\datetime\DateTimePicker::classname(), ['pluginOptions' => ['todayHighlight' => true, 'todayBtn' => true, 'autoclose' => true, 'minuteStep' => 1, 'format' => 'yyyy-mm-dd hh:ii:00']]);
?>
        </div>

    </div>

    <section class="panel adm-langs-panel">
        <header class="panel-heading bg-light">
            <ul class="nav nav-tabs nav-justified text-uc">
                <?php 
Exemplo n.º 9
0
        <?php 
echo Module::t('print', 'From<br/>Web Services, Inc.');
?>
    </div>
    <div style="float: right;width: 30%;">
        <?php 
if ($model->user_id) {
    ?>
            <?php 
    echo Module::t('print', 'Invoice No. {invoice-number}<br/>To: {email}<br/>Invoice Date: {date}<br/>Payment day: {date_end}<br/>{description}', ['invoice-number' => $model->id, 'email' => $model->email, 'date' => Yii::$app->formatter->asDate($model->created_at), 'time' => Yii::$app->formatter->asTime($model->created_at), 'status' => $model::status_list($model->response_status), 'description' => nl2br($model->description), 'date_end' => Yii::$app->formatter->asDate($model->date_end), 'dot' => false]);
    ?>
        <?php 
} else {
    ?>
            <?php 
    echo Module::t('print', 'Invoice No. {invoice-number}<br/>To: {person}<br/>Email: {email}<br/>Invoice Date: {date}<br/>Payment day: {date_end}<br/>{description}', ['invoice-number' => $model->id, 'person' => $model->person, 'email' => $model->email, 'date' => Yii::$app->formatter->asDate($model->created_at), 'time' => Yii::$app->formatter->asTime($model->created_at), 'status' => $model::status_list($model->response_status), 'description' => nl2br($model->description), 'date_end' => Yii::$app->formatter->asDate($model->date_end), 'dot' => false]);
    ?>
        <?php 
}
?>
    </div>
    <div style="clear: both;"></div>
</div>
<br/>
<table style="width: 100%;border-collapse: collapse;">
    <thead>
    <tr>
        <th style="<?php 
echo $thFirst;
?>
"><?php