Example #1
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     if (!addon_installed('tickets')) {
         return array();
     }
     require_lang('tickets');
     require_code('tickets');
     require_code('tickets2');
     $outstanding = 0;
     $tickets = get_tickets(get_member(), NULL, false, true);
     if (!is_null($tickets)) {
         foreach ($tickets as $topic) {
             if ($topic['closed'] == 0) {
                 $outstanding++;
             }
         }
     }
     if ($outstanding > 0) {
         $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'g578142633c6f3d37776e82a869deb91'));
     } else {
         $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'h578142633c6f3d37776e82a869deb91'));
     }
     $url = build_url(array('page' => 'tickets', 'type' => 'misc'), get_module_zone('tickets'));
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('SUPPORT_TICKETS'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding)))));
     return array(array($tpl, NULL, $outstanding, NULL));
 }
Example #2
0
 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('tickets')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'tickets')) {
         return NULL;
     }
     if (is_guest()) {
         return NULL;
     }
     require_code('tickets');
     require_code('tickets2');
     $ticket_types = ocfilter_to_idlist_using_callback($_filters, '', NULL, NULL, NULL, NULL, false);
     if (count($ticket_types) != 0) {
         $rows = array();
         foreach ($ticket_types as $ticket_type) {
             if (!has_category_access(get_member(), 'tickets', get_translated_text($ticket_type))) {
                 continue;
             }
             $rows = array_merge($rows, get_tickets(get_member(), $ticket_type, false, false, true));
         }
     } else {
         $rows = get_tickets(get_member(), NULL, false, false, true);
     }
     require_code('feedback');
     $content = new ocp_tempcode();
     foreach ($rows as $i => $row) {
         if ($i == $max) {
             break;
         }
         if ($row['lasttime'] < $cutoff) {
             continue;
         }
         $ticket_id = extract_topic_identifier($row['description']);
         $ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $ticket_id));
         $author = $row['firstusername'];
         $date = date($date_string, $row['firsttime']);
         $edit_date = date($date_string, $row['lasttime']);
         $title = xmlentities($row['firsttitle']);
         $summary = xmlentities($row['firstpost']->evaluate());
         $category = '';
         $category_raw = '';
         if (!is_null($ticket_type)) {
             $category = get_translated_text($ticket_type);
             $category_raw = strval($ticket_type);
         }
         $view_url = build_url(array('page' => 'tickets', 'type' => 'ticket', 'id' => $ticket_id), get_module_zone('tickets'), NULL, false, false, true);
         if ($prefix == 'RSS_' && get_option('is_on_comments') == '1') {
             $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($ticket_id)));
         } else {
             $if_comments = new ocp_tempcode();
         }
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $ticket_id, 'NEWS' => '', 'DATE' => $date)));
     }
     require_lang('tickets');
     return array($content, do_lang('SUPPORT_TICKETS'));
 }
Example #3
0
 /**
  * Standard modular run function for change_detection hooks. They see if their own something has changed in comparison to sample data.
  *
  * @param  string			The sample data, serialised and then MD5'd
  * @return boolean		Whether the something has changed
  */
 function run($data)
 {
     if (get_param('type', 'misc') == 'misc') {
         require_code('tickets');
         require_code('tickets2');
         $ticket_type = get_param_integer('ticket_type', NULL);
         $tickets = get_tickets(get_member(), $ticket_type);
         return md5(serialize($tickets)) != $data;
     }
     $id = get_param('id', NULL);
     require_code('tickets');
     require_code('tickets2');
     $forum = 0;
     $topic_id = 0;
     $ticket_type = 0;
     $_comments = get_ticket_posts($id, $forum, $topic_id, $ticket_type);
     return md5(serialize($_comments)) != $data;
 }
/**
 * Get a dropdown of the tickets.
 *
 * @since  3.1.3
 * @param  array  $args   Dropdown arguments
 * @param  string $status Specific ticket status to look for
 * @return void
 */
