setCspHeader(true); $this->frontoffice_parent_controller(); $this->load_language_frontoffice(); if (isset($_GET['preview_event'])) { Page::authorize(PAGE_CODE['events'], PRIVS[PAGE_CODE['events']]['preview_event'], true); } else { Response::showPage404('frontoffice'); } // Release the lock $this->check_instance_of_reservation_modal(); $this->load->model('event_model', '', true); $this->load->model('event_type_model', '', true); $this->load->model('event_city_location_model', '', true); $this->load->model('event_sponsor_assignee_model', '', true); $this->load->model('event_speaker_assignee_model', '', true); $this->load->model('personalization_model', '', true); $this->load->model('User_subscription_model', '', true); $this->load->model('event_payment_model', '', true); $this->load->model('event_video_model', '', true); $this->load->model('event_registration_model', '', true); $this->load->model('event_schedule_model', '', true); $this->load->model('event_registration_model','', true); $announcement = $this->personalization_model->getLatestAnnouncement(); $announcementID = @$announcement['id']; $announcementTitle = @$announcement['title']; $announcementContent = @$announcement['content']; $announcementCookie = 'announcement_cookie_'.@$announcement['cookie_char']; $this->data['announcement_id'] = $announcementID; $this->data['announcement_title'] = $announcementTitle; $this->data['announcement_content'] = $announcementContent; $this->data['announcement_cookie'] = $announcementCookie; $this->data['homepage_title'] = $this->personalization_model->get_homepage_title(); if (!isset($_COOKIE['eucookie'])) { $expire = time() + 86400; set_cookie('eucookie', 'eucookie', $expire); } if (!isset($_COOKIE[$announcementCookie])) { delete_cookie( $prefix = 'announcement_cookie_'); $expire = time() + 86400; set_cookie($announcementCookie, $announcementTitle, $expire); } $this->registration = new UserRegistration(); $this->profile = new ProfileDetails(); } public function index() { $this->home(); } public function home() { $this->load->model('user_login_history_model'); $this->load->model('event_moderation_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = (isset($new_banner['image']) && !empty($new_banner['image'])) ? $new_banner['image'] : ''; $this->data['content'] = 'frontoffice/home/homepage_view'; $this->data['page_title'] = "Les ateliers du Company For Madagascar : sélection d'ateliers et cours par la rédaction du Company For Madagascar"; $this->data['page_description'] = "Company For Madagascar propose une sélection d'ateliers et de cours organisés par la rédaction du Company For Madagascar"; $this->data['page_banner_bg'] = $banner; $this->data['page_banner_description'] = $white_label; $this->data['event_city'] = $this->event_city_location_model->home(); $this->data['past_events'] = []; $events = $this->event_model->get_selected_past_events(); /** past events */ /**Get the videos of past events */ if(count($events)>0) { $se = array(); foreach($events as $item) { $videoReserved = false; $event_item = (array)$item; $videos = $this->event_video_model->get_videos_by_event_id($item->event_id); $event_item['total_duration'] = $this->event_video_model->total_video_duration($videos); $sevs = array(); if(count($videos)>0) { foreach($videos as $video) { $video->duration = $this->event_video_model->format_video_duration($video->duration); array_push($sevs, (array)$video); } } if(UserAuth::isAuth() && ($item->workshop_session == 'ENLIGNE')) { $re = $this->event_registration_model->is_subscribed($this->data['logged_in']['user_id'], $item->event_id); if($re && $re->is_expired == 1) { $videoReserved = true; } } $event_item['video_reserved'] = $videoReserved; $event_item['event_videos'] = $sevs; array_push($se, (object)$event_item); } $this->data['past_events'] = $se; } /** end past events */ /** Only For SEO */ $this->data['event_seo'] = $this->event_model->filter_events("_default_", "1", "", "", "", "", "",""); /** end for SEO */ $event_type_data = $this->event_type_model->home(); $event_data = array(); foreach($event_type_data as $row) { $event_count = $this->event_model->count_workshop('type', $row->event_type_id, isset($this->data['logged_in']['user_id'])?$this->data['logged_in']['user_id']:NULL); if($event_count>0) { array_push($event_data, (object)array( 'event_type_id' => $row->event_type_id, 'event_type' =>$row->event_type, 'count' => $event_count )); } } $this->data['event_type'] =(object) $event_data; /** * Check if subscriber is already notified by the moderation feature or not */ $this->data['notifyUserABoutModerationFeature'] = false; $this->data['reservations'] = [ 'base' => [], 'sessions' => [] ]; if (UserAuth::isAuth()) { $this->load->model('user_subscriber_model', '', true); $this->data['notifyUserABoutModerationFeature'] = $this->user_subscriber_model->notifyUserABoutModerationFeature($this->data['logged_in']['user_id']); $subscription = $this->User_subscription_model->get_subscription($this->data['logged_in']['user_id']); if(!empty($subscription) && !is_null($subscription)) { $this->data['subscription'] = !is_null($subscription->expirationDate) && !is_null($subscription->transactionDateTime) ? 'enabled': 'disabled'; } if ($this->data['notifyUserABoutModerationFeature']) { $cur_sett = $this->event_moderation_model->getLatestModSettings(3, 0); $this->data['notifyUserABoutModerationFeature'] = (!count($cur_sett) || $cur_sett['gm_mod_stat'] == 0) ? false : true; } // Mes réservations tab data $this->data['reservations']['base'] = $this->event_payment_model->getActiveEventsPayment([ 'user_id' => $this->session->userdata('logged_in')['user_id'], //"DATEDIFF(end_date_time, NOW()) >=" => "0" ]); $events = array(); foreach($this->data['reservations']['base'] as $index => $r) { $event = (array)$r; $videoReserved = false; if($r->workshop_session =='ENLIGNE' || $r->workshop_session =='DISTANCE-PRESENTIEL'){ $videos = $this->event_video_model->get_videos_by_event_id($r->event_id); if($videos) { $event['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $event['total_videos'] = count($videos); $event["commencement_cours"] = $this->event_video_model->get_next_course_from_id($r->event_id)["live_video_start_date"]; } $re = $this->event_registration_model->is_subscribed($this->data['logged_in']['user_id'], $r->event_id); if($re) { $videoReserved = true; } } $event['video_reserved'] = $videoReserved; array_push($events, (object)$event); $this->data['reservations']['sessions'][$index] = $this->event_schedule_model->get_event_schedule($r->event_id); } $this->data['reservations']['base'] = $events; } $announcement = $this->personalization_model->getLatestAnnouncement(); $announcementID = @$announcement['id']; $announcementTitle = @$announcement['title']; $announcementContent = @$announcement['content']; $this->data['announcement_id'] = $announcementID; $this->data['announcement_title'] = $announcementTitle; $this->data['announcement_content'] = $announcementContent; $expire_announcement = $this->personalization_model->expireAnnouncement(); $this->data['expire_announcement'] = $expire_announcement; $this->load_extra_files(array( 'bootbox' => true, 'dotdotdot' => true, 'notify' => true, 'ga' => true, 'moment' => true, 'ajax_helper' => true, )); //load laguages array_push($this->data['load_scripts'], ''); if (UserAuth::isAuth()) { array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ''); } array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); // Changes start here array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); $this->data['load_styles'] = array( '' ); $this->load->view('frontoffice_view', $this->data); } public function my_account() { if (!UserAuth::isAuth()) redirect('home'); $user = null; if (Sso::isLoggedIn()) { $loggedIn = UserAuth::auth(); $user = $this->user_model->get_subscribers($loggedIn['user_id']); } $this->data['user'] = $user; $this->data['content'] = 'frontoffice/home/my_account_view'; $this->data['page_title'] = 'Mon Compte'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->load_extra_files(array( 'bootbox' => true, 'notify' => true, 'ajax_helper' => true )); //load laguages array_push($this->data['load_scripts'], ''); array_push($this->data['load_scripts'], ""); $this->load->view('frontoffice_view', $this->data); } public function my_reservations() { $this->data['content'] = 'frontoffice/home/my_reservation'; $this->data['page_title'] = 'Mes Réservations'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); // Mes réservations tab data $this->data['reservations'] = [ 'base' => [], 'sessions' => [] ]; $this->data['reservations']['base'] = $this->event_payment_model->getActiveEventsPayment([ 'user_id' => $this->session->userdata('logged_in')['user_id'], //"DATEDIFF(end_date_time, NOW()) >=" => "0" ]); $events = array(); foreach($this->data['reservations']['base'] as $index => $r) { $event = (array)$r; if($r->workshop_session =='ENLIGNE'){ $videos = $this->event_video_model->get_videos_by_event_id($r->event_id); if($videos) { $event['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $event['total_videos'] = count($videos); $event["commencement_cours"] = $this->event_video_model->get_next_course_from_id($r->event_id)["live_video_start_date"]; } } array_push($events, (object)$event); $this->data['reservations']['sessions'][$index] = $this->event_schedule_model->get_event_schedule($r->event_id); } $this->data['reservations']['base'] = $events; // Mon historique tab data $this->data['reservations_history'] = [ 'base' => [], 'sessions' => [] ]; $this->data['reservations_history']['base'] = $this->event_payment_model->getPastEventsPayment([ 'user_id' => $this->session->userdata('logged_in')['user_id'], "DATEDIFF(end_date_time, NOW()) <" => "0" ]); $historyEvents = array(); foreach($this->data['reservations_history']['base'] as $index => $r) { if($r->workshop_session =='DISTANCE-PRESENTIEL' && $r->registration_type == 'soir-distance' && $r->is_expired == 1) { break; } else { $event = (array)$r; if($r->workshop_session =='ENLIGNE' || $r->workshop_session =='DISTANCE-PRESENTIEL'){ $videos = $this->event_video_model->get_videos_by_event_id($r->event_id); if($videos) { $event['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $event['total_videos'] = count($videos); $event["commencement_cours"] = $this->event_video_model->get_next_course_from_id($r->event_id)["live_video_start_date"]; } } array_push($historyEvents, (object)$event); $this->data['reservations_history']['sessions'][$index] = $this->event_schedule_model->get_event_schedule($r->event_id); } } $this->data['reservations_history']['base'] = $historyEvents; $this->load->view('frontoffice_view', $this->data); } public function cours_en_ligne_achat($event_id = null) { if (!UserAuth::isAuth() || $event_id == null) redirect('home'); $event = $this->event_model->get_event_details($event_id); if((!isset($event) || is_null($event)) && $event->workshop_session != 'ENLIGNE') redirect('home'); $this->data['event'] = $event; /** Check if user has current subscription on this video workshop */ $user_id = $this->session->userdata('logged_in')['user_id']; if (Sso::isLoggedIn()) { $loggedIn = UserAuth::auth(); $user_id = $loggedIn['user_id']; } $re = $this->event_registration_model->is_subscribed($user_id, $event_id); if(!isset($re) || is_null($re)) redirect('home'); //$this->load->model('event_video_model'); $videos = $this->event_video_model->get_videos_by_event_id($event_id); $this->data['event_videos'] = array(); $this->data['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $this->data["commencement_cours"] = $this->event_video_model->get_next_course_from_id($event_id)["live_video_start_date"]; $this->data['total_videos'] = count($videos); foreach($videos as $video) { $video->duration = $this->event_video_model->format_video_duration($video->duration); array_push($this->data['event_videos'], $video); } $this->data['content'] = 'frontoffice/home/cours_en_ligne_achat_view'; $this->data['page_title'] = 'Cours en ligne achat'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', ); $this->data['load_scripts'] = array( "" ); $this->load->view('frontoffice_view', $this->data); } public function in_development() { $this->data['content'] = 'in_development_view'; $this->data['page_title'] = 'In Development'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->load->view('frontoffice_view', $this->data); } public function event_details(string $event_id = null) { if(!empty($event_id)) $_GET['event_id'] = $event_id; $this->data['content'] = 'frontoffice/home/event_details_view'; // $this->data['page_title'] = 'Event Details'; // $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', '' ); //$this->load->view('frontoffice_view', $this->data); if (!isset($_GET['event_id']) || empty($_GET['event_id']) || !is_numeric($_GET['event_id'])) { show_404(); } else { if(!UserAuth::isAuth()) { $this->set_event_cookie($_GET['event_id']); } $logged_in = UserAuth::isAuth(); $this->load->model('event_author_works_model'); $this->load->model('event_venue_photos_model'); $this->load->model('event_comment_model'); //$this->load->model('event_video_model'); $this->data['include_archived_events'] = (!isset($_GET['hs']) || empty($_GET['hs']) || strtolower($_GET['hs']) !== 'true') ? false : true; $event_id = $this->input->get('event_id'); $event = $this->event_model->event_details($event_id); // if(UserAuth::isPremium() == true && $event->event_id != EVENT_ID && $event->discounted_price > 0) { // $event->event_rate = $event->discounted_price; // } $similar_events = $this->event_model->get_similar_events(json_decode($event->similar_events)); $event->similar_events = []; /**Get the videos of similar events */ if(count($similar_events)>0) { $se = array(); foreach($similar_events as $item) { $videoReserved = false; $event_item = (array)$item; $videos = $this->event_video_model->get_videos_by_event_id($item['event_id']); $event_item['total_duration'] = $this->event_video_model->total_video_duration($videos); $sevs = array(); if(count($videos)>0) { foreach($videos as $video) { $video->duration = $this->event_video_model->format_video_duration($video->duration); array_push($sevs, (array)$video); } } if($logged_in && $item['workshop_session'] == 'ENLIGNE') { $re = $this->event_registration_model->is_subscribed($this->data['logged_in']['user_id'], $item['event_id']); if($re && $re->is_expired == 1) { $videoReserved = true; } } $event_item['video_reserved'] = $videoReserved; $event_item['event_videos'] = $sevs; array_push($se, $event_item); } $event->similar_events = $se; } $works = $this->event_author_works_model->get_works_by_event_id($event_id); $venue_photos = $this->event_venue_photos_model->get_venue_photos_by_event_id($event_id); $comments = $this->event_comment_model->get_formatted_comments_by_event_id($event_id); $event_videos = $this->event_video_model->get_videos_by_event_id($event_id); if($event->workshop_session == 'DISTANCE-PRESENTIEL') { $event = $this->event_model->format_night_class_prices($event); } else { $registration = $this->event_registration_model->count_total_reserved_seats($event_id); $event->remaining_combined_seat = (int)$event->total_available_seat - (int) $registration; } $event = (array)$event; $event['works'] = $works; $event['venue_photos'] = $venue_photos; $event['commentaires'] = $comments; $event['event_videos'] = $event_videos; $event = (object) $event; $event->workshop_author_awards = json_decode($event->workshop_author_awards); $this->data['event_details'] = $event; /** * Redirect to 404 page if event's back_office_status is either `en cours` (being created) or `archived` */ if (in_array($this->data['event_details']->back_office_status, [ BO_STAT['en_c'], BO_STAT['arc'], ]) ) { show_404(); } if (isset($this->data['event_details']) && !empty($this->data['event_details']) && !empty($this->data['event_details']->event_id)) { /*heart stroke*/ $this->load->model('personalization_model'); $this->load->model('event_schedule_model'); $images = $this->event_model->get_file_attachments($this->input->get('event_id')); if(isset($images)) { $image = null; for($i=0; $idata['event_details']->file_name = $image; } $this->hstroke_folder = hstroke_bundle(); $this->data['heart_stroke_img'] = $this->hstroke_folder.$this->personalization_model->get_logo()['image']; /*end heart stroke*/ $this->lang->load('frontoffice/event_details', 'fr'); $this->data['content'] = 'frontoffice/home/event_details_view'; $this->load->model('personalization_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = $new_banner['image']; $this->data['page_banner_bg'] = $banner; //images_bundle().'frontoffice/homepage/caroussel.png'; $this->data['page_banner_description'] = $white_label; if($this->data['event_details']->event_id === '38') { // Lewis Trondheim $this->data['page_title'] = 'Atelier commando BD avec Lewis Trondheim'; $this->data['page_description'] = "Atelier BD avec Lewis Trondheim : réservez votre place pour l'atelier commando BD animé par Lewis Trondheim."; }else if($this->data['event_details']->event_id === '42') { // Atelier dîner dégustation $this->data['page_title'] = 'Atelier dîner dégustation vins du Portugal avec Tomy Gousset et Micael Morais'; $this->data['page_description'] = "Atelier dîner dégustation vins du Portugal avec Tomy Gousset et Micael Morais : réservez votre place pour un dîner dégustation animé par Tomy Gousset et Micael Morais."; }else if($this->data['event_details']->event_id === '36') { // Agnès Desarthe $this->data['page_title'] = "Atelier d'écriture avec Agnès Desarthe"; $this->data['page_description'] = "Atelier d'écriture avec Agnès Desarthe : réservez votre place pour l'atelier d'écriture animé par Agnès Desarthe."; }else if($this->data['event_details']->event_id === '37') { // Muriel Gilbert $this->data['page_title'] = 'Dictée interactive avec Muriel Gilbert'; $this->data['page_description'] = "Dictée interactive avec Muriel Gilbert : réservez votre place pour la dictée interactive animée par Muriel Gilbert."; } else if($this->data['event_details']->event_id === '26') { // Véronique Ovaldé $this->data['page_title'] = "Atelier d'écriture avec Véronique Ovaldé"; $this->data['page_description'] = "Atelier d'écriture avec Véronique Ovaldé : réservez votre place pour l'atelier d'écriture animé par Véronique Ovaldé."; } else { $this->data['page_title'] = $this->data['event_details']->workshop_author . ' - ' . $this->data['event_details']->event_type . ' with ' . $this->data['event_details']->workshop_author; $this->data['page_description'] = $this->data['event_details']->event_type . ' with ' . $this->data['event_details']->workshop_author . ': ' . substr_replace(strip_tags($this->data['event_details']->description),'...', 100); } $this->load->model('event_schedule_model'); $this->load->model('event_file_attachment_model'); //check weather a user can still register more than one date per event $this->data['allowed_to_book'] = $this->event_schedule_model->continue_registration($this->input->get('event_id'), UserAuth::isAuth() ? $this->data['logged_in']['user_id'] : null, 'register', 1); //check weather a user can still register for waitinglist more than one date per event $this->data['allowed_to_book_for_wl'] = $this->event_schedule_model->continue_registration($this->input->get('event_id'), UserAuth::isAuth() ? $this->data['logged_in']['user_id'] : null, 'register', 2); // $this->data['event_schedule'] = $this->event_schedule_model->list_event_schedule($this->input->get('event_id'), 1, $this->data['include_archived_events']); $this->data['event_attachment'] = $this->event_file_attachment_model->list_event_attachment($this->input->get('event_id'), $this->event_model->event_details_attachment_type($this->input->get('event_id'))); $this->data['event_speakers'] = $this->event_speaker_assignee_model->event_details(UserAuth::isAuth() ? $this->data['logged_in']['user_id'] : null, $this->input->get('event_id')); $this->data['event_sponsors'] = $this->event_sponsor_assignee_model->event_details(UserAuth::isAuth() ? $this->data['logged_in']['user_id'] : null, $this->input->get('event_id')); $this->data['event_status'] = $this->event_detailed_info(); $this->load_extra_files(array( 'notify' => true, 'bootbox' => true, 'ga' => true, 'moment' => true, 'ajax_helper' => true, )); array_push($this->data['load_styles'], ''); //load laguages array_push($this->data['load_scripts'], ''); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); // array_push($this->data['load_scripts'], ''); $this->load->view('frontoffice_view', $this->data); } else { show_404(); } } } // OTHER SAMPLE EVENT DETAILS CONTENT public function cours_en_ligne() { $this->data['content'] = 'frontoffice/home/sample_event_details_view/cours_en_ligne_view'; $this->data['page_title'] = 'Event Details'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->load->view('frontoffice_view', $this->data); } public function cours_du_soir() { $this->data['content'] = 'frontoffice/home/sample_event_details_view/cours_du_soir_view'; $this->data['page_title'] = 'Cour du soir'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->data['load_scripts'] = array( "", "" ); $this->load->view('frontoffice_view', $this->data); } public function live_stream_view() { $this->data['content'] = 'frontoffice/home/livestream_view'; $this->data['page_title'] = 'Cour du soir'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->data['load_scripts'] = array( "", // "" ); $this->load->view('frontoffice_view', $this->data); } public function atelier_a_distance3($event_id = null) { $this->lang->load('frontoffice/subscribe', 'fr'); if (!UserAuth::isAuth() || $event_id == null) redirect('home'); $event = $this->event_model->event_details($event_id); // $ncp = $this->event_model->format_night_class_prices($event); // $event = (object) array_merge((array) $event, (array)$ncp); if((!isset($event) || is_null($event))) redirect('home'); $event->event_start_month_name = $this->lang->line($event->event_start_month_name); /** Check if user has current subscription on this video workshop */ $user_id = $this->session->userdata('logged_in')['user_id']; $user_email = $this->session->userdata('logged_in')['email_address']; if (Sso::isLoggedIn()) { $loggedIn = UserAuth::auth(); $user_id = $loggedIn['user_id']; $user_email = $loggedIn['email_address']; } //a rajouter mail pour acces //$re = $this->event_registration_model->is_subscribed_in_atelier_distance($user_id, $event_id, $user_email); $re = $this->event_registration_model->is_subscribed($user_id, $event_id, $user_email); //if(!isset($re) || is_null($re)) //$re = $this->event_registration_model->is_subscribed($user_id, "47", $user_email); if(!isset($re) || is_null($re)) redirect('home'); $date = isset($_GET["date"]) ? $_GET["date"] : date("Y-m-d H:i:s"); $videos = $this->event_video_model->get_videos_by_event_id_spec($event_id); //print_r($videos);die; $this->data['event_videos']['upcoming'] = array(); $this->data['event_videos']['replay'] = array(); $this->data['event_videos']['total_replay_duration'] = $this->event_video_model->total_replay_videos_duration_spec($videos); $this->data['event_videos']['total_replay_videos'] = $this->event_video_model->total_replay_videos_spec($videos); $this->data['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $this->data["commencement_cours"] = $this->event_video_model->get_next_course_from_id_spec($videos)->live_video_start_date; $this->data['total_videos'] = count($videos); $current_date = false; $past_videos = array(); foreach($videos as $video) { if($video->live_video_end_date < $date) { /** replay videos */ array_push($past_videos, $video); } else { /** ongoing or upcoming videos */ $video->duration = $this->event_video_model->format_video_duration($video->duration); if(!$current_date) { $current_date = true; array_push($this->data['event_videos']['upcoming'], $video); } else { $uv = $this->data['event_videos']['upcoming']; $is_inserted = false; foreach($uv as $index => $value) { if($value->live_video_start_date > $video->live_video_start_date) { $this->data['event_videos']['upcoming'] = array_merge(array_slice($this->data['event_videos']['upcoming'],0, $index),array($video), array_slice($this->data['event_videos']['upcoming'], $index)); $is_inserted = true; break; } } if(!$is_inserted) { array_push($this->data['event_videos']['upcoming'], $video); } } } } if(count($past_videos) > 0) { $this->data['event_videos']['total_replay_duration'] = $this->event_video_model->total_video_duration($past_videos); $this->data['event_videos']['total_replay_videos'] = count($past_videos); foreach($past_videos as $pv) { $pv->duration = $this->event_video_model->format_video_duration($pv->duration); array_push($this->data['event_videos']['replay'], $pv); } } /** format date of first upcoming video */ if(count($this->data['event_videos']['upcoming']) > 0) { $this->lang->load('frontoffice/subscribe', 'fr'); $u_video = $this->data['event_videos']['upcoming'][0]; $m = date('F',strtotime($u_video->live_video_start_date)); $d = date('d',strtotime($u_video->live_video_start_date)); $u_video = array_merge((array)$u_video, ['month' => $this->lang->line($m), 'day' => $d]); $this->data['event_videos']['upcoming'][0] = (object)$u_video; } $this->data['event_details'] = $event; if($date >= $event->start_date_time) { $this->data['content'] = 'frontoffice/home/livestream_view'; $this->data['page_title'] = 'Cour du soir'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->data['load_scripts'] = array( "", // "" ); } else { $this->data['content'] = 'frontoffice/home/streaming_link_view'; $this->data['page_title'] = 'Atelier a distance'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', '' ); $this->data['load_scripts'] = array( "", "" ); } $this->load->view('frontoffice_view', $this->data); } public function atelier_a_distance($event_id = null) { if($event_id == "311"){ return $this->atelier_a_distance3($event_id); } $this->lang->load('frontoffice/subscribe', 'fr'); //if (!UserAuth::isAuth() || $event_id == null) // redirect('home'); $event = $this->event_model->event_details($event_id); // $ncp = $this->event_model->format_night_class_prices($event); // $event = (object) array_merge((array) $event, (array)$ncp); //if((!isset($event) || is_null($event)) && $event->workshop_session != 'DISTANCE-PRESENTIEL' && $event->workshop_session != 'DISTANCE') // redirect('home'); $event->event_start_month_name = $this->lang->line($event->event_start_month_name); /** Check if user has current subscription on this video workshop */ //$user_id = $this->session->userdata('logged_in')['user_id']; if (Sso::isLoggedIn()) { $loggedIn = UserAuth::auth(); $user_id = $loggedIn['user_id']; } // $re = $this->event_registration_model->is_subscribed_in_atelier_distance($user_id, $event_id); //$re = $this->event_registration_model->is_subscribed($user_id, $event_id); //if(!isset($re) && is_null($re) && (($re->workshop_session != 'DISTANCE-PRESENTIEL' && $re->registration_type != 'soir-presentiel' ) || $re->workshop_session != 'DISTANCE')) // redirect('home'); $videos = $this->event_video_model->get_videos_by_event_id($event_id); $this->data['event_videos']['upcoming'] = array(); $this->data['event_videos']['replay'] = array(); $this->data['event_videos']['total_replay_duration'] = '0h0'; $this->data['event_videos']['total_replay_videos'] = 0; $this->data['total_videos_duration'] = $this->event_video_model->total_video_duration($videos); $this->data["commencement_cours"] = $this->event_video_model->get_next_course_from_id($event_id)["live_video_start_date"]; $this->data['total_videos'] = count($videos); $current_date = false; $past_videos = array(); foreach($videos as $video) { if($video->live_video_end_date < date("Y-m-d H:i:s")) { /** replay videos */ array_push($past_videos, $video); } else { /** ongoing or upcoming videos */ $video->duration = $this->event_video_model->format_video_duration($video->duration); if(!$current_date) { $current_date = true; array_push($this->data['event_videos']['upcoming'], $video); } else { $uv = $this->data['event_videos']['upcoming']; $is_inserted = false; foreach($uv as $index => $value) { if($value->live_video_start_date > $video->live_video_start_date) { $this->data['event_videos']['upcoming'] = array_merge(array_slice($this->data['event_videos']['upcoming'],0, $index),array($video), array_slice($this->data['event_videos']['upcoming'], $index)); $is_inserted = true; break; } } if(!$is_inserted) { array_push($this->data['event_videos']['upcoming'], $video); } } } } if(count($past_videos) > 0) { $this->data['event_videos']['total_replay_duration'] = $this->event_video_model->total_video_duration($past_videos); $this->data['event_videos']['total_replay_videos'] = count($past_videos); foreach($past_videos as $pv) { $pv->duration = $this->event_video_model->format_video_duration($pv->duration); array_push($this->data['event_videos']['replay'], $pv); } } /** format date of first upcoming video */ if(count($this->data['event_videos']['upcoming']) > 0) { $this->lang->load('frontoffice/subscribe', 'fr'); $u_video = $this->data['event_videos']['upcoming'][0]; $m = date('F',strtotime($u_video->live_video_start_date)); $d = date('d',strtotime($u_video->live_video_start_date)); $u_video = array_merge((array)$u_video, ['month' => $this->lang->line($m), 'day' => $d]); $this->data['event_videos']['upcoming'][0] = (object)$u_video; } $this->data['event_details'] = $event; if(date("Y-m-d H:i:s") >= $event->start_date_time) { $this->data['content'] = 'frontoffice/home/livestream_view'; $this->data['page_title'] = 'Cour du soir'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '' ); $this->data['load_scripts'] = array( "", // "" ); } else { $this->data['content'] = 'frontoffice/home/streaming_link_view'; $this->data['page_title'] = 'Atelier a distance'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', '' ); $this->data['load_scripts'] = array( "", "" ); } $this->load->view('frontoffice_view', $this->data); } public function atelier_a_distance2() { $this->data['content'] = 'frontoffice/home/atelier_a_distance_view'; $this->data['page_title'] = 'Atelier a distance'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', '' ); $this->data['load_scripts'] = array( "", "" ); $this->load->view('frontoffice_view', $this->data); } public function contact() { $this->load->model('frontoffice_faq_model'); // $this->load->model('user_subscriber_model', '', true); $this->data['content'] = 'frontoffice/home/contact_view'; $this->data['page_title'] = 'Contacter les ateliers du Company For Madagascar'; $this->data['page_description'] = "Contacter les ateliers du Company For Madagascar. Formulaire de contact."; // $this->data['page_banner_bg'] = banner_bundle().'contact_banner.jpg'; $this->data['load_styles'] = array( '', '' ); $client_session = $this->data['logged_in']; $this->data['userdata'] = $client_session; $this->load_extra_files(array( 'notify' => true, 'bootbox' => true, // "ga" => true, "select2" => true, 'form_validator' => true, )); //load laguages array_push($this->data['load_scripts'], ''); array_push($this->data['load_scripts'], ""); $this->data['natureofbusiness'] = $this->frontoffice_faq_model->natureofbusiness(); $this->lang->load('frontoffice/contact', 'fr'); $this->load->view('frontoffice_view', $this->data); } public function nous_contact() { $this->load->model('frontoffice_faq_model'); // $this->load->model('user_subscriber_model', '', true); $this->data['content'] = 'frontoffice/home/nous_contact_view'; $this->data['page_title'] = 'Contact'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; // $this->data['page_banner_bg'] = banner_bundle().'contact_banner.jpg'; $this->data['load_styles'] = array( '', '' ); // $client_session = $this->data['logged_in']; // $this->data['userdata'] = $this->user_subscriber_model->myaccount($client_session['user_id']); $this->load_extra_files(array( 'notify' => true, 'bootbox' => true, // "ga" => true, "select2" => true, 'form_validator' => true, )); //load laguages array_push($this->data['load_scripts'], ''); array_push($this->data['load_scripts'], ""); $this->data['natureofbusiness'] = $this->frontoffice_faq_model->natureofbusiness(); $this->lang->load('frontoffice/contact', 'fr'); $this->load->view('frontoffice_view', $this->data); } public function otp_verification() { $this->data['content'] = 'payment/verify_otp'; $this->data['page_title'] = 'Confirmation de payment'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_styles'] = array( '', '', '' ); array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); // array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); $this->load->view('frontoffice_view', $this->data); } public function payment() { $this->load->model('user_subscriber_model', '', true); $this->data['content'] = 'frontoffice/home/payment_view'; $this->data['page_title'] = 'Payment'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; // $this->data['page_banner_bg'] = banner_bundle().'contact_banner.jpg'; $this->data['load_styles'] = array( '', '' ); // $client_session = $this->data['logged_in']; // $this->data['userdata'] = $this->user_subscriber_model->myaccount($client_session['user_id']); /** * Get the event id from cookie set during booking * If null means no booking */ $event = json_decode(get_cookie($this->config->item('sess_cookie_name').'_event_data')); if ($event) { $this->data['event_details'] = (array)$this->event_model->event_details($event->event_id); $this->data['event_details'] = array_merge($this->data['event_details'], ["seats_reserved" => $event->seats_reserved]); } else { redirect(base_url("home")); } if($event->booking->workshop_session =='DISTANCE-PRESENTIEL') { $ncp = json_decode($this->data['event_details']['night_class_prices']); if($event->booking->session_type == 'soir-presentiel') { $this->data['event_details']['discount_apply'] = $ncp->presentiel->discount_apply; $this->data['event_details']['event_rate'] = $ncp->presentiel->rate; } else { $this->data['event_details']['discount_apply'] = $ncp->distance->discount_apply; $this->data['event_details']['event_rate'] = $ncp->distance->rate; } } $this->load_extra_files(array( 'notify' => true, 'bootbox' => true, // "ga" => true, "select2" => true, 'form_validator' => true, )); // Stripe setup // $stripePayment = new StripePayment(); // $stripePublicKey = $stripePayment->getPublicKey(); $this->data['event_details']['event_rate'] = empty($this->data['event_details']['event_rate']) ? 0 : $this->data['event_details']['event_rate']; // Total amount calculation if(UserAuth::isPremium() == true && $event->event_id == EVENT_ID) { $this->data['event_details']['discount'] = 5; $this->data['event_details']['subtotal_amount'] = ($this->data['event_details']['event_rate']-5) * $this->data['event_details']['seats_reserved']; $this->data['event_details']['service_charge'] = 0; $this->data['event_details']['total_amount'] = $this->data['event_details']['subtotal_amount'] + $this->data['event_details']['service_charge']; } else { $discount = 0; if(UserAuth::isPremium()) { $discount = $this->data['event_details']['discount_apply']; // if($this->data['event_details']['discounted_price'] > 0) { // $this->data['event_details']['event_rate'] = $this->data['event_details']['discounted_price']; // } } $this->data['event_details']['discount'] = $discount; $this->data['event_details']['subtotal_amount'] = ($this->data['event_details']['event_rate'] - $discount) * $this->data['event_details']['seats_reserved']; $this->data['event_details']['service_charge'] = 0; $this->data['event_details']['total_amount'] = $this->data['event_details']['subtotal_amount'] + $this->data['event_details']['service_charge']; } // Get user's subscriber data to prefill the form $subscriber_query = $this->user_subscriber_model->getSubscribers(['user_id' => $this->session->userdata('logged_in')['user_id']]); $this->data['subscriber_data'] = $subscriber_query ? $subscriber_query[0] : []; // array_push($this->data['load_scripts'], ''); // array_push($this->data['load_scripts'], ""); // array_push($this->data['load_scripts'], ""); // array_push($this->data['load_scripts'], ""); array_push($this->data['load_scripts'], ""); $this->load->view('frontoffice_view', $this->data); } public function payment_success() { $this->data['content'] = 'frontoffice/home/payment_success_view'; $this->data['page_title'] = 'Payment Success'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; delete_cookie($this->config->item('sess_cookie_name').'_event_data'); $this->load->view('frontoffice_view', $this->data); } public function create_account_fo() { $this->data['content'] = 'frontoffice/create_account_view'; $this->data['page_title'] = 'Create Account'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->data['load_scripts'] = array( "", "", ); $this->lang->load('frontoffice/create_account', 'fr'); $this->load->view('frontoffice_view', $this->data); } public function mentions_legales() { $this->data['content'] = 'frontoffice/home/mentions_legales_view'; $this->data['page_title'] = 'Mentions légales - Les ateliers du Company For Madagascar'; $this->data['page_description'] = "Mentions légales - Les ateliers du Company For Madagascar"; $this->load->model('personalization_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = $new_banner['image']; $this->data['page_banner_bg'] = $banner; // $this->data['page_banner_bg'] = banner_bundle().'mentions-légales.jpg'; $this->data['load_scripts'] = array(""); $this->load->view('frontoffice_view', $this->data); } public function privacy_policy() { $this->data['content'] = 'frontoffice/home/privacy_policy_view'; $this->data['page_title'] = 'Politique de confidentialité'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->load->view('frontoffice_view', $this->data); } public function manage_cookies() { $this->data['content'] = 'frontoffice/home/manage_cookies_view'; $this->data['page_title'] = 'Gestion des cookies'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->load->view('frontoffice_view', $this->data); } public function general_conditions() { $this->data['content'] = 'frontoffice/home/general_conditions_view'; $this->data['page_title'] = 'Conditions générales'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->load->view('frontoffice_view', $this->data); } public function data_privacy() { $this->data['content'] = 'frontoffice/home/data_privacy_view'; $this->data['page_title'] = 'Protection des données'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; $this->load->model('personalization_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = $new_banner['image']; $this->data['page_banner_bg'] = $banner; // $this->data['page_banner_bg'] = banner_bundle().'mentions-légales.jpg'; $this->load->view('frontoffice_view', $this->data); } public function faq() { $this->load->model('frontoffice_faq_model'); $this->data['page_title'] = 'FAQ - Les ateliers du Company For Madagascar'; $this->data['page_description'] = "Foire aux questions - Les ateliers du Company For Madagascar"; $this->load->model('personalization_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = $new_banner['image']; $this->data['page_banner_bg'] = $banner; // $this->data['page_banner_bg'] = banner_bundle().'faq_banner.jpg'; $this->load_extra_files(array( 'easycomplete' => true, 'notify' => true, 'app' => true, )); /* * check if keyword is safe from xss scripts * display results if safe, do not do anything otherwise */ $faq_search =false; if ( (isset($_GET['word']) && !empty($_GET['word'])) && $this->security->xss_clean($_GET['word'], TRUE) ) { /* Set keyword '/^[a-z0-9 .\-]+$/i'*/ $faq_search['keyword'] = preg_replace('/<|>/','' ,$this->security->xss_clean(($this->input->get('word',TRUE)))); /* fetch results */ $faq_search['results'] = $this->frontoffice_faq_model->displaysearchfaq($faq_search['keyword']); } array_push($this->data['load_styles'], ''); array_push($this->data['load_styles'], ''); array_push($this->data['load_scripts'], ''); $this->data['faq_search'] = $faq_search; $this->data['faq_cat'] = $this->frontoffice_faq_model->list_faq_cat(); $this->data['content'] = 'frontoffice/faq/faqpage'; $this->load->view('frontoffice_view', $this->data); } public function maintenance() { $this->load->model('personalization_model'); $new_banner = $this->personalization_model->upload_get_banner(); $white_label = $new_banner['description']; $banner = (isset($new_banner['image']) && !empty($new_banner['image'])) ? $new_banner['image'] : ''; $this->data['page_title'] = 'Maintenance'; $this->data['page_description'] = "Retrouvez l'ensemble des ateliers organisés par la rédaction du Company For Madagascar."; // $this->data['page_banner'] = images_bundle().'frontoffice/homepage/caroussel.png'; $this->data['page_banner_bg'] = $banner; $this->data['page_banner_description'] = $white_label; $this->load->view('maintenance_view', $this->data); } private function event_detailed_info() { $this->load->model('event_wait_list_model'); return array( 'online_event' => function($event_schedule, $event_details) { $bostatus = (int) $event_schedule->back_office_status; $fav = ((int) $event_schedule->is_favorite == 1) ? 'btn-favorite': ''; $redirectOfflineUser = (!UserAuth::isAuth() ||!UserAuth::isLoggedInAsSubscriber())? 'subscribe-btn-redirect': ''; $btnClass = 'btn btn-block btn-default-style btn-closed event-btn btn-online-event'; $btnText = ''; $btnDisabled = true; // Event is Coming soon if ($event_schedule->is_coming_soon == 'coming_soon' && $event_schedule->event_status === 'AVAILABLE' && ($bostatus == 2 || $bostatus ==1) ) { $btnClass = "${fav} ${btnClass} disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['coming_soon']; } // Event is AVAILABLE else if ($event_schedule->is_coming_soon == '' && $event_schedule->event_status === 'AVAILABLE' && $bostatus == 2 ) { $btnClass = "${fav} ${btnClass} ${redirectOfflineUser}"; $btnDisabled = false; $btnText = $this->lang->line('js')['btn']['_book_online_event']; } // Event is FULL || COMPLETE else if ($event_schedule->event_status === 'FULL' && ($bostatus == 2 || $bostatus == 3)) { $btnClass = "${btnClass} disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['_full']; } // Event is Cancelled else if ($event_schedule->event_status === 'CANCEL') { $btnClass = "${fav} ${btnClass} cancelled_event disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['_cancelled']; } // Event is Closed else if ($bostatus == 4) { $btnClass = "${btnClass} disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['_closed']; } // Event is Terminee else if ($bostatus == 7) { $btnClass = "${btnClass} disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['_terminee']; } // Event is Archived else { $btnClass = "${btnClass} disabled"; $btnDisabled = true; $btnText = $this->lang->line('js')['btn']['_archive']; } echo ""; // btn disabled btn-block btn-default-style btn-closed event-btn // btn btn-block btn-default-style event-btn btn-online-event disabled }, 'button_status' => function ($event_schedule, $event_details, $allowed_to_book, $allowed_to_book_for_wl) { $is_user_active = UserAuth::isAuth() ? true : false; $event_url = !(!$is_user_active || !UserAuth::isLoggedInAsSubscriber()) && $event_schedule->event_url ? "data-event_url='".$event_schedule->event_url."'" : ""; if (!isset($_GET['preview_event'])) { $user_idd = $this->data['logged_in'] ? $this->data['logged_in']['user_id'] : null; $booking_type = UserAuth::isLoggedInAsSubscriber()? $this->event_registration_model->check_subscription($user_idd, $event_schedule->event_schedule_id): 0; $subscribed_waitlist = 0; $subscribed = 0; $onClick = ''; $data_attrib = ''; $event_listener_class = ''; $attribs = ""; $disabledBtn = 'disabled'; $can_still_book = 0; $showCancelBtn = 1; $checkStats = array('2FULL', '3FULL', '2AVAILABLE', '3AVAILABLE'); $disbledbtns = array( 'bos1' => $this->lang->line('js')['btn']['coming_soon'], 'bos3' => $this->lang->line('js')['btn']['_full'], 'bos4' => $this->lang->line('js')['btn']['_closed'], 'bos7' => $this->lang->line('js')['btn']['_terminee'], 'bos8' => $this->lang->line('js')['btn']['_cancelled'], ); $cancelBtnWithModify = "Date limite d'annulation de la réservation"; $fav = ''; if (in_array($event_schedule->back_office_status.$event_schedule->event_status, array('2FULL'))) { if ($event_schedule->remaining_seat >= 0 && $event_schedule->quota_waiting_list_seat > 0) { $book_waiting_list = 1; } else { //complete but bo status is open $book_waiting_list = 0; $event_schedule->back_office_status = 3; } } //to make the button complete when when there are no remaining seats and waiting list seats elseif (0 == $event_schedule->remaining_seat && 0 == $event_schedule->quota_waiting_list_seat && $event_schedule->back_office_status < 4 && $event_schedule->back_office_status > 1) { $book_waiting_list = 0; $event_schedule->back_office_status = 3; } else { $book_waiting_list = (in_array($event_schedule->back_office_status.$event_schedule->event_status, $checkStats) && $event_schedule->remaining_seat <= 0 && $event_schedule->quota_waiting_list_seat > 0 && $event_schedule->back_office_status < 3 && $event_schedule->back_office_status > 1) ? 1 : 0; } //if event is not closed and is open if (in_array($event_schedule->back_office_status, [ BO_STAT['ouv'], BO_STAT['ver'] ]) || UserAuth::isLoggedInAsSubscriber() ) { $subscribed = $this->event_registration_model->check_subscription($user_idd, $event_schedule->event_schedule_id); if ($subscribed) { $booking_type = 1; //Booked in normal registration } else { $subscribed_waitlist = $this->event_wait_list_model->check_subscription($user_idd, $event_schedule->event_schedule_id); if ($subscribed_waitlist) { $booking_type = 2; //booked in waiting list } } } if ((isset($disbledbtns['bos'.$event_schedule->back_office_status]) && !empty(isset($disbledbtns['bos'.$event_schedule->back_office_status]))) && $book_waiting_list == 0) { if (!$is_user_active) { //check if user is logged in $onClick = ""; $data_attrib = "data-event-id={$event_details->event_id}"; $event_listener_class = "subscribe-btn-redirect"; $disableBtn = 'disabled="disabled"'; if ( ($event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $cancelledClass = 'cancelled_event disabled'; $btnText = 'Annulé'; } else { $cancelledClass = ''; $btnText = ''; } } else { $disableBtn = 'disabled="disabled"'; if (2 == $booking_type) { $cancelBtnWithModify = "Date limite d'annulation d'inscription sur liste d'attente"; } if ( ($event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $cancelledClass = 'cancelled_event disabled'; $btnText = 'Annulé'; } else { $cancelledClass = ''; $btnText = ''; } } echo "'; if (1 == $event_schedule->back_office_status) { echo start_date($event_schedule->reservation_start_date); } } elseif (($event_schedule->back_office_status == 2 && $book_waiting_list == 0 && $event_schedule->remaining_seat > 0) || 1 == $booking_type) { $showCancelBtn = ($is_user_active) ? $this->show_cancel_btn_or_not($booking_type, $event_schedule->event_status, $event_schedule->remaining_seat) : 1; $disableBtn = ''; $btnText = $this->lang->line('js')['btn']['_book']; $btnType = ''; $onclick = ''; $btnClass = ''; $sched_text = 'Date limite de réservation'; $fav = ''; if (1 == $booking_type && $is_user_active) { //subscriber is registered $can_still_book = $this->check_if_user_can_still_book($booking_type, $event_schedule->seats_per_subscriber, $subscribed, $event_schedule->remaining_seat); if ($can_still_book > 0) { if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { $fav = ' btn-favorite'; }else{ $fav = ' '; } if ($event_schedule->event_status != "FULL") { $btnText = 'Ajouter des places à ma réservation'; $btnType = 'reg-modify'; $data_attrib = 'data-reg-type="'.(REG_TYPE['normal_reg']) .'" data-action="'.SUBSCRIBE_ACTION['modify'] .'" data-process-type="'.PROCESS_TYPE['modify_reg'] .'" data-seat-feature="'.$event_schedule->seat_feature .'" data-show-cancel-btn="'.$showCancelBtn.'"'; $event_listener_class = "register-or-modify"; $onclick = ""; $sched_text = 'Date limite de modification'; $cancelBtnWithModify = 'Date limite de modification de la réservation'; $disableBtn = ''; $btnclosed =''; } else { $disableBtn = 'disabled="disabled"'; $btnText = 'RÉSERVÉ'; $btnType = 'disabled'; $btnclosed ='btnclosed'; $fav = ' '; } } else { if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { $fav = ''; } $disableBtn = 'disabled="disabled"'; $btnText = isset($disbledbtns['bos'.$event_schedule->back_office_status]) ? $disbledbtns['bos'.$event_schedule->back_office_status] : 'Réservé'; $btnType = 'disabled'; $btnclosed ='btnclosed'; // $cancelBtnWithModify = "Date limite d'annulation d'inscription sur liste d'attente"; } if ( ('CANCEL' == $event_schedule->event_status && $event_schedule->back_office_status != 4) || ($event_details->date_feature == 2 && $event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $btnText = 'Annulé'; $cancelledClass = 'cancelled_event disabled'; $btnType = 'disabled'; } else { $cancelledClass = ''; //$btnType = ''; } if($btnType=='reg-book'){ $style = 'style="letter-spacing:4px;"'; }else{ $style = ''; } echo ''; } else { $eventRate =""; $paidEvent = ""; if($event_schedule->event_category == 'PAID_EVENT') { $paidEvent='paid_btn'; $eventRate = $event_schedule->event_rate ? number_format($event_schedule->event_rate, 2, ',', '.') ."€" : ""; } if ($is_user_active) { //check if user is logged in /* This code fragment is used to determine whether a subscriber can book for more than 1 per event or not */ $data_attrib = 'data-reg-type="'.(REG_TYPE['normal_reg']) .'" data-action="'.SUBSCRIBE_ACTION['register'] .'" data-process-type="'.PROCESS_TYPE['event_reg'] .'" data-seat-feature="'.$event_schedule->seat_feature .'" data-show-cancel-btn="'.$showCancelBtn.'"'; $event_listener_class = "register-or-modify"; $onClick = ""; if (!$allowed_to_book) { $event_listener_class = "not-allowed-to-book"; $onClick = "'"; $btnClass = 'btn-disabled'; } /* END of code fragment*/ } else { //if user not logged in $data_attrib = "data-event-id={$event_details->event_id}"; $event_listener_class = "subscribe-btn-redirect"; $onClick = ""; } if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { if ( ('CANCEL' == $event_schedule->event_status && $event_schedule->back_office_status != 4) || ($event_details->date_feature == 2 && $event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $btnText = 'Annulé'; $cancelledClass = 'cancelled_event disabled'; $btnType = 'disabled'; } else { $cancelledClass = ''; $btnType = ''; } echo ' '; } else { $cancelledClass = ''; $btnType = ''; if ( ('CANCEL' == $event_schedule->event_status && $event_schedule->back_office_status != 4) || ($event_details->date_feature == 2 && $event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $btnText = 'Annulé'; $cancelledClass = 'cancelled_event disabled'; $btnType = 'disabled'; } echo ' '; } if (null != $event_schedule->reservation_end_date && '' != $event_schedule->reservation_end_date && 'CANCEL' != $event_schedule->event_status ) { echo "
".$sched_text.' :
'.date_in_french($event_schedule->reservation_end_date).'
'; } } } elseif ($event_schedule->back_office_status == 3 || $book_waiting_list > 0 || $booking_type == 2) { $disableBtn = ''; $btnText = $this->lang->line('js')['btn']['_bookwaitlist']; $btnType = ''; $onclick = ''; $btnClass = ''; $sched_text = 'Date limite d\'inscription sur liste d\'attente'; if (2 == $booking_type && $is_user_active) { //subscriber is registered $can_still_book = $this->check_if_user_can_still_book($booking_type, $event_schedule->quota_waiting_list_seat, $subscribed_waitlist, $event_schedule->seats_per_subscriber); if ($can_still_book > 0) { if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { $fav = ' btn-favorite'; } $btnClass = 'modify-waitlistreservation '.$fav; $disableBtn = ''; $btnText = "Ajouter des places sur liste d'attente"; $btnType = 'wl-modify'; $data_attrib = 'data-reg-type="'.(REG_TYPE['waitlist_reg']) .'" data-action="'.SUBSCRIBE_ACTION['modify'] .'" data-process-type="'.PROCESS_TYPE['modify_wl_reg'] .'" data-seat-feature="'.$event_schedule->seat_feature .'" data-show-cancel-btn="'.$showCancelBtn.'"'; $event_listener_class = "register-or-modify"; $onclick = ""; $cancelBtnWithModify = "Date limite de modification de l'inscription sur liste d'attente"; } else { if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { $fav = ' '; } $btnClass = 'modify-reservation '.$fav; $disableBtn = 'disabled="disabled"'; $btnText = isset($disbledbtns['bos'.$event_schedule->back_office_status]) ? $disbledbtns['bos'.$event_schedule->back_office_status] : "INSCRIT SUR LISTE D'ATTENTE"; $btnType = 'disabled'; $cancelBtnWithModify = "Date limite d'annulation d'inscription sur liste d'attente"; } if ( ('CANCEL' == $event_schedule->event_status && $event_schedule->back_office_status != 4) || ($event_details->date_feature == 2 && $event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $btnText = 'Annulé'; $cancelledClass = 'cancelled_event disabled'; $btnType = 'disabled'; } else { $cancelledClass = ''; //$btnType = ''; } echo ' '; } else { if ($is_user_active) { //check if user is logged in /* This code fragment is used to determine whether a subscriber can book for waiting listmore than 1 per event or not */ $data_attrib = 'data-reg-type="'.(REG_TYPE['waitlist_reg']) .'" data-action="'.SUBSCRIBE_ACTION['register'] .'" data-process-type="'.PROCESS_TYPE['waitlist_reg'] .'" data-seat-feature="'.$event_schedule->seat_feature .'"data-event-cat="'.$event_schedule->event_category .'" data-show-cancel-btn="'.$showCancelBtn.'"'; $event_listener_class = "register-or-modify"; $onClick = ""; if (!$allowed_to_book_for_wl) { $event_listener_class = "not-allowed-to-book"; $onClick = ""; $btnClass = 'btn-disabled btn-reg-waitlist_detailsp'; } else { $btnClass = 'btn-reg-waitlist_detailsp'; $disableBtn = ''; } /* END of code fragment*/ } else { //if user not logged in $data_attrib = "data-event-id={$event_details->event_id}"; $event_listener_class = "subscribe-btn-redirect"; $onClick = ""; if (!$allowed_to_book_for_wl) { $event_listener_class = "not-allowed-to-book"; $onClick = ""; $btnClass = 'btn-disabled modify-reservation'; } else { $btnClass = 'btn-reg-waitlist_detailsp'; $disableBtn = ''; } } if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { echo ''; } else { $subscription = $this->User_subscription_model->get_subscription($this->data['logged_in']['user_id']); if(!empty($subscription) && !is_null($subscription)) { if(is_null($subscription->expirationDate) && is_null($subscription->transactionDateTime)) { $disableBtn = 'disabled="disabled"'; $btnClass = 'btn-disabled btn-reg-waitlist_detailsp'; } } echo ''; } if (null != $event_schedule->reservation_end_date && '' != $event_schedule->reservation_end_date && 'CANCEL' != $event_schedule->event_status) { echo "
".$sched_text.' :
'.date_in_french($event_schedule->reservation_end_date).'
'; } } } else { if ( ('CANCEL' == $event_schedule->event_status && $event_schedule->back_office_status != 4) || ($event_details->date_feature == 2 && $event_schedule->event_status == 'CANCEL') ) { $event_schedule->back_office_status = 8; $btnText = 'Annulé'; $cancelledClass = 'cancelled_event disabled'; $btnType = 'disabled'; echo " '; } } //display cancel button when subscriber is registered if ($booking_type && $is_user_active && $event_schedule->back_office_status > 1) { if (1 == $booking_type) { $btnClass = 'btn-cancel-registration'; } else { $btnClass = 'btn-cancel-wl-registration'; } /*Cancel button will be hidden once a seat is available for reservation*/ if (1 == $this->show_cancel_btn_or_not($booking_type, $event_schedule->event_status, $event_schedule->remaining_seat) && $event_schedule->event_status != 'CANCEL') { $data_attrib = 'data-event-id="'.($event_details->event_id) .'" data-event-schedule-id="'.$event_schedule->event_schedule_id .'" data-reg-type="'.$booking_type.'"'; $event_listener_class = "cancel-reservation"; echo ''; // echo ''; if (null != $event_schedule->reservation_end_date && '' != $event_schedule->reservation_end_date && 'CANCEL' != $event_schedule->event_status) { echo "
".($cancelBtnWithModify).' :
'.date_in_french($event_schedule->reservation_end_date).'
'; } } } return $booking_type; } else { $sched_text = 'Date limite de réservation'; $cancelBtnWithModify = "Date limite d'annulation de la réservation"; if ('' != $event_details->event_favorite || null != $event_details->event_favorite) { $fav = ' btn-favorite'; } else { $fav = ''; } echo ''; if (is_object($event_schedule)) { if (null != $event_schedule->reservation_end_date && '' != $event_schedule->reservation_end_date && 'CANCEL' != $event_schedule->event_status ) { echo "
".$sched_text.' :
'.date_in_french($event_schedule->reservation_end_date).'
'; } } } }, 'schedule_info' => function ($event_schedule, $event_details) { $zero_hour_patt = '/00h00/'; if ( preg_match($zero_hour_patt, $event_schedule->start_date_hour) && preg_match($zero_hour_patt, $event_schedule->end_date_hour) || empty($event_schedule->start_date_hour) && empty($event_schedule->end_date_hour) ) { $event_start_hour = ''; $event_end_hour = ''; } elseif ( !preg_match($zero_hour_patt, $event_schedule->start_date_hour) && preg_match($zero_hour_patt, $event_schedule->end_date_hour) || (!empty($event_schedule->start_date_hour) && empty($event_schedule->end_date_hour)) ) { $event_start_hour = ' à '.$event_schedule->start_date_hour; $event_end_hour = ''; } elseif ( preg_match($zero_hour_patt, $event_schedule->start_date_hour) && !preg_match($zero_hour_patt, $event_schedule->end_date_hour) || empty($event_schedule->start_date_hour) && !empty($event_schedule->end_date_hour) ) { $event_start_hour = ''; $event_end_hour = ' à '.$event_schedule->end_date_hour; } elseif ( !preg_match($zero_hour_patt, $event_schedule->start_date_hour) && !preg_match($zero_hour_patt, $event_schedule->end_date_hour) || !empty($event_schedule->start_date_hour) && !empty($event_schedule->end_date_hour) ) { if ($event_schedule->start_date != $event_schedule->end_date) { $event_start_hour = ' à '.$event_schedule->start_date_hour; $event_end_hour = ' à '.$event_schedule->end_date_hour; } else { $event_start_hour = ' de '.$event_schedule->start_date_hour; $event_end_hour = ' à '.$event_schedule->end_date_hour; } } $ev_scheddate = false; if (0 == $event_schedule->end_day) { $event_end_day = ' au '.$event_schedule->end_day.' '; } else { $event_end_day = ''; } if ($event_schedule->start_date == $event_schedule->end_date || 0 == $event_schedule->end_date) { // Le XX Septembre XXXX 8h00 jusq'au XX October XXXX 12h00 // Du 28 octobre au 29 octobre 2016 de 20h30 Ã 23h00 echo 'Le '; translate_day_in_french($event_schedule->day); echo ' '; translate_date_in_french($event_schedule->start_date_day); echo ' '.$event_start_hour; echo ' '.$event_end_hour; } else { // Le 28 Septembre 1995 de 8h00 a 12h00 // Du 28 octobre 2016 de 20h30 Ã 22h30 if ($event_schedule->start_month == $event_schedule->end_month) { echo ' '.$event_schedule->start_day.$event_end_day.' '; translate_date_in_french($event_schedule->end_month); echo ' '.$event_schedule->end_year; // ." de ".$event_schedule->start_date_hour." Ã ".$event_schedule->end_date_hour; } elseif ($event_schedule->start_year != $event_schedule->end_year) { echo 'Du '; strtolower(translate_day_in_french($event_schedule->day)); echo ' '.$event_schedule->start_day.' '; translate_date_in_french($event_schedule->event_start_month_name); echo ' '.$event_schedule->start_year; echo ' '.$event_start_hour; echo ' au '; translate_day_in_french($event_schedule->endday); echo ' '.$event_schedule->end_day.' '; translate_date_in_french($event_schedule->end_month); echo ' '.$event_schedule->end_year; //." de ".$event_schedule->start_date_hour." Ã ".$event_schedule->end_date_hour; echo ' '.$event_end_hour; } else { echo 'Du '; strtolower(translate_day_in_french($event_schedule->day)); echo ' '.$event_schedule->start_day.' '; strtolower(translate_date_in_french($event_schedule->event_start_month_name)); echo " $event_start_hour"; echo ' au '; strtolower(translate_day_in_french($event_schedule->endday)); echo ' '.$event_schedule->end_day.' '; strtolower(translate_date_in_french($event_schedule->end_month)); echo " {$event_schedule->end_year} $event_end_hour"; $ev_scheddate = true; echo ($ev_scheddate) ? '' : $event_start_hour.$event_end_hour; } } }, ); } /*This is for showing or hiding cancel button when seats open for reservation after waiting list*/ private function show_cancel_btn_or_not($booking_type, $event_status, $remaining_seat) { if (1 == $booking_type) { //normal registration return 1; } elseif (2 == $booking_type) { //waitinglist registration if ('AVAILABLE' == $event_status && $remaining_seat > 0) { //the subscriber is currently registered for waitinglist then suddenly seats are open for reservation return 2; } return 1; } return 0; } private function check_if_user_can_still_book($reg_type = 0, $quota_seats = 0, $seats_reserved = 0, $remaining_seats = 0) { $seats_available = 0; if (1 == $reg_type) { //check if seats per subscriber caters the remaining seats if ($quota_seats >= $seats_reserved && $remaining_seats > 0) { if ($quota_seats == $seats_reserved) { $seats_available = 0; } else { $seats_available = ($quota_seats > $seats_reserved) ? $quota_seats - $seats_reserved : $quota_seats; $seats_available = ($remaining_seats >= $seats_available) ? $seats_available : $remaining_seats; } } } elseif (2 == $reg_type) { //check if quota_waiting_list_seat caters the seats_reserved /*!note remaining seat here means seat_per_subscriber*/ $seats_per_subscriber = $remaining_seats; if ($seats_per_subscriber >= $seats_reserved && $seats_per_subscriber > 0 && $quota_seats > 0) { if ($seats_per_subscriber == $seats_reserved) { $seats_available = 0; } else { $seats_available = ($seats_per_subscriber > $seats_reserved) ? $seats_per_subscriber - $seats_reserved : (($seats_per_subscriber > $quota_seats) ? $quota_seats : $seats_per_subscriber); $seats_available = ($quota_seats >= $seats_available) ? $seats_available : $quota_seats; } } } return $seats_available; } private function set_event_cookie($event_id) { delete_cookie($this->config->item('sess_cookie_name').'_eventpage'); $cookie_eventpage = array( 'name' => 'eventpage', 'value' => json_encode(array( "event_link" => base_url('event_details?event_id='.$event_id) )), 'expire' => 7200, // time() + (86400 * 30), 'prefix' => $this->config->item('sess_cookie_name').'_' ); set_cookie($cookie_eventpage); } }