public function rules() { $video = ApartmentVideo::model(); $panorama = ApartmentPanorama::model(); $rules = array(array('price', 'priceValidator', 'except' => 'video_file, video_html, panorama'), array('location_id', 'locationRequired', 'except' => 'video_file, video_html, panorama'), array('title', 'i18nRequired', 'except' => 'video_file, video_html, panorama'), array('price, price_to, floor, floor_total, window_to, type, price_type, obj_type_id, city_id, activity_always', 'numerical', 'integerOnly' => true), array('square, land_square', 'numerical'), array('type', 'numerical', 'min' => 1), array('price_to', 'priceToValidator'), array('berths', 'length', 'max' => 255), array('title', 'i18nLength', 'max' => 255), array('lat, lng', 'length', 'max' => 25), array('phone', 'length', 'max' => 15), array('id', 'safe', 'on' => 'search'), array('floor', 'myFloorValidator'), array('is_price_poa', 'boolean'), array('in_currency, owner_active, num_of_rooms, is_special_offer, is_free_from, is_free_to, active, metroStations, note, period_activity, sublocation_id, region_id', 'safe'), array($this->getI18nFieldSafe(), 'safe'), array('city_id, owner_active, active, type, obj_type_id, ownerEmail, ownerUsername, popularity', 'safe', 'on' => 'search'), array('video_html', 'checkHtmlCode'), array('video_file', 'file', 'types' => $video->supportExt, 'maxSize' => $video->fileMaxSize, 'allowEmpty' => true), array('panoramaFile', 'file', 'types' => $panorama->supportedExt, 'maxSize' => $panorama->maxSize, 'tooLarge' => Yii::t('module_apartments', 'The file was larger than {size}MB. Please upload a smaller file.', array('{size}' => $panorama->maxSizeMb)), 'allowEmpty' => true)); if (issetModule('formeditor')) { Yii::import('application.modules.formeditor.models.HFormEditor'); $addRules = HFormEditor::getRulesForModel(); $rules = CMap::mergeArray($rules, $addRules); } if (issetModule('location') && param('useLocation', 1)) { $rules[] = array('loc_city, loc_region, loc_country', 'safe', 'on' => 'search'); $rules[] = array('loc_city, loc_region, loc_country', 'numerical', 'integerOnly' => true); } return $rules; }
<?php if (issetModule('formeditor')) { echo '<dl class="ap-descr">'; Yii::import('application.modules.formeditor.models.HFormEditor'); $rows = HFormEditor::getExtendedFields(); HFormEditor::renderViewRows($rows, $data); echo '</dl>'; } $prev = ''; $column1 = 0; $column2 = 0; $column3 = 0; foreach ($data->references as $item) { if ($item['title']) { if ($prev != $item['style']) { $column2 = 0; $column3 = 0; echo '<div class="clear"></div>'; } ${$item}['style']++; $prev = $item['style']; echo '<div class="' . $item['style'] . '">'; echo '<span class="viewapartment-subheader">' . CHtml::encode($item['title']) . '</span>'; echo '<ul class="apartment-description-ul">'; foreach ($item['values'] as $key => $value) { if ($value) { if (param('useReferenceLinkInView')) { echo '<li><span>' . CHtml::link(CHtml::encode($value), $this->createAbsoluteUrl('/service-' . $key)) . '</span></li>'; } else { echo '<li><span>' . CHtml::encode($value) . '</span></li>';
?> <?php echo $form->error($model, 'is_free_to'); ?> </div> <?php } if (!isset($element)) { $element = 0; } if (issetModule('bookingcalendar') && $model->active != Apartment::STATUS_DRAFT) { $this->renderPartial('//modules/bookingcalendar/views/_form', array('apartment' => $model, 'element' => $element)); } $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>'; }*/ if (Yii::app()->user->checkAccess('backend_access')) { $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Save'), 'htmlOptions' => array('onclick' => "\$('#Apartment-form').submit(); return false;"))); } else { echo '<div class="row buttons save">'; echo CHtml::button($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Save'), array('onclick' => "\$('#Apartment-form').submit(); return false;", 'class' => 'big_button button-blue')); echo '</div>'; }
</td> <td> <button class="tel-search-res"> <img src="/themes/atlas/temp/images/icon-telephone.png"/> <span>показать</span> </button> <span class="hide"><?php echo $item->phone; ?> </span> </td> <td> <?php $additionFields = HFormEditor::getExtendedFields(); $existValue = HFormEditor::existValueInRows($additionFields, $item); $item->references = $item->getFullInformation($item->id, $item->type, $category->id); $firstTabsItems = array('content' => Yii::app()->controller->renderPartial('//modules/apartments/views/_bt_tab_addition', array('data' => $item, 'additionFields' => $additionFields), true)); ?> <?php echo $firstTabsItems['content']; ?> </td> <td> <?php $date = $item->date_created; $date = strtotime($date);
<?php if ($additionFields) { echo '<dl class="ap-descr">'; HFormEditor::renderViewRows($additionFields, $data); echo '</dl>'; }
<p class="note"><?php Yii::t('common', 'Fields with <span class="required">*</span> are required.'); ?> </p> <?php echo $form->errorSummary(array($model, $translate)); if ($model->type != FormDesigner::TYPE_DEFAULT) { if ($model->isNewRecord) { echo $form->dropDownListRow($model, 'type', FormDesigner::getTypesList()); ?> <div id="selReferenceBox" style="display: none;"> <?php $references = HFormEditor::getReferencesList(); if ($references) { echo $form->dropDownListRow($model, 'reference_id', $references); } else { echo CHtml::link(tt('Please add the new category to the form editor', 'formeditor'), Yii::app()->createUrl('/referencecategories/backend/main/admin')); } ?> </div> <?php } else { echo '<br/>'; echo '<b>' . tt('The name of a field in a table', 'formeditor') . '</b>: ' . $model->field . ''; echo '<br/>'; echo '<b>' . $model->getAttributeLabel('type') . '</b>: ' . $model->getTypeName() . ''; echo '<br/>'; }
<div class="b_item_aux__tabs"> <?php $firstTabsItems = array(); $generalContent = $this->renderPartial('//modules/apartments/views/_tab_general', array('data' => $model), true); if ($generalContent) { $firstTabsItems[tc('General')] = array('content' => $generalContent, 'id' => 'tabs1_1', 'active' => false); } if (!param('useBootstrap')) { Yii::app()->clientScript->scriptMap = array('jquery-ui.css' => false); } if (issetModule('bookingcalendar') && $model->type == Apartment::TYPE_RENT) { Bookingcalendar::publishAssets(); $firstTabsItems[tt('The periods of booking apartment', 'bookingcalendar')] = array('content' => $this->renderPartial('//modules/bookingcalendar/views/calendar', array('apartment' => $model), true), 'id' => 'tabs1_2', 'active' => false); } $additionFields = HFormEditor::getExtendedFields(); $existValue = HFormEditor::existValueInRows($additionFields, $model); if ($existValue) { $firstTabsItems[tc('Additional info')] = array('content' => $this->renderPartial('//modules/apartments/views/_tab_addition', array('data' => $model, 'additionFields' => $additionFields), true), 'id' => 'tab_3', 'active' => false); } if (param('enableCommentsForApartments', 1)) { if (!isset($comment)) { $comment = null; } $firstTabsItems[Yii::t('module_comments', 'Comments') . ' (' . Comment::countForModel('Apartment', $model->id) . ')'] = array('content' => $this->renderPartial('//modules/apartments/views/_tab_comments', array('model' => $model), true), 'id' => 'tabs1_4', 'active' => false); } ?> <?php if (count($firstTabsItems) > 0) { ?> <?php