Esempio n. 1
0
 /**
  * @return TicketManager
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
<?php

/**
 * Arrival module, this is a rewrite of the old module.
 */
$ticketManager = TicketManager::getInstance();
$usertable = $sql_prefix . "_users";
$ticketstable = $sql_prefix . "_tickets";
$tickettypestable = $sql_prefix . "_ticketTypes";
$thisModule = "arrival";
$action = isset($_GET['action']) ? $_GET['action'] : null;
$acl_ticket = acl_access("ticketadmin", "", $sessioninfo->eventID);
$acl_seating = acl_access("seating", "", $sessioninfo->eventID);
// Check if user has permission to tickets
if ($acl_ticket == 'No') {
    printNoAccessError();
}
$content .= "\n        <h1 class=\"page-title\">" . _("Arrival") . "</h1>\n        <div class=\"arrival\">";
switch ($action) {
    //==================================================================================
    // Ticket detail display
    case "changeuser":
        $ticketID = isset($_GET['ticket']) && is_numeric($_GET['ticket']) ? intval($_GET['ticket']) : -1;
        if ($ticketID < 1) {
            $content .= "<p>Ugyldig parametere</p>";
        } else {
            $ticket = $ticketManager->getTicket($ticketID);
            $changeType = isset($_GET['type']) ? $_GET['type'] : 'user';
            /* HANDLERS */
            if (isset($_GET['set']) && is_numeric($_GET['set']) == true && intval($_GET['set']) > 0) {
                $ret = "index.php?module={$thisModule}&action=ticketdetail&ticket=" . $ticketID . "&changed=" . $changeType;
Esempio n. 3
0
/**
 *
 */
function save_ticket()
{
    global $plugin;
    $category_id = $_POST['category_id'];
    $content = $_POST['content'];
    if ($_POST['phone'] != "") {
        $content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . Security::remove_XSS($_POST['phone']) . '</p>';
    }
    $course_id = $_POST['course_id'];
    $project_id = $_POST['project_id'];
    $subject = $_POST['subject'];
    $other_area = (int) $_POST['other_area'];
    $email = $_POST['email'];
    $personal_email = $_POST['personal_email'];
    $source = $_POST['source_id'];
    $user_id = $_POST['user_id_request'];
    $priority = $_POST['priority_id'];
    $status = $_POST['status_id'];
    $file_attachments = $_FILES;
    $responsible = api_is_platform_admin() ? api_get_user_id() : 0;
    if (TicketManager::insert_new_ticket($category_id, $course_id, $project_id, $other_area, $email, $subject, $content, $personal_email, $file_attachments, $source, $priority, $status, $user_id, $responsible)) {
        header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php?message=success');
        exit;
    } else {
        Display::display_header(get_lang('ComposeMessage'));
        Display::display_error_message($plugin->get_lang('ErrorRegisterMessage'));
    }
}
Esempio n. 4
0
	float:left;
	width:10%;
}
div.row div.formw2 {
    width:90%;
	float:left
}
div.ticket-form {
    width: 70%;
    float: center;
    margin-left: 15%;

}

</style>';
$types = TicketManager::get_all_tickets_categories();
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link  href="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$tools = array();
$tools['todas'] = array('id' => '', 'name' => get_lang('Todas'));
$tools['announcement'] = array('id' => 'announcement', 'name' => get_lang('Announcement'));
// $tools[]= array('id'=>'assignment','name'=>get_lang('Assignment'));
$tools['calendar_event'] = array('id' => 'calendar_event', 'name' => get_lang('Calendar_event'));
$tools['chat'] = array('id' => 'chat', 'name' => get_lang('Chat'));
$tools['conference'] = array('id' => 'conference', 'name' => get_lang('Conference'));
$tools['course_description'] = array('id' => 'course_description', 'name' => get_lang('Course_description'));
$tools['document'] = array('id' => 'document', 'name' => get_lang('Document'));
$tools['dropbox'] = array('id' => 'dropbox', 'name' => get_lang('Dropbox'));
$tools['group'] = array('id' => 'group', 'name' => get_lang('Group'));
$tools['learnpath'] = array('id' => 'learnpath', 'name' => get_lang('Learnpath'));
$tools['link'] = array('id' => 'link', 'name' => get_lang('Link'));
Esempio n. 5
0
                 // Set ticket as paid.
                 $ticket->setPaid();
                 $orderInfo["setAsPaid"] = "true";
             } else {
                 // TODO: Handle no tickets to set as paid!
             }
         } catch (\Stripe\Error\Card $e) {
             $orderInfo["error"] = strval($e);
             // no-op
         } catch (\Stripe\Error\InvalidRequest $e) {
             $orderInfo["error"] = strval($e);
             // no-op
         }
         $_SESSION["order-" . $userID] = $orderInfo;
         // Log this
         TicketManager::getInstance()->logTicketPurchase($userID, $eventID, $ticket->getTicketID(), time(), isset($orderInfo["stripeTime"]) ? $orderInfo["stripeTime"] : 0, isset($orderInfo["stripeRef"]) ? $orderInfo["stripeRef"] : "", $orderInfo["status"], $ticketType, $price, 1);
         header("Location: index.php?module=usertickets&action=receipt");
         die;
     }
     break;
     //==================================================================================
     // List user tickets
 //==================================================================================
 // List user tickets
 default:
     $tickets = $user->getTickets();
     // Message to user
     if (isset($_GET['msg']) && is_numeric($_GET['msg'])) {
         $message = "";
         $messageType = "success";
         switch ($_GET['msg']) {
<?php
/* For licensing terms, see /license.txt */

/**
 * @package chamilo.plugin.ticket
 */
$language_file = array('registration');
require_once '../config.php';
$plugin = TicketPlugin::create();

$ticket_id = intval($_POST['ticket_id']);
$history = TicketManager::get_assign_log($ticket_id);
?>
<table width="350px" border="0" cellspacing="2" cellpadding="2">
    <?php
    if (count($history) == 0) {
        ?>
        <tr>
            <td colspan="2"><?php echo api_ucfirst(('Sin Historial')); ?></td>
        </tr>
        <?php
    }
    ?>
    <?php for ($k = 0; $k < count($history); $k++) { ?>
        <tr>
            <td width="125px"><?php echo api_convert_encoding($history[$k]['assignuser'], 'UTF-8', $charset); ?></td>
            <td width="100px"><?php echo api_convert_encoding($history[$k]['assigned_date'], 'UTF-8', $charset); ?></td>
            <td width="125px"><?php echo api_convert_encoding($history[$k]['insertuser'], 'UTF-8', $charset); ?></td>
        </tr>
    <?php } ?>
</table>
Esempio n. 7
0
     $select_types .= "<option value = '" . $type['category_id'] . "'>" . $type['name'] . "</option>";
 }
 $select_types .= "</select>";
 //select admins
 $select_admins .= '<select  class ="chzn-select" style="width: 200px; " name = "keyword_admin" id="keyword_admin" ">';
 $select_admins .= '<option value="">---' . get_lang('Select') . '---</option>';
 $select_admins .= '<option value = "0">' . $plugin->get_lang('Unassigned') . '</option>';
 $admins = UserManager::get_user_list_like(array("status" => "1"), array("username"), true);
 foreach ($admins as $admin) {
     $select_admins .= "<option value = '" . $admin['user_id'] . "'>" . $admin['lastname'] . " ," . $admin['firstname'] . "</option>";
 }
 $select_admins .= "</select>";
 //select status
 $select_status .= '<select  class ="chzn-select" style="width: 200px; " name = "keyword_status" id="keyword_status" >';
 $select_status .= '<option value="">---' . get_lang('Select') . '---</option>';
 $status = TicketManager::get_all_tickets_status();
 foreach ($status as $stat) {
     $select_status .= "<option value = '" . $stat['status_id'] . "'>" . $stat['name'] . "</option>";
 }
 $select_status .= "</select>";
 //select priority
 $select_priority .= '<select  style="width: 200px; " name = "keyword_priority" id="keyword_priority" >';
 $select_priority .= '<option value="">' . get_lang('All') . '</option>';
 $select_priority .= '<option value="NRM">' . get_lang('PriorityNormal') . '</option>';
 $select_priority .= '<option value="ALT">' . get_lang('PriorityHigh') . '</option>';
 $select_priority .= '<option value="LOW">' . get_lang('PriorityLow') . '</option>';
 $select_priority .= "</select>";
 //select unread
 $select_unread = '<select  style="width: 100px; " name = "keyword_unread" id="keyword_unread" >';
 $select_unread .= '<option value="">' . get_lang('All') . '</option>';
 $select_unread .= '<option value="yes">' . get_lang('Read') . '</option>';
Esempio n. 8
0
 /**
  * Provides the tickets of this user in an array of Ticket objects.
  * 
  * @return Ticket[]
  */
 public function getTickets()
 {
     global $sql_prefix;
     if ($this->_tickets == null) {
         $this->_tickets = TicketManager::getInstance()->getTicketsOfUser($this->getUserID());
     }
     return $this->_tickets;
 }
Esempio n. 9
0
            show_form_send_message();
        } else {
            if (intval($ticket['ticket']['assigned_last_user']) == $user_id) {
                show_form_send_message();
                $cheked = "";
            }
        }
    }
} else {
    $ticket_id = $_POST['ticket_id'];
    $content = $_POST['content'];
    $subject = $_POST['subject'];
    $mensajeconfirmacion = isset($_POST['confirmation']) ? true : false;
    $file_attachments = $_FILES;
    $user_id = api_get_user_id();
    TicketManager::insert_message($ticket_id, $subject, $content, $file_attachments, $user_id, 'NOL', $mensajeconfirmacion);
    header("location:" . api_get_self() . "?ticket_id=" . $ticket_id);
}
function show_form_send_message()
{
    global $isAdmin;
    global $ticket;
    global $subject;
    global $plugin;
    Display::div('', array('span2'));
    $form = new FormValidator('send_ticket', 'POST', api_get_self() . '?ticket_id=' . $ticket['ticket']['ticket_id'], '', array('enctype' => 'multipart/form-data', 'onsubmit' => 'return validate()', 'class' => 'span9 offset1 form-horizontal'));
    $form->addElement('text', 'subject', get_lang('Subject'), array('for' => 'subject', 'value' => $subject, 'style' => 'width: 540px;'));
    $form->addElement('hidden', 'ticket_id', $_GET['ticket_id']);
    $form->addHtmlEditor('content', get_lang('Message'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '550', 'Height' => '250'));
    if ($isAdmin) {
        $form->addElement('checkbox', 'confirmation', null, $plugin->get_lang('RequestConfirmation'));
Esempio n. 10
0
                 }
             } else {
                 // Just go!
                 $orderInfo["status"] = "ordered";
                 $tickets = $ticketManager->getTicketsByMD5($orderInfo["ticketMD5"]);
                 if (is_array($tickets) && count($tickets) > 0) {
                     foreach ($tickets as $ticket) {
                         $ticketIDs[] = $ticket->getTicketID();
                     }
                 }
                 unset($tickets);
             }
             break;
     }
     // Log this
     TicketManager::getInstance()->logTicketPurchase($userID, $eventID, count($ticketIDs) > 0 ? implode(", ", $ticketIDs) : "", time(), isset($orderInfo["stripeTime"]) ? $orderInfo["stripeTime"] : 0, isset($orderInfo["stripeRef"]) ? $orderInfo["stripeRef"] : "", $orderInfo["status"], $ticketType, $price, $amount);
     $_SESSION["orderInfo" . $sessioninfo->userID] = array_merge($_SESSION["orderInfo" . $sessioninfo->userID], $orderInfo);
     header("Location: index.php?module=ticketorder&action=receipt");
     die;
     //==================================================================================
     // Order a ticket
 //==================================================================================
 // Order a ticket
 case "orderTicket":
     if ($userID < 1) {
         header("Location: ?module=ticketorder");
         die;
     }
     $ttID = $requestGet->has("ttID") ? $requestGet->getInt("ttID", -1) : -1;
     if ($ttID > 0) {
         $ticketType = $ticketManager->getTicketTypeByID($ttID);
Esempio n. 11
0
function show_form()
{
    global $types;
    global $tools;
    echo '<div class="formulario">';
    echo '<form enctype="multipart/form-data" action="' . api_get_self() . '" method="post" name="send_ticket" id="send_ticket"
 	onsubmit="return validate()" style="width:100%">';
    $courses_list = CourseManager::get_courses_list_by_user_id($user_id, false, true);
    $select_course = '<div id="user_request" >
	 </div>';
    echo $select_course;
    //select status
    $select_tool = '<div class="row"  >
	<div class="label2"  >Herramienta:</div>
	<div class="formw2">';
    $select_tool .= '<select style="width: 95%; " name = "tool" id="tool" >';
    $status = TicketManager::get_all_tickets_status();
    foreach ($tools as $tool) {
        $select_tool .= "<option value = '" . $tool['id'] . "' selected >" . $tool['name'] . "</option>";
    }
    $select_tool .= "</select>";
    $select_tool .= '</div></div>';
    echo $select_tool;
    echo '<div class="row">
			<div class="label2">Desde:</div>
			<div class="formw2"><input id="keyword_start_date_start" name="keyword_start_date_start" type="text"></div>
		  </div>
			<div class="row">
			<div class="label2">Hasta</div>
			<div class="formw2"><input id="keyword_start_date_end" name="keyword_start_date_end" type="text"></div>
			</div>';
    echo '</div>';
    echo '<div class="row">
		<div class="label2">
		</div>
		<div class="formw2">
			<button class="save" name="report" type="submit" id="btnsubmit" disabled="disabled">Generar Reporte</button>
		</div>
	</div>';
}
Esempio n. 12
0
function save_ticket()
{
    $category_id = $_POST['category_id'];
    $content = $_POST['content'];
    if ($_POST['phone'] != "") {
        $content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . $_POST['phone'] . '</p>';
    }
    $course_id = $_POST['course_id'];
    $project_id = $_POST['project_id'];
    $subject = $_POST['subject'];
    $other_area = (int) $_POST['other_area'];
    $email = $_POST['email'];
    $personal_email = $_POST['personal_email'];
    $file_attachments = $_FILES;
    if (TicketManager::insert_new_ticket($category_id, $course_id, $project_id, $other_area, $email, $subject, $content, $personal_email, $file_attachments)) {
        header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/s/myticket.php?message=success');
    } else {
        Display::display_header(get_lang('ComposeMessage'));
        Display::display_error_message($plugin->get_lang('ErrorRegisterMessage'));
    }
}
Esempio n. 13
0
 /**
  * Indicates if this ticket can be seated.
  * 
  * @see getSeat()
  * @return bool
  */
 public function canSeat()
 {
     /*
         if ticket.isPaid:
                     return true
         else:
                     canSeat = true
                     loop user.tickets
                         if ticket.isPaid is False AND ticket.hasSeat is True:
                             canSeat = false
             return canSeat
     */
     if ($this->isPaid()) {
         // This ticket is paid, user can seat it.
         return true;
     }
     $canSeat = true;
     // Fetch all tickets on user.
     $tickets = TicketManager::getInstance()->getTicketsOfUser($this->getUserID());
     if (is_array($tickets) && count($tickets) > 0) {
         foreach ($tickets as $ticket) {
             if (!$ticket->isPaid() && $ticket->hasSeat()) {
                 $canSeat = false;
             }
         }
     }
     return $canSeat;
 }
Esempio n. 14
0
 public function getTicket()
 {
     return TicketManager::getInstance()->getTicket($this->getTicketID());
 }