/** * Registers new admin User and Business */ public function register() { $user = new user(); $business = new business(); $data = $this->input->post(NULL, TRUE); $userData = array_chunk($data, 5, TRUE); $business->createBusiness($userData[0]); $business->setLatLong($business->baddress); $user->createAdmin($userData[1]); $user->bname = $business->name; if ($this->db->insert('capsql.business', $business)) { $this->db->insert('capsql.user', $user); $sessionD = array('bname' => $user->bname, 'role' => $user->role, 'uname' => $user->uname); $this->session->set_userdata($sessionD); $this->load->view('getStarted'); } else { throw new Exception(); } }
public function index() { parent::view("shared/header"); parent::view("intern/menu"); //Si l'usager à envoyer une évaluation, l'enregistrer if (isset($_POST['id'])) { parent::model("ratings"); $rating = new ratings(); $rating->RatingProject($_SESSION['ID'], $_POST['id'], $_POST['rating']); } parent::model("projects"); $model = new projects(); //Obtenir le projet assigné. $data['project'] = $model->ShowProjectByIntern($_SESSION['ID']); //Sinon obtenir tous les projets. if ($data['project'] == null) { $data['projects'] = $model->ShowProjectByStatus(1); parent::model("business"); $model = new business(); parent::model("ratings"); $rating = new ratings(); if ($data['projects'] != null) { foreach ($data['projects'] as $project) { //Obtenir les informations de l'entreprise. $data['cie'][$project->businessID] = $model->ShowCieByID($project->businessID); //Obtenir le rating. $data['ratings'][$project->ID] = $rating->FindRateByID($_SESSION['ID'], $project->ID); } } parent::view("intern/list", $data); } else { parent::model("business"); $model = new business(); //Obtenir les informations de l'entreprise. $data['cie'][$data['project']->ID] = $model->ShowCieByID($data['project']->businessID); parent::view("intern/index", $data); } parent::view("shared/footer"); }
<?php require_once __DIR__ . '../../../../businessLogic/business.php'; $business = new business(); if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'admin') { } else { echo '<script>console.log("not authorized");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("wrong token");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("no token found");</script>'; header('Location: ./../root.login/login.php'); exit; } $display = false; $display2 = false; if (isset($_POST['update-company']) && isset($_GET['id'])) {
<?php require_once 'include/header.php'; require_once 'businessModel.php'; $userModel = new business(); $member_id = $_GET['id']; if (isset($_POST['submit'])) { $userModel->member_id = $_POST['member_id']; $tmp = $_FILES['file2']['tmp_name']; move_uploaded_file($tmp, "images/business/gallery/" . $_FILES['file2']['name']); $userModel->picture = $_FILES['file2']['name']; $x = implode(' ', $_POST['category']); $userModel->category = $x; $userModel->create_pic(); header("location:create_business2.php?id={$userModel->member_id}"); } ?> <body> <div id="box_wrapper"> <section id="mainslider"> <div class="flexslider"> <ul class="slides"> <li> <div class="slide_overlay"> <img src="images/business/flex_slide01.jpg" alt=""> </div> </li> </ul> </div> </section>
<div class="container"> <form class="form-horizontal form-group" role="form" action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post" enctype="multipart/form-data"> <div class="col-sm-12 form-group"> <button class="btn btn-lg btn-warning center-block" type="submit" name="generate">Update Map</button> </div> </form> </div> <!--container--> <?php require_once __DIR__ . '/../../../businessLogic/business.php'; $business = new business(); if (isset($_POST["generate"])) { $data = $business->view_companies(); $encoded_data = json_encode($data); $fileJSON = "company.json"; file_put_contents($fileJSON, $encoded_data); require_once 'generateGeoJSON.php'; }
<?php require_once __DIR__ . '/../../../businessLogic/business.php'; $business = new business(); if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'admin') { } else { echo '<script>console.log("not authorized");</script>'; header('Location: ./../states/root.login/login.php'); exit; } } else { echo '<script>console.log("wrong token");</script>'; header('Location: ./../states/root.login/login.php'); exit; } } else { echo '<script>console.log("no token found");</script>'; header('Location: ./../states/root.login/login.php'); exit; } if (isset($_GET['ids'])) { echo '<script>console.log("lol");</script>'; $ids = unserialize($_GET['ids']);
public function review($_projectID) { parent::view("shared/header"); parent::view("cie/menu"); parent::model("projects"); $model = new projects(); if ($_projectID != null || isset($_POST['project'])) { parent::model("docs"); $model1 = new docs(); parent::model("projects"); $model2 = new projects(); if (isset($_POST['project'])) { $project = $model2->ShowProjectByID($_POST['project']); } else { $project = $model2->ShowProjectByID($_projectID[0]); } if ($project != null) { parent::model("business"); $model4 = new business(); $cie = $model4->ShowCieByUserID($_SESSION['ID']); if ($project->status == 1 && $project->businessID == $cie->ID) { $data['title'] = $project->title; $data['projectID'] = $project->ID; $internId = $project->internID; if ($internId != null) { //Vérifier l'existence d'une évaluation de stage $data['readOnly'] = $model1->ReadOnlyAdvisor($internId, 'cieReview'); parent::model("accounts"); $model3 = new accounts(); $data['intern'] = $model3->ShowUserByID($internId); if ($data['readOnly']) { //si le formulaire existe $data['review'] = $model1->LoadAdvisor($internId, "cieReview"); $data['alert'] = "alert-warning"; $data['message'] = "L'évaluation pour ce stagiaire et pour ce projet existe déjà."; } else { //si le formulaire n'existe pas //Enregistrer le formulaire d'évaluation. if (isset($_POST['sendReview']) && isset($_POST['project']) && $_SESSION['form_timer'] + 1200 > time()) { try { $_POST['intern'] = $internId; $model1->SaveAdvisor($_SESSION['ID'], "cieReview", $_POST); $data['review'] = $model1->LoadAdvisor($internId, 'cieReview'); $data['alert'] = "alert-success"; $data['message'] = "L'évaluation a été enregistrée avec succès."; $data['readOnly'] = true; } catch (Exception $e) { $data['alert'] = "alert-warning"; $data['message'] = "L'évaluation n'a pas pu être enregistrée."; } } } parent::view("cie/review", $data); parent::view("shared/footer"); } else { $data['alert'] = "alert-warning"; $data['message'] = "Aucun stagiaire associé à ce projet."; $this->index($data); } } else { $data['alert'] = "alert-warning"; $data['message'] = "Il vous est interdit de visualiser ce formulaire."; $this->index($data); } } else { $data['alert'] = "alert-warning"; $data['message'] = "Ce projet n'existe pas."; $this->index($data); } } else { $this->index(null); } }
<?php require_once __DIR__ . '../../../../businessLogic/business.php'; $business = new business(); if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'student' or $usertype == 'admin') { } else { echo '<script>console.log("not authorized");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("wrong token");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("no token found");</script>'; header('Location: ./../root.login/login.php'); exit; } ?> <!doctype html> <html>
<div class="container"> <div class="well well-sm"><label>Import PDF</label></div> <form class="form-horizontal form-group" role="form" method="post" enctype="multipart/form-data"> <label for="inputFile" class="col-sm-2 control-label">Browse PDF files</label> <div class="col-sm-10 form-group"> <input type="file" name="internshipOffer" class="form-control" id="file" accept=".pdf" required/> </div> <div class="col-sm-12 form-group"> <button class="btn btn-lg btn-success center-block" type="submit" name="importPDF">Import</button> </div> </form> </div> <!--container--> <?php require_once __DIR__ . '/../../../businessLogic/business.php'; $business = new business(); // get the connected user id if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'company') { $id = $info['id']; } else { $id = $_GET['id']; } }
<?php require_once __DIR__ . '../../../../businessLogic/business.php'; $business = new business(); if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'admin') { } else { echo '<script>console.log("not authorized");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("wrong token");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("no token found");</script>'; header('Location: ./../root.login/login.php'); exit; } ?> <?php
public function DenyBusiness($_CieID) { parent::model("business"); $cie = new business(); if (isset($_POST['cieID'])) { try { $cie->DeleteCie($_POST['cieID']); $data['alert'] = "alert-success"; $data['message'] = "Cette entreprise a bien été refusée."; } catch (exception $ex) { $data['alert'] = "alert-warning"; $data['message'] = "Cette entreprise n'a pu être refusée."; } $this->ShowUsers($data); } else { try { $cie->DenyCie($_CieID[0]); $data['alert'] = "alert-success"; $data['message'] = "Cette entreprise a bien été refusée."; } catch (exception $ex) { $data['alert'] = "alert-warning"; $data['message'] = "Cette entreprise n'a pu être refusée."; } $this->index($data); } }
<?php require_once 'include/header.php'; $member_id = $_GET['id']; require_once 'businessModel.php'; $userModel = new business(); if (isset($_POST['submit'])) { $tmp = $_FILES['file']['tmp_name']; move_uploaded_file($tmp, "images/business/" . $_FILES['file']['name']); $userModel->picture = $_FILES['file']['name']; if (empty($userModel->picture)) { $userModel->picture = "logo.png"; } $member_id = $_POST['member_id']; $userModel->username = $_POST['your_name']; $userModel->member_id = $_POST['member_id']; $userModel->party_date = $_POST['party_date']; $userModel->description = $_POST['description']; $userModel->video = $_POST['video']; $userModel->invitation = $_POST['invitation']; $userModel->phone = $_POST['phone']; $userModel->email = $_POST['email']; $userModel->address = $_POST['address']; $userModel->facebook = $_POST['facebook']; $userModel->party_type = $_POST['party_type']; $userModel->create(); header("location:create_business2.php?id={$userModel->member_id}"); } ?> <body> <div id="box_wrapper">
<div class="container"> <div class="well well-sm"><label>Internship offers</label></div> <?php require_once __DIR__ . '/../../../businessLogic/business.php'; $business = new business(); $offers = array(); // get the connected user id if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'company') { $id = $info['id']; $offers = $business->view_internship_offers($id); } else { $id = $_GET['id']; $offers = $business->view_internship_offers($id); } } } if ($offers) { foreach ($offers as $value) { if (isset($_GET['id'])) { echo '<div class="btn-group" role="group" aria-label="..."> <button class="btn btn-default"><a href=./../../offers/' . $value['linkToOffer'] . '>' . $value['linkToOffer'] . '</a></button> <button class="btn btn-danger"><a href=./../../services/deleteOffer.php?id=' . $value['linkToOffer'] . '&idCompany=' . $_GET['id'] . '>delete</a></button> </div>
public function submitCie() { parent::model("business"); parent::model("accounts"); $business = new business(); $user = new accounts(); if (!$business->EmailExist($_POST["email"])) { if ($user->UsernameExist($_POST["user"]) || $_POST["user"] == "") { $_POST["user"] = $user->PassGen(); } try { $user->CreateUser($_POST["name"], $_POST["user"], $user->PassGen(), 1); $business->CreateBusiness($_POST["address"], $_POST["city"], $_POST["tel"], $_POST["email"], $user->DBLastInsertedID('users')); $data['alert'] = "alert-success"; $data['message'] = "L'entreprise a été soumise aux coordonnateurs de stage. Merci de votre participation."; } catch (PDOException $e) { $data['alert'] = "alert-warning"; $data['message'] = "L'entreprise n'a pu être soumise aux coordonnateurs de stage. Veuillez réessayer."; } } else { $data['alert'] = "alert-warning"; $data['message'] = "Une entreprise avec ce même email existe déjà."; } parent::view('shared/header'); parent::view('home/menu'); parent::view('home/index', $data); parent::view('shared/footer'); }
<?php require_once __DIR__ . '../../../../businessLogic/business.php'; $business = new business(); if (isset($_COOKIE['auth'])) { $token = $_COOKIE['auth']; $id; $info = $business->check_token($token); if ($info != FALSE) { $user = $business->view_user($info['id']); $username = $user['loginId']; $usertype = $business->get_user_type($username); if ($usertype == 'admin') { header('Location: ./../root.admin.companies.list/list.php'); exit; } else { echo '<script>console.log("not authorized");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("wrong token");</script>'; header('Location: ./../root.login/login.php'); exit; } } else { echo '<script>console.log("no token found");</script>'; header('Location: ./../root.login/login.php'); exit; }
<?php require_once __DIR__ . '../../../../businessLogic/business.php'; $business = new business(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico"> <title>Map stage</title> <!-- Bootstrap core CSS --> <!--link href="libraries/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet"--> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!--link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"--> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!--script src="../../assets/js/ie-emulation-modes-warning.js"></script--> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]>