本文整理汇总了PHP中Room::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::setName方法的具体用法?PHP Room::setName怎么用?PHP Room::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showCreateRoomPage
private function showCreateRoomPage()
{
if (WebRequest::wasPosted()) {
try {
// get variables
$rname = WebRequest::post("rname");
$rtype = WebRequest::postInt("rtype");
$rmin = WebRequest::postInt("rmin");
$rmax = WebRequest::postInt("rmax");
$rprice = WebRequest::postFloat("rprice");
// data validation
if ($rname == "") {
throw new CreateRoomException("blank-roomname");
}
if ($rtype == 0) {
throw new CreateRoomException("blank-roomtype");
}
if ($rmax < 1 || $rmin < 0) {
throw new CreateRoomException("room-capacity-too-small");
}
if ($rmin > $rmax) {
throw new CreateRoomException("room-capacity-min-gt-max");
}
if ($rprice != abs($rprice)) {
throw new CreateRoomException("room-price-negative");
}
$room = new Room();
// set values
$room->setName($rname);
$room->setType($rtype);
$room->setMinPeople($rmin);
$room->setMaxPeople($rmax);
$room->setPrice($rprice);
$room->save();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/Rooms";
} catch (CreateRoomException $ex) {
$this->mBasePage = "mgmt/roomCreate.tpl";
$this->error($ex->getMessage());
}
} else {
$this->mBasePage = "mgmt/roomCreate.tpl";
}
$this->mSmarty->assign("rtlist", RoomType::$data);
}
示例2: Right
$s1->setLabel('kodi');
$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');
示例3: execute
/**
* 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);
}
}
示例4: migratePaperLocations
/**
* 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;
}
示例5: execute
public function execute($action)
{
$msgs = Localization::getInstance();
$forwards = $action->getForwards();
// Recebe os valores enviados
$roomCourse = $_POST["group"];
$roomManager = $_POST['manager'];
$userName = utf8_decode($_POST["name"]);
$userEmail = $_POST["email"];
$userPasswordPlataform = "mude";
if (!empty($roomCourse) && !empty($roomManager) && !empty($userName) && !empty($userEmail)) {
/**
* Routine that checks which the browser used
* If an error occurs during the login, the system should return to the previous page
* If the browser used is Firefox, the system must go back two pages
* If is Chrome should back 1 page
* TODO Test with Internet Explorer
*/
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('|Firefox/([0-9\\.]+)|', $useragent, $matched)) {
$browser_version = $matched[1];
$browser = 'Firefox';
$numReturnPages = 2;
} else {
$numReturnPages = 1;
}
/**
* Via rest, it checks if this tool (in this case the Whiteboard)
* have permission to use information from the Core
*/
$host = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
$pass = md5(date("d/m/Y") . $host);
$server = "http://code.inf.poa.ifrs.edu.br/core/index.php/rest";
$action = str_replace("%40", "@", $userEmail);
$rest = new RESTClient();
$rest->initialize(array('server' => $server, 'http_user' => $host, 'http_pass' => $pass));
$granted = $rest->get($action);
if ($granted == 1) {
// Caso o usuário esteja cadastrado na Plataform
// CHECKING USER IN WHITEBOARD
$user = $this->dao->login($userEmail, $userPasswordPlataform);
if (count($user) <= 0) {
// Not in database, create new user
if (!empty($userEmail) && !empty($userName)) {
// Instantiates a new user;
$user = new User();
$user->setName($userName);
$user->setEmail($userEmail);
$user->setPassword($userPasswordPlataform);
$user->setRoomcreator(0);
$resultUser = $this->dao->saveNewUser($user);
$user = $this->dao->login($userEmail, $userPasswordPlataform);
}
}
if ($user->getName() != $userName) {
// Upadate user;
$resultUser = $this->dao->updateUserName($user->getUserId(), $userName);
}
// User contained in the database, loggin
$_SESSION['id'] = $user->getUserId();
$_SESSION['name'] = $user->getName();
$_SESSION['roomCreator'] = $user->getRoomcreator();
$_SESSION['email'] = $user->getEmail();
$_SESSION['user'] = $user;
// Verifies and creates, if necessary, the room of course
$roomPlataform = $this->dao->getRoomByCourse($roomCourse);
if (count($roomPlataform) <= 0) {
$roomName = "Turma: " . $roomCourse;
if ($user->getEmail() == $roomManager) {
$managerId = $user->getUserId();
} else {
$manager = $this->dao->login($roomManager, $userPasswordPlataform);
if (count($manager) <= 0) {
// Not in database, create new user coordinator
$manager = new User();
$manager->setName("Professor " . $roomCourse);
$manager->setEmail($roomManager);
$manager->setPassword($userPasswordPlataform);
$manager->setRoomcreator(1);
$resultManager = $this->dao->saveNewUser($manager);
$manager = $this->dao->login($manager->getEmail(), $userPasswordPlataform);
}
$managerId = $manager->getUserId();
}
// Instantiates a new room;
$roomPlataform = new Room();
$roomPlataform->setName($roomName);
$roomPlataform->setUserId($managerId);
$roomPlataform->setActive(0);
$roomPlataform->setActiveProduction(0);
$roomPlataform->setCourse($roomCourse);
$resultRoom = $this->dao->saveNewRoom($roomPlataform);
$roomPlataform = $this->dao->getRoomByCourse($roomCourse);
// Set manager permission of room
$permission = new Permission();
$permission->setUserId($managerId);
$permission->setRoomId($roomPlataform->getRoomId());
$resultPermission = $this->dao->savePermission($permission);
}
// Checks permissions
//.........这里部分代码省略.........
示例6: execute
public function execute($action)
{
$forwards = $action->getForwards();
$roomName = $_POST['name'];
$user = $_SESSION['id'];
$listUsers = explode("-", $_POST['idsSelecteds']);
// Checks if all fields were provided
if (!empty($_POST['name']) && !empty($_SESSION['id'])) {
// Instantiates a new room;
$room = new Room();
$room->setName($_POST['name']);
$room->setUserId($_SESSION['id']);
$room->setActive(0);
$room->setActiveProduction(0);
$room->setCourse($_POST['course']);
$resultRoom = $this->dao->saveNewRoom($room);
// List Rooms
$listRoonsAction = new ListRoonsAction();
$listRoonsAction->execute($action);
$roons = $_REQUEST["roons"];
foreach ($roons as $srcRoom) {
if (is_null($srcRoom->getCode())) {
$newRoomId = $srcRoom->getRoomId();
}
}
// Generates the secret code of the room
$room = $this->dao->getRoom($newRoomId);
$code = md5($newRoomId);
$room->setCode($code);
$room->save();
// Gives permission to the user who created the room
$listUsers[] = $_SESSION['id'];
// Instantiates a new room permission;
foreach ($listUsers as $allowedUserId) {
if ($allowedUserId != 0) {
$permission = new Permission();
$permission->setUserId($allowedUserId);
$permission->setRoomId($newRoomId);
$resultPermission = $this->dao->savePermission($permission);
}
}
// Showing the page
$this->pageController->run($forwards['success']);
} else {
// It will set a variable with the id of the button
// that opens the modal window that was active
$_SESSION['openModalWindow'] = "#btnOpenNewRoomForm";
// Error if there are blank fields
$_REQUEST["errorMsg"] = $this->message->getText("error.blankField");
$this->pageController->run($forwards['error']);
}
}