miniCal
Search…
⌃K

Room Helper Functions

The helper you can use to create, delete, get and update Room details in the company.

function add_room($room) {.....}

Supported hooks

Filter name: before_add_room Description: This filter would be executed before add room into the database in add_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_add_room’, ‘before_room_tax_callback_fun’, 10, 1 );
function before_add_room_callback_fun($room) {
// code
}
Filter name: should_add_room Description: This filter would be executed before add room into database in add_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_add_room’, ‘should_add_room_callback_fun’, 10, 1 );
function should_add_room_callback_fun($room) {
// code
}
hook name: pre.add.room Description: This hook would be executed before add room into the database in add_room helper. Usage:
// The filter callback function is based on the filter.
add_action('pre.add.room', 'pre_add_room_callback_fun', 10, 1);
function pre_add_room_callback_fun($room) {
// code
}
hook name: post.add.room Description: This hook would be executed after add room into the database in add_room helper. Usage:
// The filter callback function is based on the filter.
add_action('post.add.room', 'post_add_room_callback_fun', 10, 1);
function post_add_room_callback_fun($tax) {
// code
}
Usage
// for use room helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/room');
// add a new room in room table. you can only add a new room if your number_of_rooms capacity not full in company.
$room_id = add_room($room);
Request Parameters
Parameters in array format includes following attributes:
Param
Type
Required
Default
Description
room_name
Character
Yes
Null
The room_name of a specific room.
room_type_id
Integer
Yes
0
The room_type_id for a specific room.
sort_order
Integer
Yes
0
The sort_order for a specific room.
status
Character
Yes
Clean
The room status for a specific room.
group_id
Integer
0
The group_id for a specific room.
floor_id
Integer
0
The floor_id for a specific room.
location_id
Integer
0
The location_id for a specific room.
score
Integer
0
The score for a specific room.
instructions
Text
Null
The instructions for a specific room.
can_be_sold_online
Integer
1
The can_be_sold_online for a specific room.
notes
Text
Null
The notes for a specific room.
company_id
Integer
Yes
Null
The company_id for specific room.
Response
Response includes the following attributes:
if data have been added successfully it would return the key of specific room id.
return $room_id;
if data does not add it will return null.

function get_room($room_id) {....}

Supported hooks

Filter name: before_get_room Description: This filter would be executed before retrieving room details from database in get_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_get_room’, ‘before_get_room_callback_fun’, 10, 1 );
function before_get_room_callback_fun($room_id) {
// code
}
Filter name: should_get_room Description: This filter would be executed before retrieving room details from database in get_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_get_room’, ‘should_get_room_callback_fun’, 10, 1 );
function should_get_room_callback_fun($room_id) {
// code
}
hook name: pre.get.room Description: This hook would be executed before retrieving room details from database in get_room helper. Usage:
// The filter callback function is based on the filter.
add_action('pre.get.room', 'pre_get_room_callback_fun', 10, 1);
function pre_get_room_callback_fun($room_id) {
// code
}
hook name: post.get.room Description: This hook would be executed after retrieving room details from database in get_room helper. Usage:
// The filter callback function is based on the filter.
add_action('post.get.room', 'post_get_room_callback_fun', 10, 1);
function post_get_room_callback_fun($room_id) {
// code
}
Usage
// Retrieves room data based on a room_id.
$room_data = get_room($room_id);
Request Parameters
Param
Type
Required
Default
Description
$room_id
Integer
Yes
Null
The primary id of the room corresponds to the room table
Response
// $response array includes following attributes:
// $response['room_name'] : the room_name of specific room.
// $response['room_type_id'] : the room_type_id for specific room.
// $response['sort_order'] : the sort_order for specific room.
// $response['status'] : the status for specific room.
// $response['company_id'] : the company_id for specific room.
// $response['room_type_name'] : the room_type_name for specific room.
// $response['can_be_sold_online'] : the can_be_sold_online for specific room.
// and many more attributes for table room and join with room type table.
// Successfully response giving you array of room data.
Array
(
[room_name] => 101
[room_type_id] => 2
[status] => Clean
[notes] =>
[room_id] => 11
[is_deleted] => 0
[company_id] => 1
[can_be_sold_online] => 1
[group_id] => 0
[floor_id] => 0
[location_id] => 0
[sort_order] => 0
[is_hidden] => 0
[score] => 0
[instructions] =>
[id] => 2
[name] => Sample Room Type
[acronym] => SRT
[max_occupancy] => 6
[min_occupancy] => 1
[max_adults] => 2
[max_children] => 1
[image_group_id] => 5
[description] =>
[ota_close_out_threshold] => 1
[sort] => 0
[default_room_charge] => 1
[prevent_inline_booking] => 0
[room_type_name] => Sample Room Type
)
// if there is no room data for any room id provided in input or any error will return null.

function get_rooms($filter) {.....}

