本文整理汇总了PHP中Room::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::model方法的具体用法?PHP Room::model怎么用?PHP Room::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSearchRebuild
/**
* On rebuild of the search index, rebuild all space records
*
* @param type $event
*/
public static function onSearchRebuild($event)
{
foreach (Room::model()->findAll() as $obj) {
if ($obj->visibility != Space::VISIBILITY_NONE) {
Yii::app()->search->add($obj);
}
}
}
示例2: deleteRoom
public function deleteRoom($id)
{
$result = Room::model()->findByAttributes(array('id' => $id));
$result->status = '0';
if ($result->save()) {
$data = array('code' => 200, 'message' => 'SUCCESS');
}
return $data;
}
示例3: getInfo
/**
* This is method for getInfo
* @param [int] roomId
* @return [array] {
* code:200,
* mes:'',
* data:{
* roomId:1221,
* roomName:'',
* floor:3,
* seats:8,
* pic:'http://q.qlogo.cn/qqapp/1104566934/4F54EC3310FD140F55B1BCC91A06C328/100',
* doneTime:[1,2,3,48],(every part instead half hour)
* }
* }
*/
public function getInfo()
{
$data = Room::model()->findByAttributes(array('id' => $this->roomId, 'hubId' => $this->location, 'status' => 1));
if ($data) {
$my = self::mySelect($this->date, $this->userId, $this->roomId, $this->location);
$other = self::otherSelect($this->date, $this->userId, $this->roomId, $this->location);
$value = array('info' => $data, 'my' => $my, 'other' => $other);
return array('code' => '200', 'mes' => '', 'data' => $value);
} else {
return '';
}
}
示例4: actionDeleteall
public function actionDeleteall($id)
{
$hostel = Hosteldetails::model()->findByAttributes(array('id' => $id));
$hostel->is_deleted = '1';
$hostel->save();
$floor = Floor::model()->findAllByAttributes(array('hostel_id' => $id));
foreach ($floor as $floor1) {
$room = Room::model()->findAllByAttributes(array('floor' => $floor1->id));
foreach ($room as $room1) {
$allot = Allotment::model()->findAllByAttributes(array('room_no' => $room1->id));
foreach ($allot as $allot1) {
$allot1->delete();
$floor1->delete();
$room1->delete();
}
}
}
$this->redirect(array('manage'));
}
示例5: getRoom
/**
* Returns the current selected space by parameter guid
*
* If space doesnt exists or there a no permissions and exception
* will thrown.
*
* @return Room
* @throws CHttpException
*/
public function getRoom()
{
if ($this->room != null) {
return $this->room;
}
// Get Space GUID by parameter
$guid = Yii::app()->request->getQuery('sguid');
if ($guid == "") {
// Workaround for older version
$guid = Yii::app()->request->getQuery('guid');
}
// Try Load the room
$this->room = Room::model()->findByAttributes(array('guid' => $guid));
if ($this->room == null) {
throw new CHttpException(404, Yii::t('RoomsModule.behaviors_RoomsControllerBehavior', 'Room not found!'));
}
$this->checkAccess();
// Store current space to stash
Yii::app()->params['currentRoom'] = $this->room;
return $this->room;
}
示例6: parseUrl
public function parseUrl($manager, $request, $pathInfo, $rawPathInfo)
{
if (substr($pathInfo, 0, 2) == "s/") {
$parts = explode('/', $pathInfo, 3);
if (isset($parts[1])) {
$room = Room::model()->findByAttributes(array('guid' => $parts[1]));
if ($room !== null) {
$_GET['sguid'] = $room->guid;
if (!isset($parts[2]) || substr($parts[2], 0, 4) == 'home') {
$temp = 1;
return 'rooms/room/index' . str_replace('home', '', $parts[2], $temp);
} else {
return $parts[2];
}
} else {
throw new CHttpException('404', Yii::t('RoomsModule.components_RoomUrlRule', 'Room not found!'));
}
}
}
return false;
}
示例7: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new RoomDetails();
$room = Room::model()->findByAttributes(array('room_no' => $_REQUEST['id']));
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$cnt = '';
if (isset($_POST['RoomDetails'])) {
$roomdetails = RoomDetails::model()->findAllByAttributes(array('room_no' => $_POST['RoomDetails']['room_no']));
$cnt = count($roomdetails);
if ($cnt < $room->no_of_bed) {
$model->attributes = $_POST['RoomDetails'];
$model->status = 'C';
if ($model->save()) {
//$this->redirect(array('/RoomDetails/create/','id'=>$room->id));
$this->redirect(array('view', 'id' => $model->id));
}
$cnt++;
} else {
$this->redirect(array('/Room/error/'));
}
}
$this->render('create', array('model' => $model));
}
示例8: foreach
<td align="center"><?php
echo Yii::t('hostel', 'Room No');
?>
</td>
<td align="center"><?php
echo Yii::t('hostel', 'Availability');
?>
</td>
</tr>
<?php
if ($list == NULL) {
echo '<tr><td align="center" colspan="6"><strong>' . Yii::t('hostel', 'No data available') . '</strong></td></tr>';
} else {
foreach ($list as $list_1) {
$allot = Allotment::model()->findAllByAttributes(array('room_no' => $list_1->room_no));
$room = Room::model()->findByAttributes(array('id' => $list_1->room_no));
$floor = Floor::model()->findByAttributes(array('id' => $room->floor));
$hostel = Hosteldetails::model()->findByAttributes(array('id' => $floor->hostel_id));
?>
<tr>
<td align="center">
<?php
echo $hostel->hostel_name;
?>
<td align="center">
<?php
echo $floor->floor_no;
?>
</td>
<td align="center">
<?php
示例9: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin($room)
{
$model = new MacroControl('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['MacroControl'])) {
$model->attributes = $_GET['MacroControl'];
}
$model->room_id = $room;
$this->render('admin', array('model' => $model, 'mRoom' => Room::model()->findByPk($room)));
}
示例10: getRoomOptions
public static function getRoomOptions()
{
return CHtml::listData(Room::model()->findAll(), 'ID', 'Name');
}
示例11: loadModel
/**
* 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 Room the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Room::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例12:
?>
</div>
<div class="col-sm-3">
<?php
echo $form->textFieldGroup($model, 'number', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('number'), 'data-content' => $model->getAttributeDescription('number')]]]);
?>
</div>
<div class="col-sm-3">
<?php
echo $form->textFieldGroup($model, 'start_time', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('start_time'), 'data-content' => $model->getAttributeDescription('start_time')]]]);
?>
</div>
<div class="col-sm-3">
<?php
echo $form->textFieldGroup($model, 'end_time', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('end_time'), 'data-content' => $model->getAttributeDescription('end_time')]]]);
?>
</div>
<div class="col-sm-3">
<?php
echo $form->dropDownListGroup($model, 'room_id', ['widgetOptions' => ['data' => CHtml::listData(Room::model()->findAll(), 'id', 'id')]]);
?>
</div>
</div>
</fieldset>
<?php
$this->widget('bootstrap.widgets.TbButton', ['context' => 'primary', 'encodeLabel' => false, 'buttonType' => 'submit', 'label' => '<i class="fa fa-search"> </i> ' . Yii::t('ListnerModule.listner', 'Искать Расписание')]);
?>
<?php
$this->endWidget();
示例13: loadModel
/**
* Возвращает модель по указанному идентификатору
* Если модель не будет найдена - возникнет HTTP-исключение.
*
* @param integer идентификатор нужной модели
*
* @return void
*/
public function loadModel($id)
{
$model = Room::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Yii::t('BranchModule.branch', 'Запрошенная страница не найдена.'));
}
return $model;
}
示例14: array
echo $form->labelEx($model, 'Finish');
?>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'Finish', 'value' => $model->Finish, 'options' => array('changeYear' => true, 'yearRange' => '2000:2050', 'language' => 'es', 'dateFormat' => 'yy-mm-dd', 'monthNames' => array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"), 'monthNamesShort' => array("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"), 'dayNames' => array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"), 'dayNamesMin' => array('Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'), 'defaultDate' => $model->Finish, 'firstDay' => 1), 'htmlOptions' => array('placeholder' => 'yyyy-mm-dd', 'style' => 'width:100%;')));
?>
<?php
echo $form->error($model, 'Finish');
?>
</div>
<div class="row" style="width: 25%; float: left; margin-left: 5%;">
<?php
echo $form->labelEx($model, 'RoomID');
?>
<?php
echo $form->dropDownList($model, 'RoomID', CHtml::listData(Room::model()->findAll($criteria), 'ID', 'Name'), array('empty' => '-- Selecciona la habitacion --', 'style' => 'width: 100%;'));
?>
<?php
echo $form->error($model, 'RoomID');
?>
</div>
<div class="row" style="width: 18%; float: left; margin-left: 8%;">
<h1 style="font-size: 18pt !important;">Total: <span style="font-size: 28pt !important;" id="pvp">0</span>€</h1>
</div>
<div style="clear:both;"></div>
<div class="row" style="width: 15%; float: left;">
<?php
echo $form->labelEx($model, 'Pax');
示例15: afterSave
/**
* After Save Addons
*/
protected function afterSave()
{
if ($this->status != self::VISIBILITY_NONE) {
Yii::app()->search->update($this);
} else {
Yii::app()->search->delete($this);
}
$userId = $this->created_by;
if ($this->isNewRecord) {
// Create new wall record for this room
$wall = new Wall();
$wall->object_model = 'Room';
$wall->object_id = $this->id;
$wall->save();
$this->wall_id = $wall->id;
$this->wall = $wall;
Room::model()->updateByPk($this->id, array('wall_id' => $wall->id));
// Auto add creator as admin
$membership = new RoomMembership();
$membership->room_id = $this->id;
$membership->user_id = $userId;
$membership->status = RoomMembership::STATUS_MEMBER;
$membership->invite_role = 1;
$membership->admin_role = 1;
$membership->share_role = 1;
$membership->save();
$activity = new Activity();
$activity->content->created_by = $userId;
$activity->content->room_id = $this->id;
$activity->content->user_id = $userId;
$activity->content->visibility = Content::VISIBILITY_PUBLIC;
$activity->created_by = $userId;
$activity->type = "ActivityRoomCreated";
$activity->save();
$activity->fire();
}
Yii::app()->cache->delete('userRooms_' . $userId);
parent::afterSave();
}