Beispiel #1
0
<?php

use yii\helpers\Html;
use yii\bootstrap\Tabs;
use app\widgets\ActiveForm;
use app\widgets\ButtonsContatiner;
use app\widgets\Modal;
if ($model->isNewRecord) {
    $obj_id = 'user-role_create';
    $header = __('Create user role');
} else {
    $obj_id = 'user-role_' . $model->name;
    $header = __('User role: {role}', ['role' => $model->description]);
}
$form_id = $obj_id . '_form';
Modal::begin(['size' => Modal::SIZE_LARGE, 'header' => $header, 'id' => $obj_id, 'footer' => ButtonsContatiner::widget(['model' => $model, 'footerWrapper' => false, 'removeLink' => false, 'form' => $form_id])]);
$form = ActiveForm::begin(['options' => ['id' => $form_id]]);
echo Tabs::widget(['options' => ['id' => $form_id . '_tabs', 'class' => 'app-tabs-save'], 'items' => [['label' => __('General'), 'content' => $this->render('components/form_general', ['form' => $form, 'model' => $model])], ['label' => __('Permissions'), 'content' => $this->render('components/form_permissions', ['form' => $form, 'model' => $model])], ['label' => __('Inherited roles'), 'content' => $this->render('components/form_inherit', ['form' => $form, 'model' => $model])]]]);
ActiveForm::end();
Modal::end();
use app\widgets\ActiveForm;
use app\widgets\InputGroup;
use yii\bootstrap\Button;
use yii\helpers\Html;
use yii\web\JsExpression;
/** @var $this yii\web\View */
/** @var $form app\widgets\ActiveForm */
/** @var $model app\forms\user\Profile */
/** @var $emailId string */
$emailId = Html::getInputId($model, 'email');
$form = ActiveForm::begin(['id' => 'user-profile-form', 'pjax' => true, 'layout' => 'horizontal', 'enableClientValidation' => true, 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10']]]);
?>

    <?php 
echo $form->field($model, 'email')->widget(InputGroup::className(), ['inputOptions' => ['class' => 'form-control', 'disabled' => 'disabled'], 'button' => true, 'addon' => Button::widget(['label' => Icon::icon('glyphicon glyphicon-copy'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-default btn-flat'], 'clientEvents' => ['click' => new JsExpression("function (ev) {\n                    ev.preventDefault();\n                    \$('#{$emailId}').removeAttr('disabled').select();\n                    document.execCommand('copy');\n                    \$('#{$emailId}').attr('disabled', 'disabled');\n                }")]])]);
?>
    <?php 
echo $form->field($model, 'name');
?>
    <?php 
echo $form->field($model, 'password')->passwordInput();
?>
    <?php 
echo $form->field($model, 'password_repeat')->passwordInput();
?>

<?php 
ActiveForm::endWithActions(['cancel' => false]);
?>
        
<?php

use app\widgets\ActiveForm;
use app\widgets\Check;
/** @var $register app\forms\user\Register */
?>

<?php 
$form = ActiveForm::begin(['pjax' => true, 'enableAjaxValidation' => true]);
?>
    <?php 
echo $form->field($register, 'name');
?>
    <?php 
echo $form->field($register, 'email');
?>
    <?php 
echo $form->field($register, 'password')->passwordInput();
?>
    <?php 
echo $form->field($register, 'password_repeat')->passwordInput();
?>
    <?php 
echo $form->field($register, 'sendmail')->widget(Check::className())->label(false);
ActiveForm::endWithActions(['cancel' => ['options' => ['data-dismiss' => 'modal']]]);
Beispiel #4
0
/** @var $editor modules\wiki\forms\Editor */
/** @var $form app\widgets\ActiveForm */
/** @var $wiki modules\wiki\models\Wiki */
/** @var $cancelUrl array */
$wiki = $editor->getWiki();
if ($wiki->id) {
    $cancelUrl = ['page/view', 'id' => $wiki->id];
} elseif ($wiki->parent_id) {
    $cancelUrl = ['page/view', 'id' => $wiki->parent_id];
} else {
    $cancelUrl = ['page/index'];
}
?>

<?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($editor, 'title');
?>
    <?php 
echo $form->field($editor, 'content')->widget(MarkdownEditor::className(), ['previewUrl' => ['page/markdown-preview']]);
?>
    <?php 
echo $form->field($editor, 'summary')->textInput(['placeholder' => Yii::t('app', 'What did you change ?')]);
?>

<?php 
ActiveForm::endWithActions(['cancel' => ['url' => $cancelUrl]]);
Beispiel #5
0
 /**
  * Renders tab section content.
  * @param string $section
  * @return string
  */
 protected function renderSection($section)
 {
     $configs = isset($this->_configs[$section]) ? $this->_configs[$section] : Param::getConfigsBySection($section);
     ob_start();
     ob_implicit_flush(false);
     if ($this->pjax) {
         Pjax::begin($this->pjaxOptions);
     }
     $form = ActiveForm::begin(['action' => [$this->id, 'tab' => $section], 'pjax' => $this->pjax]);
     echo Html::hiddenInput('section', $section);
     foreach ($configs as $config) {
         if (!Param::isAccess($config)) {
             continue;
         }
         $title = Yii::t('app', $config->title);
         $field = $form->field($config, "[{$config->id}]value")->hint(Yii::t('app', $config->desc));
         switch ($config->value_type) {
             case Config::TYPE_TEXT:
             case Config::TYPE_URL:
             case Config::TYPE_EMAIL:
             case Config::TYPE_INT:
             case Config::TYPE_NUM:
                 echo $field->textInput()->label($title);
                 break;
             case Config::TYPE_EDITOR:
                 echo $field->textArea()->label($title);
                 break;
             case Config::TYPE_SWITCH:
                 echo $field->widget(Check::className(), ['label' => $title])->label(false);
                 break;
             case Config::TYPE_SELECT:
                 echo $field->widget(Select2::className(), ['items' => $config->options])->label($title);
                 break;
             case Config::TYPE_PASSWORD:
                 echo $field->passwordInput()->label($title);
                 break;
         }
     }
     ActiveForm::endWithActions(['cancel' => false]);
     if ($this->pjax) {
         Pjax::end();
     }
     return ob_get_clean();
 }
Beispiel #6
0
</p>
    <ul>
    <?php 
    foreach ($delete->getChildren() as $child) {
        ?>
        <li><?php 
        echo Html::a(e($child->title), ['page/view', 'id' => $child->id]);
        ?>
</li>
    <?php 
    }
    ?>
    </ul>
    <p class="lead"><?php 
    echo Yii::t('app', 'Please select what to do with these pages: ');
    ?>
</p>
    <?php 
    echo $form->field($delete, 'mode')->widget(Check::className(), ['type' => Check::TYPE_RADIO, 'options' => ['class' => 'checkbox-list-vert'], 'items' => $delete->getChoices()]);
    ?>
    <?php 
    echo $form->field($delete, 'parentId')->widget(Select2::className(), ['hideSearch' => false, 'remote' => ['wiki-suggest', 'ign' => $delete->getWiki()->id]])->label(false);
    ?>
    <hr>
<?php 
}
?>

<?php 
ActiveForm::endWithActions(['save' => ['label' => Yii::t('app', 'DELETE'), 'options' => ['class' => 'btn btn-flat bg-red']], 'cancel' => ['url' => ['page/view', 'id' => $delete->getWiki()->id]]]);