예제 #1
6
 /**
  * Ham tao giao dien cho column
  * @param string $keyColumn ten truong cua column
  * @param array $column mang setting cua column
  * @param array $gallery mang gia tri cua image
  * @param string $id id cua 1 anh
  * @param string $tdOptions Html Attribute of td column
  * @return string
  */
 private function generateColumnByType($keyColumn, $column, $gallery, $id, $tdOptions = [], $module, $attribute)
 {
     $typeImage = ArrayHelper::getValue($column, 'displayType', 'text');
     $items = ArrayHelper::getValue($column, 'items', []);
     $options = ArrayHelper::getValue($column, 'options', ['class' => 'form-control']);
     $column_name = $module . '[' . $attribute . '][' . $id . '][' . $keyColumn . ']';
     switch ($typeImage) {
         case self::SYA_TYPE_COLUMN_DROPDOWN:
             $template = Html::dropDownList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_TEXTAREA:
             $template = Html::textarea($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_RADIO:
             $template = Html::radio($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_RADIOLIST:
             $template = Html::radioList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_CHECKBOX:
             $template = Html::checkbox($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_CHECKBOXLIST:
             $template = Html::checkboxList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_HIDDEN:
             $tdOptions = ArrayHelper::merge($tdOptions, ['style' => 'display: none;']);
             $template = Html::hiddenInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         default:
             $template = Html::textInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
     }
     $templateGallery = Html::beginTag('td', $tdOptions);
     $templateGallery .= $template;
     $templateGallery .= Html::endTag('td');
     return $templateGallery;
 }
예제 #2
0
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->checkboxOptions instanceof Closure) {
         $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
     } else {
         $options = $this->checkboxOptions;
         if (!isset($options['value'])) {
             $options['value'] = is_array($key) ? json_encode($key, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $key;
         }
     }
     if (isset($options['class'])) {
         $options['class'] .= ' icheck';
     } else {
         $options['class'] = 'icheck';
     }
     $options['hidden'] = true;
     return Html::checkbox($this->name, !empty($options['checked']), $options);
 }
예제 #3
0
    foreach ($broadcast_address as $address) {
        if ($address->user_id) {
            $user_exist = true;
            echo Html::tag('li', '<div class="checkbox">' . Html::checkbox('check_user_' . $address->id, true, ['label' => Html::tag('strong', $address->user->email) . ' &mdash; ' . $address->user->username, 'data-checkbox-address-id' => $address->id, 'class' => 'check-user', 'disabled' => Yii::$app->request->get('action') == 'send' ? true : false]) . (Yii::$app->request->get('action') == 'send' ? Html::tag('span', 'Ожидание', ['id' => 'status-' . $address->id, 'class' => 'text-danger', 'style' => 'margin-left: 15px;']) : '') . '</div>');
        }
    }
    if (!$user_exist) {
        echo Html::tag('li', '<em class="text-muted">Не заданы</em>');
    }
}
if (ArrayHelper::getColumn($broadcast_address, 'email')) {
    echo Html::tag('li', '<h3>Незарегистрированные пользователи</h3>');
    $user_exist = false;
    foreach ($broadcast_address as $address) {
        if ($address->email) {
            $user_exist = true;
            echo Html::tag('li', '<div class="checkbox">' . Html::checkbox('check_user_' . $address->id, true, ['label' => Html::tag('strong', $address->email) . ($address->fio ? ' &mdash; ' . $address->fio : ''), 'data-checkbox-address-id' => $address->id, 'class' => 'check-user', 'disabled' => Yii::$app->request->get('action') == 'send' ? true : false]) . (Yii::$app->request->get('action') == 'send' ? Html::tag('span', 'Ожидание', ['id' => 'status-' . $address->id, 'class' => 'text-danger', 'style' => 'margin-left: 15px;']) : '') . '</div>');
        }
    }
    if (!$user_exist) {
        echo Html::tag('li', '<em class="text-muted">Не заданы</em>');
    }
}
?>
        </ul>
    </div>
</div>



예제 #4
0
 /**
  * @param null $options
  * @param null $pluginOptions
  *
  * @return string
  * @throws \Exception
  */
 public function getItem($options = null, $pluginOptions = null)
 {
     switch ($this->type) {
         case self::TYPE_TEXT:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_EMAIL:
             return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_NUMBER:
             return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_TEXTAREA:
             return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_COLOR:
             return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]);
         case self::TYPE_DATE:
             return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
         case self::TYPE_TIME:
             return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]);
         case self::TYPE_DATETIME:
             return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]);
         case self::TYPE_PASSWORD:
             return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]);
         case self::TYPE_ROXYMCE:
             return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]);
         case self::TYPE_SELECT:
             return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_MULTI_SELECT:
             $options['multiple'] = true;
             if (!isset($options['class'])) {
                 $options['class'] = 'form-control';
             }
             return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_FILE_PATH:
             $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]);
         case self::TYPE_FILE_URL:
             $value = $this->store_url . '/' . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]);
         case self::TYPE_PERCENT:
             return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]);
         case self::TYPE_SWITCH:
             $selector = explode(',', $this->store_range);
             if (count($selector) != 2) {
                 throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500);
             }
             return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]);
         case self::TYPE_CHECKBOX:
             $random = rand(1000, 9999);
             return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_RADIO:
             $random = rand(1000, 9999);
             return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_SEPARATOR:
             return '<hr>';
         default:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
     }
 }
