コード例 #1
0
ファイル: MainController.php プロジェクト: barricade86/raui
 public function actionCreate()
 {
     $model = new FormDesigner();
     $model->scenario = 'advanced';
     $model->type = FormDesigner::TYPE_TEXT;
     $translate = new TranslateMessage();
     if (isset($_POST['FormDesigner'])) {
         $model->attributes = $_POST['FormDesigner'];
         if ($model->validate()) {
             // magic begin
             $this->fieldName = translit($model->getStrByLang('label'), '_', true);
             $this->fieldName = substr($this->fieldName, 0, 12);
             if ($this->setFieldInTable($_POST['FormDesigner']['type'])) {
                 $model->field = $this->fieldName;
                 $translate->attributes = $_POST['TranslateMessage'];
                 $translate->category = 'common';
                 $translate->message = 'Search by ' . $this->fieldName;
                 if ($translate->save()) {
                     $model->save();
                     Yii::app()->cache->flush();
                     Yii::app()->user->setFlash('success', tt('The new field is successfully created.'));
                     $this->redirect(Yii::app()->createUrl('/formdesigner/backend/main/admin'));
                 }
             } else {
                 $model->addError('', tt('Failed to create field'));
             }
         }
     }
     $this->render('create', array('model' => $model, 'translate' => $translate));
 }
コード例 #2
0
 public function beforeDelete()
 {
     $sql = 'DELETE FROM {{apartment_reference_values}} WHERE reference_category_id="' . $this->id . '";';
     Yii::app()->db->createCommand($sql)->execute();
     $sql = 'DELETE FROM {{apartment_reference}} WHERE reference_id="' . $this->id . '"';
     Yii::app()->db->createCommand($sql)->execute();
     $formDesignerModel = FormDesigner::model()->findByAttributes(array('reference_id' => $this->id));
     if ($formDesignerModel) {
         $formDesignerModel->delete();
     }
     return parent::beforeDelete();
 }
コード例 #3
0
ファイル: SearchForm.php プロジェクト: barricade86/raui
 public static function getSearchFields()
 {
     if (!isset(self::$_cache['fields'])) {
         self::$_cache['fields'] = array(self::TERM => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Search by term'), self::SEARCH_AP_TYPE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Search in section'), self::SEARCH_OBJ_TYPE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Property type'), self::SEARCH_LOCATION => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Search by location'), self::SEARCH_ROOMS => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Rooms range'), self::SEARCH_PRICE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Price range'), self::SEARCH_SQUARE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Square range'), self::SEARCH_FLOOR => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Floor range'), self::SEARCH_BY_ID => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Apartment ID'), self::SEARCH_BY_LAND_SQUARE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Apartment square to'), self::SEARCH_WITH_PHOTO => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Only with photo'), self::SEARCH_OWNER_TYPE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Listing from'), self::SEARCH_BOOKING => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Booking'));
         if (issetModule('formeditor')) {
             $newFieldsAll = FormDesigner::getNewFields();
             foreach ($newFieldsAll as $field) {
                 self::$_cache['fields'][$field->field] = array('status' => SearchFormModel::STATUS_NEW_FIELD, 'translate' => 'Search by ' . $field->field, 'formdesigner_id' => $field->id);
             }
         }
     }
     return self::$_cache['fields'];
 }
コード例 #4
0
ファイル: SearchForm.php プロジェクト: alexjkitty/estate
 public static function getSearchFields()
 {
     if (!isset(self::$_cache['fields'])) {
         self::$_cache['fields'] = array(self::SEARCH_AP_TYPE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Search in section'), self::SEARCH_OBJ_TYPE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Property type'), self::SEARCH_ROOMS => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Rooms range'), self::SEARCH_PRICE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Price range'), self::SEARCH_SQUARE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Square range'), self::SEARCH_FLOOR => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Floor range'), self::SEARCH_BY_ID => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Apartment ID'), self::SEARCH_BY_LAND_SQUARE => array('status' => SearchFormModel::STATUS_STANDARD, 'translate' => 'Apartment square to'));
         if (issetModule('formeditor')) {
             //Yii::import('application.modules.formeditor.models.HFormEditor');
             $newFieldsAll = FormDesigner::getNewFields();
             foreach ($newFieldsAll as $field) {
                 self::$_cache['fields'][$field->field] = array('status' => SearchFormModel::STATUS_NEW_FIELD, 'translate' => 'Search by ' . $field->field, 'formdesigner_id' => $field->id);
             }
         }
     }
     return self::$_cache['fields'];
 }