function wpas_tickets_dropdown($args = array(), $status = '')
{
    $defaults = array('name' => 'wpas_tickets', 'id' => '', 'class' => '', 'exclude' => array(), 'selected' => '', 'select2' => true, 'please_select' => false);
    /* List all tickets */
    $tickets = get_tickets($status);
    $options = '';
    foreach ($tickets as $ticket) {
        $options .= "<option value='{$ticket->ID}'>{$ticket->post_title}</option>";
    }
    echo wpas_dropdown(wp_parse_args($args, $defaults), $options);
}
Example #5
0
 /**
  * Actualise to toggle the closed state of a ticket.
  *
  * @return tempcode		The UI
  */
 function toggle_ticket_closed()
 {
     $id = get_param('id');
     require_code('feedback');
     $action = 'CLOSE_TICKET';
     // Our tickets - search them for this ticket, acting as a kind of security check (as we will only iterate through tickets we have access to)
     $tickets = get_tickets(get_member(), NULL);
     foreach ($tickets as $ticket) {
         $ticket_id = extract_topic_identifier($ticket['description']);
         if ($ticket_id == $id) {
             if ($ticket['closed'] == 0) {
                 $action = 'OPEN_TICKET';
             }
             $GLOBALS['FORUM_DB']->query_update('f_topics', array('t_is_open' => $ticket['closed']), array('id' => $ticket['id']), '', 1);
         }
     }
     $title = get_page_title($action);
     $url = build_url(array('page' => '_SELF', 'type' => 'ticket', 'id' => $id), '_SELF');
     if (is_guest()) {
         $url = build_url(array('page' => '_SELF'), '_SELF');
     }
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Example #6
0
<?php

require '../model/functions.php';
get_header();
get_tickets();
get_footer();
Example #7
0
define('CURR_MENU', 'tickets');
require 'inc/common.inc.php';
check_permissions(CURR_MENU, 1);
$id_ticket = intval($_POST['id_ticket']) ? intval($_POST['id_ticket']) : intval($_GET['id_ticket']);
$tpl->assign('id_ticket', $id_ticket);
if (($_POST['reply'] || $_GET['reply']) && $id_ticket) {
    check_permissions(CURR_MENU, 2);
    $reply_text = $_POST['confirm'] ? addslashes(htmlspecialchars($_POST['reply_text'])) : '';
    $errors = array();
    if (!$reply_text) {
        $errors[] = $lang['errors_reply_empty'];
    }
    if (!$db->sql_numrows($db->sql_query("select * from tickets where id='{$id_ticket}' and id_group='{$my_group}'"))) {
        $errors[] = $lang['errors_ticket_incorrect'];
    }
    if (count($errors) || !$_POST['confirm']) {
        if ($_POST['confirm']) {
            $tpl->assign('errors', $errors);
        }
        $tpl->display('tickets_reply.tpl');
        exit;
    } elseif ($_POST['confirm']) {
        $db->sql_query("update tickets set reply='{$reply_text}', answered='" . time() . "' where id='{$id_ticket}'");
        header("location: tickets.php?id_ticket={$id_ticket}");
        exit;
    }
}
//get_root_id($id_ticket);
$tickets = get_tickets($id_ticket, 0);
$tpl->assign('tickets', $tickets);
$tpl->display('tickets.tpl');
Example #8
0
function get_tickets($id_ticket, $id_parent)
{
    global $db, $id_user;
    $tickets = array();
    $i = 0;
    if ($id_ticket) {
        $sql_where = "and tickets.id='{$id_ticket}'";
    } else {
        $sql_where = "and tickets.id_parent='{$id_parent}'";
    }
    $list_res = $db->sql_query("select tickets.*, admins_groups.group_name, users_accounts.name, users_accounts.lastname, users_accounts.surname from tickets, admins_groups, users, users_accounts where tickets.id_group=admins_groups.id and tickets.id_user=users.id and tickets.id_user='******' and users_accounts.id=users.id_account {$sql_where} order by tickets.created, tickets.answered desc");
    while ($tickets[$i] = $db->sql_fetchrow($list_res)) {
        $tickets[$i]['sub'] = get_tickets(0, $tickets[$i]['id']);
        $i++;
    }
    unset($tickets[count($tickets) - 1]);
    return $tickets;
}
 /**
  * Add ticket count in admin menu item.
  *
  * @return boolean True if the ticket count was added, false otherwise
  * @since  1.0.0
  */
 public function tickets_count()
 {
     if (false === (bool) wpas_get_option('show_count')) {
         return false;
     }
     global $menu, $current_user;
     $args = array();
     if (current_user_can('administrator') && false === boolval(wpas_get_option('admin_see_all')) || !current_user_can('administrator') && current_user_can('edit_ticket') && false === boolval(wpas_get_option('agent_see_all'))) {
         $args['meta_query'][] = array('key' => '_wpas_assignee', 'value' => $current_user->ID, 'compare' => '=');
     }
     $count = count(get_tickets('open', $args));
     if (0 === $count) {
         return false;
     }
     foreach ($menu as $key => $value) {
         if ($menu[$key][2] == 'edit.php?post_type=ticket') {
             $menu[$key][0] .= ' <span class="awaiting-mod count-' . $count . '"><span class="pending-count">' . $count . '</span></span>';
         }
     }
     return true;
 }
Example #10
0
function insert_db_row($dbh, $row)
{
    $name = $row['Name'];
    $email = $row['E-mail'];
    # check if they are in the people table first
    $pid = person_exists($dbh, $name, $email);
    if (is_null($pid)) {
        $pid = insert_person($dbh, $name, $email);
        $oid = insert_order($dbh, $pid, $row['Spaces'], '', 1, $pid);
    }
    # check number of tickets
    $tickets = get_tickets($dbh, $pid);
    if (count($tickets) != $row['Spaces']) {
        # Delete and regenerate all tickets
        delete_tickets($dbh, $pid);
        generate_tickets_pdf($dbh, $pid, $pid, $row);
    }
    # Return something useful to indicate what we just did
}
Example #11
0
<?php

/** on vérifie si une variable de session existe */
if (!isset($_SESSION['id'])) {
    /** retour à l'index */
    header('Location: index.php');
}
/** sinon on récupère les données des tickets */
include_once 'model/tickets.php';
/** on vérifie si des variables sont passés par l'url */
if (isset($_GET['a_recup'])) {
    /** @var array contient les données du ticket */
    $ticket = get_ticket($_GET['a_recup']);
    /** on vérifie si l'utilisateur a l'autorisation */
    if ($_SESSION['nm_grp'] != 'Techicien' && $ticket[0]['idVisiteur'] != $_SESSION['id'] && $ticket[0]['etat_ticket'] != 'Ouvert' && $ticket[0]['etat_ticket'] != 'En Attente') {
        /** retour à l'index */
        header('Location: index.php?page=tickets');
    }
}
/** @var array récupère tous les tickets */
$tickets = get_tickets();
/** @var array récupère tous les équipements */
$equipements = get_equipements();
/** on appel la view des tickets */
include_once 'view/tickets.php';