Location: PHPKode > scripts > PHPMass Shopping Cart > phpmass-shopping-cart/user/support.php
<?php
/******************************************************************
 * PHPMass Shopping Cart
 * The contents of this file are subject to the PHPMass License. 
 * If you do not agree with PHPMass License Terms and Conditions 
 * than you should not use this software.
 * A copy of the license file is available on www.phpmass.com/license.htm page.
 * 
 * PHPMass.com.
 * All Rights Reserved.
 ******************************************************************/
$SiteSection = 'user';
require('../includes/config.php');


// Cart and top products
$LastProducts = $Carts->getLastProducts();
if (is_array($LastProducts)) {
	$LastProduct = array_shift($LastProducts);
}
$smarty->assign('LastProduct', $LastProduct);
$smarty->assign('LastProducts', $LastProducts);

$TopProducts = $Categories->getTopProducts(0,false,true);
$smarty->assign('TopProducts', $TopProducts);

// END Cart and top products

if (isset($_POST['AddTicket'])) {
	$TickeID = $Support->newTicket($userid,$_POST['TicketTitle'],$_POST['Dept'],$_POST['Priority']);
	header('Location: /user/support.php?viewTicket='.$TickeID);
}
if (isset($_GET['viewTicket'])) {
	$Ticket = $Support->getTicket($userid,$_GET['viewTicket'])	;
	if (isset($_POST['addMessage']) && $_POST['TickedID'] == $Ticket['ticketid']){
		if (strlen($_POST['newMessage']) >= 2){
			$Support->insertMessage($Ticket['ticketid'],$_POST['newMessage'],$userid);
			$Support->sendNewMSGNotification($userid);
			$InfoMessage['Msg_Ticket_Added'] = $Lang['Msg_Ticket_Added'];
		}
		else $Error['Empty_Ticket_Msg'] = $Lang['Empty_Ticket_Msg'];
	}
	$Messages = $Support->getMessages($Ticket['ticketid']);
	if (count($Messages) == 0) $InfoMessage['No_Msg_In_Ticket'] = $Lang['No_Msg_In_Ticket'];
	$smarty->assign('Ticket', $Ticket);
	$smarty->assign('Messages', $Messages);
	$smarty->assign('GET', $_GET);

	$smarty->assign('PageTitle', $Lang['Support']);
	$smarty->assign('Error', $Error);
	$smarty->assign('InfoMessage', $InfoMessage);
	$smarty->display(DOC_ROOT.'/skin/templates/user/'.'support.tpl');
}
else {
	$Tickets = $Support->getTickets($userid,$Page);

	//Total Products
	if(isset($_GET['PageID'])) $Page = $_GET['PageID']; else $Page = 1;
	$TotalTickets = $Support->countTickets($userid);
	if ($TotalTickets == 0) $InfoMessage['No_Tickets_Found'] = $Lang['No_Tickets_Found'];
	$smarty->assign('TotalTickets', $TotalTickets);
	// Curent URL for POST unmodified and for GET without the page number
	$CurentURL = $_SERVER[REQUEST_URI];
	$smarty->assign('URL', $CurentURL);
	$smarty->assign('CurentURL', removeFilterFromURL($CurentURL,'page'));
	// Pages Array with URL, pageID, IsHref
	$PagesHtmlArr = makePagesURLs($CurentURL,$TotalTickets,$Page);
	$smarty->assign('PagesHtmlArr', $PagesHtmlArr);

	$smarty->assign('Tickets', $Tickets);

	$smarty->assign('PageTitle', $Lang['Support']);
	$smarty->assign('Error', $Error);
	$smarty->assign('InfoMessage', $InfoMessage);
	$smarty->display(DOC_ROOT.'/skin/templates/user/'.'support.tpl');
}



?>
Return current item: PHPMass Shopping Cart