コード例 #5
0
ファイル: ApartmentObjType.php プロジェクト: barricade86/raui
 public function afterSave()
 {
     if ($this->isNewRecord) {
         if (issetModule('formdesigner')) {
             Yii::import('application.modules.formdesigner.models.*');
             $forms = FormDesigner::model()->findAll();
             foreach ($forms as $form) {
                 $formType = new FormDesignerObjType();
                 $formType->formdesigner_id = $form->id;
                 $formType->obj_type_id = $this->id;
                 $formType->save();
             }
         }
         $searchFields = SearchFormModel::model()->sort()->findAllByAttributes(array('obj_type_id' => SearchFormModel::OBJ_TYPE_ID_DEFAULT));
         foreach ($searchFields as $field) {
             $newSearch = new SearchFormModel();
             $newSearch->attributes = $field->attributes;
             $newSearch->obj_type_id = $this->id;
             $newSearch->save();
         }
     }
     return parent::afterSave();
 }
コード例 #6
0
ファイル: MainController.php プロジェクト: alexjkitty/estate
 public function actionLoadForm()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         throw404();
     }
     $this->objType = Yii::app()->request->getParam('obj_type_id');
     $isInner = Yii::app()->request->getParam('is_inner');
     $roomsMin = Yii::app()->request->getParam('room_min');
     $roomsMax = Yii::app()->request->getParam('room_max');
     if ($roomsMin || $roomsMax) {
         $this->roomsCountMin = $roomsMin;
         $this->roomsCountMax = $roomsMax;
     }
     $this->sApId = (int) Yii::app()->request->getParam('sApId');
     $floorMin = Yii::app()->request->getParam('floor_min');
     $floorMax = Yii::app()->request->getParam('floor_max');
     if ($floorMin || $floorMax) {
         $this->floorCountMin = $floorMin;
         $this->floorCountMax = $floorMax;
     }
     $floor = Yii::app()->request->getParam('floor');
     if ($floor) {
         $this->floorCount = $floor;
     }
     if (issetModule('selecttoslider') && param('useSquareSlider') == 1) {
         $squareMin = Yii::app()->request->getParam('square_min');
         $squareMax = Yii::app()->request->getParam('square_max');
         if ($squareMin || $squareMax) {
             $this->squareCountMin = $squareMin;
             $this->squareCountMax = $squareMax;
         }
     } else {
         $square = Yii::app()->request->getParam('square');
         if ($square) {
             $this->squareCount = $square;
         }
     }
     if (issetModule('location') && param('useLocation', 1)) {
         $country = Yii::app()->request->getParam('country');
         if ($country) {
             $this->selectedCountry = $country;
         }
         $region = Yii::app()->request->getParam('region');
         if ($region) {
             $this->selectedRegion = $region;
         }
         $city = Yii::app()->request->getParam('city');
         if ($city) {
             $this->selectedCity = $city;
         }
     } else {
         $city = Yii::app()->request->getParam('city');
         if ($city) {
             $this->selectedCity = $city;
         }
     }
     $this->objType = Yii::app()->request->getParam('objType');
     $this->apType = Yii::app()->request->getParam('apType');
     /*        if(issetModule('selecttoslider') && param('usePriceSlider') == 1) {
                 $priceMin = Yii::app()->request->getParam("price_min");
                 $priceMax = Yii::app()->request->getParam("price_max");
     
                 if($priceMin || $priceMax) {
                     $this->priceSlider["min"] = $priceMin;
                     $this->priceSlider["max"] = $priceMax;
                 }
             } else {
                 $price = Yii::app()->request->getParam('price');
     
                 if(issetModule('currency')){
                     $priceDefault = ceil(Currency::convertToDefault($price));
                 } else {
                     $priceDefault = $price;
                 }
     
                 if($priceDefault) {
                     $this->price = $price;
                 }
             }*/
     if (issetModule('formeditor')) {
         $newFieldsAll = FormDesigner::getNewFields();
         foreach ($newFieldsAll as $field) {
             $value = CHtml::encode(Yii::app()->request->getParam($field->field));
             if (!$value) {
                 continue;
             }
             $fieldString = $field->field;
             $this->newFields[$fieldString] = $value;
         }
     }
     $compact = Yii::app()->request->getParam('compact', 0);
     HAjax::jsonOk('', array('html' => $this->renderPartial('//site/_search_form', array('isInner' => $isInner, 'compact' => $compact), true), 'sliderRangeFields' => SearchForm::getSliderRangeFields(), 'cityField' => SearchForm::getCityField(), 'countFiled' => SearchForm::getCountFiled(), 'compact' => $compact));
 }
