Exemplo n.º 1
0
 public function retrieveIssues()
 {
     try {
         $ticket_types = kyTicketType::getAll();
         foreach ($ticket_types as $ticket_type) {
             $issuesArray[] = array('value' => $ticket_type->getId(), 'label' => $ticket_type->getTitle());
         }
         return $issuesArray;
     } catch (Exception $e) {
         Mage::getSingleton('core/session')->addError('Error: Please check Kayako API credentials');
         return array();
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 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());
             $smarty->assign('_ticketSubject', $_POST['ticketsubject']);
Exemplo n.º 4
0
    ?>
			</div>
		</fieldset>

		<input type="submit" name="submit_department" value="Next">
	</form>
<?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 
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");
		});
	});

	function AddTicketFile(_namePrefix) {
Exemplo n.º 6
0
 /**
  * Returns TicketType list
  *
  * @return array $_ticketTypes
  */
 public function getTicketTypeList()
 {
     // Load ticket types
     $_ticketTypes = kyTicketType::getAll()->filterByType(kyTicketType::TYPE_PUBLIC);
     return $_ticketTypes;
 }
Exemplo n.º 7
0
require_once "../kyIncludes.php";
print "<pre>";
/**
 * Initialization.
 */
kyConfig::set(new kyConfig("<API URL>", "<API key>", "<Secret key>"));
kyConfig::get()->setDebugEnabled(true);
/**
 * Optional. Setting defaults for new tickets.
 * WARNING:
 * Names may be different in your instalation.
 */
$default_status_id = kyTicketStatus::getAll()->filterByTitle("Open")->first()->getId();
$default_priority_id = kyTicketPriority::getAll()->filterByTitle("Normal")->first()->getId();
$default_type_id = kyTicketType::getAll()->filterByTitle("Issue")->first()->getId();
kyTicket::setDefaults($default_status_id, $default_priority_id, $default_type_id);
$general_department = kyDepartment::getAll()->filterByTitle("General")->filterByModule(kyDepartment::MODULE_TICKETS)->first();
/**
 * Cleanup - delete what's left from previous run of this example.
 */
$example_department = kyDepartment::getAll()->filterByTitle("Printers (example)");
if (count($example_department) > 0) {
    $tickets_to_delete = kyTicket::getAll($example_department)->filterBySubject("Printer not working (example)");
    $tickets_to_delete->deleteAll();
    if (count($tickets_to_delete) > 0) {
        printf("Tickets DELETED:\n%s", $tickets_to_delete);
    }
}
$users_to_delete = kyUser::getAll()->filterByEmail("*****@*****.**");
$users_to_delete->deleteAll();