예제 #1
0
 public function run()
 {
     $login = new login(session::getSID());
     if ($login->logged_in() === true) {
         $tpl = new template();
         //Messages
         $message = new messages();
         $messages = $message->getInbox($_SESSION['userdata']['id'], 5, 0);
         $messageCount = count($messages);
         if ($messageCount) {
             $mailOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#');
         } else {
             $mailOptions = array('class' => 'dropdown-toggle');
         }
         $tpl->assign("mailOptions", $mailOptions);
         $tpl->assign("messagecount", $messageCount);
         $tpl->assign("messages", $messages);
         $tpl->assign("helper", new helper());
         //Tickets
         $tickets = new tickets();
         $newTickets = $tickets->getUnreadTickets($_SESSION['userdata']['id']);
         $ticketCount = count($newTickets);
         if (count($newTickets)) {
             $ticketOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#');
         } else {
             $ticketOptions = array('class' => 'dropdown-toggle');
         }
         if (is_array($newTickets) === true) {
             $limitedTicketItems = array_slice($newTickets, 0, 5);
         } else {
             $limitedTicketItems = array();
         }
         $tpl->assign("tickeOptions", $ticketOptions);
         $tpl->assign("ticketCount", $ticketCount);
         $tpl->assign("newTickets", $limitedTicketItems);
         $tpl->display("general.headMenu");
     }
 }
예제 #2
0
<?php

$tickets = new tickets();
$helper = new helper();
$ticket = $this->get('ticket');
$statePlain = $this->get('statePlain');
?>

<!--<h3><?php 
echo $ticket['headline'];
?>
</h3><br />-->
<p><br />
	<?php 
if ($ticket['dependingTicketId'] != 0) {
    ?>
 
		<?php 
    echo $language->lang_echo('TICKET_DEPENDS_ON');
    ?>
		<?php 
    $this->displayLink('tickets.showTicket', $ticket['dependingTicketId'], array('id' => $ticket['dependingTicketId']));
    ?>
<br />
	<?php 
}
?>
</p>

<table cellpadding="0" cellspacing="0" border="0" class="table table-bordered responsive">
	<colgroup>
예제 #3
0
  <div class="container-fluid">
    
	<div class="row-fluid">
	  <?php 
