$s1->save(); $r1 = new Right(); $r1->setSection($s1->getId()); $r1->setRead('1'); $r1->setDelete('1'); $r1->setCreate('1'); $r1->setUpdate('1'); $r1->setRank('1'); $r1->save(); $conf = new Configuration(); $conf->put('plugin_kodiCmd_api_url_kodi', 'http://192.168.1.107:85/jsonrpc'); $conf->put('plugin_kodiCmd_api_timeout_kodi', 5); $conf->put('plugin_kodiCmd_api_recognition_status', ''); $ro = new Room(); $ro->setName('KODI'); $ro->setDescription('De la bonne zic, un bon p\'tit film....'); $ro->save(); $roomManager = new Room(); $rooms = $roomManager->populate(); foreach ($rooms as $room) { if ($room->getName() == "KODI") { $kodiRoomId = $room->getId(); } } $id = 0; $kodi = new KodiCmd(); $kodi->setName('à droite'); $kodi->setDescription('se déplacer à droite'); $kodi->setJson('"method":"Input.Right","id":"1"'); $kodi->setConfidence('0.8'); $kodi->setRoom($kodiRoomId);
/** * Save room. */ function execute() { $roomDao = DAORegistry::getDAO('RoomDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->roomId)) { $room =& $roomDao->getRoom($this->roomId); } if (!isset($room)) { $room = new Room(); } $room->setBuildingId($this->buildingId); $room->setName($this->getData('name'), null); // Localized $room->setAbbrev($this->getData('abbrev'), null); // Localized $room->setDescription($this->getData('description'), null); // Localized // Update or insert room if ($room->getId() != null) { $roomDao->updateRoom($room); } else { $roomDao->insertRoom($room); } }
/** * For upgrade to 2.1.0: Migrate paper locations into scheduler * @return boolean */ function migratePaperLocations() { $paperDao = DAORegistry::getDAO('PaperDAO'); $buildingDao = DAORegistry::getDAO('BuildingDAO'); $roomDao = DAORegistry::getDAO('RoomDAO'); $lastSchedConfId = null; $buildingId = null; $result =& $paperDao->retrieve("SELECT p.paper_id, c.primary_locale, sc.sched_conf_id, p.location FROM papers p, published_papers pp, sched_confs sc, conferences c WHERE p.paper_id = pp.paper_id AND p.sched_conf_id = sc.sched_conf_id AND sc.conference_id = c.conference_id AND location IS NOT NULL AND location <> '' ORDER BY sched_conf_id"); while (!$result->EOF) { $row = $result->GetRowAssoc(false); $paperId = $row['paper_id']; $schedConfId = $row['sched_conf_id']; $locale = $row['primary_locale']; $location = $row['location']; if ($schedConfId !== $lastSchedConfId) { // Create a default building $defaultText = __('common.default'); $building = new Building(); $building->setSchedConfId($schedConfId); $building->setName($defaultText, $locale); $building->setAbbrev($defaultText, $locale); $building->setDescription($defaultText, $locale); $buildingId = $buildingDao->insertBuilding($building); unset($building); $rooms = array(); } if (!isset($rooms[$location])) { $room = new Room(); $room->setBuildingId($buildingId); $room->setName($location, $locale); $room->setAbbrev($location, $locale); $room->setDescription($location, $locale); $roomId = $roomDao->insertRoom($room); $rooms[$location] =& $room; unset($room); } else { $room =& $rooms[$location]; $roomId = $room->getId(); unset($room); } $paperDao->update('UPDATE published_papers SET room_id = ? WHERE paper_id = ?', array($roomId, $paperId)); $result->MoveNext(); $lastSchedConfId = $schedConfId; } $result->Close(); unset($result); return true; }
public function modifyRoom() { $msg = ""; $room = new Room(); if ($room->access_ModelMember_sessionExists() && $room->access_ModelMember_userAdmin()) { // Récupération de l'id passée en URL $id = $_GET['id']; $room->setIdSalle($id); $modRoom = $room->findRoom(); if ($_POST) { $id_salle = $modRoom['id_salle']; $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"); $photo = $_FILES['photo']; $capacite = htmlentities($_POST['capacite'], ENT_QUOTES, "utf-8"); $categorie = htmlentities($_POST['categorie'], ENT_QUOTES, "utf-8"); // Instancie un nouvel objet room $room = new Room(); $room->setIdSalle($id_salle); // 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); $msgError = ""; // VERIFICATIONS SI LA PHOTO EST CHANGEE if (!empty($_FILES['photo']['name'])) { $resultArray = $room->checkPhotoReplace(); for ($i = 0; $i < count($resultArray); $i++) { if (!$resultArray[$i]->getPassed()) { $msgError .= $resultArray[$i]->getErrorMessage(); $msgError .= "<br/>"; } } } if ($msgError == "") { $room->replaceRoom(); header('location:index.php?controller=rooms&action=roomModified'); // $msg = '<p class="validation">Bravo, la salle a bien été enregistrée</p>'; // Appeler une autre page pour rafficher la salle modifiée ? } else { $msg .= $msgError; } } } else { $msg .= 'Vous n\'avez pas le droit d\'accéder à cette page.<br/>'; } include "views/rooms/modifyRooms.php"; }
$price = $database->escapeString($_POST['price']); $persons = $database->escapeString($_POST['persons']); $isAvailable = $database->escapeString($_POST['isAvailable']); $availableUntil = $database->escapeString($_POST['availableUntil']); $description = $database->escapeString($_POST['description']); $hotelId = $database->escapeString($_POST['hotelId']); $room->setRoomName($name); $room->setPrice($price); $room->setPersons($persons); $room->setIsAvailable($isAvailable); if ($isAvailable == 1) { $room->setAvailableUntil($availableUntil); } else { $room->setAvailableUntil("NOT AVAILABLE"); } $room->setDescription($description); $room->setHotelId($hotelId); if (isset($_POST['roomId'])) { $roomId = $database->escapeString($_POST['hotelId']); $room->setRoomId($roomId); $hotel->update($database); } else { $roomId = $room->create($database); } if (count($_FILES) != 0) { $error = 0; $files = array(); $uploaddir = "../images/rooms/large/"; $uploaddirthumb = "../images/rooms/thumb/"; $nameArray = $_FILES['mediaUploads']['name']; $typeArray = $_FILES['mediaUploads']['type'];