当前位置: 首页>>代码示例>>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;未经允许,请勿转载。