// Assigned area..
if (($MSTEAM->id == '1' || in_array('assign', $userAccess)) && mswRowCount('departments WHERE `id` = \'' . $SUPTICK->department . '\' AND `manual_assign` = \'yes\'') > 0) {
    include PATH . 'templates/system/tickets/view/users.php';
}
// Notepad area..
if ($MSTEAM->notePadEnable == 'yes' || $MSTEAM->id == '1') {
    include PATH . 'templates/system/tickets/view/notepad.php';
}
// Is this a dispute?
if (TICKET_TYPE == 'dispute') {
    include REL_PATH . 'control/classes/class.tickets.php';
    $MST = new tickets();
    $usersInDispute = $MST->disputeUserNames($SUPTICK, $SUPTICK->name);
    ?>
	  <div class="block">
	   <p class="block-heading"><?php 
    echo strtoupper(str_replace('{count}', count($usersInDispute), $msg_showticket30));
    ?>
</p>
	   <div class="block-body">
	   <span class="pull-right"><a href="?p=view-dispute&amp;disputeUsers=<?php 
    echo $_GET['id'];
    ?>
" style="font-size:11px"><i class="icon-cog"></i> <?php 
    echo $msg_disputes8;
    ?>
</a></span>
예제 #4
0
    /**
     * run - display template and edit data
     *
     * @access public
     *
     */
    public function run()
    {
        $login = new login(session::getSID());
        //Check if user is logged in
        if ($login->logged_in() !== true) {
            exit;
        }
        $helper = new helper();
        $projects = new projects();
        $tickets = new tickets();
        $module = $_GET['module'];
        //Organize ajax handlers by module and action
        if ($module == "tickets.showAll") {
            // AJAX status change
            if (isset($_POST['ticketId'])) {
                $ticketId = $_POST['ticketId'];
                $newStatus = $_POST['newStatus'];
                if ($tickets->getAccessRights($ticketId)) {
                    if ($tickets->changeStatus($ticketId, $newStatus) === true) {
                        echo "Status was changed";
                    } else {
                        echo "Error with change";
                    }
                } else {
                    echo "You have no rights to do that.";
                }
            }
        } else {
            if ($module == "tickets.showTicket") {
                $users = new users();
                $id = $_GET['id'];
                $results = $tickets->getTimelineHistory($id);
                $ticket = $tickets->getTicket($id);
                $jsonArr = array();
                $description = strip_tags($ticket['description']);
                $description = str_replace("\n", "", $description);
                $description = str_replace("\r", "", $description);
                $json = '{"timeline":
			    {   "headline":"Ticket History for ' . $ticket['headline'] . '",
			        "type":"default",
					"text":"' . $description . '",
					"startDate":"' . $ticket['timelineDate'] . '",
			        "date": [ ';
                //Creation Date
                $items[] = '{
					"startDate":"' . $ticket['timelineDate'] . '",
	                "headline":"Ticket Created",
	                "text":"<p>Ticket created by ' . $ticket['userFirstname'] . ', ' . $ticket['userLastname'] . '</p>",
	                "asset":
	                {  "media":"",
	                    "credit":"",
	                    "caption":""
	                }
				}';
                foreach ($results as $row) {
                    $items[] = '{
					"startDate":"' . $row['date'] . '",
	                "headline":"Ticket Update",
	                "text":"<p>' . $row['firstname'] . ', ' . $row['lastname'] . ' changed ' . $row['changeType'] . ' to ' . $row['changeValue'] . '</p>",
	                "asset":
	                {  "media":"' . $users->getProfilePicture($row['userId']) . '",
	                    "credit":"' . $row['firstname'] . ', ' . $row['lastname'] . '",
	                    "caption":""
	                }
				}';
                }
                $comments = new comments();
                $allcomments = $comments->getComments('ticket', $id);
                foreach ($allcomments as $comment) {
                    $items[] = '{
					"startDate":"' . $comment['timelineDate'] . '",
	                "headline":"New Comment",
	                "text":' . json_encode('<p>' . $comment['firstname'] . ', ' . $comment['lastname'] . ' said:<br /> </p>' . $comment['text']) . ',
	                "asset":
	                {	"media":"' . $users->getProfilePicture($comment['userId']) . '",
	                    "credit":"' . $comment['firstname'] . ', ' . $comment['lastname'] . '",
	                    "caption":""
	                }
				}';
                }
                $file = new files();
                $files = $file->getFilesByModule('ticket', $id);
                $tempStr = '';
                $tempStr3 = '';
                $imgExtensions = array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv');
                foreach ($files as $fileRow) {
                    if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/userdata/' . $fileRow['module'] . '/' . $fileRow['encName'] . '.' . $fileRow['extension'])) {
                        $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "' />";
                        $filepath = "userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "";
                    } else {
                        $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/file.png' />";
                        $filepath = "userdata/file.png";
                    }
                    $tempStr = '{
					"startDate":"' . $fileRow['timelineDate'] . '",
	                "headline":"New File",
	                "text":"' . $fileRow['firstname'] . ', ' . $fileRow['lastname'] . ' uploaded:<br /><a href=\'' . $filepath . '\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</a>",';
                    $tempStr3 .= '<span class=\'filename\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</span>
                        </a>",';
                    $tempStr .= '
	               "asset":
	                {	"media":"' . $filepath . '",
	                    "credit":"' . $fileRow['realName'] . '.' . $fileRow['extension'] . '",
	                    "caption":""
	                }
				}';
                    $items[] = $tempStr;
                }
                $json .= implode(",", $items);
                $json .= '	
					]
    				}
				}';
                header('Content-type: text/json');
                header('Content-type: application/json');
                echo $json;
            } else {
                echo "There are no ajax actions for this module";
            }
        }
    }
