public function init() { parent::init(); $this->filter = array('country_id' => 0, 'region_id' => 0, 'city_id' => 0, 'type' => 0, 'obj_type_id' => 0, 'rooms' => 0, 'ot' => 0, 'wp' => 0); $addedFields = InfoPages::getAddedFields(); if ($addedFields) { $this->addedFields = $addedFields; foreach ($addedFields as $field) { $this->filter[$field['field']] = ''; } } }
public function attributeLabels() { $return = array('id' => 'Id', 'username' => tt('Your name', 'usercpanel'), 'password' => tt('Password', 'usercpanel'), 'password_repeat' => tt('Repeat password', 'usercpanel'), 'old_password' => tt('Current administrator password', 'adminpass'), 'email' => tt('E-mail', 'users'), 'phone' => Yii::t('common', 'Your phone number'), 'Login (email)' => Yii::t('common', 'Login (email)'), 'verifyCode' => Yii::t('common', 'Verify Code'), 'additional_info' => tt('Additional info', 'usercpanel'), 'balance' => tc('balance'), 'type' => tc('Type'), 'role' => tt('Role', 'users'), 'agency_name' => tc('Agency name'), 'agency_user_id' => tc('Agency name'), 'date_created' => tc('Registration date'), 'last_login_date' => tc('The last date the user logged in to the system'), 'last_ip_addr' => tc('Last IP address'), 'agree' => tc('I agree with') . ' ' . CHtml::link(tc('with User agreement'), InfoPages::getUrlById(4), array('target' => '_blank'))); if ($this->scenario == 'changePass' || $this->scenario == 'changeAdminPass') { $return['password'] = tt('Enter new password', 'usercpanel'); } if ($this->scenario == 'usercpanel') { $return['email'] = tt('Your e-mail', 'usercpanel'); } if ($this->scenario == 'backend' || $this->scenario == 'update') { $return['email'] = tt('E-mail', 'users'); $return['username'] = tt('User name', 'users'); $return['password'] = tt('Password', 'users'); $return['phone'] = Yii::t('common', 'Phone number'); } return $return; }
echo $form->labelEx($model, 'widget'); ?> <?php echo $form->dropDownList($model, 'widget', InfoPages::getWidgetOptions()); ?> <?php echo $form->error($model, 'widget'); ?> </div> <div class="rowold"> <?php echo $form->labelEx($model, 'widget_position'); ?> <?php echo $form->dropDownList($model, 'widget_position', InfoPages::getPositionList()); ?> <?php echo $form->error($model, 'widget_position'); ?> </div> <?php echo $this->renderPartial('_form_apartments_filter'); ?> <div class="rowold buttons"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? tc('Add') : tc('Save'))); ?> </div>
public function getCriteriaForAdList() { $criteria = new CDbCriteria(); if ($this->widget_data) { $this->_filter = CJSON::decode($this->widget_data); if (issetModule('location')) { $this->setForCriteria($criteria, 'country_id', 'loc_country'); $this->setForCriteria($criteria, 'region_id', 'loc_region'); $this->setForCriteria($criteria, 'city_id', 'loc_city'); if (isset($this->_filter['country_id']) && $this->_filter['country_id']) { Yii::app()->controller->selectedCountry = $this->_filter['country_id']; } if (isset($this->_filter['region_id']) && $this->_filter['region_id']) { Yii::app()->controller->selectedRegion = $this->_filter['region_id']; } if (isset($this->_filter['city_id']) && $this->_filter['city_id']) { Yii::app()->controller->selectedCity = $this->_filter['city_id']; } } else { $this->setForCriteria($criteria, 'city_id', 'city_id'); if (isset($this->_filter['city_id']) && $this->_filter['city_id']) { Yii::app()->controller->selectedCity = $this->_filter['city_id']; } } $this->setForCriteria($criteria, 'type', 't.price_type'); $this->setForCriteria($criteria, 'obj_type_id', 't.obj_type_id'); if (!(issetModule('selecttoslider') && param('useRoomSlider') == 1)) { $this->setForCriteria($criteria, 'rooms', 't.num_of_rooms'); } $this->setForCriteria($criteria, 'ot', 't.ot'); $this->setForCriteria($criteria, 'wp', 't.count_img'); if (isset($this->_filter['type']) && $this->_filter['type']) { Yii::app()->controller->apType = $this->_filter['type']; } if (isset($this->_filter['obj_type_id']) && $this->_filter['obj_type_id']) { Yii::app()->controller->objType = $this->_filter['obj_type_id']; } if (isset($this->_filter['rooms']) && $this->_filter['rooms']) { Yii::app()->controller->roomsCount = $this->_filter['rooms']; } if (isset($this->_filter['ot']) && $this->_filter['ot']) { Yii::app()->controller->ot = $this->_filter['ot']; } if (isset($this->_filter['wp']) && $this->_filter['wp']) { Yii::app()->controller->wp = $this->_filter['wp']; } # new fields $newFieldsAll = InfoPages::getAddedFields(); if ($newFieldsAll) { foreach ($newFieldsAll as $field) { $this->setForCriteria($criteria, $field['field'], 't.' . $field['field'], true, $field); if (isset($this->_filter[$field['field']]) && $this->_filter[$field['field']]) { Yii::app()->controller->newFields[$field['field']] = $this->_filter[$field['field']]; } } } } //deb($criteria); return $criteria; }
public static function getInfoPagesAddList() { $return = array(); $result = InfoPages::model()->findAll('active = ' . self::STATUS_ACTIVE); if ($result) { foreach ($result as $item) { $return[$item->id] = $item->getStrByLang('title'); } } return $return; }
<?php $this->menu = array(array('label' => InfoPagesModule::t('Add infopage'), 'url' => array('create')), array('label' => InfoPagesModule::t('Edit infopage'), 'url' => array('update', 'id' => $model->id)), array('label' => tt('Delete infopage'), 'url' => '#', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => tc('Are you sure you want to delete this item?')))); $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('label' => CHtml::encode($model->getAttributeLabel('active')), 'value' => $model->active == InfoPages::STATUS_ACTIVE ? tc('Active') : tc('Inactive'), 'template' => "<tr class=\"{class}\"><th>{label}</th><td>{value}</td></tr>\n"), array('label' => CHtml::encode($model->getAttributeLabel('title')), 'type' => 'raw', 'value' => CHtml::encode($model->getStrByLang('title')), 'template' => "<tr class=\"{class}\"><th>{label}</th><td>{value}</td></tr>\n"), array('label' => CHtml::encode($model->getAttributeLabel('body')), 'type' => 'raw', 'value' => CHtml::decode($model->getStrByLang('body')), 'template' => "<tr class=\"{class}\"><th>{label}</th><td>{value}</td></tr>\n"), array('label' => CHtml::encode($model->getAttributeLabel('widget')), 'value' => $model->widget ? InfoPages::getWidgetOptions($model->widget) : '', 'template' => "<tr class=\"{class}\"><th>{label}</th><td>{value}</td></tr>\n"))));
<div class="rowold" id="menu_is_blank"> <?php echo $form->checkboxRow($model, 'is_blank'); ?> <?php echo $form->error($model, 'is_blank'); ?> </div> <div class="rowold" id="menu_pageid"> <?php echo $form->labelEx($model, 'pageId'); ?> <?php echo $form->dropDownList($model, 'pageId', InfoPages::getInfoPagesAddList(), array('id' => 'pageid')); ?> <?php echo $form->error($model, 'pageId'); ?> </div> <div class="rowold buttons"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? tc('Add') : tc('Save'))); ?> </div> <?php $this->endWidget(); ?>