当前位置: 首页>>代码示例>>PHP>>正文


PHP Room::setActive方法代码示例

本文整理汇总了PHP中Room::setActive方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::setActive方法的具体用法?PHP Room::setActive怎么用?PHP Room::setActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room::setActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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
//.........这里部分代码省略.........
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:101,代码来源:PlataformActions.php

示例2: 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']);
     }
 }
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:52,代码来源:RoomActions.php


注:本文中的Room::setActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。