예제 #5
0
<div class="form-group">
    <?php 
echo Html::label('Список тем');
?>
    <?php 
echo Html::listBox('workList', null, $workListArr, ['class' => 'form-control', 'options' => $disabledWorks]);
?>
</div>
<div class="form-group">
    <?php 
echo Html::label('Новая тема');
?>
    <div class="input-group ">    
        <span class="input-group-addon">
            <?php 
echo Html::checkbox('newWorkCheckbox');
?>
        </span>    
        <span class="input-group-addon" id="basic-addon1">
            Название
        </span>
        <?php 
echo Html::textInput('newWorkName', null, ['class' => 'form-control']);
?>
        <span class="input-group-addon" id="basic-addon1">
            Руководитель
        </span>
        <?php 
echo Html::dropDownList('newWorkTeacher', null, $teachersArr, ['class' => 'form-control']);
?>
    </div>    
예제 #6
0
        <p><?php 
echo Yii::t('InstallerModule.views_config_modules', 'HumHub is very flexible and can be adjusted and/or expanded for various different applications thanks to its’ different modules.  The following modules are just a few examples and the ones we thought are most important for your chosen application.<br><br>You can always install or remove modules later. You can find more available modules after installation in the admin area.');
?>
</p>
        <br>

        <?php 
echo Html::beginForm();
?>

        <?php 
foreach ($modules as $module) {
    ?>
            <label>
                <?php 
    echo Html::checkbox('enableModules[' . $module['id'] . ']', true);
    echo $module['name'];
    ?>
            </label>
            <p class="help-block" style="margin: 0 0 10px 23px;"><?php 
    echo $module['description'];
    ?>
</p>
            <hr>
        <?php 
}
?>

        <?php 
