Esempio n. 1
0
 /**
  * @return bool
  */
 public function save()
 {
     if (!isset(Yii::$app->params[Module::getInstance()->settingsKey])) {
         $path = Yii::getAlias('@webroot/files/common') . '/';
         if (!is_file($path . 'underconstruction.jpg')) {
             FileHelper::createDirectory($path);
             copy(Yii::getAlias('@webroot/modules/admunderconst/assets/images/underconstruction.jpg'), $path . 'underconstruction.jpg');
         }
     }
     return ParamsManager::getInstance()->manager->staticParams('change', Module::getInstance()->settingsKey, $this->getAttributes());
 }
 /**
  * @return string
  */
 public function actionIndex()
 {
     $module = Module::getInstance();
     /* @var $model \app\modules\admunderconst\models\SettingsForm */
     $model = $module->manager->createSettingsForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             Yii::$app->getSession()->setFlash('success', Adm::t('', 'Data successfully changed!'));
             return Adm::redirect(['index']);
         }
     }
     return $this->render('index', ['model' => $model]);
 }
Esempio n. 3
0
<?php

use app\assets_b\AppAsset;
use app\core\admpages\models\Page;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\helpers\Html;
use app\helpers\Url;
use yii\widgets\Breadcrumbs;
/* @var $this \yii\web\View */
/* @var $content string */
$appAsset = AppAsset::register($this);
/* @var $i18n \pavlinter\translation\I18N */
$i18n = Yii::$app->getI18n();
\app\modules\admunderconst\Module::loadUnderConstruction($this);
$menus = Page::find()->with(['translations', 'childs' => function ($q) {
    $q->andWhere(['active' => 1, 'visible' => 1]);
}])->where(['id_parent' => [1, 2, 3], 'active' => 1, 'visible' => 1])->orderBy(['weight' => SORT_ASC])->all();
$Menu1 = [];
$Menu2 = [];
$Menu3 = [];
$baseUrl = Url::getLangUrl();
foreach ($menus as $menu) {
    $item = [];
    $item['label'] = $menu->name;
    if ($menu->type === 'main') {
        $item['url'] = $baseUrl;
    } else {
        $item['url'] = $menu->url();
    }
    if ($menu->childs) {
Esempio n. 4
0
echo Module::t('', 'Under Construction');
?>
</h1>

    <?php 
$form = ActiveForm::begin(['id' => 'admunderconst-form']);
?>

        <div class="row">
            <div class="col-xs-12 col-sm-6 col-md-3">
                <?php 
echo Adm::widget('FileInput', ['form' => $form, 'model' => $model, 'attribute' => 'imagePath']);
?>
            </div>
            <div class="col-xs-12 col-sm-6 col-md-3 form-without-label">
                <?php 
echo $form->field($model, 'active', ["template" => "{input}\n{label}\n{hint}\n{error}"])->widget(CheckboxX::classname(), ['pluginOptions' => ['threeState' => false]]);
?>
            </div>
        </div>
        <p>
            <?php 
echo InputButton::widget(['label' => !isset(Yii::$app->params[Module::getInstance()->settingsKey]) ? Adm::t('', 'Create', ['dot' => false]) : Adm::t('', 'Update', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'formSelector' => $form]);
?>

        </p>
    <?php 
ActiveForm::end();
?>
</div>