public function add(Entreprise $ent) { $q = $this->_bd->prepare('INSERT INTO Entreprise SET id = :id, ' . 'nom = :nom, domaine = :domaine, ville = :ville, '); $q->bindValue(':id', $ent->getId(), PDO::PARAM_INT); $q->bindValue(':nom', $ent->getNom()); $q->bindValue(':domaine', $ent->getDomaine()); $q->bindValue(':ville', $ent->getVille()); $q->execute(); }
/** * Usine à fabriquer des Stage * @param int $idEtudiant : l'ID de l'étudiant * @param int $idOffre : l'ID de l'offre * @param int $idEnseignant : l'ID de l'enseignant * @return Stage */ public static function createFromIDs($idEtudiant, $idOffre, $idEnseignant) { $pdo = myPDO::getInstance(); $stmt = $pdo->prepare(<<<SQL SELECT * FROM STAGE WHERE idEtu = :idEtu AND idOffre = :idOffre AND idEns = :idEns SQL ); $stmt->execute(array("idEtu" => $idEtudiant, "idOffre" => $idOffre, "idEns" => $idEnseignant)); $stmt->setFetchMode(PDO::FETCH_CLASS, 'Stage'); if (($object = $stmt->fetch()) !== false) { $object->entrepriseCorrespondante = Entreprise::createFromID(OffreStage::createFromID($idOffre)->getEntrepriseId()); return $object; } }
<?php require_once "../inc/config.inc.php"; session_start(); if (isset($_SESSION["membre"]) && $_SESSION["membre"] instanceof Entreprise) { $idOffre = (int) $_GET["idO"]; $idEtudiant = (int) $_GET["idE"]; $idEntreprise = $_SESSION["membre"]->getID(); if (in_array(OffreStage::createFromID($idOffre), $_SESSION["membre"]->getOffresProposees())) { $message = "Candidature acceptée. Vous pouvez voir l'état d'avancement du stage dans votre récapitulatif <a href='listeStagesEntreprise.php'>\"Mes stages\"</a><br>\n <a href=\"listeCandidatures.php?id={$idOffre}\">Retour</a>"; $g = Gestionnaire::getInstance(); $g->creeStage($idEtudiant, $idOffre); // MAJ de l'objet en session : $_SESSION["membre"] = Entreprise::createFromID($_SESSION["membre"]->getID()); } else { $message = "Vous ne pouvez pas accepter cette offre. <a href=\"index.php\">Retour</a>"; } $p = new Page("Gestion des stages :: Valider une candidature"); $p->appendCssUrl("../inc/style/stylePageAjout.css"); $p->appendContent(<<<HTML <header> <h1>Valider une candidature</h1> </header> <p class="mesage">{$message}</p> HTML ); echo $p->toHTML(); } else { header("Location: ../index.php"); }
$addedSQL = " \n SELECT numStage AS 'id', titre, dateFin, dateDebut, description, domaine, nbPoste, gratification, s.numEntreprise as 'entreprise', dateCreation\n FROM Stage s, Entreprise e\n WHERE s.numEntreprise = e.numEntreprise\n AND upper(s.titre) LIKE concat('%', upper(?) , '%')\n AND (upper(e.ville) LIKE concat('%', upper(?) , '%')\n OR upper(e.pays) = upper(?))"; $tab = array($_REQUEST['poste'], $_REQUEST['ville'], $_REQUEST['ville']); for ($i = 0; $i < sizeof($domaines); $i++) { $addedSQL .= " AND upper(s.domaine) LIKE concat('%', upper(?) , '%')"; $tab[] = $domaines[$i]; } $addedSQL .= " ORDER BY dateCreation DESC"; $req = $pdo->prepare($addedSQL); //var_dump($req); //var_dump($tab); $req->execute($tab); /*$req->execute(array(':poste' => $_REQUEST['poste'], ':ville' => $_REQUEST['ville']));*/ $listStage = $req->fetchAll(PDO::FETCH_CLASS, "Stage"); $html = ""; //var_dump($entreprise); //Chaques entreprise crée a comme observeur l'entrepreneur passer en parametre foreach ($listStage as $key => $stage) { $entreprise = Entreprise::creatFromId($stage->getEntreprise()); $numEntreprise = $entreprise->getId(); $titre = htmlspecialchars($stage->getTitre()); $nom = htmlspecialchars($entreprise->getNom()); $ville = htmlspecialchars($entreprise->getVille()); $pays = htmlspecialchars($entreprise->getPays()); $date = DateTime::createFromFormat('Y-m-d H:i:s', $stage->getDate()); $wellFormedDate = $date->format('d/m/Y'); $id = $stage->getId(); $html .= "<tr><th scope='row'>{$wellFormedDate}</th> <td><a href='displayEntreprise.php?id={$numEntreprise}'>{$nom}</a></td> <td><a href=\"viewStage.php?id={$id}\">{$titre}</a></td> <td>{$pays}, {$ville}</td> </tr> </a>"; } echo $html; }
require_once "autoload.inc.php"; require_once "init.inc.php"; $p = new webpage("Iut Stage"); $p->appendToHead(<<<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=""> head ); $p->appendCssUrl("style/bootstrap-3.3.5-dist/css/bootstrap.min.css"); //inclusion de la barre de navigation include_once "navbar.inc.php"; if (isset($_REQUEST['id']) && ($entreprise = Entreprise::creatFromId($_REQUEST['id'])) != null) { $nom = htmlspecialchars($entreprise->getNom()); $adr = htmlspecialchars($entreprise->getAdresse()); $tel = htmlspecialchars($entreprise->getTel()); $typeJurydique = htmlspecialchars($entreprise->getTypeJuridique()); $site = htmlspecialchars($entreprise->getSite() != null ? $entreprise->getSite() : ""); $pays = htmlspecialchars($entreprise->getPays()); $siret = htmlspecialchars($entreprise->getSIRET()); $siren = htmlspecialchars($entreprise->getSIREN()); $ville = htmlspecialchars($entreprise->getVille()); $codePostal = htmlspecialchars($entreprise->getCodePostal()); //Affiche tous les avis sur l'entreprise $commentaires = ""; foreach ($entreprise->getAvis() as $key => $value) { $pdo = myPDO::getInstance(); $rq1 = $pdo->prepare(<<<SQL
/* * Classe Collection */ require_once "../pedaframework/trunk/Collection.class.php"; /* * Faire référence au Model de notre application */ require_once "Entreprise.class.php"; //Initialisation de la connexion � la base de donn�es Database::InitDB("config/config.xml"); echo "<h1>chargement de la base</h1>"; $DAOentreprise = new Entreprise(); $mesentreprises = $DAOentreprise->LoadAll(40, 3); var_dump($mesentreprises); echo "<h2>enregistrement d'une entreprise</h2>"; $uneEntreprise = new Entreprise(); $uneEntreprise->setId(100); $uneEntreprise->setNom("Entreprise test"); $uneEntreprise->setAdresse("adresse Entreprise test"); $uneEntreprise->setCodePostal(69000); $uneEntreprise->setVille("une ville"); $uneEntreprise->setContact("un contact"); $uneEntreprise->setEtudiantAjout("un etudiant"); try { $uneEntreprise->Save(); } catch (Execption $e) { var_dump($e); } echo "<h1>Rechargement de la base apres insertion</h1>"; $mesentreprisesafter = $DAOentreprise->LoadAll(40, 5); var_dump($mesentreprisesafter);
<?php include_once 'class/utilisateur.class.php'; include_once 'autoload.inc.php'; include_once 'class/entrepreneur.class.php'; include_once 'init.inc.php'; var_dump($_REQUEST); if (isset($_REQUEST['nomEntreprise']) && isset($_REQUEST['siteEntreprise']) && isset($_REQUEST['tel']) && isset($_REQUEST['pays']) && isset($_REQUEST['codePostal']) && isset($_REQUEST['SIREN']) && isset($_REQUEST['SIRET']) && isset($_REQUEST['codeAPE']) && isset($_REQUEST['adresse']) && isset($_REQUEST['ville']) && isset($_REQUEST['typeJurydique'])) { //transformation de l'url donnée preg_match_all('#[-a-zA-Z0-9@:%_\\+.~\\#?&//=]{2,256}\\.[a-z]{2,4}\\b(\\/[-a-zA-Z0-9@:%_\\+.~\\#?&//=]*)?#si', $_REQUEST['siteEntreprise'], $site); if (preg_match("/^[0-9]{5}\$/", $_REQUEST['codePostal']) && preg_match("/^[0-9]{9}\$/", $_REQUEST['SIREN']) && preg_match("/^[0-9]{14}\$/", $_REQUEST['SIRET']) && $_REQUEST['nomEntreprise'] != "" && $_REQUEST['ville'] != "" && $_REQUEST['adresse'] != "") { try { $entreprise = new Entreprise($_REQUEST['nomEntreprise'], $_REQUEST['adresse'], $_REQUEST['tel'], $_REQUEST['typeJurydique'], $_REQUEST['ville'], $_REQUEST['pays'], $_REQUEST['SIREN'], $_REQUEST['SIRET'], $_REQUEST['codeAPE'], $user, $_REQUEST['codePostal'], $site); $entreprise->setNom($_REQUEST['nomEntreprise']); $entreprise->setTel($_REQUEST['tel']); $entreprise->setAdresse($_REQUEST['adresse']); $entreprise->setTypeJuridique($_REQUEST['typeJurydique']); $entreprise->setSite($site); $entreprise->setPays($_REQUEST['pays']); $entreprise->setSIRET($_REQUEST['SIRET']); $entreprise->setSIREN($_REQUEST['SIREN']); $entreprise->setCodeAPE($_REQUEST['codeAPE']); $entreprise->setVille($_REQUEST['ville']); $entreprise->setCodePostal($_REQUEST['codePostal']); $entreprise->setEntrepreneur($user); $entreprise->save(); header("Location: profileEntrepreneur.php?ins=true"); exit; } catch (Exeption $e) { echo $e->getMessage(); }
$dir = dirname("http://localhost/webprojet/projet_conf/projet_conf/server/images"); $checkbox = ''; $checkbox2 = ''; if (!isset($_POST['checkbox_orateur']) && !isset($_POST['checkbox_entreprise'])) { $id_presentation = Presentation::insertPres($_POST['titre_presentation'], $_POST['desc_presentation'], $_POST['heure_debut'], $_POST['heure_fin'], $_POST['date'], $_POST['id_evt'], $_POST['select_type_presentation']); $presente = Presentation::insertPresenteOratExist($_POST['select_orateur']); } else { if (isset($_POST['checkbox_orateur']) && !isset($_POST['checkbox_entreprise'])) { $id_presentation = Presentation::insertPres($_POST['titre_presentation'], $_POST['desc_presentation'], $_POST['heure_debut'], $_POST['heure_fin'], $_POST['date'], $_POST['id_evt'], $_POST['select_type_presentation']); $id_orateur = Orateur::insertOrateurEntpExist($_POST['nom_orateur'], $_POST['prenom_orateur'], $_POST['courriel_orateur'], $_POST['tel_orateur'], $_POST['select_entreprise']); $presente = Presentation::insertPresenteNvOrateur(); } else { if (isset($_POST['checkbox_orateur']) && isset($_POST['checkbox_entreprise'])) { if (true == $img->validUpload()) { $id_presentation = Presentation::insertPres($_POST['titre_presentation'], $_POST['desc_presentation'], $_POST['heure_debut'], $_POST['heure_fin'], $_POST['date'], $_POST['id_evt'], $_POST['select_type_presentation']); $id_entreprise = Entreprise::insertEntreprise($_POST['nom_entreprise'], $_POST['adresse_entreprise'], $dir . '/images/' . $imgName, $_POST['url_entreprise']); $id_orateur = Orateur::insertOrateurNvEntp($_POST['nom_orateur'], $_POST['prenom_orateur'], $_POST['courriel_orateur'], $_POST['tel_orateur']); $presente = Presentation::insertPresenteNvOrateur(); } } } } } //Envoi les nouvelles infos pour la presentation et la met à jours. if (isset($_POST['modifier_presentation'])) { Presentation::updatePres($_POST['id_presentation'], $_POST['titre_presentation'], $_POST['description'], $_POST['date'], $_POST['heure_debut'], $_POST['heure_fin'], $_POST['orateurs'], $_POST['type_event']); } //Renvoi la liste des orateurs en fonction de la présentation if (isset($_REQUEST['id_presentation'])) { $orateur = Orateur::getOrateursArrayByPres($_REQUEST['id_presentation']); echo json_encode($orateur);
/** * Retourne la liste des offres d'une entreprise, formatée en HTML * @param Entreprise $entreprise : l'entreprise dont on souhaite la liste des offres * @return HTML */ public function listeOffresEntreprise($entreprise) { return $entreprise->listeOffresProposees(); }
public function getCommentaires() { $html = "<div>"; foreach ($this->commentaires as $c) { $e = Entreprise::createFromID($c["idEnt"]); $html .= "<a href='../offres/profil.php?id=" . $e->getId() . "'>" . $e->getNomEntreprise() . "</a> : <i><< " . substr($c["descrEns"], 0, 30) . " [...] >></i>"; $html .= "<form method='GET' action='description.php'><input type='submit' value='EDITER'><input type='hidden' name='id' value={$e->getId()}></form><br><br>"; } $html .= "</div>"; return $html; }
public function getEntreprise() { return Entreprise::createFromID($this->idEnt)->getNomEntreprise(); }
/** * Réinitialise la lites d'entreprse de l'objet courrant * @param L'entreprise rajouté */ public function notify() { $this->entreprises = Entreprise::creatFromEntrepreneur($this); self::startSession(); $this->saveIntoSession(); }
<?php require_once "../inc/config.inc.php"; session_start(); $g = Gestionnaire::getInstance(); $p = new Page("Gestion des stages :: Description"); if (isset($_SESSION["membre"]) && $_SESSION["membre"] instanceof Enseignant && isset($_GET["id"])) { foreach ($g->getEnseignants() as $e) { if ($e != NULL && $e->getId() == $_SESSION["membre"]->getId()) { $c = html_entity_decode($e->getCommentaire($_GET["id"])); $e = Entreprise::createFromID($_GET["id"]); $p->appendToHead(<<<CSS <style> div { margin-top:50px; width:500px; position:relative; left:50% !important; transform: translateX(-50%) !important; } h1 { margin:10px 0; text-align:center; } textarea { position:relative; width:100%; left:50% !important; transform: translateX(-50%) !important; } input {