Ejemplo n.º 1
0
    if ($search->formdesigner->type == FormDesigner::TYPE_INT) {
        $width = 'search-input-new width120';
    } elseif ($search->formdesigner->type == FormDesigner::TYPE_REFERENCE) {
        $width = 'search-input-new width290';
    } else {
        $width = 'search-input-new width285';
    }
    $value = isset($this->newFields[$search->field]) ? CHtml::encode($this->newFields[$search->field]) : '';
    ?>
		<div class="<?php 
    echo $controlClass;
    ?>
">
		<?php 
    if ($search->formdesigner->type == FormDesigner::TYPE_REFERENCE) {
        echo CHtml::dropDownList($search->field, $value, CMap::mergeArray(array(0 => $search->getLabel()), FormDesigner::getListByCategoryID($search->formdesigner->reference_id)), array('class' => 'searchField ' . $fieldClass));
    } else {
        if (!$this->searchShowLabel) {
            echo CHtml::textField($search->field, $value, array('class' => $width, 'onChange' => 'changeSearch();', 'placeholder' => $search->getLabel()));
        } else {
            echo CHtml::textField($search->field, $value, array('class' => $width, 'onChange' => 'changeSearch();'));
        }
        if ($search->formdesigner->type == FormDesigner::TYPE_INT && $search->formdesigner->measure_unit) {
            echo '&nbsp;<span class="measurement">' . $search->formdesigner->measure_unit . '</span>';
        }
    }
    echo '</div>';
    ?>
	</div>
<?php 
}
Ejemplo n.º 2
0
 public static function getAddedFields()
 {
     $addedFields = null;
     if (issetModule('formdesigner')) {
         $newFieldsAll = FormDesigner::getNewFields();
         if ($newFieldsAll && count($newFieldsAll)) {
             foreach ($newFieldsAll as $key => $field) {
                 $addedFields[$key]['field'] = $field->field;
                 $addedFields[$key]['type'] = $field->type;
                 $addedFields[$key]['compare_type'] = $field->compare_type;
                 $addedFields[$key]['label'] = $field->getStrByLang('label');
                 if ($field->type == FormDesigner::TYPE_REFERENCE) {
                     $addedFields[$key]['listData'] = FormDesigner::getListByCategoryID($field->reference_id);
                 }
             }
         }
     }
     return $addedFields;
 }
Ejemplo n.º 3
0
 public static function renderFormRows($rows, Apartment $model)
 {
     if (!$rows) {
         return '';
     }
     //print_r($rows);
     $isShowTip = true;
     foreach ($rows as $row) {
         if (!$model->canShowInForm($row['field'])) {
             continue;
         }
         // если есть файл отображения для формы
         if ($row['standard_type'] == FormDesigner::STANDARD_TYPE_ORIGINAL_VIEW) {
             Yii::app()->controller->renderPartial('//../views/common/apartments/backend/fields/' . $row['field'], array('model' => $model));
             continue;
         }
         $required = $row->rules == FormDesigner::RULE_REQUIRED || $row->rules == FormDesigner::RULE_REQUIRED_NUMERICAL ? array('required' => true) : array();
         echo '<div class="rowold">';
         if ($row['standard_type'] == FormDesigner::STANDARD_TYPE_NEW) {
             echo CHtml::label($row['label_' . Yii::app()->language], get_class($model) . '_' . $row['field'], $required);
         } else {
             echo $row['is_i18n'] ? '' : CHtml::activeLabel($model, $row['field']);
         }
         if ($row['is_i18n']) {
             $isShowTip = false;
         }
         if ($isShowTip) {
             echo Apartment::getTip($row['field']);
         }
         switch ($row['type']) {
             case FormDesigner::TYPE_TEXT:
                 if ($row['is_i18n']) {
                     Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'string'));
                 } else {
                     echo CHtml::activeTextField($model, $row['field'], array('class' => 'width500', 'maxlength' => 255));
                 }
                 break;
             case FormDesigner::TYPE_INT:
                 echo CHtml::activeTextField($model, $row['field'], array('class' => 'width70', 'maxlength' => 255));
                 if ($row->measure_unit) {
                     echo '&nbsp;' . $row->measure_unit;
                 }
                 break;
             case FormDesigner::TYPE_TEXT_AREA:
                 if ($row['is_i18n']) {
                     Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'text'));
                 } else {
                     echo CHtml::activeTextArea($model, $row['field'], array('class' => 'width500 height200'));
                 }
                 break;
             case FormDesigner::TYPE_TEXT_AREA_WS:
                 if ($row['is_i18n']) {
                     Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'text-editor'));
                 } else {
                     // даем пользователям ограниченый набор форматирования
                     $toolbar = array(array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike'), array('NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'));
                     $filebrowserImageUploadUrl = '';
                     if (Yii::app()->user->checkAccess('backend_access')) {
                         // if admin - enable upload image
                         $filebrowserImageUploadUrl = Yii::app()->createAbsoluteUrl('/site/uploadimage', array('type' => 'imageUpload', Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken));
                         $toolbar = array(array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike'), array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'), array('NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'), array('Styles', 'Format', 'Font', 'FontSize', 'TextColor', 'BGColor'), array('Image', 'Link', 'Unlink', 'SpecialChar'));
                     }
                     Yii::app()->controller->widget('application.extensions.editMe.widgets.ExtEditMe', array('model' => $model, 'attribute' => $row['field'], 'toolbar' => $toolbar, 'filebrowserImageUploadUrl' => $filebrowserImageUploadUrl, 'htmlOptions' => array('id' => $model->id)));
                 }
                 break;
             case FormDesigner::TYPE_REFERENCE:
                 echo CHtml::activeDropDownList($model, $row['field'], CMap::mergeArray(array("" => Yii::t('common', 'Please select')), FormDesigner::getListByCategoryID($row->reference_id)));
                 break;
         }
         echo '</div>';
     }
 }
Ejemplo n.º 4
0
">
    <span class="search"><div class="<?php 
    echo $textClass;
    ?>
"><?php 
    echo $search->getLabel();
    ?>
:</div> </span>
    <?php 
    if ($search->formdesigner->type == FormDesigner::TYPE_INT) {
        $width = 'search-input-new width70';
    } elseif ($search->formdesigner->type == FormDesigner::TYPE_REFERENCE) {
        $width = 'search-input-new width290';
    } else {
        $width = 'search-input-new width285';
    }
    $value = isset($this->newFields[$search->field]) ? CHtml::encode($this->newFields[$search->field]) : '';
    echo '<span class="search">';
    if ($search->formdesigner->type == FormDesigner::TYPE_REFERENCE) {
        echo CHtml::dropDownList($search->field, $value, CMap::mergeArray(array(0 => Yii::t('common', 'Please select')), FormDesigner::getListByCategoryID($search->formdesigner->reference_id)), array('class' => 'searchField ' . $fieldClass));
    } else {
        echo CHtml::textField($search->field, $value, array('class' => $width, 'onChange' => 'changeSearch();'));
        if ($search->formdesigner->type == FormDesigner::TYPE_INT && $search->formdesigner->measure_unit) {
            echo '&nbsp;<span>' . $search->formdesigner->measure_unit . '</span>';
        }
    }
    echo '</span>';
    ?>
</div>
<?php 
}