/** * Access to the functionnality of viewing an event in full detail. * Redirect to welcome page if not logged in. * params : * id : id of the event to display in the managing forms */ function index($id) { if ($this->session->userdata('logged_in')) { $data['title'] = 'Détails de l\\évènement'; $idUser = $this->session->userdata('logged_in')['id']; $data['nb_notifications'] = $this->user->count_unread_message($idUser); $info_event = $this->event->get_details($id, $idUser); $session_data = $this->session->userdata('logged_in'); $info_event['id_user'] = $session_data['id']; $info_event['id_event'] = $id; $info_event['participation'] = get_participation_link($session_data['id'], $id, $info_event['event']->private); $this->load->helper(array('form')); $this->load->view('templates/header_logged_in', $data); $this->load->view('pages/details_event_view', $info_event); $this->load->view('templates/footer'); //if user is not logged in : redirection to welcome page } else { redirect('welcome', 'refresh'); } }
function quit_event() { $aResult = array(); if (!isset($_POST['arguments'])) { $aResult['error'] = 'No function arguments!'; } if (!isset($aResult['error'])) { if (!is_array($_POST['arguments']) || count($_POST['arguments']) < 3) { $aResult['error'] = 'Error in arguments!'; } else { $id_user = $_POST['arguments'][0]; $id_event = $_POST['arguments'][1]; $private = $_POST['arguments'][2]; $result = $this->event->quit_event($id_user, $id_event); $aResult['result'] = get_participation_link($id_user, $id_event, $private); } } echo json_encode($aResult); }