예제 #5
0
 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $info = '';
     //Only admins and employees
     if ($_SESSION['userdata']['role'] == 'admin' || $_SESSION['userdata']['role'] == 'employee') {
         $projects = new projects();
         $helper = new helper();
         $tickets = new tickets();
         $values = array('userId' => $_SESSION['userdata']['id'], 'ticket' => '', 'project' => '', 'date' => '', 'kind' => '', 'hours' => '', 'description' => '', 'invoicedEmpl' => '', 'invoicedComp' => '', 'invoicedEmplDate' => '', 'invoicedCompDate' => '');
         if (isset($_POST['save']) === true || isset($_POST['saveNew']) === true) {
             if (isset($_POST['tickets']) && $_POST['tickets'] != '') {
                 $temp = $_POST['tickets'];
                 $tempArr = explode('|', $temp);
                 $values['project'] = $tempArr[0];
                 $values['ticket'] = $tempArr[1];
             }
             if (isset($_POST['kind']) && $_POST['kind'] != '') {
                 $values['kind'] = $_POST['kind'];
             }
             if (isset($_POST['date']) && $_POST['date'] != '') {
                 $values['date'] = $helper->timestamp2date($_POST['date'], 4);
             }
             if (isset($_POST['hours']) && $_POST['hours'] != '') {
                 $values['hours'] = $_POST['hours'];
             }
             if (isset($_POST['invoicedEmpl']) && $_POST['invoicedEmpl'] != '') {
                 if ($_POST['invoicedEmpl'] == 'on') {
                     $values['invoicedEmpl'] = 1;
                 }
                 if (isset($_POST['invoicedEmplDate']) && $_POST['invoicedEmplDate'] != '') {
                     $values['invoicedEmplDate'] = $helper->timestamp2date($_POST['invoicedEmplDate'], 4);
                 }
             }
             if (isset($_POST['invoicedComp']) && $_POST['invoicedComp'] != '') {
                 if ($_SESSION['userdata']['role'] == 'admin') {
                     if ($_POST['invoicedComp'] == 'on') {
                         $values['invoicedComp'] = 1;
                     }
                     if (isset($_POST['invoicedCompDate']) && $_POST['invoicedCompDate'] != '') {
                         $values['invoicedCompDate'] = $helper->timestamp2date($_POST['invoicedCompDate'], 4);
                     }
                 }
             }
             if (isset($_POST['description']) && $_POST['description'] != '') {
                 $values['description'] = $_POST['description'];
             }
             if ($values['ticket'] != '' && $values['project'] != '') {
                 if ($values['kind'] != '') {
                     if ($values['date'] != '') {
                         if ($values['hours'] != '' && $values['hours'] > 0) {
                             $this->addTime($values);
                             $info = 'TIME_SAVED';
                         } else {
                             $info = 'NO_HOURS';
                         }
                     } else {
                         $info = 'NO_DATE';
                     }
                 } else {
                     $info = 'NO_KIND';
                 }
             } else {
                 $info = 'NO_TICKET';
             }
             if (isset($_POST['save']) === true) {
                 $values['date'] = $helper->timestamp2date($values['date'], 2);
                 $values['invoicedCompDate'] = $helper->timestamp2date($values['invoicedCompDate'], 2);
                 $values['invoicedEmplDate'] = $helper->timestamp2date($values['invoicedEmplDate'], 2);
                 $tpl->assign('values', $values);
             } elseif (isset($_POST['saveNew']) === true) {
                 $values = array('userId' => $_SESSION['userdata']['id'], 'ticket' => '', 'project' => '', 'date' => '', 'kind' => '', 'hours' => '', 'description' => '', 'invoicedEmpl' => '', 'invoicedComp' => '', 'invoicedEmplDate' => '', 'invoicedCompDate' => '');
                 $tpl->assign('values', $values);
             }
         }
         $tpl->assign('info', $info);
         $tpl->assign('allProjects', $projects->getAll());
         $tpl->assign('allTickets', $tickets->getAll());
         $tpl->assign('kind', $this->kind);
         $tpl->display('timesheets.addTime');
     } else {
         $tpl->display('general.error');
     }
 }
