Example #1
0
        <div class="jarviswidget-editbox">
            <!-- This area used as dropdown edit box -->
            <input class="form-control" type="text" />
        </div>
        <!-- end widget edit box -->
        <!-- widget content -->
        <div class="widget-body">
            <?php 
echo $form->field($groupModel, 'id')->dropDownList($groups);
?>
            <?php 
foreach ($properties as $prop) {
    if ($prop->has_static_values == 0) {
        continue;
    }
    $property_values = app\models\PropertyStaticValues::getValuesForPropertyId($prop->id);
    ?>
                <div class="form-group">
                    <label class="col-md-2 control-label"><?php 
    echo $prop->name;
    ?>
</label>

                    <div class="col-md-10">
                        <div class="scrollable-options-list">
                            <?php 
    foreach ($property_values as $property_value) {
        ?>
                                <?php 
        $checked = false;
        if (isset($optionGenerate['values'][$prop->id][$property_value['id']])) {
Example #2
0
echo \kartik\helpers\Html::getInputId($model, $property_key);
?>
">
        <?php 
if ($multiple) {
    ?>
            <?php 
    echo \yii\helpers\Html::hiddenInput(\yii\helpers\Html::getInputName($model, $property_key), '');
    ?>
        <?php 
}
?>
        <?php 
echo \yii\helpers\Html::activeLabel($model, $property_key, ['class' => 'col-md-2 control-label']);
?>
        <div class="col-md-10">
            <?php 
$addUrl = \yii\helpers\Url::to(['/backend/properties/add-static-value', 'key' => $property_key, 'returnUrl' => Yii::$app->request->url]);
?>
            <?php 
echo kartik\widgets\Select2::widget(['name' => \yii\helpers\Html::getInputName($model, $property_key), 'data' => ['' => ''] + app\models\PropertyStaticValues::getSelectForPropertyId($property_id), 'options' => ['multiple' => $multiple ? true : false], 'pluginOptions' => ['allowClear' => false, 'escapeMarkup' => new \yii\web\JsExpression('function (markup) {return markup;}'), 'language' => new \yii\web\JsExpression('{ noResults:function(){
                                       var NowValue = encodeURI($(".select2-dropdown--below input.select2-search__field").val());
                                       return "<a data-toggle=\'modal\' href=\'' . $addUrl . '&value="+ NowValue +"\' data-target=\'#newStaticValue\'>Add static value</a>"
                                     }
                                 }')], 'value' => is_array($model->{$property_key}) ? $model->{$property_key} : explode(', ', $model->{$property_key})]);
?>
        </div>
    </div>


Example #3
0
 * @var $model \app\properties\AbstractModel
 * @var $multiple boolean
 * @var $property_id integer
 * @var $property_key string
 * @var $this \app\properties\handlers\Handler
 * @var $values array
 */
if ($multiple) {
    ?>
    <div class="form-group field-<?php 
    echo \kartik\helpers\Html::getInputId($model, $property_key);
    ?>
">
        <?php 
    echo \yii\helpers\Html::activeLabel($model, $property_key, ['class' => 'col-md-2 control-label']);
    ?>
        <div class="col-md-10">
            <?php 
    echo \yii\helpers\Html::hiddenInput(\yii\helpers\Html::getInputName($model, $property_key), '');
    ?>
            <?php 
    echo kartik\widgets\Select2::widget(['name' => \yii\helpers\Html::getInputName($model, $property_key), 'data' => app\models\PropertyStaticValues::getSelectForPropertyId($property_id), 'options' => ['multiple' => true], 'value' => explode(', ', $model->{$property_key})]);
    ?>
        </div>
    </div>
<?php 
} else {
    ?>
    <?php 
    echo $form->field($model, $property_key)->dropDownList([0 => Yii::t('app', 'Not selected')] + app\models\PropertyStaticValues::getSelectForPropertyId($property_id));
}