當前位置: 首頁>>代碼示例>>PHP>>正文


PHP History::setDate方法代碼示例

本文整理匯總了PHP中History::setDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP History::setDate方法的具體用法?PHP History::setDate怎麽用?PHP History::setDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在History的用法示例。


在下文中一共展示了History::setDate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute


//.........這裏部分代碼省略.........
                 $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
             $permissions = $this->dao->listPermissions($roomPlataform->getRoomId());
             $havePermission = false;
             foreach ($permissions as $permission) {
                 if ($permission->getUserId() == $user->getUserId()) {
                     $havePermission = true;
                 }
             }
             if (!$havePermission) {
                 $permission = new Permission();
                 $permission->setUserId($user->getUserId());
                 $permission->setRoomId($roomPlataform->getRoomId());
                 $resultPermission = $this->dao->savePermission($permission);
             }
             $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
             $_SESSION['plataform'] = true;
             unset($_POST["group"]);
             unset($_POST['manager']);
             unset($_POST["name"]);
             unset($_POST["email"]);
             // If the room is active, will be given a join
             if ($roomPlataform->getActive() == 1) {
                 $_SESSION["idRoom"] = $roomPlataform->getRoomId();
                 $room = $this->dao->getRoom($roomPlataform->getRoomId());
                 // put the production in the session
                 $idProduction = $room->getActiveProduction();
                 $_SESSION['idProduction'] = $idProduction;
                 $history = new History();
                 $history->setUserId($_SESSION["id"]);
                 $history->setProductionId($idProduction);
                 $history->setDate(date('Y-m-d'));
                 $resultHistory = $this->dao->saveHistory($history);
                 // Retrieving the users in the room
                 $_REQUEST["users"] = $this->dao->getRoomUsers($_SESSION['idProduction']);
                 // Showing the page
                 $this->pageController->run($forwards['success']);
             } else {
                 if ($user->getUserId() == $roomPlataform->getUserId()) {
                     // If it is not active and the user is the owner of the room, will be given a start in the room
                     $production = new Production();
                     $production->setCreationDate(date('Y-m-d'));
                     $production->setUpdateDate(date('Y-m-d'));
                     $production->setRoomId($roomPlataform->getRoomId());
                     $resultProduction = $this->dao->createProduction($production);
                     if ($resultProduction) {
                         $_SESSION['idProduction'] = $production->getProductionId();
                     }
                     $resultUpdateRoom = $this->dao->updateRoomState($roomPlataform->getRoomId(), true, $_SESSION['idProduction']);
                     if ($resultUpdateRoom) {
                         $_SESSION["idRoom"] = $roomPlataform->getRoomId();
                     }
                     $resultRoom = $this->dao->getRoom($roomPlataform->getRoomId());
                     if ($resultRoom) {
                         $_SESSION["currentRoomManager"] = $resultRoom->getUserId();
                     }
                     $history = new History();
                     $history->setUserId($_SESSION["id"]);
                     $history->setProductionId($_SESSION['idProduction']);
                     $history->setDate(date('Y-m-d'));
                     $resultHistory = $this->dao->saveHistory($history);
                     // Retrieving the users in the room
                     $_REQUEST["users"] = $this->dao->getRoomUsers($_SESSION['idProduction']);
                     $this->pageController->run($forwards['success']);
                 } else {
                     // Otherwise, the room is closed and the user must wait until she opens
                     unset($_SESSION['id']);
                     unset($_SESSION['name']);
                     unset($_SESSION['roomCreator']);
                     unset($_SESSION['email']);
                     unset($_SESSION['user']);
                     // Closed room
                     echo "<script type='text/javascript'>";
                     echo "alert('" . $msgs->getText('error.plataform.closeRoom') . "');";
                     // Without permission			echo "history.go(-{$numReturnPages});";
                     echo "</script>";
                 }
             }
         } else {
             // Without permission
             echo "<script type='text/javascript'>";
             echo "alert('" . $msgs->getText('error.plataform.withoutPermission') . "');";
             echo "history.go(-{$numReturnPages});";
             echo "</script>";
         }
     } else {
         // Insufficient data
         echo "<script type='text/javascript'>";
         echo "alert('" . $msgs->getText('error.plataform.insufficientData') . "');";
         echo "history.go(-{$numReturnPages});";
         echo "</script>";
     }
 }
開發者ID:rodrigoprestesmachado,項目名稱:whiteboard,代碼行數:101,代碼來源:PlataformActions.php

示例2: execute

 public function execute($action)
 {
     $forwards = $action->getForwards();
     $_SESSION["idRoom"] = $_GET["idRoom"];
     $room = $this->dao->getRoom($_GET["idRoom"]);
     if ($room) {
         // If the room is open
         if ($room->getActive() != 0) {
             // put the production in the session
             $idProduction = $room->getActiveProduction();
             $_SESSION['idProduction'] = $idProduction;
             $history = new History();
             $history->setUserId($_SESSION["id"]);
             $history->setProductionId($idProduction);
             $history->setDate(date('Y-m-d'));
             $resultHistory = $this->dao->saveHistory($history);
             // Retrieving the users in the room
             $_REQUEST["users"] = $this->dao->getRoomUsers($_SESSION['idProduction']);
             // Showing the page
             $this->pageController->run($forwards['success']);
         } else {
             $_REQUEST["errorMsg"] = $this->message->getText("error.closeRoom");
             $this->pageController->run($forwards['error']);
         }
     } else {
         $_REQUEST["errorMsg"] = $this->message->getText("error.retrieveRoom");
         $this->pageController->run($forwards['error']);
     }
 }
開發者ID:rodrigoprestesmachado,項目名稱:whiteboard,代碼行數:29,代碼來源:RoomActions.php


注:本文中的History::setDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。