예제 #6
0
 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $info = '';
     //Only admins and employees
     if ($_SESSION['userdata']['role'] == 'admin' || $_SESSION['userdata']['role'] == 'employee') {
         if (isset($_GET['id']) === true) {
             $projects = new projects();
             $helper = new helper();
             $tickets = new tickets();
             $id = $_GET['id'];
             $timesheet = $this->getTimesheet($id);
             $values = array('id' => $id, 'userId' => $timesheet['userId'], 'ticket' => $timesheet['ticketId'], 'project' => $timesheet['projectId'], 'date' => $timesheet['workDate'], 'kind' => $timesheet['kind'], 'hours' => $timesheet['hours'], 'description' => $timesheet['description'], 'invoicedEmpl' => $timesheet['invoicedEmpl'], 'invoicedComp' => $timesheet['invoicedComp'], 'invoicedEmplDate' => $timesheet['invoicedEmplDate'], 'invoicedCompDate' => $timesheet['invoicedCompDate']);
             if ($_SESSION['userdata']['role'] == 'admin' || $_SESSION['userdata']['id'] == $values['userId']) {
                 if (isset($_POST['save']) === true) {
                     if (isset($_POST['tickets']) && $_POST['tickets'] != '') {
                         $temp = $_POST['tickets'];
                         $tempArr = explode('|', $temp);
                         $values['project'] = $tempArr[0];
                         $values['ticket'] = $tempArr[1];
                     }
                     if (isset($_POST['kind']) && $_POST['kind'] != '') {
                         $values['kind'] = $_POST['kind'];
                     }
                     if (isset($_POST['date']) && $_POST['date'] != '') {
                         $dateFormat = $values['date'];
                         $values['date'] = $helper->date2timestamp($_POST['date']);
                         //($helper->timestamp2date($_POST['date'], 4));
                     }
                     if (isset($_POST['hours']) && $_POST['hours'] != '') {
                         $values['hours'] = $_POST['hours'];
                     }
                     if (isset($_POST['description']) && $_POST['description'] != '') {
                         $values['description'] = $_POST['description'];
                     }
                     if (isset($_POST['invoicedEmpl']) && $_POST['invoicedEmpl'] != '') {
                         if ($_POST['invoicedEmpl'] == 'on') {
                             $values['invoicedEmpl'] = 1;
                         }
                         if (isset($_POST['invoicedEmplDate']) && $_POST['invoicedEmplDate'] != '') {
                             $values['invoicedEmplDate'] = $helper->timestamp2date($_POST['invoicedEmplDate'], 4);
                         } else {
                             $values['invoicedEmplDate'] = date("Y-m-d");
                         }
                     } else {
                         $values['invoicedEmpl'] = 0;
                         $values['invoicedEmplDate'] = '';
                     }
                     if ($_SESSION['userdata']['role'] == 'admin') {
                         if (isset($_POST['invoicedComp']) && $_POST['invoicedComp'] != '') {
                             if ($_POST['invoicedComp'] == 'on') {
                                 $values['invoicedComp'] = 1;
                             }
                             if (isset($_POST['invoicedCompDate']) && $_POST['invoicedCompDate'] != '') {
                                 $values['invoicedCompDate'] = $helper->timestamp2date($_POST['invoicedCompDate'], 4);
                             } else {
                                 $values['invoicedCompDate'] = date("Y-m-d");
                             }
                         } else {
                             $values['invoicedComp'] = 0;
                             $values['invoicedCompDate'] = '';
                         }
                     }
                     if ($values['ticket'] != '' && $values['project'] != '') {
                         if ($values['kind'] != '') {
                             if ($values['date'] != '') {
                                 if ($values['hours'] != '' && $values['hours'] > 0) {
                                     $this->updateTime($values);
                                     $tpl->setNotification('SAVE_SUCCESS', 'success');
                                     $values['description'] = $_POST['description'];
                                 } else {
                                     $tpl->setNotification('NO_HOURS', 'error');
                                 }
                             } else {
                                 $tpl->setNotification('NO_DATE', 'error');
                             }
                         } else {
                             $tpl->setNotification('NO_KIND', 'error');
                         }
                     } else {
                         $tpl->setNotification('NO_TICKET', 'error');
                     }
                 }
                 $values['date'] = $helper->timestamp2date($values['date'], 2);
                 $values['invoicedCompDate'] = $helper->timestamp2date($values['invoicedCompDate'], 2);
                 $values['invoicedEmplDate'] = $helper->timestamp2date($values['invoicedEmplDate'], 2);
                 if (isset($dateFormat)) {
                     $values['date'] = $dateFormat;
                 }
                 $tpl->assign('values', $values);
                 $tpl->assign('info', $info);
                 $tpl->assign('allProjects', $projects->getAll());
                 $tpl->assign('allTickets', $tickets->getAll());
                 $tpl->assign('kind', $this->kind);
                 $tpl->display('timesheets.editTime');
             } else {
                 $tpl->display('general.error');
             }
         } else {
             $tpl->display('general.error');
         }
     } else {
         $tpl->display('general.error');
     }
 }