コード例 #7
0
ファイル: HFormEditor.php プロジェクト: barricade86/raui
 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>';
     }
 }
コード例 #8
0
ファイル: _form.php プロジェクト: barricade86/raui
        echo '<br/>';
        echo '<b>' . $model->getAttributeLabel('type') . '</b>: ' . $model->getTypeName() . '';
        echo '<br/>';
    }
    $this->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => 'label', 'type' => 'string'));
}
echo $form->dropDownListRow($model, 'view_in', FormDesigner::getViewInList());
echo $form->dropDownListRow($model, 'rules', FormDesigner::getRulesList());
//echo $form->dropDownListRow($model, 'view_in', FormDesigner::getViewInList());
echo $form->checkBoxRow($model, 'visible');
echo $form->checkBoxListRow($model, 'objTypesArray', ApartmentObjType::getList());
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => 'tip', 'type' => 'string'));
echo '<div class="fields_for_search">';
echo '<h5>' . tt('For search') . '</h5>';
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $translate, 'field' => 'translation', 'type' => 'string'));
echo $form->dropDownListRow($model, 'compare_type', FormDesigner::getCompareList());
echo '</div>';
?>

    <div id="selMeasureUnitBox" style="display: none;">
        <?php 
echo $form->textFieldRow($model, 'measure_unit');
?>
    </div>

    <br/>

    <div class="rowold buttons">
        <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => tc('Save')));
?>
コード例 #9
0
ファイル: InfoPages.php プロジェクト: barricade86/raui
 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;
 }
コード例 #10
0
ファイル: Apartment.php プロジェクト: alexjkitty/estate
 public function getAttributeLabel($attribute)
 {
     if (issetModule('formeditor')) {
         $label = FormDesigner::getLabelForm($attribute);
         return $label ? $label : parent::getAttributeLabel($attribute);
     }
     return parent::getAttributeLabel($attribute);
 }
