本文整理汇总了PHP中History::setUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP History::setUserId方法的具体用法?PHP History::setUserId怎么用?PHP History::setUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::setUserId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFor
static function createFor(HistoricalObjectI $object)
{
$data = $object->getDataForHistory();
if (!is_array($data)) {
$data = array($data);
}
foreach ($data as $historyDataEntry) {
$history = new History();
$history->setUserId($historyDataEntry->getUserId());
$history->setEntityType(get_class($object));
$history->setData(serialize($historyDataEntry->getData()));
$history->save();
}
}
示例2: 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
//.........这里部分代码省略.........
示例3: 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']);
}
}