本文整理汇总了PHP中Apartment::getObjTypesArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::getObjTypesArray方法的具体用法?PHP Apartment::getObjTypesArray怎么用?PHP Apartment::getObjTypesArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::getObjTypesArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<div class="<?php
echo $divClass;
?>
">
<span class="search"><div class="<?php
echo $textClass;
?>
"><?php
echo Yii::t('common', 'Property type');
?>
:</div> </span>
<span class="search">
<?php
echo CHtml::dropDownList('objType', isset($this->objType) ? CHtml::encode($this->objType) : 0, CMap::mergeArray(array(0 => Yii::t('common', 'Please select')), Apartment::getObjTypesArray()), array('class' => $fieldClass));
Yii::app()->clientScript->registerScript('objType', '
focusSubmit($("select#objType"));
', CClientScript::POS_READY);
?>
</span>
</div>
示例2: isset
<?php
if ($this->searchShowLabel) {
?>
<div class="<?php
echo $textClass;
?>
"><?php
echo Yii::t('common', 'Property type');
?>
:</div>
<?php
}
?>
<li>
<?php
echo CHtml::dropDownList('objType', isset($this->objType) ? $this->objType : 0, CMap::mergeArray(array(0 => Yii::t('common', 'Property type')), Apartment::getObjTypesArray()), array('class' => $fieldClass));
?>
</li>
示例3: addListingFromCSV
private function addListingFromCSV($value, $isZip, $maxSorter, $selectedImportUser)
{
if (is_array($value)) {
$model = new $this->modelName();
$type = !empty($value['type']) ? $value['type'] : Apartment::TYPE_DEFAULT;
$priceType = !empty($value['priceType']) ? $value['priceType'] : '';
$objType = !empty($value['objType']) ? $value['objType'] : min(Apartment::getObjTypesArray());
$countryName = !empty($value['countryName']) ? trim($value['countryName']) : null;
$regionName = !empty($value['regionName']) ? trim($value['regionName']) : null;
$cityName = !empty($value['cityName']) ? trim($value['cityName']) : null;
$countryId = $countryInfo = $regionId = $regionInfo = $cityId = $cityInfo = 0;
if (issetModule('location')) {
if ($countryName) {
if (isFree()) {
$countryInfo = Country::model()->findByAttributes(array('name_' . Yii::app()->language => $countryName));
} else {
Yii::app()->setLanguage($this->defLang);
$countryInfo = Country::model()->findByAttributes(array('name_' . Yii::app()->language => $countryName));
Yii::app()->setLanguage($this->currLang);
}
if ($countryInfo && isset($countryInfo->id)) {
$countryId = $countryInfo->id;
}
}
if ($regionName) {
if (isFree()) {
$regionInfo = Region::model()->findByAttributes(array('name_' . Yii::app()->language => $regionName));
} else {
Yii::app()->setLanguage($this->defLang);
$regionInfo = Region::model()->findByAttributes(array('name_' . Yii::app()->language => $regionName));
Yii::app()->setLanguage($this->currLang);
}
if ($regionInfo && isset($regionInfo->id)) {
$regionId = $regionInfo->id;
}
}
if ($cityName) {
if (isFree()) {
$cityInfo = City::model()->findByAttributes(array('name_' . Yii::app()->language => $cityName));
} else {
Yii::app()->setLanguage($this->defLang);
$cityInfo = City::model()->findByAttributes(array('name_' . Yii::app()->language => $cityName));
Yii::app()->setLanguage($this->currLang);
}
if ($cityInfo && isset($cityInfo->id)) {
$cityId = $cityInfo->id;
}
}
} else {
if ($cityName) {
Yii::import('application.modules.apartmentCity.models.ApartmentCity');
if (isFree()) {
$cityInfo = ApartmentCity::model()->findByAttributes(array('name_' . Yii::app()->language => $cityName));
} else {
Yii::app()->setLanguage($this->defLang);
$cityInfo = ApartmentCity::model()->findByAttributes(array('name_' . Yii::app()->language => $cityName));
Yii::app()->setLanguage($this->currLang);
}
if ($cityInfo && isset($cityInfo->id)) {
$cityId = $cityInfo->id;
}
}
}
// if type for sale - set price type only for sale
if ($type == Apartment::TYPE_SALE) {
$priceType = Apartment::PRICE_SALE;
}
$isPricePoa = isset($value['isPricePoa']) ? $value['isPricePoa'] : 0;
$price = !empty($value['price']) ? $value['price'] : '';
$priceTo = !empty($value['priceTo']) ? $value['priceTo'] : '';
$numberRooms = !empty($value['numberRooms']) ? $value['numberRooms'] : '';
$floor = !empty($value['floor']) ? $value['floor'] : '';
$floor_total = !empty($value['floorTotal']) ? $value['floorTotal'] : '';
$square = !empty($value['square']) ? $value['square'] : '';
$landSquare = !empty($value['landSquare']) ? $value['landSquare'] : '';
$sleeps = !empty($value['sleeps']) ? $this->deleteChars($value['sleeps']) : '';
if (isFree()) {
$title = !empty($value['title']) ? $this->deleteChars($value['title']) : '';
$description = !empty($value['description']) ? $this->deleteChars($value['description']) : '';
$near = !empty($value['near']) ? $this->deleteChars($value['near']) : '';
$address = !empty($value['location']) ? $this->deleteChars($value['location']) : '';
$exchange = !empty($value['exchange']) ? $this->deleteChars($value['exchange']) : '';
} else {
if ($this->allLangs) {
foreach ($this->i18nMaskFields as $i18nMaskField) {
foreach ($this->allLangs as $lang) {
$title[$lang->name_iso] = $this->deleteChars($value['title_' . $lang->name_iso]);
$description[$lang->name_iso] = $this->deleteChars($value['description_' . $lang->name_iso]);
$near[$lang->name_iso] = $this->deleteChars($value['near_' . $lang->name_iso]);
$address[$lang->name_iso] = $this->deleteChars($value['location_' . $lang->name_iso]);
$exchange[$lang->name_iso] = $this->deleteChars($value['exchange_' . $lang->name_iso]);
}
}
}
}
$lat = !empty($value['lat']) ? $value['lat'] : '';
$lng = !empty($value['lng']) ? $value['lng'] : '';
// references
$adRef = array();
$adRef['bathroom'] = !empty($value['bathroom']) ? explode($this->separatorElem, $value['bathroom']) : null;
//.........这里部分代码省略.........
示例4: array
echo $form->labelEx($model, 'type');
?>
<?php
echo $form->dropDownList($model, 'type', Apartment::getTypesArray(), array('class' => 'width240', 'id' => 'ap_type'));
?>
<?php
echo $form->error($model, 'type');
?>
</div>
<div class="rowold">
<?php
echo $form->labelEx($model, 'obj_type_id');
?>
<?php
echo $form->dropDownList($model, 'obj_type_id', Apartment::getObjTypesArray(), array('class' => 'width240', 'id' => 'obj_type'));
?>
<?php
echo $form->error($model, 'obj_type_id');
?>
</div>
<?php
if (issetModule('location')) {
?>
<?php
$countries = Country::getCountriesArray();
?>
<div class="rowold">
<?php
echo $form->labelEx($model, 'loc_country');
示例5: renderFilter
public function renderFilter(&$criteria)
{
// start set filter
$this->filterPriceType = Yii::app()->request->getParam('filterPriceType');
if ($this->filterPriceType) {
$criteria->addCondition('price_type = :filterPriceType');
$criteria->params[':filterPriceType'] = $this->filterPriceType;
}
$this->filterObjType = Yii::app()->request->getParam('filterObjType');
if ($this->filterObjType) {
$criteria->addCondition('obj_type_id = :filterObjType');
$criteria->params[':filterObjType'] = $this->filterObjType;
}
$this->filterByLat = Yii::app()->request->getParam('filterByLat');
if ($this->filterByLat) {
$criteria->addCondition('lat = :filterByLat');
$criteria->params[':filterByLat'] = $this->filterByLat;
}
$this->filterByLng = Yii::app()->request->getParam('filterByLng');
if ($this->filterByLng) {
$criteria->addCondition('lng = :filterByLng');
$criteria->params[':filterByLng'] = $this->filterByLng;
}
// end set filter
// echo filter form
$data = SearchForm::apTypes();
echo '<div class="block-filter-viewallonmap">';
echo '<form method="GET" action="" id="form-filter-viewallonmap">';
echo CHtml::dropDownList('filterPriceType', isset($this->filterPriceType) ? CHtml::encode($this->filterPriceType) : '', $data['propertyType']);
echo CHtml::dropDownList('filterObjType', isset($this->filterObjType) ? CHtml::encode($this->filterObjType) : 0, CMap::mergeArray(array(0 => Yii::t('common', 'Please select')), Apartment::getObjTypesArray()));
echo CHtml::button(tc('Filter'), array('onclick' => '$("#form-filter-viewallonmap").submit();', 'id' => 'click-filter-viewallonmap', 'class' => 'inline button-blue'));
echo '</form>';
echo '</div>';
}
示例6: actionCreate
//.........这里部分代码省略.........
}
$login = new LoginForm();
$model = new Apartment();
$model->active = Apartment::STATUS_DRAFT;
$model->period_activity = param('apartment_periodActivityDefault', 'always');
$model->references = $model->getFullInformation($model->id, $model->type);
$isAdmin = false;
$activeTab = 'tab_register';
$isUpdate = Yii::app()->request->getPost('is_update');
if (!$isUpdate && isset($_POST['LoginForm']) && ($_POST['LoginForm']['username'] || $_POST['LoginForm']['password'])) {
if (Yii::app()->user->getState('attempts-login') >= LoginForm::ATTEMPTSLOGIN) {
$login->scenario = 'withCaptcha';
}
$activeTab = 'tab_login';
$login->attributes = $_POST['LoginForm'];
if ($login->validate() && $login->login()) {
Yii::app()->user->setState('attempts-login', 0);
User::updateUserSession();
$isAdmin = Yii::app()->user->checkAccess('backend_access');
$user = User::model()->findByPk(Yii::app()->user->id);
} else {
Yii::app()->user->setState('attempts-login', Yii::app()->user->getState('attempts-login', 0) + 1);
if (Yii::app()->user->getState('attempts-login') >= LoginForm::ATTEMPTSLOGIN) {
$login->scenario = 'withCaptcha';
}
}
}
if (isset($_POST['Apartment'])) {
$model->attributes = $_POST['Apartment'];
if (!$isUpdate) {
$adValid = $model->validate();
$userValid = false;
if ($activeTab == 'tab_register' && param('useUserRegistration')) {
$user->attributes = $_POST['User'];
$userValid = $user->validate();
if ($adValid && $userValid) {
$user->activatekey = User::generateActivateKey();
$userData = User::createUser($user->attributes);
if ($userData) {
$user = $userData['userModel'];
$user->password = $userData['password'];
$user->activatekey = $userData['activatekey'];
$user->activateLink = $userData['activateLink'];
$notifier = new Notifier();
$notifier->raiseEvent('onNewUser', $user, array('forceEmail' => $user->email));
}
}
}
if ($user->id && ($activeTab == 'tab_login' && $adValid || $activeTab == 'tab_register' && param('useUserRegistration') && $adValid && $userValid)) {
if (param('useUseradsModeration', 1)) {
$model->active = Apartment::STATUS_MODERATION;
} else {
$model->active = Apartment::STATUS_ACTIVE;
}
$model->owner_active = Apartment::STATUS_ACTIVE;
$model->owner_id = $user->id;
if ($model->save(false)) {
if (!$isAdmin && param('useUseradsModeration', 1)) {
Yii::app()->user->setFlash('success', tc('The listing is succesfullty added and is awaiting moderation'));
} else {
Yii::app()->user->setFlash('success', tc('The listing is succesfullty added'));
}
if ($activeTab == 'tab_register') {
if (param('user_registrationMode') == 'without_confirm') {
$login = new LoginForm();
$login->setAttributes(array('username' => $user['username'], 'password' => $user['password']));
if ($login->validate() && $login->login()) {
User::updateUserSession();
User::updateLatestInfo(Yii::app()->user->id, Yii::app()->controller->currentUserIp);
$this->redirect(array('/usercpanel/main/index'));
} else {
/*echo 'getErrors=<pre>';
print_r($login->getErrors());
echo '</pre>';
exit;*/
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered.'));
}
} else {
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered. The letter for account activation has been sent on {useremail}', array('{useremail}' => $user['email'])));
}
} else {
if ($isAdmin) {
NewsProduct::getProductNews();
$this->redirect(array('/apartments/backend/main/update', 'id' => $model->id));
Yii::app()->end();
} else {
$this->redirect(array('/userads/main/update', 'id' => $model->id));
}
}
}
}
}
} else {
$objTypes = array_keys(Apartment::getObjTypesArray());
$model->setDefaultType();
$model->obj_type_id = reset($objTypes);
$user->unsetAttributes(array('verifyCode'));
}
$this->render('create', array('model' => $model, 'user' => $user, 'login' => $login, 'activeTab' => $activeTab));
}
示例7: generateMap
//.........这里部分代码省略.........
}
}
foreach ($apartmentsByType as $value) {
if ($this->activeLangs && is_array($this->activeLangs)) {
foreach ($this->activeLangs as $keyLang => $valLang) {
$this->app->setLanguage($valLang);
if (isset($value['title_' . $valLang]) && $value['title_' . $valLang]) {
$map['quick_search']['subsection'][$i]['apartments'][$k]['title'][$keyLang] = $value['title_' . $valLang];
}
if (isset($value['url_' . $valLang]) && $value['url_' . $valLang]) {
$map['quick_search']['subsection'][$i]['apartments'][$k]['url'][$keyLang] = Yii::app()->createAbsoluteUrl('/apartments/main/view', array('url' => $value['url_' . $valLang] . (param('urlExtension') ? '.html' : '')));
} else {
$map['quick_search']['subsection'][$i]['apartments'][$k]['url'][$keyLang] = Yii::app()->createAbsoluteUrl('/apartments/main/view', array('id' => $value['id']));
}
if (isset($value['date_updated']) && $value['date_updated']) {
$map['quick_search']['subsection'][$i]['apartments'][$k]['lastmod'][$keyLang] = date($this->dateFormat, strtotime($value['date_updated']));
}
}
}
$this->app->setLanguage($this->defaultLang);
$k++;
}
}
} else {
//$map['apartment_types'][$i]['title'] = mb_convert_case($value, MB_CASE_TITLE, "UTF-8");
$map['quick_search']['subsection'][$i]['title'] = $value;
$map['quick_search']['subsection'][$i]['url'] = Yii::app()->createAbsoluteUrl('quicksearch/main/mainsearch', array('apType' => $key));
}
$i++;
}
}
}
####################################### search object types #######################################
$objTypes = Apartment::getObjTypesArray();
if (is_array($objTypes)) {
$i = 1;
if (array_key_exists('subsection', $map['quick_search'])) {
if ($isXml) {
$countSubsection = count($map['quick_search']['subsection']);
if ($this->activeLangs && is_array($this->activeLangs)) {
foreach ($this->activeLangs as $keyLang => $valLang) {
foreach ($objTypes as $key => $value) {
$this->app->setLanguage($valLang);
$map['quick_search']['subsection'][$countSubsection + $i]['title'][$keyLang] = $value;
$map['quick_search']['subsection'][$countSubsection + $i]['url'][$keyLang] = Yii::app()->createAbsoluteUrl('quicksearch/main/mainsearch', array('objType' => $key));
$i++;
}
}
$this->app->setLanguage($this->defaultLang);
}
} else {
$countSubsection = count($map['quick_search']['subsection']);
foreach ($objTypes as $key => $value) {
$map['quick_search']['subsection'][$countSubsection + $i]['title'] = $value;
$map['quick_search']['subsection'][$countSubsection + $i]['url'] = Yii::app()->createAbsoluteUrl('quicksearch/main/mainsearch', array('objType' => $key));
$i++;
}
}
}
// no in xml because all links to listings generated above in search subtypes section
// duplication link is not needed.
}
####################################### special offers #######################################
if (issetModule('specialoffers')) {
$specialOfferPage = Menu::model()->findByPk(Menu::SPECIALOFFERS_ID);
if ($specialOfferPage && $specialOfferPage->active == 1) {
示例8: tt
<?php
Yii::app()->getModule('userads');
//if(!Yii::app()->request->isAjaxRequest){
// echo '<h1>'.tt('Manage apartments', 'apartments').'</h1>';
//}
$this->pageTitle .= ' - ' . tt('Manage apartments', 'apartments');
if (!isset($this->breadcrumbs)) {
$this->breadcrumbs = array(Yii::t('common', 'Control panel') => array('/usercpanel/main/index'), tt('Manage apartments', 'apartments'));
}
//echo CHtml::button(tc('Add ad', 'apartments'), array('onclick' => 'document.location.href="'.Yii::app()->createUrl('/userads/main/create').'"', 'class' => 'button-blue'));
Yii::app()->clientScript->registerScript('ajaxSetStatus', "\n\t\tfunction ajaxSetStatus(elem, id){\n\t\t\t\$.ajax({\n\t\t\t\turl: \$(elem).attr('href'),\n\t\t\t\tsuccess: function(){\n\t\t\t\t\t\$('#'+id).yiiGridView.update(id);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t", CClientScript::POS_HEAD);
$columns = array(array('name' => 'id', 'headerHtmlOptions' => array('class' => 'apartments_id_column')), array('name' => 'active', 'type' => 'raw', 'value' => 'UserAds::returnStatusHtml($data, "userads-grid", 0)', 'headerHtmlOptions' => array('class' => 'userads_status_column'), 'filter' => Apartment::getModerationStatusArray(), 'sortable' => false), array('name' => 'owner_active', 'type' => 'raw', 'value' => 'UserAds::returnStatusOwnerActiveHtml($data, "userads-grid", 1)', 'headerHtmlOptions' => array('class' => 'userads_owner_status_column'), 'filter' => array('0' => tc('Inactive'), '1' => tc('Active')), 'sortable' => false), array('name' => 'type', 'type' => 'raw', 'value' => 'Apartment::getNameByType($data->type)', 'filter' => Apartment::getTypesArray(), 'sortable' => false), array('name' => 'obj_type_id', 'type' => 'raw', 'value' => '(isset($data->objType) && $data->objType) ? $data->objType->name : ""', 'filter' => Apartment::getObjTypesArray(), 'sortable' => false), array('header' => tc('Name'), 'name' => 'title_' . Yii::app()->language, 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->{"title_".Yii::app()->language}), $data->getUrl())'));
if (issetModule('location') && param('useLocation', 1)) {
$columns[] = array('name' => 'loc_country', 'value' => '$data->loc_country ? $data->locCountry->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Country::getCountriesArray(0, 1));
$columns[] = array('name' => 'loc_region', 'value' => '$data->loc_region ? $data->locRegion->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Region::getRegionsArray($model->loc_country, 0, 1));
$columns[] = array('name' => 'loc_city', 'value' => '$data->loc_city ? $data->locCity->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => City::getCitiesArray($model->loc_region, 0, 1));
} else {
$columns[] = array('name' => 'city_id', 'value' => '$data->city_id ? $data->city->name : ""', 'sortable' => false, 'filter' => ApartmentCity::getAllCity());
}
if (issetModule('paidservices')) {
$columns[] = array('header' => tc('Paid services'), 'value' => '$data->getPaidHtml(false, false, true)', 'type' => 'raw', 'htmlOptions' => array('class' => 'width70 center'));
}
$columns[] = array('class' => 'CButtonColumn', 'deleteConfirmation' => tc('Are you sure you want to delete this item?'), 'viewButtonUrl' => '$data->getUrl()', 'buttons' => array('update' => array('url' => 'Yii::app()->createUrl("/userads/main/update", array("id" => $data->id))'), 'delete' => array('url' => 'Yii::app()->createUrl("/userads/main/delete", array("id" => $data->id))')));
$this->widget('NoBootstrapGridView', array('id' => 'userads-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => $columns));
示例9: array
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery.ui');
$cs->registerScriptFile($cs->getCoreScriptUrl() . '/jui/js/jquery-ui-i18n.min.js');
$cs->registerCssFile($cs->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css');
}
$this->breadcrumbs = array(tt('Manage apartments'));
$this->menu = array(array('label' => tt('Add apartment'), 'url' => array('create')));
$this->adminTitle = tt('Manage apartments');
if (Yii::app()->user->hasFlash('mesIecsv')) {
echo "<div class='flash-success'>" . Yii::app()->user->getFlash('mesIecsv') . "</div>";
}
if (param('useUserads', 1)) {
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery.jeditable.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScript('editable_select', "\n\t\tfunction ajaxSetModerationStatus(elem, id, id_elem, owner_id, items){\n\t\t\t\$('#editable_select-'+id_elem).editable('" . Yii::app()->controller->createUrl("activate") . "', {\n\t\t\t\tdata : items,\n\t\t\t\ttype : 'select',\n\t\t\t\tcancel : '" . tc('Cancel') . "',\n\t\t\t\tsubmit : '" . tc('Ok') . "',\n\t\t\t\tstyle : 'inherit',\n\t\t\t\tsubmitdata : function() {\n\t\t\t\t\treturn {id : id_elem};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t", CClientScript::POS_HEAD);
}
$columns = array(array('class' => 'CCheckBoxColumn', 'id' => 'itemsSelected', 'selectableRows' => '2', 'htmlOptions' => array('class' => 'center')), array('name' => 'id', 'htmlOptions' => array('class' => 'apartments_id_column'), 'sortable' => false), array('name' => 'active', 'type' => 'raw', 'value' => 'Yii::app()->controller->returnControllerStatusHtml($data, "apartments-grid", 1)', 'htmlOptions' => array('class' => 'apartments_status_column'), 'sortable' => false, 'filter' => Apartment::getModerationStatusArray()), array('name' => 'owner_active', 'type' => 'raw', 'value' => 'Apartment::getApartmentsStatus($data->owner_active)', 'htmlOptions' => array('class' => 'apartments_status_column'), 'sortable' => false, 'filter' => Apartment::getApartmentsStatusArray()), array('name' => 'type', 'type' => 'raw', 'value' => 'Apartment::getNameByType($data->type)', 'filter' => Apartment::getTypesArray(), 'sortable' => false), array('name' => 'obj_type_id', 'type' => 'raw', 'value' => '(isset($data->objType) && $data->objType) ? $data->objType->name : ""', 'filter' => Apartment::getObjTypesArray(), 'sortable' => false));
if (issetModule('location') && param('useLocation', 1)) {
$columns[] = array('name' => 'loc_country', 'value' => '$data->loc_country ? $data->locCountry->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Country::getCountriesArray(0, 1));
$columns[] = array('name' => 'loc_region', 'value' => '$data->loc_region ? $data->locRegion->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Region::getRegionsArray($model->loc_country, 0, 1));
$columns[] = array('name' => 'loc_city', 'value' => '$data->loc_city ? $data->locCity->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => City::getCitiesArray($model->loc_region, 0, 1));
} else {
$columns[] = array('name' => 'city_id', 'value' => '$data->location_id ? $data->location->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Location::getLocationArrayWithoutChooseOption());
}
$columns[] = array('name' => 'ownerEmail', 'htmlOptions' => array('style' => 'width: 150px;'), 'type' => 'raw', 'value' => '(isset($data->user) && $data->user->id != 1) ? CHtml::link(CHtml::encode($data->user->email), array("/users/backend/main/view","id" => $data->user->id)) : tt("administrator", "common")');
$columns[] = array('name' => 'ownerUsername', 'htmlOptions' => array('style' => 'width: 150px;'), 'value' => 'isset($data->user->username) ? $data->user->username : ""');
$columns[] = array('header' => tc('Name'), 'name' => 'title_' . Yii::app()->language, 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->{"title_".Yii::app()->language}),array("/apartments/backend/main/view","id" => $data->id))', 'sortable' => false);
if (issetModule('paidservices')) {
$columns[] = array('header' => tc('Paid services'), 'value' => '$data->getPaidHtml(true, true)', 'type' => 'raw', 'htmlOptions' => array('style' => 'width: 200px;'));
}
$columns[] = array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{up}{down}{view}{update}{delete}', 'deleteConfirmation' => tc('Are you sure you want to delete this item?'), 'viewButtonUrl' => "Yii::app()->createUrl('/apartments/backend/main/view', array('id' => \$data->id))", 'htmlOptions' => array('class' => 'width120'), '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("/apartments/backend/main/move", array("id"=>$data->id, "direction" => "down", "catid" => "0"))', 'options' => array('class' => 'infopages_arrow_image_up'), 'visible' => '$data->sorter < "' . $maxSorter . '"', 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'apartments-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("/apartments/backend/main/move", array("id"=>$data->id, "direction" => "up", "catid" => "0"))', 'options' => array('class' => 'infopages_arrow_image_down'), 'visible' => '$data->sorter > 1', 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'apartments-grid'); return false;}")));
$this->widget('CustomGridView', array('id' => 'apartments-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove();}', 'columns' => $columns));
示例10: renderFilter
public function renderFilter(&$criteria)
{
// start set filter
$this->filterPriceType = Yii::app()->request->getParam('filterPriceType');
if ($this->filterPriceType) {
$criteria->addCondition('price_type = :filterPriceType');
$criteria->params[':filterPriceType'] = $this->filterPriceType;
}
$this->filterObjType = Yii::app()->request->getParam('filterObjType');
if ($this->filterObjType) {
$criteria->addCondition('obj_type_id = :filterObjType');
$criteria->params[':filterObjType'] = $this->filterObjType;
}
// Комнаты
$this->roomsCount = $_GET['rooms'];
if ($this->roomsCount) {
$criteria->addCondition('num_of_rooms = :roomsCount');
$criteria->params[':roomsCount'] = $this->roomsCount;
}
// !Комнаты
// end set filter
// echo filter form
$data = SearchForm::apTypes();
echo '<div class="block-filter-viewallonmap">';
echo '<form method="GET" action="" id="form-filter-viewallonmap">';
echo CHtml::dropDownList('filterPriceType', isset($this->filterPriceType) ? CHtml::encode($this->filterPriceType) : '', $data['propertyType']);
echo CHtml::dropDownList('filterObjType', isset($this->filterObjType) ? CHtml::encode($this->filterObjType) : 0, CMap::mergeArray(array(0 => Yii::t('common', 'Please select')), Apartment::getObjTypesArray()));
// Комнаты
$roomItems = array('0' => Yii::t('common', 'Number of rooms'), '1' => 1, '2' => 2, '3' => 3, '4' => Yii::t('common', '4 and more'));
echo CHtml::dropDownList('rooms', isset($this->roomsCount) ? CHtml::encode($this->roomsCount) : 0, $roomItems, array('class' => $fieldClass . ' searchField'));
// !Комнаты
echo CHtml::button(tc('Filter'), array('onclick' => '$("#form-filter-viewallonmap").submit();', 'id' => 'click-filter-viewallonmap', 'class' => 'inline button-blue'));
echo '</form>';
echo '</div>';
}
示例11: array
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery.ui');
$cs->registerScriptFile($cs->getCoreScriptUrl() . '/jui/js/jquery-ui-i18n.min.js');
$cs->registerCssFile($cs->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css');
$this->breadcrumbs = array(tt('Manage apartments'));
$this->menu = array(array('label' => tt('Add apartment'), 'url' => array('create')));
$this->adminTitle = tt('Manage apartments');
if (Yii::app()->user->hasFlash('mesIecsv')) {
echo "<div class='flash-success'>" . Yii::app()->user->getFlash('mesIecsv') . "</div>";
}
if (param('useUserads', 1)) {
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery.jeditable.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScript('editable_select', "\n\t\tfunction ajaxSetModerationStatus(elem, id, id_elem, owner_id, items){\n\t\t\t\$('#editable_select-'+id_elem).editable('" . Yii::app()->controller->createUrl("activate") . "', {\n\t\t\t\tdata : items,\n\t\t\t\ttype : 'select',\n\t\t\t\tcancel : '" . tc('Cancel') . "',\n\t\t\t\tsubmit : '" . tc('Ok') . "',\n\t\t\t\tstyle : 'inherit',\n\t\t\t\tsubmitdata : function() {\n\t\t\t\t\treturn {id : id_elem};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t", CClientScript::POS_HEAD);
}
$columns = array(array('class' => 'CCheckBoxColumn', 'id' => 'itemsSelected', 'selectableRows' => '2', 'htmlOptions' => array('class' => 'center')), array('name' => 'id', 'htmlOptions' => array('class' => 'apartments_id_column'), 'sortable' => false), array('name' => 'active', 'type' => 'raw', 'value' => 'Yii::app()->controller->returnControllerStatusHtml($data, "apartments-grid", 1).
(($data->deleted && !param("notDeleteListings", 0)) ? tt("Listing is deleted", "apartments") : "")', 'htmlOptions' => array('class' => 'apartments_status_column'), 'sortable' => false, 'filter' => Apartment::getModerationStatusArray()), array('name' => 'owner_active', 'type' => 'raw', 'value' => 'Apartment::getApartmentsStatus($data->owner_active)', 'htmlOptions' => array('class' => 'apartments_status_column'), 'sortable' => false, 'filter' => Apartment::getApartmentsStatusArray()), array('name' => 'deleted', 'type' => 'raw', 'value' => 'Apartment::getApartmentsDeleted($data->deleted)', 'htmlOptions' => array('class' => 'apartments_status_column'), 'sortable' => false, 'filter' => Apartment::getApartmentsDeletedArray(), 'visible' => param("notDeleteListings", 0)), array('name' => 'type', 'type' => 'raw', 'value' => 'Apartment::getNameByType($data->type)', 'filter' => Apartment::getTypesArray(), 'sortable' => false), array('name' => 'price', 'type' => 'raw', 'value' => '$data->getPrettyPrice(false)', 'htmlOptions' => array('style' => 'width: 100px;'), 'filter' => false, 'sortable' => false), array('name' => 'obj_type_id', 'type' => 'raw', 'value' => '(isset($data->objType) && $data->objType) ? $data->objType->name : ""', 'filter' => Apartment::getObjTypesArray(), 'sortable' => false));
if (issetModule('location')) {
$columns[] = array('name' => 'loc_country', 'value' => '($data->loc_country && isset($data->locCountry)) ? $data->locCountry->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Country::getCountriesArray(0, 1));
$columns[] = array('name' => 'loc_region', 'value' => '($data->loc_region && isset($data->locRegion)) ? $data->locRegion->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Region::getRegionsArray($model->loc_country, 0, 1));
$columns[] = array('name' => 'loc_city', 'value' => '($data->loc_city && isset($data->locCity)) ? $data->locCity->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => City::getCitiesArray($model->loc_region, 0, 1));
} else {
$columns[] = array('name' => 'city_id', 'value' => '($data->city_id && isset($data->city)) ? $data->city->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => ApartmentCity::getAllCity());
}
$columns[] = array('name' => 'ownerEmail', 'htmlOptions' => array('style' => 'width: 150px;'), 'type' => 'raw', 'value' => '(isset($data->user) && $data->user->role != "admin") ? CHtml::link(CHtml::encode($data->user->email), array("/users/backend/main/view","id" => $data->user->id)) : tt("administrator", "common")');
//$columns[]=array(
// 'name' => 'ownerUsername',
// 'htmlOptions' => array(
// 'style' => 'width: 150px;',
// ),
// 'value' => 'isset($data->user->username) ? $data->user->username : ""'
//);