コード例 #11
0
ファイル: index.php プロジェクト: barricade86/raui
                                 echo '<li><span>' . CHtml::encode($value) . '</span></li>';
                             }
                         }
                     }
                     echo '</ul>';
                 }
                 echo '</td>';
             }
             echo '</tr>';
         }
     }
 }
 if (issetModule('formeditor')) {
     $rows = FormDesigner::getNewFields();
     foreach ($rows as $row) {
         if (!FormDesigner::isShowForAnything($row['field'])) {
             continue;
         }
         echo '<tr>';
         echo '<td>';
         echo '<strong>' . CHtml::encode($row['label_' . Yii::app()->language]) . ':</strong>';
         echo '</td>';
         foreach ($apartments as $item) {
             if ($row->type == FormDesigner::TYPE_REFERENCE) {
                 $sql = "SELECT title_" . Yii::app()->language . " FROM {{apartment_reference_values}} WHERE id=" . $item->{$row}['field'];
                 $value = Yii::app()->db->createCommand($sql)->queryScalar();
             } else {
                 $value = CHtml::encode($item->{$row}['field']);
             }
             if ($row->type == FormDesigner::TYPE_INT && $row->measure_unit) {
                 $value .= '&nbsp;' . CHtml::encode($row->measure_unit);
コード例 #12
0
ファイル: FormDesigner.php プロジェクト: barricade86/raui
 private static function setCache()
 {
     $fields = FormDesigner::model()->cache(param('cachingTime', 1209600), self::getDependency())->with(array('objTypes'))->findAll(array('order' => 't.sorter ASC'));
     /** @var $field FormDesigner */
     foreach ($fields as $field) {
         if ($field->standard_type == self::STANDARD_TYPE_NEW) {
             self::$_cacheNewFields[] = $field;
         }
         if ($field->view_in) {
             self::$_cacheByView[$field->view_in][] = $field;
         }
         self::$_cache[$field->field]['visible'] = $field->visible;
         self::$_cache[$field->field]['tip'] = $field->getTip();
         self::$_cache[$field->field]['label'] = $field->getLabel();
         self::$_cache[$field->field]['standard_type'] = $field->standard_type;
         self::$_cache[$field->field]['objTypes'] = array();
         foreach ($field->objTypes as $type) {
             self::$_cache[$field->field]['objTypes'][] = $type->id;
         }
     }
 }
コード例 #13
0
ファイル: _setup_form.php プロジェクト: barricade86/raui
<p>
    <strong><?php 
echo tt('Settings for the field', 'formdesigner');
?>
</strong>: <?php 
echo Apartment::model()->getAttributeLabel($model->field);
?>
</p>

<?php 
/** @var CustomForm $form */
$form = $this->beginWidget('CustomForm', array('id' => 'form-designer-filter'));
echo $form->errorSummary($model);
echo CHtml::hiddenField('id', $model->id);
echo CHtml::hiddenField('FormDesigner[save]', $model->id);
echo $form->dropDownListRow($model, 'view_in', FormDesigner::getViewInList());
echo '<br>';
echo $form->checkBoxRow($model, 'visible');
echo '<br>';
echo $form->checkBoxListRow($model, 'objTypesArray', ApartmentObjType::getList());
echo '<br>';
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => 'tip', 'type' => 'string'));
echo '<div class="clear"></div>';
echo '<br>';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? tc('Add') : tc('Save')));
$this->endWidget();
コード例 #14
0
ファイル: FormDesigner.php プロジェクト: alexjkitty/estate
 private static function setCache()
 {
     $fields = FormDesigner::model()->cache(param('cachingTime', 1209600), self::getDependency())->with(array('objTypes'))->findAll();
     /** @var $field FormDesigner */
     foreach ($fields as $field) {
         if ($field->type != self::TYPE_DEFAULT) {
             self::$_cacheNewFields[] = $field;
             if ($field->view_in) {
                 self::$_cacheByView[$field->view_in][] = $field;
             }
         }
         self::$_cache[$field->field]['visible'] = $field->visible;
         self::$_cache[$field->field]['tip'] = $field->getTip();
         self::$_cache[$field->field]['label'] = $field->getLabel();
         self::$_cache[$field->field]['objTypes'] = array();
         foreach ($field->objTypes as $type) {
             self::$_cache[$field->field]['objTypes'][] = $type->id;
         }
     }
 }
コード例 #15
0
ファイル: admin.php プロジェクト: barricade86/raui
<?php

