本文整理匯總了PHP中Ticket_User::load_With_TUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ticket_User::load_With_TUserId方法的具體用法?PHP Ticket_User::load_With_TUserId怎麽用?PHP Ticket_User::load_With_TUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ticket_User
的用法示例。
在下文中一共展示了Ticket_User::load_With_TUserId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: show_reply
/**
* This function is beign used to load info that's needed for the show_reply page.
* check if the person is allowed to see the reply, if not he'll be redirected to an error page.
* data regarding to the reply will be returned by this function that will be used by the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function show_reply()
{
//if logged in
if (WebUsers::isLoggedIn() && isset($_GET['id'])) {
$result['reply_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
$reply = new Ticket_Reply();
$reply->load_With_TReplyId($result['reply_id']);
$ticket = new Ticket();
$ticket->load_With_TId($reply->getTicket());
//check if the user is allowed to see the reply
if ($ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() && !$reply->getHidden() || Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$content = new Ticket_Content();
$content->load_With_TContentId($reply->getContent());
$author = new Ticket_User();
$author->load_With_TUserId($reply->getAuthor());
$result['hidden'] = $reply->getHidden();
$result['ticket_id'] = $reply->getTicket();
$result['reply_timestamp'] = $reply->getTimestamp();
$result['author_permission'] = $author->getPermission();
$result['reply_content'] = $content->getContent();
$result['author'] = $author->getExternId();
$webUser = new WebUsers($author->getExternId());
$result['authorName'] = $webUser->getUsername();
if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$result['isMod'] = "TRUE";
}
global $INGAME_WEBPATH;
$result['ingame_webpath'] = $INGAME_WEBPATH;
return $result;
} else {
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
} else {
//ERROR: not logged in!
header("Cache-Control: max-age=1");
header("Location: index.php");
throw new SystemExit();
}
}
示例2: getTickets
/**
* returns the tickets that are related in someway defined by $input.
* The $input parameter should be a string that defines what kind of queue should be loaded. A new pagination object will be instantiated and will load 10 entries,
* related to the $_GET['pagenum'] variable.
* @param $input identifier that defines what queue to load.
* @param $user_id the id of the user that browses the queues, some queues can be depending on this.
* @return an array consisting of ticket objects, beware, the author & category of a ticket, are objects on their own (no integers are used this time).
*/
public function getTickets($input, $user_id)
{
switch ($input) {
case "all":
$this->queue->loadAllTickets();
break;
case "all_open":
$this->queue->loadAllOpenTickets();
break;
case "archive":
$this->queue->loadAllClosedTickets();
break;
case "not_assigned":
$this->queue->loadAllNotAssignedTickets();
break;
case "todo":
$this->queue->loadToDoTickets($user_id);
break;
case "create":
//set these with the createQueue function proceding the getTickets function
break;
default:
return "ERROR";
}
$this->pagination = new Pagination($this->queue->getQuery(), "lib", 10, "Ticket", $this->queue->getParams());
$elemArray = $this->pagination->getElements();
if (!empty($elemArray)) {
foreach ($elemArray as $element) {
$catInstance = new Ticket_Category();
$catInstance->load_With_TCategoryId($element->getTicket_Category());
$element->setTicket_Category($catInstance);
$userInstance = new Ticket_User();
$userInstance->load_With_TUserId($element->getAuthor());
$element->setAuthor($userInstance);
}
}
return $this->pagination->getElements();
}
示例3: explode
/**
* Handles an incomming email
* Read the content of one email by using imap's functionality. If a ticket id is found inside the message_id or else in the subject line, then a reply will be added
* (if the email is not being sent from the authors email address it won't be added though and a warning will be sent to both parties). If no ticket id is found, then a new
* ticket will be created.
* @param $mbox a mailbox object
* @param $i the email's id in the mailbox (integer)
* @param $group the group object that owns the inbox.
* @return a string based on the found ticket i and timestamp (will be used to store a copy of the email locally)
*/
function incoming_mail_handler($mbox, $i, $group)
{
global $MAIL_LOG_PATH;
$header = imap_header($mbox, $i);
$subject = self::decode_utf8($header->subject);
$entire_email = imap_fetchheader($mbox, $i) . imap_body($mbox, $i);
$subject = self::decode_utf8($header->subject);
$to = $header->to[0]->mailbox;
$from = $header->from[0]->mailbox . '@' . $header->from[0]->host;
$fromEmail = $header->from[0]->mailbox . '@' . $header->from[0]->host;
$txt = self::get_part($mbox, $i, "TEXT/PLAIN");
//$html = self::get_part($mbox, $i, "TEXT/HTML");
//get the id out of the email address of the person sending the email.
if ($from !== NULL && !is_numeric($from)) {
$from = Ticket_User::get_id_from_email($from);
}
//get ticket_id out of the message-id or else out of the subject line
$ticket_id = 0;
if (isset($header->references)) {
$pieces = explode(".", $header->references);
if ($pieces[0] == "<ams") {
$ticket_id = $pieces[2];
} else {
$ticket_id = self::get_ticket_id_from_subject($subject);
}
} else {
$ticket_id = self::get_ticket_id_from_subject($subject);
}
//if ticket id is found, that means it is a reply on an existing ticket
if ($ticket_id && is_numeric($ticket_id) && $ticket_id > 0) {
$ticket = new Ticket();
$ticket->load_With_TId($ticket_id);
//if email is sent from an existing email address in the db (else it will give an error while loading the user object)
if ($from != "FALSE") {
$user = new Ticket_User();
$user->load_With_TUserId($from);
//if user has access to it!
if ((Ticket_User::isMod($user) or $ticket->getAuthor() == $user->getTUserId()) and $txt != "") {
Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0);
error_log("Email found that is a reply to a ticket at:" . $group->getGroupEmail() . "\n", 3, $MAIL_LOG_PATH);
} else {
//if user has no access to it
//Warn real ticket owner + person that send the mail
Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, NULL, "WARNAUTHOR", $from);
Mail_Handler::send_ticketing_mail($from, $ticket, NULL, "WARNSENDER", NULL);
error_log("Email found that was a reply to a ticket, though send by another user to " . $group->getGroupEmail() . "\n", 3, $MAIL_LOG_PATH);
}
} else {
//if a reply to a ticket is being sent by a non-user!
//Warn real ticket owner + person that send the mail
Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, NULL, "WARNAUTHOR", $fromEmail);
Mail_Handler::send_ticketing_mail($fromEmail, $ticket, NULL, "WARNUNKNOWNSENDER", NULL);
error_log("Email found that was a reply to a ticket, though send by an unknown email address to " . $group->getGroupEmail() . "\n", 3, $MAIL_LOG_PATH);
}
return $ticket_id . "." . time();
} else {
if ($from != "FALSE") {
//if ticket_id isn't found, create a new ticket!
//if an existing email address mailed the ticket
//if not default group, then forward it by giving the $group->getSGroupId's param
$newTicketId = Ticket::create_Ticket($subject, $txt, 1, $from, $from, $group->getSGroupId());
error_log("Email regarding new ticket found at:" . $group->getGroupEmail() . "\n", 3, $MAIL_LOG_PATH);
return $newTicketId . "." . time();
} else {
//if it's a email that has nothing to do with ticketing, return 0;
error_log("Email found that isn't a reply or new ticket, at:" . $group->getGroupEmail() . "\n", 3, $MAIL_LOG_PATH);
return 0;
}
}
}
示例4: get_username_from_id
/**
* return the username of a ticket_user.
* @param $id the TUserId of the entry.
* @return string containing username of that user.
*/
public static function get_username_from_id($id)
{
$user = new Ticket_User();
$user->load_With_TUserId($id);
$webUser = new WebUsers($user->getExternId());
return $webUser->getUsername();
}