echo Html::submitButton(Yii::t('base', 'Next'), array('class' => 'btn btn-primary', 'data-loader' => "modal", 'data-message' => Yii::t('InstallerModule.base', 'Downloading & Installing Modules...')));
?>
예제 #7
0
 public static function renderField($group, $fieldName, $fieldParams)
 {
     $id = $fieldParams['id'];
     $type = $fieldParams['type'];
     $value = $fieldParams['value'];
     $description = $fieldParams['description'];
     $options = $fieldParams['options'];
     $fld = $group . '[' . $fieldName . ']';
     $html = '';
     switch ($type) {
         case 'text':
             $html .= self::labelInput($fieldName, $fld, Html::textInput($fld, $value, ['class' => 'form-control']));
             $html .= self::hint($description);
             break;
         case 'textarea':
             $html .= self::labelInput($fieldName, $fld, Html::textarea($fld, $value, ['rows' => 5, 'class' => 'form-control', 'hint' => $description]));
             $html .= ConfigurationUtils::hint($description);
             break;
         case 'checkbox':
             $html .= self::labelInput($fieldName, $fld, Html::checkbox($fld, $value, ['value' => $value == '1' ? '1' : '0', 'class' => 'form-control autoval']));
             break;
         case 'dropdown':
             $data = explode(",", $options);
             $data = array_reverse($data);
             $data[''] = Yii::t('app', 'Select an option...');
             $data = array_reverse($data);
             $data = array_combine($data, $data);
             $html .= self::labelInput($fieldName, $fld, Html::dropDownList($fld, $value, $data, ['class' => 'form-control']));
             break;
     }
     return $html;
 }
예제 #8
0
    <div class="row">
        <div class="col-md-7">
            <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
        </div>
        <div class="col-md-5">
            <?php 
echo $form->field($model, 'isPublished')->checkbox();
?>
            <?php 
if (YII_DEBUG) {
    echo Html::checkbox('createMigration', false, ['label' => \Yii::t('app', 'Создать миграцию')]);
}
?>
        </div>
    </div>
    <?php 
echo $form->field($model, 'text')->widget(CKEditor::className());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? \Yii::t('app', 'Добавить') : \Yii::t('app', 'Сохранить'), ['class' => 'btn btn-primary']);
?>
    </div>

<?php 
예제 #9
0
class="hidden-js" <?php 
}
?>
>
			<?php 
echo $form->field($model, 'material_other');
?>
		</div>
		<?php 
echo $form->field($model, 'entrances')->checkboxList($model->getBoxEntrances(), ['unselect' => null, 'item' => function ($index, $label, $name, $checked, $value) use($form, $model) {
    $extra = '';
    $checked = is_array($model->checked_entrances) && in_array($value, array_keys($model->checked_entrances)) ? true : false;
    if ($value === Boxtypes::BOX_ENTRANCES_OTHER && !empty($model->checked_entrances[$value])) {
        $extra = '<input type="text" name="Boxtypes[entrance_other]" value="' . $model->checked_entrances[$value] . '" class="form-control">';
    }
    return '<div>' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . ' ' . $extra . '</div>';
}]);
?>
		<?php 
echo $form->field($model, 'dropping_board')->dropDownList(["" => ""] + Boxtypes::getBoxDroppingBoards());
?>
		<div id="dropping_board_other_container" <?php 
if (!$model->dropping_board_other) {
    ?>
class="hidden-js" <?php 
}
?>
>
			<?php 
echo $form->field($model, 'dropping_board_other');
?>
예제 #10
0
파일: admin_bar.php 프로젝트: oakcms/oakcms
" title="<?php 
echo Yii::t('admin', 'Go to admin panel');
?>
" data-toggle="tooltip" data-placement="bottom">
        <img src="<?php 
echo $asset->baseUrl;
?>
/images/icon-logo.svg" alt="OakCMS">
        <?php 
echo Yii::t('admin', 'Admin panel');
?>
    </a>

    <div class="live-edit">
        <?php 
echo Html::checkbox('', LIVE_EDIT, ['class' => 'simple-switch', 'data-url' => Url::to(['/system/default/live-edit'])]);
?>
        <i class="glyphicon glyphicon-pencil"></i>
        <span><?php 
echo Yii::t('admin', 'Live edit');
?>
</span>
    </div>

    <div class="user-menu">
        <a href="#"><?php 
echo $userIdentity->username;
?>
</a>
        <div class="sub-wrapper">
            <ul class="submenu">