예제 #1
1
			<h1>Danh bạ khách sạn</h1>
		</div><!--/.page-header-->
		<div class="row-fluid">
			<div class="span12">
				<a href="<?php 
echo PIUrl::createUrl('/admin/hotel/create/');
?>
" class="btn btn-primary">
					<i class="icon-ok bigger-110"></i>
					<?php 
echo translate('Thêm');
?>
				</a>
				<form method="post">
					<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'hotel-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'htmlOptions' => array(), 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'emptyText' => 'Không có kết quả hiển thị', 'selectableRows' => 2, 'summaryText' => 'Hiển thị {start} - {end} của {count} kết quả ', 'columns' => array(array('id' => 'id', 'class' => 'CCheckBoxColumn'), array('header' => 'STT', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), 'image' => array('name' => 'image', 'type' => 'raw', 'filter' => false, 'value' => 'CHtml::image(getImage($data->image,"80", "60" ))', 'htmlOptions' => array("class" => "image")), 'name', 'type' => array('name' => 'type', 'type' => 'raw', 'filter' => CHtml::dropDownList('Hotel[type]', '', Hotel::model()->getTypeHotel()), 'value' => 'Hotel::model()->getType($data->type)'), 'pro.title' => array('name' => 'provinces', 'type' => 'raw', 'value' => 'isset($data->pro->title) ? $data->pro->title :  ""', 'filter' => CHtml::dropDownList('Hotel[provinces]', '', Provinces::model()->getData())), 'ward.title' => array('name' => 'wards', 'type' => 'raw', 'value' => 'isset($data->ward->title) ? $data->ward->title :  ""', 'filter' => CHtml::dropDownList('Hotel[wards]', '', Wards::model()->getData())), 'address' => array('name' => 'address', 'type' => 'raw', 'value' => '$data->address', 'filter' => false), array('header' => '<input type="button" name="deleteAll" class="deleteAll btn btn-mini btn-danger icon-trash bigger-120" value="Xóa" />', 'class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('update' => array('options' => array('class' => 'btn btn-mini btn-info icon-edit bigger-120', 'title' => 'Sửa tin tức'), 'imageUrl' => false, 'label' => false), 'delete' => array('label' => false, 'options' => array('class' => 'btn btn-mini btn-danger icon-trash bigger-120', 'title' => 'Xóa tin tức'), 'imageUrl' => false)), 'deleteConfirmation' => 'Bạn có muốn xóa tin tức này không?'))));
?>
			</form>	
			</div><!--/.span-->
		</div><!--/.row-fluid-->
	</div><!--/.page-content-->
</div><!--/.main-content-->
<style>
.grid-view .filters input, .grid-view .filters select {
    width: 92%;
}
.image img{
	width:80px;
	height:60px;
}
.btn-info{margin-right:3px;}
예제 #2
0
 /**
  * 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 Hotel the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Hotel::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
0
 /**
  * 查看酒店
  */
 public function ActionViewHotel()
 {
     $hotel_id = trim(Yii::app()->request->getParam('hotel_id'));
     // 获取酒店ID
     if (!empty($hotel_id) && intval($hotel_id) > 0) {
         $hotel_data = Hotel::model()->findByPk($hotel_id);
         // 根据酒店ID 获取酒店信息
         $area = AreaManage::getAreaByCityid($hotel_data['CityId']);
         // 根据酒店所在城市ID 获取酒店所在的的 大洲/国家/城市
         // 获取酒店图
         $hotel_picture = HotelPicture::model()->findAllByAttributes(array('Hotel_Id' => $hotel_data->Id, 'SizeType' => '2'));
         // 跳转至查看页
         $this->render('view_hotel', array('hotel_data' => $hotel_data, 'area' => $area, 'hotel_picture' => $hotel_picture));
     } else {
         Yii::app()->user->setFlash('message', '参数错误');
         $this->redirect(Yii::app()->createUrl('Hotel/HotelList'));
     }
 }
예제 #4
0
 public function actionGetHotelByCity()
 {
     $city = isset($_POST['city']) ? $_POST['city'] : '';
     $city = addcslashes($city, '%_');
     $Criteria = new CDbCriteria(array('condition' => "city LIKE :city", 'params' => array(':city' => "%{$city}")));
     $hotelModel = Hotel::model()->findAll($Criteria);
     $result = array();
     $hotel_data = array();
     if ($hotelModel) {
         foreach ($hotelModel as $record) {
             $new_hotel = new Hotel();
             $new_hotel->id = $record->id;
             $new_hotel->name = $record->name;
             $new_hotel->address = $record->address;
             $new_hotel->city = $record->city;
             $new_hotel->longitude = $record->longitude;
             $new_hotel->latitude = $record->latitude;
             array_push($hotel_data, $new_hotel);
         }
         $result['response'] = true;
         $result['message'] = "Successfull";
     } else {
         //echo '{"message":"Invalid Username/Password"}';
         $result['response'] = true;
         $result['message'] = "Failure";
     }
     $result['hotels'] = $hotel_data;
     header('Content-type: application/json');
     echo CJSON::encode($result);
     foreach (Yii::app()->log->routes as $route) {
         if ($route instanceof CWebLogRoute) {
             $route->enabled = false;
             // disable any weblogroutes
         }
     }
 }
예제 #5
0
<div class="col-md-12 hotel">
    <input type="hidden" class="hotel" value="<?php 
echo $i;
?>
">

    <div class="col-md-9">

        <?php 
echo $form->dropDownListGroup($hotel, 'hotel_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Hotel::model()->findAllByAttributes(array('ciudad_id' => $ciudad)), 'id', 'nombre'), 'htmlOptions' => array('id' => 'Hotel_' . $i . '_hotel_id', 'name' => 'Hotel[' . $i . '][hotel_id]', 'prompt' => 'Seleccione Hotel'))));
?>
    </div>
    <?php 
echo $form->hiddenField($hotel, 'id', array('name' => 'Hotel[' . $i . '][id]'));
?>
    <input type="hidden" name="Hotel[<?php 
echo $i;
?>
][ciudad_id]'" value="<?php 
echo $ciudad;
?>
">

</div>