public function orderTimeRange() { if ($this->opening_status !== '1') { return NULL; } $time_format = $this->CI->config->item('time_format') ? $this->CI->config->item('time_format') : '%h:%i %a'; $time_interval = $this->order_type === '1' ? $this->deliveryTime() : $this->collectionTime(); $start_time = mdate('%H:%i', strtotime($this->current_time) + $time_interval * 60); $time_range = array(); $order_times = time_range($this->openingTime(), $this->lastOrderTime(), $time_interval); // retrieve the location delivery times from location library foreach ($order_times as $key => $value) { // loop through delivery times // check if current time is within location opening hour if (strtotime($value) > strtotime($start_time) and $this->CI->config->item('future_orders') !== '1') { $time_range[$value] = mdate($time_format, strtotime($value)); } else { if (strtotime($value) > strtotime($start_time) and $this->CI->config->item('future_orders') === '1') { $time_range[$value] = mdate($time_format, strtotime($value)); } } } return $time_range; }
$code[] = '<div id="wall_response" class="wall_posting" style="display: none;">' . $lang['global.posting'] . '</div>'; if ($comments) { $code[] = '<div id="comments_delimiter" style="display:none;"></div>'; foreach ($comments as $comment) { $photo = $comment['photo'] == '' ? 'nopic-' . $comment['gender'] . '.gif' : $comment['photo']; $username = $comment['username']; $code[] = '<div id="wall_comment_' . $comment['wall_id'] . '" class="col-xs-12 m-t-15">'; $code[] = '<div class="row">'; $code[] = '<div class="pull-left">'; $code[] = '<a href="' . $config['BASE_URL'] . '/user/' . $username . '">'; $code[] = '<img src="' . $config['BASE_URL'] . '/media/users/' . $photo . '" title="' . $username . '" alt="' . $username . '" class="img-responsive comment-avatar" />'; $code[] = '</a>'; $code[] = '</div>'; $code[] = '<div class="comment">'; $code[] = '<div class="comment-info">'; $code[] = '<a href="' . $config['BASE_URL'] . '/user/' . $username . '">' . $username . '</a> - <span class="font-10">' . time_range($comment['addtime']) . '</span>'; $code[] = '</div>'; $code[] = '<div class="comment-body overflow-hidden">' . nl2br($comment['message']) . '</div>'; if ($uid) { $code[] = '<div class="comment-actions">'; if ($comment['UID'] == $uid) { $code[] = '<a href="#delete_comment" id="delete_comment_wall_' . $comment['wall_id'] . '_' . $oid . '">' . $lang['global.delete'] . '</a> <span id="delete_response_' . $comment['wall_id'] . '" style="display: none;"></span>'; } if ($comment['UID'] != $uid) { $code[] = '<span id="reported_spam_' . $comment['wall_id'] . '_' . $oid . '"><a href="#report_spam" id="report_spam_wall_' . $comment['wall_id'] . '_' . $oid . '">' . $lang['global.report_spam'] . '</a></span>'; } $code[] = '</div>'; } $code[] = '</div>'; $code[] = '<div class="clearfix"></div>'; $code[] = '</div>';
public function findATable($find = array()) { if (!isset($find['location']) or !isset($find['guest_num']) or empty($find['reserve_date']) or empty($find['reserve_time']) or empty($find['time_interval'])) { return 'NO_ARGUMENTS'; } if (!($available_tables = $this->getLocationTablesByMinCapacity($find['location'], $find['guest_num']))) { return 'NO_TABLE'; } $find['reserve_date_time'] = strtotime($find['reserve_date'] . ' ' . $find['reserve_time']); $find['unix_start_time'] = strtotime('-' . $find['time_interval'] * 2 . ' mins', $find['reserve_date_time']); $find['unix_end_time'] = strtotime('+' . $find['time_interval'] * 2 . ' mins', $find['reserve_date_time']); $time_slots = time_range(mdate('%H:%i', $find['unix_start_time']), mdate('%H:%i', $find['unix_end_time']), $find['time_interval'], '%H:%i'); $reserve_time_slot = array_flip($time_slots); $reserved_tables = $this->getReservedTableByDate($find, array_keys($available_tables)); foreach ($reserved_tables as $reserved) { // remove available table if already reserved if (isset($available_tables[$reserved['table_id']])) { unset($available_tables[$reserved['table_id']]); } // remove reserve time slot if already reserved $reserve_time = mdate('%H:%i', strtotime($reserved['reserve_date'] . ' ' . $reserved['reserve_time'])); if (isset($reserve_time_slot[$reserve_time])) { unset($reserve_time_slot[$reserve_time]); } } if (empty($available_tables) or empty($reserve_time_slot)) { return 'FULLY_BOOKED'; } return array('table_found' => $available_tables, 'time_slots' => array_flip($reserve_time_slot)); }
$end_num = $pagination->getEndItem(); $code[] = '<div class="blinkp">'; $code[] = $lang['global.showing'] . ' <strong>' . $start_num . '</strong> ' . $lang['global.to'] . ' <strong>' . $end_num . '</strong> ' . $lang['global.of'] . ' <strong>' . $total . '</strong> ' . $lang['global.comments'] . '.'; $code[] = '</div>'; if ($comments) { $code[] = '<div class="pagination"><ul>' . $page_link . '</ul></div>'; $code[] = '<div id="comments_delimiter" style="display:none;"></div>'; foreach ($comments as $comment) { $photo = $comment['photo'] == '' ? 'nopic-' . $comment['gender'] . '.gif' : $comment['photo']; $username = $comment['username']; $code[] = '<div id="wall_comment_' . $oid . '_' . $comment['wall_id'] . '">'; $code[] = '<div id="delete_response_' . $comment['wall_id'] . '" class="response" style="display: none;"></div>'; $code[] = '<div class="comment">'; $code[] = '<div class="comment_left"><a href="' . $config['BASE_URL'] . '/user/' . $username . '"><img src="' . $config['BASE_URL'] . '/media/users/' . $photo . '" width="60" title="' . $username . '" alt="' . $username . '" /></a></div>'; $code[] = '<div class="comment_right">'; $code[] = '<div class="comment_info"><a href="' . $config['BASE_URL'] . '/user/' . $username . '">' . $username . '</a> <strong>-</strong> <span class="font-10">' . time_range($comment['addtime']) . '</span></div>'; $code[] = '<p class="comment_body">' . nl2br(htmlspecialchars($comment['message'], ENT_QUOTES, 'UTF-8')) . '</p>'; if ($uid) { $code[] = '<div class="comment_actions">'; if ($comment['UID'] == $uid) { $code[] = '<a href="#delete_comment" id="delete_comment_wall_' . $comment['wall_id'] . '_' . $oid . '">' . $lang['global.delete'] . '</a> <strong>·</strong>'; } $code[] = '<span id="reported_spam_' . $comment['wall_id'] . '_' . $oid . '"><a href="#report_spam" id="report_spam_wall_' . $comment['wall_id'] . '_' . $oid . '">' . $lang['global.report_spam'] . '</a></span>'; $code[] = '</div>'; } $code[] = '</div>'; $code[] = '<div class="clear"></div>'; $code[] = '</div>'; $code[] = '</div>'; } $code[] = '<div class="pagination"><ul>' . $page_link_b . '</ul></div>';
$code[] = '<div class="thumb-overlay">'; $code[] = '<img src="' . get_thumb_url($video['VID']) . '/' . $video['thumb'] . '.jpg" title="' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '" alt="' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '" id="rotate_' . $video['VID'] . '_' . $video['thumbs'] . '_' . $video['thumb'] . '" ' . $img_class . ' />'; if ($video['type'] == 'private') { $code[] = '<div class="label-private">' . $lang['global.PRIVATE'] . '</div>'; } if ($video['hd'] == 1) { $code[] = '<div class="hd-text-icon">HD</div>'; } $code[] = '<div class="duration">'; $code[] = duration($video['duration']); $code[] = '</div>'; $code[] = '</div>'; $code[] = '<span class="video-title title-truncate m-t-5">' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '</span>'; $code[] = '</a>'; $code[] = '<div class="video-added">'; $code[] = time_range($video['addtime']); $code[] = '</div>'; $code[] = '<div class="video-views pull-left">'; $views = $video['viewnumber'] == '1' ? $lang['global.view'] : $lang['global.views']; $code[] = $video['viewnumber'] . ' ' . $views; $code[] = '</div>'; if ($video['rate'] == 0 && $video[dislikes] == 0) { $rate_class = 'no-rating"'; $rate_icon = '<i class="fa fa-heart video-rating-heart no-rating"></i> <b>-</b>'; } else { $rate_class = ''; $rate_icon = '<i class="fa fa-heart video-rating-heart"></i> <b>' . $video['rate'] . '%</b>'; } $code[] = '<div class="video-rating pull-right ' . $rate_class . '">'; $code[] = $rate_icon; $code[] = '</div>';
private function getFormData($order_data, $data = array()) { if ($this->input->post('checkout_step')) { $data['checkout_step'] = $this->input->post('checkout_step'); } else { if (isset($order_data['checkout_step'])) { $data['checkout_step'] = $order_data['checkout_step']; // retrieve customer first name from session data } else { $data['checkout_step'] = 'one'; } } if ($this->input->post('first_name')) { $data['first_name'] = $this->input->post('first_name'); } else { if (isset($order_data['first_name'])) { $data['first_name'] = $order_data['first_name']; // retrieve customer first name from session data } else { if ($this->customer->getFirstName()) { $data['first_name'] = $this->customer->getFirstName(); // retrieve customer first name from customer library } else { $data['first_name'] = ''; } } } if ($this->input->post('last_name')) { $data['last_name'] = $this->input->post('last_name'); } else { if (isset($order_data['last_name'])) { $data['last_name'] = $order_data['last_name']; // retrieve customer last name from session data } else { if ($this->customer->getLastName()) { $data['last_name'] = $this->customer->getLastName(); // retrieve customer last name from customer library } else { $data['last_name'] = ''; } } } if ($this->input->post('email')) { $data['email'] = $this->input->post('email'); } else { if (isset($order_data['email'])) { $data['email'] = $order_data['email']; // retrieve customer email from session data } else { if ($this->customer->getEmail()) { $data['email'] = $this->customer->getEmail(); // retrieve customer email address from customer library } else { $data['email'] = ''; } } } if ($this->input->post('telephone')) { $data['telephone'] = $this->input->post('telephone'); } else { if (isset($order_data['telephone'])) { $data['telephone'] = $order_data['telephone']; // retrieve telephone from session data } else { if ($this->customer->getTelephone()) { $data['telephone'] = $this->customer->getTelephone(); // retrieve customer telephone from customer library } else { $data['telephone'] = ''; } } } $local_info = $this->session->userdata('local_info'); if ($this->input->post('order_type')) { $data['order_type'] = $this->input->post('order_type'); // retrieve order_type value from $_POST data if set } else { if (isset($order_data['order_type'])) { $data['order_type'] = $order_data['order_type']; // retrieve order_type from session data } else { if (isset($local_info['order_type'])) { $data['order_type'] = $local_info['order_type']; } else { $data['order_type'] = '1'; } } } if ($this->input->post('order_time')) { $data['order_time'] = $this->input->post('order_time'); // retrieve order_time value from $_POST data if set } else { if (isset($order_data['order_time'])) { $data['order_time'] = $order_data['order_time']; // retrieve order_type from session data } else { $data['order_time'] = ''; } } if ($this->input->post('address_id')) { $data['address_id'] = $this->input->post('address_id'); // retrieve existing_address value from $_POST data if set } else { if (isset($order_data['address_id'])) { $data['address_id'] = $order_data['address_id']; // retrieve existing_address from session data } else { if ($this->customer->getAddressId()) { $data['address_id'] = $this->customer->getAddressId(); // retrieve customer default address id from customer library } else { $data['address_id'] = ''; } } } if ($this->config->item('country_id')) { $country_id = $this->config->item('country_id'); // retrieve country_id from config settings } if ($this->input->post('address')) { $addresses = $this->input->post('address'); // retrieve address value from $_POST data if set } else { if ($this->customer->islogged()) { $addresses = $this->Addresses_model->getAddresses($this->customer->getId()); // retrieve customer addresses array from getAddresses method in Customers model } else { if (!empty($order_data['address_id'])) { $addresses = array($this->Addresses_model->getGuestAddress($order_data['address_id'])); // retrieve customer addresses array from getAddresses method in Customers model } } } if (empty($addresses)) { $addresses = array(array('address_id' => '', 'address_1' => '', 'address_2' => '', 'city' => '', 'state' => '', 'postcode' => '', 'country_id' => $country_id)); } $data['addresses'] = array(); if ($addresses) { foreach ($addresses as $address) { // loop through customer addresses arrary if (empty($address['country'])) { $country = $this->Countries_model->getCountry($address['country_id']); $address['country'] = !empty($address['country']) ? $address['country'] : $country['country_name']; } $data['addresses'][] = array('address_id' => isset($address['address_id']) ? $address['address_id'] : NULL, 'address_1' => $address['address_1'], 'address_2' => $address['address_2'], 'city' => $address['city'], 'state' => $address['state'], 'postcode' => $address['postcode'], 'country_id' => $address['country_id'], 'address' => $this->country->addressFormat($address)); } } if ($this->input->post('comment')) { $data['comment'] = $this->input->post('comment'); // retrieve comment value from $_POST data if set } else { if (isset($order_data['comment'])) { $data['comment'] = $order_data['comment']; // retrieve comment from session data } else { $data['comment'] = ''; } } if ($this->input->post('payment')) { $data['payment'] = $this->input->post('payment'); // retrieve comment value from $_POST data if set } else { if (isset($order_data['payment'])) { $data['payment'] = $order_data['payment']; // retrieve comment from session data } else { $data['payment'] = ''; } } if ($this->config->item('checkout_terms') > 0) { $data['checkout_terms'] = str_replace(root_url(), '/', site_url('pages?popup=1&page_id=' . $this->config->item('checkout_terms'))); } else { $data['checkout_terms'] = FALSE; } if ($this->input->ip_address()) { $data['ip_address'] = $this->input->ip_address(); // retrieve ip_address value if set } $data['countries'] = array(); $results = $this->Countries_model->getCountries(); // retrieve countries array from getCountries method in locations model foreach ($results as $result) { // loop through crountries array $data['countries'][] = array('country_id' => $result['country_id'], 'name' => $result['country_name']); } $time_format = $this->config->item('time_format') ? $this->config->item('time_format') : '%h:%i %a'; $current_time = $this->location->currentTime(); // retrieve the location current time from location library $data['delivery_times'] = array(); $data['asap_time'] = mdate('%H:%i', strtotime($current_time) + $this->location->deliveryTime() * 60); if (strtotime($current_time) > strtotime($this->location->openingTime())) { $delivery_times = time_range($this->location->openingTime(), $this->location->lastOrderTime(), $this->location->deliveryTime()); // retrieve the location delivery times from location library foreach ($delivery_times as $key => $value) { // loop through delivery times if (strtotime($value) > strtotime($data['asap_time']) or $this->config->item('future_orders') === '1') { $data['delivery_times'][$value] = mdate($time_format, strtotime($value)); } } } $local_payments = $this->location->payments(); $data['payments'] = array(); $payments = $this->extension->getAvailablePayments(); foreach (sort_array($payments) as $code => $payment) { if (!empty($local_payments) and !in_array($payment['code'], $local_payments)) { continue; } $data['payments'][] = $payment; } return $data; }
} else { $img_class = 'class="img-responsive"'; } $code[] = '<div class="col-sm-6 col-md-3 col-lg-3">'; $code[] = '<div class="well well-sm m-b-0 m-t-20">'; $code[] = '<a href="' . $config['BASE_URL'] . '/game/' . $game['GID'] . '/' . prepare_string($game['title']) . '">'; $code[] = '<div class="thumb-overlay">'; $code[] = '<img src="' . $config['BASE_URL'] . '/media/games/tmb/' . $game['GID'] . '.jpg" title="' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '" alt="' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '" ' . $img_class . ' />'; if ($game['type'] == 'private') { $code[] = '<div class="label-private">' . $lang['global.PRIVATE'] . '</div>'; } $code[] = '</div>'; $code[] = '<span class="game-title title-truncate m-t-5">' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '</span>'; $code[] = '</a>'; $code[] = '<div class="game-added">'; $code[] = time_range($game['addtime']); $code[] = '</div>'; $code[] = '<div class="game-views pull-left">'; $views = $game['total_plays'] == '1' ? $lang['global.play'] : $lang['global.plays']; $code[] = $game['viewnumber'] . ' ' . $views; $code[] = '</div>'; if ($game['rate'] == 0 && $game[dislikes] == 0) { $rate_class = 'no-rating"'; $rate_icon = '<i class="fa fa-heart video-rating-heart no-rating"></i> <b>-</b>'; } else { $rate_class = ''; $rate_icon = '<i class="fa fa-heart video-rating-heart"></i> <b>' . $game['rate'] . '%</b>'; } $code[] = '<div class="game-rating pull-right ' . $rate_class . '">'; $code[] = $rate_icon; $code[] = '</div>';
public function index() { $this->load->model('Reservations_model'); $this->load->library('location'); // load the location library $this->lang->load('reservation_module/reservation_module'); if (!file_exists(EXTPATH . 'reservation_module/views/reservation_module.php')) { //check if file exists in views folder show_404(); // Whoops, show 404 error page! } $this->template->setStyleTag(extension_url('reservation_module/views/stylesheet.css'), 'reservation-module-css', '154000'); $this->template->setStyleTag(base_url('assets/js/datepicker/datepicker.css'), 'datepicker-css', '124000'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-datepicker.js"), 'bootstrap-datepicker-js', '12000'); $this->template->setStyleTag(base_url('assets/js/datepicker/bootstrap-timepicker.css'), 'bootstrap-timepicker-css', '124440'); $this->template->setScriptTag(base_url("assets/js/datepicker/bootstrap-timepicker.js"), 'bootstrap-timepicker-js', '12550'); if ($this->config->item('reservation_mode') !== '1') { $this->alert->set('alert', $this->lang->line('alert_reservation_disabled')); redirect('home'); } $date_format = $this->config->item('date_format') ? $this->config->item('date_format') : '%d %M %y'; $time_format = $this->config->item('time_format') ? $this->config->item('time_format') : '%h:%i %a'; if (strpos($time_format, '%h') !== FALSE) { $data['time_format'] = '12hr'; $time_format = '%g:%i %A'; } else { $data['time_format'] = '24hr'; $time_format = '%H:%i'; } if (strpos($date_format, 'm') === 1) { $data['date_format'] = 'month_first'; $date_format = '%m-%d-%Y'; } else { if (strpos($date_format, 'Y') === 1) { $data['date_format'] = 'year_first'; $date_format = '%Y-%m-%d'; } else { $data['date_format'] = 'day_first'; $date_format = '%d-%m-%Y'; } } $data['current_url'] = page_url() . '?action=find_table&'; $data['reset_url'] = site_url('reservation'); $data['find_table_action'] = 'find_table'; if ($this->input->get() and ($response = $this->findTable()) !== FALSE) { if ($this->input->get('action') === 'select_time' and $this->input->get('selected_time')) { $data['find_table_action'] = 'view_summary'; $data['current_url'] = page_url() . '?action=select_time&'; } else { $data['find_table_action'] = 'select_time'; $data['current_url'] = page_url() . '?action=select_time&'; } } $data['locations'] = array(); $locations = $this->Locations_model->getLocations(); foreach ($locations as $location) { $data['locations'][] = array('id' => $location['location_id'], 'name' => $location['location_name']); } $data['guest_numbers'] = array('2', '3', '4', '5', '6', '7', '8', '9', '10'); $data['location_image'] = $this->location->getImage(); if ($this->input->get('location')) { $data['location_id'] = $this->input->get('location'); $data['current_url'] .= 'location=' . $data['location_id'] . '&'; } else { $data['location_id'] = $this->location->getId(); } if ($this->input->get('guest_num')) { $data['guest_num'] = $this->input->get('guest_num'); $data['current_url'] .= 'guest_num=' . $data['guest_num'] . '&'; } else { $data['guest_num'] = ''; } if ($this->input->get('reserve_date')) { $data['date'] = $this->input->get('reserve_date'); $data['current_url'] .= 'reserve_date=' . urlencode($data['date']) . '&'; } else { $data['date'] = mdate($date_format, strtotime('+1 day', time())); } if ($this->input->get('selected_time')) { $data['time'] = mdate($time_format, strtotime($this->input->get('selected_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { if ($this->input->get('reserve_time')) { $data['time'] = mdate($time_format, strtotime($this->input->get('reserve_time'))); $data['current_url'] .= 'reserve_time=' . urlencode($data['time']) . '&'; } else { $data['time'] = ''; } } $data['reservation_times'] = array(); $start_time = mdate('%H:%i', strtotime($this->location->openingTime()) + $this->location->getReservationInterval() * 60); $reservation_times = time_range($start_time, $this->location->closingTime(), $this->location->getReservationInterval()); // retrieve the location delivery times from location library foreach ($reservation_times as $key => $value) { // loop through delivery times $data['reservation_times'][$value] = mdate($time_format, strtotime($value)); } $data['time_slots'] = array(); if (!empty($response['time_slots'])) { for ($i = 0; $i < 5; $i++) { if (isset($response['time_slots'][$i])) { $time = mdate($time_format, strtotime($response['time_slots'][$i])); $data['time_slots'][$i]['state'] = ''; $data['time_slots'][$i]['time'] = $time; } else { $data['time_slots'][$i]['state'] = 'disabled'; $data['time_slots'][$i]['time'] = '--'; } } } $data['reservation_alert'] = $this->alert->display('reservation_module'); $this->load->view('reservation_module/reservation_module', $data); }
public function orderTimeRange() { if ($this->isClosed() or !$this->checkOrderType()) { return NULL; } if ($this->order_type === '1') { $order_type = 'delivery'; $time_interval = $this->deliveryTime(); } else { $order_type = 'collection'; $time_interval = $this->collectionTime(); } $days_in_advance = $this->hasFutureOrder() ? $this->futureOrderDays($order_type) : '0'; $start_date = mdate("%d-%m-%Y", strtotime("-1 day", $this->current_time)); $end_date = mdate("%d-%m-%Y", strtotime("+{$days_in_advance} day", $this->current_time)); $working_hours = isset($this->working_hours[$this->location_id]) ? $this->working_hours[$this->location_id] : array(); $working_hours = $this->parseWorkingHours($order_type, $start_date, $end_date, $working_hours); $count = 1; $order_times = array(); foreach ($working_hours as $date => $hour) { if ($hour['open'] > $hour['close']) { $hour['close'] = $hour['close'] + 86400; } $start_time = mdate("%d-%m-%Y %H:%i", $hour['open'] + $time_interval * 60); $end_time = mdate("%d-%m-%Y %H:%i", $hour['close'] - $this->local_info['last_order_time'] * 60); $time_ranges = time_range($start_time, $end_time, $time_interval, "%d-%m-%Y %H:%i"); array_pop($time_ranges); foreach ($time_ranges as $time) { if (strtotime($time) >= $this->current_time + $time_interval * 60) { if ($hour['working_status'] === 'open' and $count === 1) { $order_times['asap'] = $time; } else { $dt = mdate('%d-%m-%Y', strtotime($time)); $hr = mdate('%H', strtotime($time)); $order_times[$dt][$hr][] = mdate('%i', strtotime($time)); } $count++; } } } return $order_times; }