本文整理汇总了PHP中Ticket_User::constr_TUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket_User::constr_TUserId方法的具体用法?PHP Ticket_User::constr_TUserId怎么用?PHP Ticket_User::constr_TUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket_User
的用法示例。
在下文中一共展示了Ticket_User::constr_TUserId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRepliesOfTicket
/**
* return all replies on a specific ticket.
* @param $ticket_id the id of the ticket of which we want the replies.
* @param $view_as_admin if the browsing user is an admin/mod it should be 1, this will also show the hidden replies.
* @return an array with ticket_reply objects (beware the author and content are objects on their own, not integers!)
*/
public static function getRepliesOfTicket($ticket_id, $view_as_admin)
{
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content INNER JOIN ticket_user ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id and ticket_user.TUserId = ticket_reply.Author ORDER BY ticket_reply.TReplyId ASC", array('id' => $ticket_id));
$row = $statement->fetchAll();
$result = array();
foreach ($row as $tReply) {
//only add hidden replies if the user is a mod/admin
if (!$tReply['Hidden'] || $view_as_admin) {
//load author
$instanceAuthor = Ticket_User::constr_TUserId($tReply['Author']);
$instanceAuthor->setExternId($tReply['ExternId']);
$instanceAuthor->setPermission($tReply['Permission']);
//load content
$instanceContent = new Ticket_Content();
$instanceContent->setTContentId($tReply['TContentId']);
$instanceContent->setContent($tReply['Content']);
//load reply and add the author and content object in it.
$instanceReply = new self();
$instanceReply->setTReplyId($tReply['TReplyId']);
$instanceReply->setTimestamp($tReply['Timestamp']);
$instanceReply->setAuthor($instanceAuthor);
$instanceReply->setTicket($ticket_id);
$instanceReply->setContent($instanceContent);
$instanceReply->setHidden($tReply['Hidden']);
$result[] = $instanceReply;
}
}
return $result;
}
示例2: getLogsOfTicket
/**
* return all log entries related to a ticket.
* @param $ticket_id the id of the ticket of which we want all related log entries returned.
* @return an array of ticket_log objects, be aware that the author in the ticket_log object is a ticket_user object on its own (so not a simple integer).
*/
public static function getLogsOfTicket($ticket_id)
{
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id ORDER BY ticket_log.TLogId ASC", array('id' => $ticket_id));
$row = $statement->fetchAll();
$result = array();
foreach ($row as $log) {
$instanceAuthor = Ticket_User::constr_TUserId($log['Author']);
$instanceAuthor->setExternId($log['ExternId']);
$instanceAuthor->setPermission($log['Permission']);
$instanceLog = new self();
$instanceLog->setTLogId($log['TLogId']);
$instanceLog->setTimestamp($log['Timestamp']);
$instanceLog->setAuthor($instanceAuthor);
$instanceLog->setTicket($ticket_id);
$instanceLog->setQuery($log['Query']);
$result[] = $instanceLog;
}
return $result;
}