Пример #1
0
 public function createTicket($data)
 {
     $default_status_id = kyTicketStatus::getAll()->filterByTitle('New')->first()->getId();
     $default_priority_id = kyTicketPriority::getAll()->filterByTitle('Normal')->first()->getId();
     $default_type_id = $data['issue'];
     kyTicket::setDefaults($default_status_id, $default_priority_id, $default_type_id);
     $general_department = kyDepartment::getAll()->filterByTitle('Customer Service')->filterByModule(kyDepartment::MODULE_TICKETS)->first();
     $ticket = kyTicket::createNewAuto($general_department, $data['name'], $data['email'], $data['comment'], $data['subject'])->create();
     return true;
 }
Пример #2
0
 /**
  * Fetch the list of departments
  */
 public function fetchAllDepartment()
 {
     $this->init();
     $departments_tree = $this->getDepartmentsTree();
     foreach ($departments_tree as $key => $val) {
         $options_array[$key] = $val['department'];
         foreach ($val['child_departments'] as $child_dept_key => $child_dept_value) {
             $options_array[$child_dept_key] = $child_dept_value;
         }
     }
     $this->all_departments = $options_array;
     $this->priority_list = kyTicketPriority::getAll();
     $this->status_list = kyTicketStatus::getAll();
     $this->ticket_type = kyTicketType::getAll();
 }
