add all files
This commit is contained in:
+685
@@ -0,0 +1,685 @@
|
||||
<?php
|
||||
class Service_model extends CI_Model {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function createService($serviceArray){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('INSERT INTO services (
|
||||
service_type,
|
||||
service_category_no,
|
||||
service_category_en,
|
||||
service_category_hu,
|
||||
service_name_no,
|
||||
service_name_en,
|
||||
service_name_hu,
|
||||
service_description_no,
|
||||
service_description_en,
|
||||
service_description_hu,
|
||||
service_price,
|
||||
service_time,
|
||||
service_category_id,
|
||||
is_enabled
|
||||
) VALUES(
|
||||
"'.$serviceArray['service_type'].'",
|
||||
"'.$serviceArray['service_category_no'].'",
|
||||
"'.$serviceArray['service_category_en'].'",
|
||||
"'.$serviceArray['service_category_hu'].'",
|
||||
"'.$serviceArray['service_name_no'].'",
|
||||
"'.$serviceArray['service_name_en'].'",
|
||||
"'.$serviceArray['service_name_hu'].'",
|
||||
"'.$serviceArray['service_description_no'].'",
|
||||
"'.$serviceArray['service_description_en'].'",
|
||||
"'.$serviceArray['service_description_hu'].'",
|
||||
"'.$serviceArray['service_price'].'",
|
||||
"'.$serviceArray['service_time'].'",
|
||||
"'.$serviceArray['service_category_id'].'",
|
||||
"'.$serviceArray['is_enabled'].'"
|
||||
);');
|
||||
}
|
||||
|
||||
public function createServiceCategory($serviceCategoryArray){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('INSERT INTO service_categories (
|
||||
serv_cat_slug,
|
||||
serv_cat_name
|
||||
) VALUES(
|
||||
"'.$serviceCategoryArray['serv_cat_slug'].'",
|
||||
"'.$serviceCategoryArray['serv_cat_name'].'"
|
||||
);');
|
||||
}
|
||||
|
||||
public function updateService($service_id, $serviceArray){
|
||||
$this->load->database();
|
||||
|
||||
foreach($serviceArray as $propertyKey => $propertyValue){
|
||||
$query = $this->db->query('UPDATE services SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
|
||||
}
|
||||
}
|
||||
|
||||
public function updateServiceCategory($service_category_id, $serviceCategoryArray){
|
||||
$this->load->database();
|
||||
|
||||
foreach($serviceCategoryArray as $propertyKey => $propertyValue){
|
||||
$query = $this->db->query('UPDATE service_categories SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_category_id = "'.$service_category_id.'";');
|
||||
}
|
||||
}
|
||||
|
||||
public function createWorker($workerArray){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('INSERT INTO workers (
|
||||
worker_name,
|
||||
worker_profile_img,
|
||||
worker_info,
|
||||
is_beauty,
|
||||
is_barber,
|
||||
service_category_id
|
||||
) VALUES(
|
||||
"'.$workerArray['worker_name'].'",
|
||||
"'.$workerArray['worker_profile_img'].'",
|
||||
"'.$workerArray['worker_info'].'",
|
||||
"'.$workerArray['is_beauty'].'",
|
||||
"'.$workerArray['is_barber'].'",
|
||||
"'.$workerArray['service_category_id'].'"
|
||||
);');
|
||||
}
|
||||
|
||||
public function updateWorker($worker_id, $workerArray){
|
||||
$this->load->database();
|
||||
|
||||
foreach($workerArray as $propertyKey => $propertyValue){
|
||||
$query = $this->db->query('UPDATE workers SET '.$propertyKey.' = "'.$propertyValue.'" WHERE worker_id = "'.$worker_id.'";');
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBooking($booking_id, $bookingArray){
|
||||
$this->load->database();
|
||||
|
||||
foreach($bookingArray as $propertyKey => $propertyValue){
|
||||
$query = $this->db->query("UPDATE bookings SET ".$propertyKey." = '".$propertyValue."' WHERE booking_id = '".$booking_id."';");
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllServiceByServiceType($service_type, $lang){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE service_type = "'.$service_type.'" AND services.is_enabled = "1" AND services.is_deleted != "1" ORDER BY service_id ASC;');
|
||||
$serviceArray = array();
|
||||
if($query->num_rows() > 0){
|
||||
foreach($query->result() as $resultItem){
|
||||
|
||||
$service_category = '';
|
||||
$service_name = '';
|
||||
$service_description = '';
|
||||
|
||||
switch($lang){
|
||||
case 'no':
|
||||
$service_category = $resultItem->service_category_no;
|
||||
$service_name = $resultItem->service_name_no;
|
||||
$service_description = $resultItem->service_description_no;
|
||||
break;
|
||||
case 'en':
|
||||
$service_category = $resultItem->service_category_en;
|
||||
$service_name = $resultItem->service_name_en;
|
||||
$service_description = $resultItem->service_description_en;
|
||||
break;
|
||||
case 'hu':
|
||||
$service_category = $resultItem->service_category_hu;
|
||||
$service_name = $resultItem->service_name_hu;
|
||||
$service_description = $resultItem->service_description_hu;
|
||||
break;
|
||||
}
|
||||
|
||||
$resultItemTmp = array(
|
||||
'service_id' => $resultItem->service_id,
|
||||
'service_type' => $resultItem->service_type,
|
||||
'service_category' => $service_category,
|
||||
'service_name' => $service_name,
|
||||
'service_description' => $service_description,
|
||||
'service_price' => $resultItem->service_price,
|
||||
'service_time' => $resultItem->service_time,
|
||||
'serv_cat_slug' => $resultItem->serv_cat_slug,
|
||||
'service_category_id' => $resultItem->service_category_id
|
||||
);
|
||||
|
||||
$serviceArray[] = (object)$resultItemTmp;
|
||||
}
|
||||
}
|
||||
return $serviceArray;
|
||||
}
|
||||
|
||||
public function getServiceById($service_id){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result()[0];
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getServiceCategoryById($service_category_id){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM service_categories WHERE service_category_id = "'.$service_category_id.'" LIMIT 1;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result()[0];
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllServices(){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE services.is_deleted != "1" ORDER BY service_type ASC, service_name_hu ASC;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllServiceCategories(){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM service_categories WHERE is_deleted != "1" ORDER BY service_category_id;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result();
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAvailableServices(){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM services WHERE is_enabled = "1" AND is_deleted != "1" ORDER BY service_name_hu ASC;');
|
||||
|
||||
if($query->num_rows() > 0){
|
||||
|
||||
$serviceArray = array();
|
||||
foreach($query->result() as $resultItem){
|
||||
$serviceTmp = array(
|
||||
'service_name' => $resultItem->service_name_hu.' ('.$resultItem->service_type.')',
|
||||
'service_id' => $resultItem->service_id
|
||||
);
|
||||
|
||||
$serviceArray[] = $serviceTmp;
|
||||
}
|
||||
return $serviceArray;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllWorkers(){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" ORDER BY worker_name ASC;');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getWorkersByCategorySlug($serv_cat_slug){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" AND serv_cat_slug = "'.$serv_cat_slug.'" ORDER BY worker_name ASC;');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getActiveWorkers($subpage = ''){
|
||||
$this->load->database();
|
||||
$subpageString = '';
|
||||
|
||||
if($subpage == 'beauty'){
|
||||
$subpageString = ' AND is_beauty = "1"';
|
||||
}
|
||||
else if($subpage == 'barber'){
|
||||
$subpageString = ' AND is_barber = "1"';
|
||||
}
|
||||
else{
|
||||
$subpageString = '';
|
||||
}
|
||||
|
||||
$query = $this->db->query('SELECT * FROM workers WHERE is_active = "1" '.$subpageString.' AND is_deleted != "1" ORDER BY worker_name ASC;');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function deleteBooking($booking_id){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('DELETE FROM bookings WHERE booking_id = "'.$booking_id.'";');
|
||||
}
|
||||
|
||||
public function getAllBookings(){
|
||||
$this->load->database();
|
||||
$this->load->model('Service_model');
|
||||
|
||||
$query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id ORDER BY booking_date DESC, booking_start_time ASC;');
|
||||
|
||||
if($query->num_rows() > 0){
|
||||
$resultsArray = array();
|
||||
foreach($query->result() as $resultItem){
|
||||
$resultTmp = (array)$resultItem;
|
||||
if($resultTmp['service_ids'] != ''){
|
||||
$servicesArray = unserialize($resultTmp['service_ids']);
|
||||
if(is_array($servicesArray)){
|
||||
$services = array();
|
||||
foreach($servicesArray as $servicesArrayItem){
|
||||
$selectedService = $this->Service_model->getServiceById($servicesArrayItem);
|
||||
$services[] = (object)array(
|
||||
'service_type' => $selectedService->service_type,
|
||||
'service_name' => $selectedService->service_name_hu,
|
||||
'service_price' => $selectedService->service_price,
|
||||
'service_time' => $selectedService->service_time
|
||||
);
|
||||
}
|
||||
$resultTmp['services'] = $services;
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
|
||||
}
|
||||
$resultsArray[] = (object)$resultTmp;
|
||||
}
|
||||
|
||||
|
||||
return $resultsArray;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getActualBookings(){
|
||||
$this->load->database();
|
||||
$this->load->model('Service_model');
|
||||
|
||||
$query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() ORDER BY booking_date DESC, booking_start_time ASC;');
|
||||
|
||||
if($query->num_rows() > 0){
|
||||
$resultsArray = array();
|
||||
foreach($query->result() as $resultItem){
|
||||
$resultTmp = (array)$resultItem;
|
||||
if($resultTmp['service_ids'] != ''){
|
||||
$servicesArray = unserialize($resultTmp['service_ids']);
|
||||
if(is_array($servicesArray)){
|
||||
$services = array();
|
||||
foreach($servicesArray as $servicesArrayItem){
|
||||
$selectedService = $this->Service_model->getServiceById($servicesArrayItem);
|
||||
$services[] = (object)array(
|
||||
'service_type' => $selectedService->service_type,
|
||||
'service_name' => $selectedService->service_name_hu,
|
||||
'service_price' => $selectedService->service_price,
|
||||
'service_time' => $selectedService->service_time
|
||||
);
|
||||
}
|
||||
$resultTmp['services'] = $services;
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
|
||||
}
|
||||
$resultsArray[] = (object)$resultTmp;
|
||||
}
|
||||
|
||||
|
||||
return $resultsArray;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getActualBookingsByWorkerID($workerID){
|
||||
$this->load->database();
|
||||
$this->load->model('Service_model');
|
||||
|
||||
$query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() AND bookings.worker_id = "'.$workerID.'" ORDER BY booking_date DESC, booking_start_time ASC;');
|
||||
|
||||
if($query->num_rows() > 0){
|
||||
$resultsArray = array();
|
||||
foreach($query->result() as $resultItem){
|
||||
$resultTmp = (array)$resultItem;
|
||||
if($resultTmp['service_ids'] != ''){
|
||||
$servicesArray = unserialize($resultTmp['service_ids']);
|
||||
if(is_array($servicesArray)){
|
||||
$services = array();
|
||||
foreach($servicesArray as $servicesArrayItem){
|
||||
$selectedService = $this->Service_model->getServiceById($servicesArrayItem);
|
||||
$services[] = (object)array(
|
||||
'service_type' => $selectedService->service_type,
|
||||
'service_name' => $selectedService->service_name_hu,
|
||||
'service_price' => $selectedService->service_price,
|
||||
'service_time' => $selectedService->service_time
|
||||
);
|
||||
}
|
||||
$resultTmp['services'] = $services;
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$resultTmp['services'] = array();
|
||||
|
||||
}
|
||||
$resultsArray[] = (object)$resultTmp;
|
||||
}
|
||||
|
||||
|
||||
return $resultsArray;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBookingById($booking_id){
|
||||
$this->load->database();
|
||||
$this->load->model('Service_model');
|
||||
|
||||
$query = $this->db->query('SELECT * FROM bookings WHERE booking_id = "'.$booking_id.'" LIMIT 1;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result()[0];
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getWorkerById($worker_id){
|
||||
$this->load->database();
|
||||
$query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
|
||||
if($query->num_rows() > 0){
|
||||
return $query->result()[0];
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
|
||||
$this->load->database();
|
||||
$serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
|
||||
$service_length_time = strtotime($servicelength);
|
||||
$availableTimeArray = array();
|
||||
$selectedDayName = date('D', strtotime($selectedDate));
|
||||
$dayStartTime = new DateTime($selectedDate.' 10:00');
|
||||
$finishTime = new DateTime($selectedDate.' 18:00');
|
||||
$lastBookingLimitDate = date('Y-m-d', strtotime("+3 months", strtotime(date('Y-m-d'))));
|
||||
|
||||
if($selectedDayName == 'Sun'){
|
||||
return array();
|
||||
}
|
||||
elseif($selectedDayName == 'Sat'){
|
||||
$finishTime = new DateTime($selectedDate.' 16:00');
|
||||
}
|
||||
else{
|
||||
//finish time - selected service length
|
||||
$finishTime = new DateTime($selectedDate.' 18:00');
|
||||
|
||||
}
|
||||
|
||||
$today=date_create(date('Y-m-d'));
|
||||
$selectedDay=date_create($selectedDate);
|
||||
$dateDiff=date_diff($today,$selectedDay);
|
||||
|
||||
$tmpDateStart = date_create(date('2024-02-29'));
|
||||
$tmpDateEnd = date_create(date('2024-03-07'));
|
||||
|
||||
$datelength = new DateTime($servicelength);
|
||||
$diff = $datelength->diff($finishTime);
|
||||
|
||||
//max time for start
|
||||
$maxTime = $diff->h.':'.$diff->i.':00';
|
||||
$hours = (intval($diff->h)-10)*4+1;
|
||||
$mins = floor(intval($diff->i) / 15);
|
||||
$loopSteps = intval($hours) + intval($mins);
|
||||
|
||||
for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
|
||||
$minutes_to_add_start = $periodIndex*15;
|
||||
$minutes_to_add_end = ($periodIndex+1)*15;
|
||||
$startTime = new DateTime($selectedDate.' 09:45');
|
||||
$endTime = new DateTime($selectedDate.' 09:45');
|
||||
$startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
|
||||
$endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
|
||||
$maxTimeObject = new DateTime($maxTime);
|
||||
|
||||
$tz = new DateTimeZone('Europe/Budapest');
|
||||
$addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
|
||||
$addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
|
||||
$addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
|
||||
|
||||
$currentStartTime = $startTime->format('H:i:00');
|
||||
$currentEndTime = $endTime->format('H:i:00');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
echo '<< ';
|
||||
print_r($serviceLengthDateTime->format('H:i:00'));
|
||||
echo ' / ';
|
||||
print_r($currentStartTime);
|
||||
echo ' / ';
|
||||
print_r($addStartTimeAndLength->format('H:i:00'));
|
||||
echo ' >>';
|
||||
*/
|
||||
/*
|
||||
$query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
|
||||
|
||||
(TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
|
||||
(TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
|
||||
(TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
|
||||
(TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
|
||||
AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
|
||||
|
||||
|
||||
(TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
|
||||
AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
|
||||
|
||||
|
||||
(TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
|
||||
);
|
||||
');
|
||||
*/
|
||||
|
||||
|
||||
$query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
|
||||
/*start later and finish before*/
|
||||
(TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
/*check if not end service until next booking*/
|
||||
(TIME(booking_start_time) < CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
/*start later and finish later*/
|
||||
(TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) < CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
|
||||
|
||||
/*start before and finish before*/
|
||||
(TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
|
||||
AND TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME)) OR
|
||||
|
||||
/**/
|
||||
(TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)
|
||||
AND TIME(booking_finish_time) > CAST("'.$currentStartTime.'" AS TIME)) OR
|
||||
|
||||
/**/
|
||||
(TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
|
||||
);
|
||||
');
|
||||
|
||||
$now = strtotime(date('H:i:s')) + 60*60;
|
||||
$timezone = 'Europe/Budapest';
|
||||
$todayStartTime = strtotime($currentStartTime.' '.$timezone);
|
||||
$minDiff = ($todayStartTime - $now) / 60;
|
||||
|
||||
if($lastBookingLimitDate >= $selectedDate){
|
||||
if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
|
||||
if($query->num_rows() == 0){
|
||||
$availableTimeArray[] = $currentStartTime;
|
||||
}
|
||||
}
|
||||
|
||||
elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
|
||||
if($query->num_rows() == 0){
|
||||
$availableTimeArray[] = $currentStartTime;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $availableTimeArray;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function createBooking($bookingArray){
|
||||
$this->load->database();
|
||||
$query = $this->db->query("INSERT INTO bookings (
|
||||
guest_name,
|
||||
guest_email,
|
||||
guest_phone,
|
||||
worker_id,
|
||||
booking_date,
|
||||
booking_start_time,
|
||||
booking_finish_time,
|
||||
service_ids,
|
||||
guest_confirmed,
|
||||
guest_confirm_code
|
||||
) VALUES(
|
||||
'".$bookingArray['guest_name']."',
|
||||
'".$bookingArray['guest_email']."',
|
||||
'".$bookingArray['guest_phone']."',
|
||||
'".$bookingArray['worker_id']."',
|
||||
'".$bookingArray['booking_date']."',
|
||||
'".$bookingArray['booking_start_time']."',
|
||||
'".$bookingArray['booking_finish_time']."',
|
||||
'".$bookingArray['service_ids']."',
|
||||
'".$bookingArray['guest_confirmed']."',
|
||||
'".$bookingArray['guest_confirm_code']."'
|
||||
);");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user