コード例 #1
0
ファイル: ActiveFormStyled.php プロジェクト: Liv1020/cms
    /**
     * Runs the widget.
     * This registers the necessary javascript code and renders the form close tag.
     * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
     */
    public function run()
    {
        $view = $this->getView();
        $view->registerCss(<<<CSS
        .sx-form-fieldset
        {
            border-bottom: 1px dashed silver;
        }
            .sx-form-fieldset .sx-form-fieldset-title
            {
                font-weight: bold;
            }
                .sx-form-fieldset .sx-form-fieldset-title a
                {
                    font-weight: bold;
                    border-bottom: 1px dashed silver;
                    text-decoration: none;
                }

                    .sx-form-fieldset .sx-form-fieldset-title a:hover
                    {
                        text-decoration: none;
                    }

            .sx-form-fieldset .sx-form-fieldset-content
            {
                padding: 0px 20px;
            }
CSS
);
        echo <<<HTML
HTML;
        parent::run();
    }
コード例 #2
0
ファイル: EmailController.php プロジェクト: Liv1020/cms
 public function actionIndex()
 {
     $model = new EmailConsoleForm();
     if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
         $model->load(\Yii::$app->request->post());
         \Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     $result = "";
     if ($model->load(\Yii::$app->request->post()) && $model->execute()) {
         $result = \Yii::t('app', "Submitted");
     } else {
         if (\Yii::$app->request->post()) {
             $result = \Yii::t('app', "Not sent");
         }
     }
     return $this->render('index', ['model' => $model, 'result' => $result]);
 }
コード例 #3
0
 /**
  * Updates an existing Game model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionChangePassword()
 {
     $model = $this->model;
     $modelForm = new PasswordChangeForm(['user' => $model]);
     if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
         $modelForm->load(\Yii::$app->request->post());
         \Yii::$app->response->format = Response::FORMAT_JSON;
         return \skeeks\cms\modules\admin\widgets\ActiveForm::validate($modelForm);
     }
     if ($modelForm->load(\Yii::$app->request->post()) && $modelForm->changePassword()) {
         \Yii::$app->getSession()->setFlash('success', 'Успешно сохранено');
         return $this->redirect(['change-password', 'id' => $model->id]);
     } else {
         if (\Yii::$app->request->isPost) {
             \Yii::$app->getSession()->setFlash('error', 'Не удалось изменить пароль');
         }
         return $this->output(\Yii::$app->cms->moduleCms()->renderFile('admin-user/change-password.php', ['model' => $modelForm]));
         /*return $this->render('_form-change-password', [
               'model' => $modelForm,
           ]);*/
     }
 }
コード例 #4
0
ファイル: _form.php プロジェクト: Liv1020/cms
    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 64]);
?>
    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 2])->label(\Yii::t('app', 'Description'));
?>

    <?php 
/*=
  $form->field($model, 'ruleName')->widget('yii\jui\AutoComplete', [
      'options' => [
          'class' => 'form-control',
      ],
      'clientOptions' => [
          'source' => array_keys(Yii::$app->authManager->getRules()),
      ]
  ])
  */
?>

    <?php 
echo $form->field($model, 'data')->textarea(['rows' => 6, 'readonly' => 'readonly'])->label(\Yii::t('app', 'Data'));
?>

    <?php 
echo $form->buttonsCreateOrUpdate($model);
?>

    <?php 
ActiveForm::end();
コード例 #5
0
ファイル: change-trees-form.php プロジェクト: Liv1020/cms
echo $form->fieldSelectMulti($model, 'treeIds', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions())->label(\Yii::t('app', 'Additional sections'));
?>

    <?php 
echo \yii\helpers\Html::checkbox('removeCurrent', false);
?>
 <label><?php 
echo \Yii::t('app', 'Get rid of the already linked (in this case, the selected records bind only to the selected section)');
?>
</label>
    <?php 
echo $form->buttonsStandart($model, ['save']);
?>

<?php 
\skeeks\cms\modules\admin\widgets\ActiveForm::end();
?>


<?php 
\yii\bootstrap\Alert::begin(['options' => ['class' => 'alert-info']]);
?>
    <p><?php 
echo \Yii::t('app', 'You can specify some additional sections that will show your records.');
?>
</p>
    <p><?php 
echo \Yii::t('app', 'This does not affect the final address of the page, and hence safe.');
?>
</p>
<?php 
コード例 #6
0
ファイル: ActiveFormUseTab.php プロジェクト: Liv1020/cms
    /**
     * Runs the widget.
     * This registers the necessary javascript code and renders the form close tag.
     * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
     */
    public function run()
    {
        $view = $this->getView();
        $view->registerJs(<<<JS
        (function(sx, \$, _)
        {
            sx.classes.FormUseTabs = sx.classes.Component.extend({

                _init: function()
                {
                    this.activeTab = window.location.hash.replace("#","");
                },

                _onDomReady: function()
                {
                    var self = this;

                    var counter = 0;
                    \$('.sx-form-tab').each(function(i,s)
                    {
                        counter = counter + 1;

                        var Jcontroll = \$("<a>", {
                            'href' : '#' + \$(this).attr('id'),
                            'aria-controls' : \$(this).attr('id'),
                            'role' : 'tab',
                            'data-toggle' : 'tab',
                        }).append(\$(this).data('name'));

                        Jcontroll.on('click', function()
                        {
                            location.href = \$(this).attr("href");
                        });

                        var Jli = \$("<li>", {
                            'role' : 'presentation',
                            'class' : 'presentation'
                        }).append(Jcontroll);


                        if (self.activeTab)
                        {
                             if (self.activeTab == \$(this).attr('id'))
                            {
                                Jli.addClass("active");
                                \$(this).addClass("active");
                            }
                        } else
                        {
                            if (counter == 1)
                            {
                                Jli.addClass("active");
                                \$(this).addClass("active");
                            }
                        }

                        \$('.sx-form-tab-panel .nav').append(Jli);
                    });



                },

                _onWindowReady: function()
                {}
            });

            new sx.classes.FormUseTabs();

        })(sx, sx.\$, sx._);
JS
);
        //$view->registerJs("jQuery('#$id').yiiActiveForm($attributes, $options);");
        echo <<<HTML
        <!--<div role="tabpanel">

          &lt;!&ndash; Nav tabs &ndash;&gt;
          <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
            <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
            <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
            <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
          </ul>

          &lt;!&ndash; Tab panes &ndash;&gt;
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="home">1</div>
            <div role="tabpanel" class="tab-pane" id="profile">2</div>
            <div role="tabpanel" class="tab-pane" id="messages">3</div>
            <div role="tabpanel" class="tab-pane" id="settings">4</div>
          </div>-->

            </div>
        </div>
HTML;
        parent::run();
    }
コード例 #7
0
 public function init()
 {
     parent::init();
     echo \yii\helpers\Html::hiddenInput("sx-model-value", $this->modelHasRelatedProperties->id);
     echo \yii\helpers\Html::hiddenInput("sx-model", $this->modelHasRelatedProperties->className());
 }