Supported hooks
Filter name: before_get_rooms Description: This filter would be executed before retrieving room details from database in get_rooms helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_get_rooms’, ‘before_get_rooms_callback_fun’, 10, 1 );
function before_get_rooms_callback_fun($filter) {
// code
}
Filter name: should_get_rooms Description: This filter would be executed before retrieving room details from database in get_rooms helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_get_rooms’, ‘should_get_rooms_callback_fun’, 10, 1 );
function should_get_rooms_callback_fun($filter) {
// code
}
hook name: pre.get.rooms Description: This hook would be executed before retrieving room details from database in get_rooms helper. Usage:
// The filter callback function is based on the filter.
add_action('pre.get.rooms', 'pre_get_rooms_callback_fun', 10, 1);
function pre_get_rooms_callback_fun($filter) {
// code
}
hook name: post.get.rooms Description: This hook would be executed after retrieving room details from database in get_rooms helper. Usage:
// The filter callback function is based on the filter.
add_action('post.get.rooms', 'post_get_rooms_callback_fun', 10, 1);
function post_get_rooms_callback_fun($filter) {
// code
}
Usage
// Retrieves room data based on a filter array.
$room_data = get_rooms($filter);
Request Parameters
parameter array filter required for room details.
Param
Type
Required
Default
Description
room_name
Character
Yes
Null
The room_name for a specific room.
company_id
Integer
Yes
Null
The company_id for specific room.
room_type_id
Integer
yes
Null
The room_type_id for specific room.
Response
// $response array includes following attributes:
// $response['room_name'] : the room_name of specific room.
// $response['room_type_id'] : the room_type_id for specific room.
// $response['sort_order'] : the sort_order for specific room.
// $response['status'] : the status for specific room.
// $response['company_id'] : the company_id for specific room.
// $response['room_type_name'] : the room_type_name for specific room.
// $response['can_be_sold_online'] : the can_be_sold_online for specific room.
// and many more attributes for table room and join with room type table.
// Successfully response giving you array of room data.
Array
(
[0] => Array
(
[room_name] => 101
[room_type_id] => 2
[status] => Clean
[notes] =>
[room_id] => 11
[is_deleted] => 0
[company_id] => 1
[can_be_sold_online] => 1
[group_id] => 0
[floor_id] => 0
[location_id] => 0
[sort_order] => 0
[is_hidden] => 0
[score] => 0
[instructions] =>
[id] => 2
[name] => Sample Room Type
[acronym] => SRT
[max_occupancy] => 6
[min_occupancy] => 1
[max_adults] => 2
[max_children] => 1
[image_group_id] => 5
[description] =>
[ota_close_out_threshold] => 1
[sort] => 0
[default_room_charge] => 1
[prevent_inline_booking] => 0
)
)
// if there is no room data for filter provided in input or any error will return null.

function update_room($room, $room_id) {....}

Usage
// update room data based on a update data and room_id.
update_room($room, $room_id);
Supported hooks
Filter name: before_update_room Description: This filter would be executed before update room into the database in update_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_update_room’, ‘before_update_room_callback_fun’, 10, 1 );
function before_update_room_callback_fun($room, $room_id) {
// code
}
Filter name: should_update_room Description: This filter would be executed before update room into database in update_room helper. Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_update_room’, ‘should_update_room_callback_fun’, 10, 1 );
function should_update_room_callback_fun($room, $room_id) {
// code
}
hook name: pre.update.room Description: This hook would be executed before update room into the database in update_room helper. Usage:
// The filter callback function is based on the filter.
add_action('pre.update.room', 'pre_update_room_callback_fun', 10, 1);
function pre_update_room_callback_fun($room, $room_id) {
// code
}
hook name: post.update.room Description: This hook would be executed after update room into the database in update_room helper. Usage:
// The filter callback function is based on the filter.
add_action('post.update.room', 'post_update_room_callback_fun', 10, 1);
function post_update_room_callback_fun($room, $room_id) {
// code
}
Request Parameters
Request required room_id and array format data includes following attributes:
Param
Type
Required
Default
Description
room_id
Integer
Yes
Null
The room_id primary key of a specific room.
room_name
Character
Yes
Null
The room_name of a specific room.
room_type_id
Integer
Yes
0
The room_type_id for a specific room.
sort_order
Integer
Yes
0
The sort_order for a specific room.
status
Character
Yes
Clean
The room status for a specific room.
group_id
Integer
0
The group_id for a specific room.
floor_id
Integer
0
The floor_id for a specific room.
location_id
Integer
0
The location_id for a specific room.
score
Integer
0
The score for a specific room.
instructions
Text
Null
The instructions for a specific room.
can_be_sold_online
Integer
1
The can_be_sold_online for a specific room.
notes
Text
Null
The notes for a specific room.
company_id
Integer
Yes
Null
The company_id for specific room.
Response
Response return mixed Either true or null if room data is updated then true else null.

function delete_room($room_id) {.....}

Usage
// delete a room data from the room table. it's a soft delete process only status will change data still existing in the backend database.
delete_room($room_id);
Request Parameters
Param
Type
Required
Default
Description
$room_id
integer
yes
null
The id of the room corresponds to the room table
Response
Response return mixed Either true or null if room data is deleted then true
else null.