Пример #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());
 }
Пример #2
0
 /**
  * @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]);
 }
Пример #3
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>