Пример #3
0
         }
         $smarty->assign('_customFieldGroupContainer', $_customFieldGroupContainer);
         $smarty->assign('_ticketFormURL', WHMCS_URL . 'submitticket.php?step=3');
         $smarty->assign('_departmentID', $_POST['departmentid']);
         $smarty->assign('_templateURL', getcwd() . '/templates/kayako');
         $smarty->assign('_imageURL', WHMCS_URL . 'templates/kayako/images');
         $templatefile = 'ticketform';
     } else {
         header('Location: ' . WHMCS_URL . 'submitticket.php');
     }
 } else {
     if ($_REQUEST['step'] == 3) {
         if (!empty($_POST)) {
             //Set Defaults for a new ticket
             $_defaultStatusID = kyTicketStatus::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId();
             $_defaultPriorityID = kyTicketPriority::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId();
             $_defaultTypeID = kyTicketType::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId();
             kyTicket::setDefaults($_defaultStatusID, $_defaultPriorityID, $_defaultTypeID);
             //Create ticket
             $_department = kyDepartment::get($_POST['departmentid']);
             $_priority = kyTicketPriority::get($_POST['ticketpriorityid']);
             $_ticket = kyTicket::createNewAuto($_department, $clientsdetails['firstname'] . ' ' . $clientsdetails['lastname'], $clientsdetails['email'], $_POST['ticketmessage'], $_POST['ticketsubject'])->setPriority($_priority)->setIgnoreAutoResponder($_settings['ignoreautoresponder'])->create();
             $_ticketPosts = $_ticket->getPosts();
             //Save ticket attachments
             foreach ($_FILES['ticketattachments']['tmp_name'] as $_key => $_ticketAttachment) {
                 kyTicketAttachment::createNewFromFile($_ticketPosts[0], $_ticketAttachment, $_FILES['ticketattachments']['name'][$_key])->create();
             }
             //Save custom fields
             $_ticket->setCustomFieldValuesFromPOST();
             $_ticket->updateCustomFields();
             $smarty->assign('_ticketDisplayID', $_ticket->getDisplayId());
Пример #4
0
<?php 
}
//we are rendering General Information form
if ($render === 'general') {
    //load the department we've chosen in Department form
    $department = kyDepartment::get($department_id);
    //load user group for ticket type and priority visibility test
    $user_group = kyUserGroup::getAll()->filterByTitle(USER_GROUP_TITLE)->first();
    //load public ticket types
    $ticket_types = kyTicketType::getAll()->filterByType(kyTicketType::TYPE_PUBLIC);
    //get only types visible to user group
    if ($user_group !== null) {
        $ticket_types = $ticket_types->filterByIsVisibleToUserGroup(true, $user_group);
    }
    //load public ticket priorities
    $ticket_priorities = kyTicketPriority::getAll()->filterByType(kyTicketPriority::TYPE_PUBLIC);
    //get only priorities visible to user group
    if ($user_group !== null) {
        $ticket_priorities = $ticket_priorities->filterByIsVisibleToUserGroup(true, $user_group);
    }
    ?>
	<form method="POST">
		<input type="hidden" name="page" id="page" value="general">

		<input type="hidden" name="department_id" id="department_id" value="<?php 
    echo $department_id;
    ?>
">

		<fieldset>
			<legend>General Information</legend>
defined('_JEXEC') or die;
require_once 'modules/mod_kayako/includes/kayako-php-api/kyIncludes.php';
require_once 'modules/mod_kayako/helper.php';
$email = JFactory::getUser()->email;
if (empty($email) || !isset($email)) {
    throw new kyException();
}
//Retrieve the get value
$input = JFactory::getApplication()->input;
//$edit_id = $input->get('id', null);
$edit_id = $_REQUEST['ticketid'];
JTickets::init();
$all_departments = kyDepartment::getAll()->filterByModule(kyDepartment::MODULE_TICKETS)->filterByType(kyDepartment::TYPE_PUBLIC);
$department_titles = kyDepartment::getAll()->collectTitle();
$department_id = kyDepartment::getAll()->collectId();
$priority_list = kyTicketPriority::getAll();
$status_list = kyTicketStatus::getAll();
$ticket_type = kyTicketType::getAll();
$ticket_details = kyTicket::get($edit_id);
$document =& JFactory::getDocument();
$document->addScript('/media/jui/js/jquery.min.js');
?>

<link rel="stylesheet" type="text/css" href="modules/mod_kayako/resources/css/style.css">

<script>
	jQuery(document).ready(function() {
		jQuery('#Reply').click(function() {
			jQuery('#div_reply').slideToggle("fast");
		});
	});
Пример #6
0
 /**
  * Returns Ticket Priority list
  *
  * @return array $_ticketPriorities
  */
 public function getTicketPriorityList()
 {
     // Load ticket priorities
     $_ticketPriorities = kyTicketPriority::getAll()->filterByType(kyTicketPriority::TYPE_PUBLIC);
     return $_ticketPriorities;
 }
Пример #7
0
 * Load some user organization.
 */
$user_organization = kyUserOrganization::getAll()->first();
print 'Fetched: ' . $user_organization;
/**
 * Create new user in Registered group:
 * fullname: Anno Ying
 * email: anno.ying@example.com
 * password: qwerty123
 */
$user = $registered_user_group->newUser("Anno Ying", "*****@*****.**", "qwerty123")->setUserOrganization($user_organization)->setSalutation(kyUser::SALUTATION_MR)->setSendWelcomeEmail(false)->create();
print 'Created: ' . $user;
/**
 * Load urgent priority.
 */
$priority_urgent = kyTicketPriority::getAll()->filterByTitle("Urgent")->first();
print 'Fetched: ' . $priority_urgent;
/**
 * Create urgent ticket as the user created in previous step.
 */
$ticket = $user->newTicket($printers_department, "The printer on 4th floor in building B2 doesn't print at all. Fix it quickly, please.", "Printer not working (example)")->setPriority($priority_urgent)->create();
print 'Created: ' . $ticket;
/**
 * Get ticket display id and print it.
 */
$ticket_display_id = $ticket->getDisplayId();
printf("The ticket was created and its ID is: %s\n", $ticket_display_id);
/**
 * Ticket processing.
 */
/**
Пример #8
0
$_ticketStatusContainer = [];
foreach ($_ticketStatusObjectContainer as $_ticketStatusObject) {
    $_ticketStatus['ticketstatusid'] = $_ticketStatusObject->getId();
    $_ticketStatus['title'] = $_ticketStatusObject->getTitle();
    $_ticketStatus['displayorder'] = $_ticketStatusObject->getId();
    $_ticketStatus['markasresolved'] = $_ticketStatusObject->getMarkAsResolved();
    $_ticketStatus['statustype'] = $_ticketStatusObject->getType();
    $_ticketStatus['displaycount'] = $_ticketStatusObject->getDisplayCount();
    $_ticketStatus['statuscolor'] = $_ticketStatusObject->getStatusColor();
    $_ticketStatus['statusbgcolor'] = $_ticketStatusObject->getStatusBackgroundColor();
    $_ticketStatus['displayicon'] = $_ticketStatusObject->getDisplayIcon();
    $_ticketStatus['triggersurvey'] = $_ticketStatusObject->getTriggerSurvey();
    $_ticketStatusContainer[$_ticketStatusObject->getId()] = $_ticketStatus;
}
//Process ticket priorities
$_ticketPriorityObjectContainer = kyTicketPriority::getAll()->filterByType(kyDepartment::TYPE_PUBLIC);
$_ticketPriorityContainer = [];
foreach ($_ticketPriorityObjectContainer as $_ticketPriorityObject) {
    $_ticketPriority['priorityid'] = $_ticketPriorityObject->getId();
    $_ticketPriority['title'] = $_ticketPriorityObject->getTitle();
    $_ticketPriority['displayorder'] = $_ticketPriorityObject->getDisplayOrder();
    $_ticketPriority['type'] = $_ticketPriorityObject->getType();
    $_ticketPriority['frcolorcode'] = $_ticketPriorityObject->getForegroundColor();
    $_ticketPriority['bgcolorcode'] = $_ticketPriorityObject->getBackgroundColor();
    $_ticketPriority['displayicon'] = $_ticketPriorityObject->getDisplayIcon();
    $_ticketPriority['uservisibilitycustom'] = $_ticketPriorityObject->getUserVisibilityCustom();
    $_ticketPriorityContainer[$_ticketPriorityObject->getId()] = $_ticketPriority;
}
if (isset($_GET['aid'])) {
    $_ticketAttachment = kyTicketAttachment::get($_GET['tid'], $_GET['aid']);
    Download($_ticketAttachment->getFileName(), $_ticketAttachment->getContents());