/** * @return string */ public function __toString() { $str = parent::__toString(); $str .= 'Destination: ' . $this->planeDestination . "<br>\n"; $str .= 'Speed: ' . $this->planeSpeed . "<br>\n"; return $str; }
public static function getAdminCommercialList($action, $per_page = 10, $current_page = 1) { if ($action == 'newSales') { $where = "f.status='" . REALTY_STATUS_APPLY . "'"; } else { if ($action == 'newRent') { $where = "f.status='" . REALTY_STATUS_RENT_APPLY . "'"; } } $start_pos = ($current_page - 1) * $per_page; $limit = " LIMIT {$start_pos},{$per_page}"; $amount = Commercial::getAmountInList($where); $order = " ORDER BY id DESC"; $db_res = Commercial::getFullListLink($where . ' GROUP BY f.id ' . $order . $limit); $paginator = self::paginator("commercial.php?action={$action}", $amount, $per_page, $current_page); $html = "\n\t\t<div>{$paginator}</div>\n\t\t<div><a href='commercial.html?action=activateAll'>Активировать все</a></div>\t\n\t\t<table class='base_text'>\n\t\t<thead>\n\t\t<tr>\n\t\t <th>Адрес</th>\n\t\t <th>Цена</th>\t\t \n\t\t <th>Тип</th>\n\t\t <th>Карта</th>\n\t\t <th>Юзер</th>\t\t \n\t\t <th></th>\n\t\t <th></th>\n\t\t <th></th>\n\t\t <th></th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t"; $status = $action == 'newSales' ? REALTY_STATUS_SALE : REALTY_STATUS_RENT; while ($row = $db_res->fetchRow()) { $type = Commercial::$TYPE[$row['type_id']]; $city = $row['city_id'] == 0 ? '' : $row['city'] . ','; $addr = $city; $price = number_format($row['price'], 0); $map = $row['lat'] && $row['lon'] ? 'Да' : '<b>Нет</b>'; $user = ''; if ($row['user_name'] != '') { $user = $row['user_name']; } if ($row['company_name'] != '') { $user .= ' - ' . $row['company_name']; } $html .= "<tr>\n\t\t\t<td>{$addr}</td>\n\t\t\t<td>{$price}</td>\n\t\t\t<td>{$type}</td>\t\t\t\n\t\t\t<td>{$map}</td>\n\t\t\t<td>{$user}</td>\n\t\t\t<td><a href='/commercial.html?action=edit&id={$row['id']}' target='_blank'>Редактировать</a></td>\t\t\t\n\t\t\t<td><a href='/commercial.html?action=view&id={$row['id']}' target='_blank'>Смотреть</a></td>\n\t\t\t<td><a href='javascript:delObject({$row['id']})'>Удалить</a></td>\n\t\t\t<td><a href='/commercial.html?action=approve&id={$row['id']}&status={$status}' target='_blank'>Активировать</a></td>\n\t\t\t</tr>"; } $html .= "</tbody></table>\n\t\t<script>\t\t\n\t\t\tdelObject = function(id) {\n\t\t\tif (confirm('Вы уверены удалить этот объект?')) {\n\t\t\t\tlocation.href = '/commercial.html?action=delete&id='+id;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\t\t\t\t\n\t\t</script>"; return $html; }
?> <?php echo $form->textFieldGroup($model, 'description', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'))); ?> <?php echo $form->dropDownListGroup($weather, 'code', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Weather::model()->getWeatherOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($theme, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $model->getThemeOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($commercial, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Commercial::model()->getCommercialOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'monitor_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Monitor::model()->getMonitorOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'dongle_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Dongle::model()->getDongleOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'yeshuv_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Yeshuv::model()->getYeshuvOptions(), 'htmlOptions' => array()))); ?>
function getCommercialListByCity($param) { global $config; $id = intval($param['id']); if (isset($_SESSION['user_id']) && in_array($_SESSION['user_id'], $config['user_workers'])) { $is_editor = true; $h = '<th></th>'; } else { $is_editor = false; $h = ''; } if (!$is_editor) { $limit = 5; } else { $limit = 30; } $html = ' История продаж в этом населенном пункте:<br><br> <table class="table table-striped table-bordered table-condensed"><thead> <tr> <th>Дата</th><th>Цена (руб.)</th><th>Тип</th><th>Общ. пл.м<sup>2</sup></th><th>Описание</th><th>Сделка</th>' . $h . ' </tr></thead>'; $db_res = Commercial::getFullListLink("f.city_id={$id} AND (f.status=" . REALTY_STATUS_SALE . " OR f.status=" . REALTY_STATUS_RENT . ") GROUP BY f.id ORDER BY updated_on DESC LIMIT {$limit}"); while ($row = $db_res->fetchRow()) { $html .= '<tr>'; $date = formatDate($row['updated_on']); $t = $is_editor ? '<td><a href="/commercial.html?action=updateDate&id=' . $row['id'] . '" title="Обновить дату"><img src="/images/icon_update.png"></a></td>' : ''; $price = number_format($row['price'], 0); $description = textReduce($row['description']); $type = Commercial::$TYPE[$row['type_id']]; $type_sale = $row['status'] == REALTY_STATUS_SALE ? 'продажа' : 'аренда'; $html .= "<td><a href='/commercial.html?action=view&id={$row['id']}' title='смотреть'>{$date}</a></td><td>{$price}</td><td>{$type}</td><td>{$row['total_area']}</td><td>{$description}</td><td>{$type_sale}</td>{$t}"; $html .= '</tr>'; } $html .= '</table>'; if (isset($date)) { echo $html; } else { echo ''; } }
/* @var $this ScreenController */ /* @var $model Screen */ $this->breadcrumbs = array(Yii::t('screen', 'Screens') => array('index'), $model->name); $this->menu = array(array('label' => Yii::t('screen', 'List Screen'), 'url' => array('index')), array('label' => Yii::t('screen', 'Create Screen'), 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Update Screen'), 'url' => array('update', 'id' => $model->id), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Delete Screen'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Yii::t('default', 'Are you sure you want to delete this item?')), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Manage Screen'), 'url' => array('admin'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('ad', 'Create Ad'), 'url' => array('Ad/Create', 'screen_id' => $model->id))); ?> <h1> <?php echo Yii::t('screen', 'View Screen') . ' #' . $model->id; $admin = Yii::app()->user->checkAccess('Administrator'); if ($admin) { $this->widget('booster.widgets.TbButton', array('label' => Yii::t('screen', 'Display Screen'), 'id' => 'openDisplay', 'context' => 'primary', 'htmlOptions' => array('onclick' => 'js:window.open("' . Yii::app()->createUrl('display/' . $model->id) . '")', 'style' => 'float:left; margin-right:2px;'))); } $this->widget('booster.widgets.TbButton', array('context' => 'success', 'htmlOptions' => array('style' => 'float:left;'), 'tooltip' => true, 'tooltipOptions' => array('placement' => 'top', 'title' => Yii::t('screen', 'Update Messages in the display'), 'delay' => array('show' => 400, 'hide' => 500)), 'id' => 'screenRefresh', 'label' => Yii::t('screen', 'Refresh'), 'buttonType' => 'ajaxSubmit', 'url' => Yii::app()->createUrl('Ajax/screenRefresh'), 'ajaxOptions' => array('type' => 'POST', 'data' => array('screen_id' => $model->id), 'success' => 'function(data) { $("#screenRefresh").prop("disabled", true); }'))); ?> </h1> <?php $this->widget('booster.widgets.TbDetailView', array('type' => 'striped', 'data' => $model, 'attributes' => array('name', 'description', array('label' => Weather::model()->getAttributeLabel('Weather Area'), 'value' => empty($model->weatherCodes) ? null : $model->weatherCodes[0]->name_heb, 'visible' => $admin), array('label' => Theme::model()->getAttributeLabel('theme'), 'value' => empty($model->themes) ? null : $model->themes[0]->theme, 'visible' => $admin), array('label' => Commercial::model()->getAttributeLabel('id'), 'value' => empty($model->commercials) ? null : $model->commercials[0]->name, 'visible' => $admin), array('name' => 'monitor.name', 'visible' => $admin), array('name' => 'dongle.name', 'visible' => $admin), array('name' => 'yeshuv.name_heb', 'visible' => $admin), array('name' => 'url', 'visible' => $admin), array('name' => 'webkey_nickname', 'type' => 'raw', 'value' => CHtml::link($model->getAttribute('webkey_nickname'), 'http://webkey.cc/' . $model->getAttribute('webkey_nickname'), array('target' => '_blank')), 'visible' => $admin)))); ?> <br> <h1><?php echo Yii::t('screen', 'Screen Ads'); ?> </h1> <div class="clear"></div> <?php $this->widget('booster.widgets.TbListView', array('dataProvider' => $adDataProvider, 'itemView' => '/ad/_view', 'viewData' => array('screen_id' => $model->id)));
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Commercial the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Commercial::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('default', 'The requested page does not exist.')); } return $model; }
/** * Returns the List of Commercial Areas and Id to * Populate the drop down list. * * @return Commercial List */ public function getCommercialOptions() { return CHtml::listData(Commercial::model()->findAll(array('order' => 'name')), 'id', 'name'); }
function map($s) { $s->assign("lat",LAT_YOLA); $s->assign("lon",LON_YOLA); $s->assign("YANDEX_KEY",YANDEX_KEY); $ids = ''; $rooms = ''; $prices = ''; $prices_m = ''; $areas = ''; $addresses = ''; $storeys = ''; $dates = ''; $types = ''; $lons = ''; $lats = ''; $photos = ''; $icons = ''; if (!isset($_REQUEST['act']) || $_REQUEST['act']=='sales') { $status=REALTY_STATUS_SALE; } else { $status=REALTY_STATUS_RENT; } $res = _filter($status); $add_sql = "f.updated_on>'".getNextDate(date('Y-m-d'),-30)."' AND t.status=".REALTY_STATUS_ACTIVE.' AND '.$res['sql']; $db_res = Commercial::getFullListLink($add_sql); while ($row = $db_res->fetchRow()) { $ids .= $row['id'].','; $rooms .= $row['rooms'].','; $prices .= "'".number_format($row['price'],0)."',"; $prices_m .= "'".number_format($row['price_m'],0)."',"; $areas .= "'".$row['total_area']."',"; $addr = "{$row['street']}, {$row['tnum']}"; $addresses .= "'".$addr."',"; $date = explode(' ',$row['updated_on']); $ds = explode('-',$date[0]); $date = $ds[2].'.'.$ds[1].'.'.$ds[0]; $dates .= "'".$date."',"; $storeys .= "'".$row['storey']."/".$row['storeys']."',"; $types .= "'".Tenement::$TYPE[$row['ttype']]."',"; $lons .= "'".$row['lon']."',"; $lats .= "'".$row['lat']."',"; $photo = ($row['photo_tenement']!='') ? $row['tenement_id']."/".$row['photo_tenement']."_prev" : ''; $photos .= "'".$photo."',"; if ($row['price_m']<30000) { $color = 'a'; } else if ($row['price_m']<40000) { $color = 'b'; } else { $color = 'c'; } $ri = ($row['rooms']<4) ? $row['rooms'] : 3; $icons .= "'".$ri."k".$color."',"; } $s->assign("ids",$ids); $s->assign("rooms",$rooms); $s->assign("prices",$prices); $s->assign("prices_m",$prices_m); $s->assign("areas",$areas); $s->assign("addresses",$addresses); $s->assign("storeys",$storeys); $s->assign("dates",$dates); $s->assign("types",$types); $s->assign("lons",$lons); $s->assign("lats",$lats); $s->assign("photos",$photos); $s->assign("icons",$icons); $block_html = Html::getBlock('Квартиры на продажу на карте Йошкар-Олы',Html::pageCommercialMap()); $s->assign("block_html",$block_html); $s->display("commercial_map.tpl"); }