本文整理汇总了PHP中Room::addRoom方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::addRoom方法的具体用法?PHP Room::addRoom怎么用?PHP Room::addRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::addRoom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRoom
public function addRoom()
{
$msg = "";
$errors = array();
// Instancie un nouvel objet room
$room = new Room();
if ($room->access_ModelMember_sessionExists() && $room->access_ModelMember_userAdmin()) {
if ($_POST) {
$pays = htmlentities($_POST['pays'], ENT_QUOTES, "utf-8");
$ville = htmlentities($_POST['ville'], ENT_QUOTES, "utf-8");
$adresse = htmlentities($_POST['adresse'], ENT_QUOTES, "utf-8");
$cp = htmlentities($_POST['cp'], ENT_QUOTES, "utf-8");
$titre = htmlentities($_POST['titre'], ENT_QUOTES, "utf-8");
// $description = htmlentities($_POST['description'], ENT_QUOTES, "UTF-8");
$description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
if ($description == NULL || $description == false || empty($description)) {
$errors[] = '<div class="alert alert-warning">Vous devez donner une description pour la salle.</div>';
}
$photo = $_FILES['photo'];
$capacite = htmlentities($_POST['capacite'], ENT_QUOTES, "utf-8");
$categorie = htmlentities($_POST['categorie'], ENT_QUOTES, "utf-8");
// $this->resize_image($photo, $photoResized, 600, false);
// $photo = $photoResized;
if (count($errors) == 0) {
// Je remplis le nouvel objet avec les valeurs récupérées dans le formulaire
$room->setPays($pays);
$room->setVille($ville);
$room->setAdresse($adresse);
$room->setCP($cp);
$room->setTitre($titre);
$room->setDescription($description);
$room->setPhoto($photo);
$room->setCapacite($capacite);
$room->setCategorie($categorie);
// VERIFICATIONS
$resultArray = $room->checkAll();
$msgError = "";
for ($i = 0; $i < count($resultArray); $i++) {
if (!$resultArray[$i]->getPassed()) {
$msgError .= $resultArray[$i]->getErrorMessage();
$msgError .= "<br/>";
}
}
// Si le message d'erreur est vide, je rentre la salle en base avec la méthode addRoom()
// Sinon j'affiche les erreurs
if ($msgError == "") {
$room->addRoom();
header('location:index.php?controller=rooms&action=roomAdded');
} else {
$msg .= $msgError;
}
} else {
$errors[] .= '<div class="alert alert-warning">La salle n\'a pas été enregistrée.</div>';
}
}
} else {
$msg .= '<div class="alert alert-danger">Vous n\'avez pas le droit d\'accéder à cette page.</div>';
}
include "views/rooms/addRoom.php";
}
示例2: addslashes
<?php
require_once 'include.php';
$loggedUser = User::whoIsLogged();
if ($loggedUser === null) {
Utils::redirect('login.php');
}
if ($_POST['create_room'] && $loggedUser['admin']) {
$room = Room::addRoom(addslashes($_POST['title']), addslashes($_POST['description']));
Utils::redirect('room.php?id=' . $room);
}
$roomRepository = new RoomRepository();
$rooms = $roomRepository->getAll();
$GLOBALS['smarty']->assign('loggedUser', $loggedUser);
$GLOBALS['smarty']->assign('rooms', $rooms);
$GLOBALS['smarty']->assign('content', $GLOBALS['smarty']->fetch('rooms.tpl'));
echo $GLOBALS['smarty']->fetch('content.tpl');
示例3: addRoom
public function addRoom($name, $public)
{
$roomId = Room::addRoom($name, $public);
$this->individualRoom($roomId);
}