예제 #7
0
 /**
  * @return unknown_type
  */
 public function run()
 {
     $tpl = new template();
     $helper = new helper();
     if (!$this->userHasWidgets($_SESSION['userdata']['id'])) {
         $this->setDefaultWidgets($_SESSION['userdata']['id']);
     }
     // CALENDAR
     $calendar = new calendar();
     $tpl->assign('calendar', $calendar->getCalendar($_SESSION['userdata']['id']));
     // TICKETS
     $tickets = new tickets();
     $tpl->assign('myTickets', $tickets->getUserTickets(3, $_SESSION['userdata']['id']));
     // PROJECTS
     $projects = new projects();
     $allProjects = $projects->getAll(false, 5);
     $myProjects = array();
     foreach ($allProjects as $project) {
         $opentickets = $projects->getOpenTickets($project['id']);
         $closedTickets = $project['numberOfTickets'] - $opentickets['openTickets'];
         if ($project['numberOfTickets'] != 0) {
             $projectPercentage = round($closedTickets / $project['numberOfTickets'] * 100, 2);
         } else {
             $projectPercentage = 0;
         }
         $values = array('id' => $project['id'], 'name' => $project['name'], 'projectPercentage' => $projectPercentage);
         $myProjects[] = $values;
     }
     // HOURS
     $ts = new timesheets();
     $myHours = $ts->getUsersHours($_SESSION['userdata']['id']);
     $tpl->assign('myHours', $myHours);
     // NOTES
     if (isset($_POST['save'])) {
         if (isset($_POST['title']) && isset($_POST['description'])) {
             $values = array('title' => $_POST['title'], 'description' => $_POST['description']);
             $this->addNote($_SESSION['userdata']['id'], $values);
             $tpl->setNotification('SAVE_SUCCESS', 'success');
         } else {
             $tpl->setNotification('MISSING_FIELDS', 'error');
         }
     }
     // Statistics
     $tpl->assign('closedTicketsPerWeek', $this->getClosedTicketsPerWeek());
     $tpl->assign('hoursPerTicket', round($this->getHoursPerTicket()));
     $tpl->assign('hoursBugFixing', round($this->getHoursBugFixing(), 1));
     // WIDGET CUSTOMIZATION
     if (isset($_POST['updateWidgets'])) {
         $widgets = array();
         foreach ($this->getWidgets() as $widget) {
             if (isset($_POST['widget-' . $widget['id']])) {
                 $widgets[] = $widget['id'];
             }
         }
         if (count($widgets)) {
             $this->updateWidgets($_SESSION['userdata']['id'], $widgets);
             $tpl->setNotification('SAVE_SUCCESS', 'success');
         } else {
             $tpl->setNotification('ONE_WIDGET_REQUIRED', 'error');
         }
     }
     // HOT LEADS
     $leads = new leads();
     $hotLeads = $leads->getHotLeads();
     $tpl->assign('hotLeads', $hotLeads);
     $tpl->assign('notes', $this->getNotes($_SESSION['userdata']['id']));
     $tpl->assign('availableWidgets', $this->getAvailableWidgets($_SESSION['userdata']['id']));
     $tpl->assign('myProjects', $myProjects);
     $tpl->assign('widgetTypes', $this->getWidgets());
     $tpl->assign('widgets', $this->getUsersWidgets($_SESSION['userdata']['id']));
     $tpl->assign('helper', $helper);
     $tpl->display('dashboard.show');
 }