$this->adminTitle = tc('The forms designer');
if (issetModule('formeditor')) {
    $this->menu = array(array('label' => tt('Add field', 'formeditor'), 'url' => array('/formeditor/backend/main/create')), array('label' => tt('Edit search form', 'formeditor'), 'url' => array('/formeditor/backend/search/editSearchForm')));
}
Yii::app()->clientScript->registerScript('search', "\n\$('#form-designer-filter').submit(function(){\n    \$('#form-designer-grid').yiiGridView('update', {\n        data: \$(this).serialize()\n    });\n    return false;\n});\n\nfunction ajaxSetVisible(elem){\n\t\$.ajax({\n\t\turl: \$(elem).attr('href'),\n\t\tsuccess: function(){\n\t\t\t\$('#form-designer-grid').yiiGridView.update('form-designer-grid');\n\t\t}\n\t});\n}\n");
$this->widget('CustomGridView', array('id' => 'form-designer-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'function(id, data){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove(); reInstallSortable(id, data);}', 'rowCssClassExpression' => '"items[]_{$data->id}"', 'filter' => $model, 'columns' => array(array('name' => 'field', 'value' => '$data->getLabel()', 'filter' => false), array('name' => 'view_in', 'value' => '$data->getViewInName()', 'filter' => FormDesigner::getViewInList()), array('header' => tt('Show for property types', 'formdesigner'), 'value' => '$data->getTypesHtml()', 'type' => 'raw', 'sortable' => false), array('name' => 'tip', 'filter' => false), array('name' => 'visible', 'value' => '$data->getVisibleHtml()', 'type' => 'raw', 'sortable' => false, 'filter' => false), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{up}{down}{fast_up}{fast_down}&nbsp;{update}{delete}', 'htmlOptions' => array('class' => 'infopages_buttons_column', 'style' => 'width:160px;'), 'buttons' => array('up' => array('label' => tc('Move an item up'), 'imageUrl' => $url = Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets.gridview') . '/up.gif'), 'url' => 'Yii::app()->createUrl("/formeditor/backend/main/move", array("id"=>$data->id, "direction" => "up", "view_in"=>$data->view_in))', 'options' => array('class' => 'infopages_arrow_image_up'), 'visible' => '($data->sorter > "' . $model->minSorter . '") && ' . intval($model->view_in), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'form-designer-grid'); return false;}"), 'down' => array('label' => tc('Move an item down'), 'imageUrl' => $url = Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets.gridview') . '/down.gif'), 'url' => 'Yii::app()->createUrl("/formeditor/backend/main/move", array("id"=>$data->id, "direction" => "down", "view_in"=>$data->view_in))', 'options' => array('class' => 'infopages_arrow_image_down'), 'visible' => '($data->sorter < "' . $model->maxSorter . '") && ' . intval($model->view_in), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'form-designer-grid'); return false;}"), 'fast_up' => array('label' => tc('Move to the beginning of the list'), 'imageUrl' => Yii::app()->theme->baseUrl . '/images/default/fast_top_arrow.gif', 'url' => 'Yii::app()->createUrl("/formeditor/backend/main/move", array("id"=>$data->id, "direction" => "fast_up", "view_in"=>$data->view_in))', 'options' => array('class' => 'infopages_arrow_image_fast_up'), 'visible' => '($data->sorter > "' . $model->minSorter . '") && ' . intval($model->view_in), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'form-designer-grid'); return false;}"), 'fast_down' => array('label' => tc('Move to end of list'), 'imageUrl' => Yii::app()->theme->baseUrl . '/images/default/fast_bottom_arrow.gif', 'url' => 'Yii::app()->createUrl("/formeditor/backend/main/move", array("id"=>$data->id, "direction" => "fast_down", "view_in"=>$data->view_in))', 'options' => array('class' => 'infopages_arrow_image_fast_down'), 'visible' => '($data->sorter < "' . $model->maxSorter . '") && ' . intval($model->view_in), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'form-designer-grid'); return false;}"), 'update' => array('url' => '$data->getUpdateUrl()'), 'delete' => array('visible' => '$data->standard_type == 0', 'url' => 'Yii::app()->createUrl("/formeditor/backend/main/delete", array("id" => $data->id))'))))));
?>

<?php 
$csrf_token_name = Yii::app()->request->csrfTokenName;
$csrf_token = Yii::app()->request->csrfToken;
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery.ui');
$str_js = "\n\t\tvar fixHelper = function(e, ui) {\n\t\t\tui.children().each(function() {\n\t\t\t\t\$(this).width(\$(this).width());\n\t\t\t});\n\t\t\treturn ui;\n\t\t};\n\n\t\tfunction reInstallSortable(id, data) {\n\t\t\tinstallSortable(\$(data).find('select[name=\"FormDesigner[view_in]\"] option:selected').val());\n\t\t}\n\n\t\tfunction updateGrid() {\n\t\t\t\$.fn.yiiGridView.update('form-designer-grid');\n\t\t}\n\n\t\tfunction installSortable(areaIdSel) {\n\t\t\tif (areaIdSel > 0) {\n\t\t\t\t\$('#form-designer-grid table.items tbody').sortable({\n\t\t\t\t\tforcePlaceholderSize: true,\n\t\t\t\t\tforceHelperSize: true,\n\t\t\t\t\titems: 'tr',\n\t\t\t\t\tupdate : function () {\n\t\t\t\t\t\tserial = \$('#form-designer-grid table.items tbody').sortable('serialize', {key: 'items[]', attribute: 'class'}) + '&{$csrf_token_name}={$csrf_token}&area_id=' + areaIdSel;\n\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t'url': '" . $this->createUrl('/formeditor/backend/main/sortitems') . "',\n\t\t\t\t\t\t\t'type': 'post',\n\t\t\t\t\t\t\t'data': serial,\n\t\t\t\t\t\t\t'success': function(data){\n\t\t\t\t\t\t\t\tupdateGrid();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'error': function(request, status, error){\n\t\t\t\t\t\t\t\talert('We are unable to set the sort order at this time.  Please try again in a few minutes.');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\thelper: fixHelper\n\t\t\t\t}).disableSelection();\n\t\t\t}\n\t\t}\n\n\t\tinstallSortable('" . intval($model->view_in) . "');\n";
$cs->registerScript('sortable-project', $str_js);
コード例 #16
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 
}
コード例 #17
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 
}