public function testDelete() { $this->resetRoomDetailsTable(); $roomDetails = new RoomDetails(); $roomDetails->setAttributes(array('roomid' => 1, 'description' => 'A single room with sea views')); $roomDetails->save(); $this->assertTrue($roomDetails->delete()); }
$this->breadcrumbs = array('Room Details' => array('index'), 'Manage'); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="247" valign="top"> <?php $this->renderPartial('/settings/hostel_left'); ?> </td> <td valign="top"> <div class="cont_right"> <h1>Manage Room Details</h1> <div class="pdtab_Con"> <?php $bedinfo = RoomDetails::model()->findAll(); if ($bedinfo != NULL) { ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" > <tr class="pdtab-h"> <td align="center">Room No</td> <td align="center">Floor</td> <td align="center">Bed No</td> <td align="center">Available</td> </tr> <?php foreach ($bedinfo as $bed_info) { ?> <tr> <td align="center"><?php echo $bed_info->room_no;
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = RoomDetails::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->errorSummary($model); if (Yii::app()->controller->action->id == 'create') { $bed_no_1 = ''; $floor_no = ''; if (isset($_REQUEST['id']) && !isset($_REQUEST['bed_no'])) { $bed_no = RoomDetails::model()->findAll('status=:x ORDER BY id ASC', array(':x' => 'C')); if ($bed_no == NULL) { $bed_no_1 = ''; $floor_no = ''; } else { $bed_no_1 = $bed_no[0]['bed_no']; $floor_no = $bed_no[0]['no_of_floors']; } } else { if (isset($_REQUEST['id']) && isset($_REQUEST['bed_no'])) { $room = RoomDetails::model()->findByAttributes(array('bed_no' => $_REQUEST['bed_no'])); $floor_no = $room->no_of_floors; $bed_no_1 = $_REQUEST['bed_no']; } } } ?> <div class="row"> <?php echo $form->labelEx($model, 'Floor'); ?> <?php echo CHtml::dropDownList('floor', '', CHtml::listData(Floor::model()->findAll(), 'id', 'floor_no'), array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/room/allot'), 'update' => '#bed', 'data' => 'js:$(this).serialize()'))); ?> </div>