예제 #8
0
<?php

defined('RESTRICTED') or die('Restricted access');
$ticket = $this->get('ticket');
$objTicket = $this->get('objTicket');
$helper = $this->get('helper');
$state = $this->get('state');
$statePlain = $this->get('statePlain');
$userId = $this->get('userId');
$unreadCount = $this->get('unreadCount');
$tickets = new tickets();
?>
<div class="pageheader">
            <form action="index.php?act=tickets.showAll" method="post" class="searchbar">
                <input type="text" name="term" placeholder="To search type and hit enter..." />
            </form>
            
            <div class="pageicon"><span class="<?php 
echo $this->getModulePicture();
?>
"></span></div>
            <div class="pagetitle">
                <h5><?php 
echo $language->lang_echo('TICKET_DETAILS');
?>
</h5>
                <h1><?php 
echo '' . $language->lang_echo('TICKET') . ' #' . $ticket['id'] . '  |  ' . $ticket['headline'];
?>
</h1>
            </div>
예제 #9
0
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT') || !defined('TICKET_REPLY')) {
    $HEADERS->err403(true);
}
// Merge reload time..
define('MERGE_RELOAD_TIME', 5);
// Load mail params
include REL_PATH . 'control/mail-data.php';
// Call the relevant classes..
include_once REL_PATH . 'control/classes/class.tickets.php';
include_once PATH . 'control/classes/class.accounts.php';
include_once REL_PATH . 'control/classes/class.fields.php';
$MSACC = new accounts();
$MSPTICKETS = new tickets();
$MSCFMAN = new customFieldManager();
$MSACC->settings = $SETTINGS;
$MSPTICKETS->settings = $SETTINGS;
$MSPTICKETS->datetime = $MSDT;
// Add only if comments are added..
if (trim($_POST['comments'])) {
    $replyToAddr = '';
    $isDispute = $SETTINGS->disputes == 'yes' && $_POST['isDisputed'] == 'yes' ? 'yes' : 'no';
    // Add reply..
    // $ret[0] = yes/no for merge
    // $ret[1] = Ticket ID
    // $ret[2] = Merged ticket subject
    // $ret[3] = Reply ID
    $ret = $MSTICKET->addTicketReply();
    // Get merged parent ticket or current ticket..
예제 #10
0
 public function ticketList($email, $lv, $count = false, $queryAdd = '')
 {
     global $msg_portal8, $msg_public_history7, $msg_portal7, $msg_portal21, $msg_showticket23, $msg_showticket24, $msg_script30, $msg_public_dashboard6, $msg_public_dashboard7;
     $data = '';
     $sch = '';
     $qft = array();
     $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`id` DESC';
     // Check for search mode..
     if (isset($_GET['qt'])) {
         // Load the skip words array..
         include PATH . 'control/skipwords.php';
         $chop = array_map('trim', explode(' ', urldecode($_GET['qt'])));
         if (!empty($chop)) {
             foreach ($chop as $word) {
                 if (!in_array($word, $searchSkipWords) && strlen($word) > 1) {
                     $word = strtolower($word);
                     $sch .= (!$sch ? '' : 'OR ') . "LOWER(`subject`) LIKE '%" . mswSafeImportString(mswCleanData($word)) . "%' OR LOWER(`comments`) LIKE '%" . mswSafeImportString(mswCleanData($word)) . "%'";
                 }
             }
             if ($sch) {
                 $qft[] = 'AND (' . $sch . ')';
             }
         }
     }
     // Order filters..
     if (isset($_GET['order'])) {
         switch ($_GET['order']) {
             // Subject (ascending)..
             case 'subject_asc':
                 $oft = 'ORDER BY `subject`';
                 break;
                 // Subject (descending)..
             // Subject (descending)..
             case 'subject_desc':
                 $oft = 'ORDER BY `subject` desc';
                 break;
                 // TicketID (ascending)..
             // TicketID (ascending)..
             case 'id_asc':
                 $oft = 'ORDER BY `ticketID`';
                 break;
                 // TicketID (descending)..
             // TicketID (descending)..
             case 'id_desc':
                 $oft = 'ORDER BY `ticketID` desc';
                 break;
                 // Priority (ascending)..
             // Priority (ascending)..
             case 'pr_asc':
                 $oft = 'ORDER BY `levelName`';
                 break;
                 // Priority (descending)..
             // Priority (descending)..
             case 'pr_desc':
                 $oft = 'ORDER BY `levelName` desc';
                 break;
                 // Department (ascending)..
             // Department (ascending)..
             case 'dept_asc':
                 $oft = 'ORDER BY `deptName`';
                 break;
                 // Department (descending)..
             // Department (descending)..
             case 'dept_desc':
                 $oft = 'ORDER BY `deptName` desc';
                 break;
                 // Date Updated (ascending)..
             // Date Updated (ascending)..
             case 'rev_asc':
                 $oft = 'ORDER BY `lastrevision`';
                 break;
                 // Date Updated (descending)..
             // Date Updated (descending)..
             case 'rev_desc':
                 $oft = 'ORDER BY `lastrevision` desc';
                 break;
                 // Date Added (ascending)..
             // Date Added (ascending)..
             case 'date_asc':
                 $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`ts`';
                 break;
                 // Date Added (descending)..
             // Date Added (descending)..
             case 'date_desc':
                 $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`ts` desc';
                 break;
         }
     }
     // Service level and department filters..
     if (isset($_GET['filter'])) {
         $qft[] = 'AND `priority` = \'' . mswSafeImportString($_GET['filter']) . '\'';
     }
     if (isset($_GET['dept'])) {
         $qft[] = 'AND `department` = \'' . mswSafeImportString($_GET['dept']) . '\'';
     }
     $lWrap = file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/tickets-last-reply-date.htm');
     $q = mysql_query("SELECT SQL_CALC_FOUND_ROWS *,\n           `" . DB_PREFIX . "tickets`.`id` AS `ticketID`,\n\t\t   `" . DB_PREFIX . "tickets`.`ts` AS `ticketStamp`,\n\t       `" . DB_PREFIX . "portal`.`name` AS `ticketName`,\n\t       `" . DB_PREFIX . "departments`.`name` AS `deptName`,\n\t       `" . DB_PREFIX . "levels`.`name` AS `levelName`\n\t\t   FROM `" . DB_PREFIX . "tickets`\n\t\t   LEFT JOIN `" . DB_PREFIX . "departments`\n\t       ON `" . DB_PREFIX . "tickets`.`department` = `" . DB_PREFIX . "departments`.`id`\n\t\t   LEFT JOIN `" . DB_PREFIX . "portal`\n\t       ON `" . DB_PREFIX . "tickets`.`visitorID`  = `" . DB_PREFIX . "portal`.`id`\n\t       LEFT JOIN `" . DB_PREFIX . "levels`\n\t       ON `" . DB_PREFIX . "tickets`.`priority`   = `" . DB_PREFIX . "levels`.`id`\n\t        OR `" . DB_PREFIX . "tickets`.`priority`  = `" . DB_PREFIX . "levels`.`marker`\n           WHERE `" . DB_PREFIX . "portal`.`email`    = '{$email}'\n\t\t   AND `isDisputed`                       = 'no'\n\t\t   AND `spamFlag`                         = 'no'\n\t\t   " . $queryAdd . "\n\t\t   " . (!empty($qft) ? implode(mswDefineNewline(), $qft) : '') . "\n           {$oft}\n\t\t   LIMIT " . $lv[0] . "," . $lv[1] . "\n           ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__));
     if ($count) {
         $c = mysql_fetch_object(mysql_query("SELECT FOUND_ROWS() AS `rows`"));
         return isset($c->rows) ? $c->rows : '0';
     }
     while ($T = mysql_fetch_object($q)) {
         $last = tickets::getLastReply($T->ticketID);
         // Ticket starter..
         $starter = mswSpecialChars($T->ticketName);
         $lastRep = '';
         $replyBy = '- - - -';
         if ($last[0] != '0') {
             $lastRep = str_replace(array('{date}', '{time}'), array($this->datetime->mswDateTimeDisplay($last[1], $this->settings->dateformat), $this->datetime->mswDateTimeDisplay($last[1], $this->settings->timeformat)), $lWrap);
             $replyBy = $last[0];
         }
         $data .= str_replace(array('{ticket_id}', '{subject}', '{priority}', '{dept}', '{started_by}', '{url}', '{text_alt}', '{start_date}', '{start_time}', '{last_reply}', '{status}', '{icon}', '{users_in_dispute}', '{view}', '{last_reply_dashboard}'), array(mswTicketNumber($T->ticketID), mswSpecialChars($T->subject), tickets::levels($T->priority), $this->system->department($T->department, $msg_script30), $starter, '?t=' . $T->ticketID, mswCleanData($msg_portal8), $this->datetime->mswDateTimeDisplay($T->ticketStamp, $this->settings->dateformat), $this->datetime->mswDateTimeDisplay($T->ticketStamp, $this->settings->timeformat), $replyBy . $lastRep, $T->ticketStatus == 'open' ? $msg_showticket23 : $msg_showticket24, $T->ticketStatus == 'open' ? 'eye-open' : 'eye-close', '', $msg_public_dashboard6, tickets::dashboardStatus($T, 'no')), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/' . ($queryAdd ? 'tickets-dashboard' : 'ticket-list-entry') . '.htm'));
     }
     return $data ? trim($data) : str_replace('{text}', $sch ? $msg_portal21 : ($queryAdd ? $msg_public_dashboard7 : $msg_portal7), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/tickets-no-data.htm'));
 }
예제 #11
0
파일: admin.php 프로젝트: labrack/helpdesk
 public function close_ticket($ticket)
 {
     $tickets = new tickets();
     $users = new users();
     $_link = $this->getDBH();
     if ($tickets->is_ticket($ticket) && $users->getuserinfo('user_group') == 1) {
         $query = $_link->prepare('UPDATE `tickets` SET `resolved` = 1 WHERE `uniqid` = :ticket');
         $query->bindParam(':ticket', $ticket, PDO::PARAM_STR);
         $query->execute();
         echo 'success';
     }
 }
예제 #12
0
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Load mail params
include REL_PATH . 'control/mail-data.php';
// Call the relevant classes..
include_once REL_PATH . 'control/classes/class.tickets.php';
include_once PATH . 'control/classes/class.accounts.php';
include_once REL_PATH . 'control/classes/class.fields.php';
include_once REL_PATH . 'control/classes/class.accounts.php';
$MSACC = new accounts();
$MSPORTAL = new accountSystem();
$MSPTICKETS = new tickets();
$MSCFMAN = new customFieldManager();
$MSACC->settings = $SETTINGS;
$MSPTICKETS->settings = $SETTINGS;
$MSPTICKETS->datetime = $MSDT;
$MSPORTAL->settings = $SETTINGS;
// Add ticket..
if (isset($_POST['process'])) {
    $OK = 'fail';
    if ($_POST['subject'] && $_POST['comments'] && $_POST['name'] && mswIsValidEmail($_POST['email'])) {
        // Check if account exists for email address..
        $PORTAL = mswGetTableData('portal', 'email', mswSafeImportString($_POST['email']));
        // Check language..
        if (isset($_PORTAL->id) && $PORTAL->language && file_exists(LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-add-ticket.txt')) {
            $mailT = LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-add-ticket.txt';
            $pLang = $PORTAL->language;