Ejemplo n.º 1
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.º 2
0
<?php

if ($model->canShowInForm('berths')) {
    ?>
    <div class="rowold">
        <?php 
    echo CHtml::activeLabelEx($model, 'berths');
    ?>
        <?php 
    echo Apartment::getTip('berths');
    ?>
        <?php 
    echo CHtml::activeTextField($model, 'berths', array('class' => 'width150', 'maxlength' => 255));
    ?>
        <?php 
    echo CHtml::error($model, 'berths');
    ?>
    </div>
<?php 
}
Ejemplo n.º 3
0
<?php

if ($model->canShowInForm('num_of_rooms')) {
    ?>
    <div class="rowold">
        <?php 
    echo CHtml::activeLabelEx($model, 'num_of_rooms');
    ?>
        <?php 
    echo Apartment::getTip('num_of_rooms');
    ?>
        <?php 
    echo CHtml::activeDropDownList($model, 'num_of_rooms', array_merge(array(0 => ''), range(1, param('moduleApartments_maxRooms', 8))), array('class' => 'width50'));
    ?>
        <?php 
    echo CHtml::error($model, 'num_of_rooms');
    ?>
    </div>
    <div class="clear5"></div>
<?php 
}
Ejemplo n.º 4
0
    echo $form->error($model, 'square');
    ?>
    </div>
<?php 
}
?>

<?php 
if ($model->canShowInForm('land_square')) {
    ?>
    <div class="rowold">
        <?php 
    echo $form->labelEx($model, 'land_square');
    ?>
        <?php 
    echo Apartment::getTip('land_square');
    ?>
        <?php 
    echo $form->textField($model, 'land_square', array('size' => 5, 'class' => 'width70')) . ' ' . tc('site_land_square');
    ?>
        <?php 
    echo $form->error($model, 'land_square');
    ?>
    </div>
<?php 
}
?>

<?php 
if ($model->type == Apartment::TYPE_CHANGE) {
    echo '<div class="clear">&nbsp;</div>';
Ejemplo n.º 5
0
 private function genContentTab($field, $lang)
 {
     $isCKEditor = $this->type == 'text-editor' ? 1 : 0;
     $fieldId = 'id_' . $this->modelName . $this->field . '_' . $lang;
     $html = '';
     if ($this->useTranslate) {
         $html .= '<div class="translate_button" >';
         $html .= '<span class="t_loader_' . $this->modelName . $this->field . '" style="display: none;"><img src="' . Yii::app()->request->baseUrl . '/images/ajax-loader.gif" alt="Переводим"></span>';
         $html .= CHtml::button(tc('Translate'), array('onClick' => "translateField('{$this->field}', '{$lang}', '{$isCKEditor}', '" . $this->modelName . "')"));
         $html .= '</div>';
     }
     if ($this->useCopyButton) {
         $html .= '<div class="copylang_button">';
         $html .= CHtml::button(tc('Copy to all languages'), array('onClick' => "copyField('{$this->field}', '{$lang}', '{$isCKEditor}', '" . $this->modelName . "')"));
         $html .= '</div>';
     }
     $html .= '<div class="rowold">';
     $html .= CHtml::activeLabel($this->model, $this->field, array('required' => $this->model->isLangAttributeRequired($this->field)));
     $html .= Apartment::getTip($this->field);
     if ($this->note) {
         $html .= CHtml::tag('p', array('class' => 'note'), $this->note);
     }
     switch ($this->type) {
         case 'string':
             $html .= CHtml::activeTextField($this->model, $field, array('class' => 'width500', 'maxlength' => 255, 'id' => $fieldId));
             break;
         case 'text':
             $html .= CHtml::activeTextArea($this->model, $field, array('class' => 'width500 height200', 'id' => $fieldId));
             break;
         case 'text-editor':
             $html .= '<div class="clear"></div>';
             $options = array();
             if (Yii::app()->user->getState('isAdmin')) {
                 // if admin - enable upload image
                 $options = array('filebrowserUploadUrl' => Yii::app()->createAbsoluteUrl('/site/uploadimage', array('type' => 'imageUpload', Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken)));
                 $options['allowedContent'] = true;
             }
             $html .= $this->widget('application.extensions.ckeditor.CKEditor', array('model' => $this->model, 'attribute' => $field, 'language' => '' . Yii::app()->language . '', 'editorTemplate' => 'advanced', 'skin' => 'kama', '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')), 'options' => $options, 'htmlOptions' => array('id' => $fieldId)), true);
             break;
     }
     $html .= CHtml::error($this->model, $field);
     $html .= '</div>';
     $this->fieldIdArr[$lang] = $fieldId;
     return $html;
 }
Ejemplo n.º 6
0
<?php

if ($model->canShowInForm('window_to')) {
    ?>
    <div class="rowold">
        <?php 
    echo CHtml::activeLabelEx($model, 'window_to');
    ?>
        <?php 
    echo Apartment::getTip('window_to');
    ?>
        <?php 
    echo CHtml::activeDropDownList($model, 'window_to', WindowTo::getWindowTo(), array('class' => 'width150'));
    ?>
        <?php 
    echo CHtml::error($model, 'window_to');
    ?>
    </div>
<?php 
}
Ejemplo n.º 7
0
    <div class="rowold">
        <?php 
    echo CHtml::activeLabelEx($model, 'floor', array('class' => 'noblock'));
    ?>
 /
        <?php 
    echo CHtml::activeLabelEx($model, 'floor_total', array('class' => 'noblock'));
    ?>
<br/>
        <?php 
    echo Apartment::getTip('floor_all');
    ?>
        <?php 
    echo CHtml::activeDropDownList($model, 'floor', array_merge(array('0' => ''), range(1, param('moduleApartments_maxFloor', 30))), array('class' => 'width50'));
    ?>
 /
        <?php 
    echo CHtml::activeDropDownList($model, 'floor_total', array_merge(array('0' => ''), range(1, param('moduleApartments_maxFloor', 30))), array('class' => 'width50'));
    ?>
        <?php 
    echo CHtml::error($model, 'floor');
    ?>
        <?php 
    echo CHtml::error($model, 'floor_total');
    ?>
        <?php 
    echo Apartment::getTip('floor_all');
    ?>
    </div>
<?php 
}
Ejemplo n.º 8
0
}
?>

	<?php 
if ($model->canShowInForm('description_near')) {
    $this->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => 'description_near', 'type' => 'text'));
    echo '<div class="clear">&nbsp;</div>';
}
if ($model->canShowInForm('phone')) {
    echo $form->label($model, 'phone');
    echo Apartment::getTip('phone');
    echo $form->textField($model, 'phone');
}
if ($model->canShowInForm('note')) {
    echo $form->label($model, 'note');
    echo Apartment::getTip('note');
    echo $form->textArea($model, 'note', array('class' => 'width500'));
}
if (issetModule('formeditor')) {
    Yii::import('application.modules.formeditor.models.HFormEditor');
    $rows = HFormEditor::getExtendedFields();
    HFormEditor::renderFormRows($rows, $model);
}
?>

</div>

	<?php 
/*if ($model->isNewRecord) {
		echo '<p>' . tt('After pressing the button "Create", you will be able to load photos for the listing and to mark the property on the map.', 'apartments') . '</p>';
	}*/