本文整理汇总了PHP中Ticket_User类的典型用法代码示例。如果您正苦于以下问题:PHP Ticket_User类的具体用法?PHP Ticket_User怎么用?PHP Ticket_User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ticket_User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterAdd
static function afterAdd(Group_Ticket $item)
{
global $DB;
//Toolbox::logDebug(__METHOD__, $item);
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('add_notif')) {
if ($item->getField('type') == CommonITILActor::ASSIGN) {
$ticket = new Ticket();
if ($ticket->getFromDB($item->getField('tickets_id'))) {
NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
}
}
}
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
return false;
// No check
}
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
$crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
if ($data['id'] != $item->getID()) {
$gu = new Group_Ticket();
$gu->delete($data);
}
}
if ($config->getField('single_tech_mode') == 2) {
foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
$gu = new Ticket_User();
$gu->delete($data);
}
}
}
}
示例2: syncing
/**
* This function is beign used to load info that's needed for the syncing page.
* this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here
* so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function syncing()
{
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
//return a paginated version of all unsynced changes.
$pagination = new Pagination("SELECT * FROM ams_querycache", "lib", 5, "Querycache");
$pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements(), array("getSID", "getType"), array("id", "type"));
$pageResult['links'] = $pagination->getLinks(5);
$pageResult['lastPage'] = $pagination->getLast();
$pageResult['currentPage'] = $pagination->getCurrent();
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
//check if shard is online
try {
$dbs = new DBLayer("shard");
$pageResult['shard'] = "online";
} catch (PDOException $e) {
$pageResult['shard'] = "offline";
}
return $pageResult;
} else {
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
}
示例3: plugins_update
/**
* function plugins_update to get
* plugins updates from the Database using pagination object.
*
* @author shubham meena mentored by Matthew Lagoe
*/
function plugins_update()
{
if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$pagination = new Pagination("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache");
$pageResult['plug'] = Gui_Elements::make_table($pagination->getElements(), array("getId", "getPluginName", "getPluginInfo", "getUpdateInfo"), array("id", "plugin_name", "plugin_info", "update_info"));
$pageResult['links'] = $pagination->getLinks(5);
$pageResult['lastPage'] = $pagination->getLast();
$pageResult['currentPage'] = $pagination->getCurrent();
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
// check if shard is online
try {
$dbs = new DBLayer("shard");
$pageResult['shard'] = "online";
} catch (PDOException $e) {
$pageResult['shard'] = "offline";
}
return $pageResult;
} else {
// ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
}
示例4: login
/**
* This function is beign used to load info that's needed for the login page.
* it will try to auto-login, this can only be used while ingame, the web browser sends additional cookie information that's also stored in the open_ring db.
* We will compare the values and if they match, the user will be automatically logged in!
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function login()
{
global $INGAME_WEBPATH;
global $WEBPATH;
if (helpers::check_if_game_client()) {
//check if you are logged in ingame, this should auto login
$result = Helpers::check_login_ingame();
if ($result) {
//handle successful login
$_SESSION['user'] = $result['name'];
$_SESSION['id'] = WebUsers::getId($result['name']);
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
//go back to the index page.
header("Cache-Control: max-age=1");
if (Helpers::check_if_game_client()) {
header('Location: ' . $INGAME_WEBPATH);
} else {
header('Location: ' . $WEBPATH);
}
throw new SystemExit();
}
}
$pageElements['ingame_webpath'] = $INGAME_WEBPATH;
$GETString = "";
foreach ($_GET as $key => $value) {
$GETString = $GETString . $key . '=' . $value . "&";
}
if ($GETString != "") {
$GETString = '?' . $GETString;
}
$pageElements['getstring'] = $GETString;
return $pageElements;
}
示例5: 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;
}
示例6: userlist
/**
* This function is beign used to load info that's needed for the userlist page.
* this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function userlist()
{
if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$pagination = new Pagination(WebUsers::getAllUsersQuery(), "web", 10, "WebUsers");
$pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements(), array("getUId", "getUsername", "getEmail"), array("id", "username", "email"));
$pageResult['links'] = $pagination->getLinks(5);
$pageResult['lastPage'] = $pagination->getLast();
$pageResult['currentPage'] = $pagination->getCurrent();
$i = 0;
foreach ($pageResult['userlist'] as $user) {
$pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
$i++;
}
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
$pageResult['isAdmin'] = "TRUE";
}
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
global $BASE_WEBPATH;
$pageResult['base_webpath'] = $BASE_WEBPATH;
return $pageResult;
} else {
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
}
示例7: plugin_vip_item_update_user
static function plugin_vip_item_update_user(Ticket_User $ticket)
{
global $DB;
$ticketid = $ticket->getField('tickets_id');
$vipticket = self::isTicketVip($ticketid);
$vipdbticket = "";
$ticketquery = "SELECT isvip\n\t\t\t\t\t\t FROM glpi_plugin_vip_tickets\n\t\t\t\t \t\t WHERE id = " . $ticketid;
$vipticketres = $DB->query($ticketquery);
$vipdbticket = mysqli_fetch_object($vipticketres);
if ($vipticket) {
$vipdbquery = "UPDATE glpi_plugin_vip_tickets\n SET isvip = 1\n WHERE id = " . $ticketid;
} else {
$vipdbquery = "UPDATE glpi_plugin_vip_tickets\n SET isvip = 0\n WHERE id = " . $ticketid;
}
$updatevipdb = $DB->query($vipdbquery);
}
示例8: dashboard
/**
* This function is beign used to load info that's needed for the dashboard page.
* check if the person who wants to view this page is a mod/admin, if this is not the case, he will be redirected to an error page.
* next it will fetch a lot of information regarding to the status of the ticket system (eg return the total amount of tickets) and return this information so
* it can be used by the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function dashboard()
{
//if logged in
if (WebUsers::isLoggedIn()) {
//is Mod
if (ticket_user::isMod(unserialize($_SESSION['ticket_user']))) {
//return useful information about the status of the ticket system.
$result['user_id'] = unserialize($_SESSION['ticket_user'])->getTUserId();
$result['nrToDo'] = Ticket_Queue_Handler::getNrOfTicketsToDo(unserialize($_SESSION['ticket_user'])->getTUserId());
$result['nrAssignedWaiting'] = Ticket_Queue_Handler::getNrOfTicketsAssignedWaiting(unserialize($_SESSION['ticket_user'])->getTUserId());
$result['nrTotalTickets'] = Ticket_Queue_Handler::getNrOfTickets();
$ticket = Ticket_Queue_Handler::getNewestTicket();
$result['newestTicketId'] = $ticket->getTId();
$result['newestTicketTitle'] = $ticket->getTitle();
$result['newestTicketAuthor'] = Ticket_User::get_username_from_id($ticket->getAuthor());
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();
}
}
示例9: reply_on_ticket
/**
* This function is beign used to reply on a ticket.
* It will first check if the user who executed this function is a mod/admin or the topic creator himself. If this is not the case the page will be redirected to an error page.
* in case the isset($_POST['hidden'] is set and the user is a mod, the message will be hidden for the topic starter. The reply will be created. If $_POST['ChangeStatus']) & $_POST['ChangePriority'] is set
* it will try to update the status and priority. Afterwards the page is being redirecte to the ticket again.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function reply_on_ticket()
{
global $INGAME_WEBPATH;
global $WEBPATH;
//if logged in
if (WebUsers::isLoggedIn() && isset($_POST['ticket_id'])) {
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$target_ticket = new Ticket();
$target_ticket->load_With_TId($ticket_id);
//check if the user who executed this function is a mod/admin or the topic creator himself.
if ($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() || Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
try {
$author = unserialize($_SESSION['ticket_user'])->getTUserId();
if (isset($_POST['Content'])) {
$content = $_POST['Content'];
} else {
$content = "";
}
$hidden = 0;
if (isset($_POST['hidden']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$hidden = 1;
}
//create the reply
Ticket::createReply($content, $author, $ticket_id, $hidden);
//try to update the status & priority in case these are set.
if (isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
$newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT);
Ticket::updateTicketStatusAndPriority($ticket_id, $newStatus, $newPriority, $author);
}
header("Cache-Control: max-age=1");
if (Helpers::check_if_game_client()) {
header("Location: " . $INGAME_WEBPATH . "?page=show_ticket&id=" . $ticket_id);
} else {
header("Location: " . $WEBPATH . "?page=show_ticket&id=" . $ticket_id);
}
throw new SystemExit();
} catch (PDOException $e) {
//ERROR: LIB DB is not online!
print_r($e);
//header("Location: index.php");
throw new SystemExit();
}
} 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();
}
}
示例10: modify_email_of_sgroup
/**
* This function is beign used to modify the email related to a support group.
* It will first check if the user who executed this function is an admin. If this is not the case the page will be redirected to an error page.
* the new email will be validated and in case it's valid we'll add it to the db. Before adding it, we will encrypt the password by using the MyCrypt class. Afterwards the password gets
* updated and the page redirected again.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function modify_email_of_sgroup()
{
global $INGAME_WEBPATH;
global $WEBPATH;
if (WebUsers::isLoggedIn()) {
//check if user is an admin
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user'])) && isset($_POST['target_id'])) {
$sgroupid = filter_var($_POST['target_id'], FILTER_SANITIZE_NUMBER_INT);
$group = Support_Group::getGroup($sgroupid);
$groupemail = filter_var($_POST['GroupEmail'], FILTER_SANITIZE_STRING);
if (Users::validEmail($groupemail) || $groupemail == "") {
$password = filter_var($_POST['IMAP_Password'], FILTER_SANITIZE_STRING);
$group->setGroupEmail($groupemail);
$group->setIMAP_MailServer(filter_var($_POST['IMAP_MailServer'], FILTER_SANITIZE_STRING));
$group->setIMAP_Username(filter_var($_POST['IMAP_Username'], FILTER_SANITIZE_STRING));
//encrypt password!
global $cfg;
$crypter = new MyCrypt($cfg['crypt']);
$enc_password = $crypter->encrypt($password);
$group->setIMAP_Password($enc_password);
$group->update();
$result['RESULT_OF_MODIFYING'] = "SUCCESS";
if ($password == "") {
$result['RESULT_OF_MODIFYING'] = "NO_PASSWORD";
}
} else {
$result['RESULT_OF_MODIFYING'] = "EMAIL_NOT_VALID";
}
$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
$result['no_visible_elements'] = 'FALSE';
$result['username'] = $_SESSION['user'];
//global $SITEBASE;
//require_once($SITEBASE . 'inc/show_sgroup.php');
//$result= array_merge($result, show_sgroup());
//helpers :: loadtemplate( 'show_sgroup', $result);
header("Cache-Control: max-age=1");
if (Helpers::check_if_game_client()) {
header("Location: " . $INGAME_WEBPATH . "?page=show_sgroup&id=" . $sgroupid);
} else {
header("Location: " . $WEBPATH . "?page=show_sgroup&id=" . $sgroupid);
}
throw new SystemExit();
} 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();
}
}
示例11: 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();
}
}
示例12: _testTicketUser
protected function _testTicketUser(Ticket $ticket, $actor, $role, $notify, $alternateEmail)
{
if ($actor > 0) {
$user = new User();
$user->getFromDB($actor);
$this->assertFalse($user->isNewItem());
$ticketUser = new Ticket_User();
$ticketUser->getFromDBForItems($ticket, $user);
$this->assertFalse($ticketUser->isNewItem());
$this->assertEquals($role, $ticketUser->getField('type'));
$this->assertEquals($notify, $ticketUser->getField('use_notification'));
} else {
$ticketId = $ticket->getID();
$ticketUser = new Ticket_User();
$ticketUser->getFromDBByQuery("WHERE `tickets_id` = '{$ticketId}' AND `users_id` = '0' AND `alternative_email` = '{$alternateEmail}'");
$this->assertFalse($ticketUser->isNewItem());
$this->assertEquals($role, $ticketUser->getField('type'));
$this->assertEquals($notify, $ticketUser->getField('use_notification'));
}
}
示例13: settings
/**
* This function is beign used to load info that's needed for the settings page.
* check if the person who wants to view this page is a mod/admin or the user to whom te settings belong himself, if this is not the case, he will be redirected to an error page.
* it will return a lot of information of that user, that's being used for loading the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function settings()
{
if (WebUsers::isLoggedIn()) {
//in case id-GET param set it's value as target_id, if no id-param is given, ue the session id.
if (isset($_GET['id'])) {
if ($_GET['id'] != $_SESSION['id'] && !Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
} else {
$webUser = new Webusers($_GET['id']);
$result = $webUser->getInfo();
if (Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && $_GET['id'] != $_SESSION['id']) {
$result['changesOther'] = "TRUE";
}
$result['target_id'] = $_GET['id'];
$result['current_mail'] = $webUser->getEmail();
$result['target_username'] = $webUser->getUsername();
}
} else {
$webUser = new Webusers($_SESSION['id']);
$result = $webUser->getInfo();
$result['target_id'] = $_SESSION['id'];
$result['current_mail'] = $webUser->getEmail();
$result['target_username'] = $webUser->getUsername();
}
//Sanitize Data
$result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL);
$result['target_username'] = filter_var($result['target_username'], FILTER_SANITIZE_STRING);
$result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING);
$result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING);
$result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);
$result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT);
$result['ReceiveMail'] = filter_var($result['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT);
$result['country_array'] = getCountryArray();
global $INGAME_WEBPATH;
$result['ingame_webpath'] = $INGAME_WEBPATH;
$dbl = new DBLayer("lib");
$statement = $dbl->executeWithoutParams("SELECT * FROM settings");
$rows = $statement->fetchAll();
foreach ($rows as &$value) {
$result[$value['Setting']] = $value['Value'];
}
return $result;
} else {
//ERROR: not logged in!
header("Location: index.php");
header("Cache-Control: max-age=1");
throw new SystemExit();
}
}
示例14: add_user_to_sgroup
/**
* This function is beign used to add a user to a support group.
* It will first check if the user who executed this function is an admin. If the user exists it will try to add it to the supportgroup, in case it's not a mod or admin it will not
* add it to the group. if the executing user is not an admin or not logged in, the page will be redirected to the error page.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function add_user_to_sgroup()
{
global $INGAME_WEBPATH;
global $WEBPATH;
if (WebUsers::isLoggedIn()) {
//check if the that executed the task is an admin.
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user'])) && isset($_POST['target_id'])) {
$name = filter_var($_POST['Name'], FILTER_SANITIZE_STRING);
$id = filter_var($_POST['target_id'], FILTER_SANITIZE_NUMBER_INT);
$user_id = WebUsers::getId($name);
if ($user_id != "") {
//if the target user is a mod/admin
if (Ticket_User::constr_ExternId($user_id)->getPermission() > 1) {
//add it to the support group
$result['RESULT_OF_ADDING'] = Support_Group::addUserToSupportGroup($user_id, $id);
} else {
//return error message.
$result['RESULT_OF_ADDING'] = "NOT_MOD_OR_ADMIN";
}
} else {
$result['RESULT_OF_ADDING'] = "USER_NOT_EXISTING";
}
//$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
//$result['no_visible_elements'] = 'FALSE';
//$result['username'] = $_SESSION['user'];
//global $SITEBASE;
//require_once($SITEBASE . 'inc/show_sgroup.php');
//$result= array_merge($result, show_sgroup());
//helpers :: loadtemplate( 'show_sgroup', $result);
if (Helpers::check_if_game_client()) {
header("Cache-Control: max-age=1");
header("Location: " . $INGAME_WEBPATH . "?page=show_sgroup&id=" . $id);
} else {
header("Cache-Control: max-age=1");
header("Location: " . $WEBPATH . "?page=show_sgroup&id=" . $id);
}
throw new SystemExit();
} 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();
}
}
示例15: 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();
}