function _notifyTicket() { if (!$this->is_staff) { return; } if (!RSTicketsProHelper::getConfig('autoclose_enabled')) { return; } if ($this->_ticket->last_reply_customer) { return; } if ($this->_ticket->autoclose_sent) { return; } $date = JFactory::getDate(); $date = $date->toUnix(); $date = RSTicketsProHelper::getCurrentDate($date); $this->_db->setQuery("UPDATE #__rsticketspro_tickets SET autoclose_sent='" . $date . "' WHERE id='" . $this->_ticket->id . "' LIMIT 1"); $this->_db->query(); $interval = RSTicketsProHelper::getConfig('autoclose_email_interval') * 86400; if ($interval < 86400) { $interval = 86400; } $last_reply_interval = RSTicketsProHelper::getCurrentDate($this->_ticket->last_reply) + $interval; if ($last_reply_interval > $date) { return; } $overdue = floor(($date - $last_reply_interval) / 86400); $closed = RSTicketsProHelper::getConfig('autoclose_interval'); // get email sending settings $from = RSTicketsProHelper::getConfig('email_address'); $fromname = RSTicketsProHelper::getConfig('email_address_fullname'); // are we using global ? if (RSTicketsProHelper::getConfig('email_use_global')) { $config = new JConfig(); $from = $config->mailfrom; $fromname = $config->fromname; } $department =& JTable::getInstance('RSTicketsPro_Departments', 'Table'); $department->load($this->_ticket->department_id); if (!$department->get('email_use_global')) { $from = $department->email_address; $fromname = $department->email_address_fullname; } $email = RSTicketsProHelper::getEmail('notification_email'); $customer = JFactory::getUser($this->_ticket->customer_id); $staff = JFactory::getUser($this->_ticket->staff_id); $code = $this->_ticket->code; $replace = array('{live_site}', '{ticket}', '{customer_name}', '{customer_username}', '{customer_email}', '{staff_name}', '{staff_username}', '{staff_email}', '{code}', '{subject}', '{inactive_interval}', '{close_interval}'); $with = array(JURI::root(), RSTicketsProHelper::route(JURI::root() . 'index.php?option=com_rsticketspro&view=ticket&cid=' . $this->_ticket->id . ':' . JFilterOutput::stringURLSafe($this->_ticket->subject)), $customer->get('name'), $customer->get('username'), $customer->get('email'), $staff->get('name'), $staff->get('username'), $staff->get('email'), $code, $this->_ticket->subject, $overdue, $closed); $email_subject = str_replace($replace, $with, $email->subject); $email_message = str_replace($replace, $with, $email->message); JUtility::sendMail($from, $fromname, $customer->get('email'), $email_subject, $email_message, 1); }
$k = 1; $i = 0; $n = count($this->notes); foreach ($this->notes as $note) { $avatar = RSTicketsProHelper::getAvatar($note->user_id); ?> <tr> <td class="sectiontableheader" valign="bottom"><div align="left"><?php echo $avatar; ?> <?php echo JText::sprintf('RST_TICKET_WROTE', '<strong>' . $this->escape($note->user) . '</strong>'); ?> </div></td> <td class="sectiontableheader" valign="bottom" width="15%" nowrap="nowrap"><div align="right"><?php echo $this->escape(date($this->date_format, RSTicketsProHelper::getCurrentDate($note->date))); ?> </div></td> </tr> <tr class="sectiontableentry<?php echo $k; ?> "> <td colspan="2"> <span class="rst_buttons"> <?php echo JHTML::_('rsticketsproicon.editnote', $note, $this->permissions); echo JHTML::_('rsticketsproicon.deletenote', $note, $this->permissions); ?> </span> <div id="rst_ticket_note_<?php
function convertTicket($ticket, $params) { $kb_template_body = RSTicketsProHelper::getConfig('kb_template_body'); $kb_template_ticket_body = RSTicketsProHelper::getConfig('kb_template_ticket_body'); $use_editor = RSTicketsProHelper::getConfig('allow_rich_editor'); $date_format = RSTicketsProHelper::getConfig('date_format'); $show_email_link = RSTicketsProHelper::getConfig('show_email_link'); // Parse template body $replace = array('{ticket_subject}', '{ticket_department}', '{ticket_date}'); $with = array($ticket->subject, $ticket->department, date($date_format, RSTicketsProHelper::getCurrentDate($ticket->date))); $text = str_replace($replace, $with, $kb_template_body); // Parse ticket message template $messages = array(); foreach ($ticket->messages as $message) { if (!$use_editor) { $message->message = nl2br($message->message); } if ($show_email_link) { $message->user = '******' . $message->email . '">' . $message->user . '</a>'; } $replace = array('{message_user}', '{message_date}', '{message_text}'); $with = array($message->user, date($date_format, RSTicketsProHelper::getCurrentDate($message->date)), $message->message); $messages[] = str_replace($replace, $with, $kb_template_ticket_body); } $text = str_replace('{ticket_messages}', implode("\n", $messages), $text); $row =& JTable::getInstance('RSTicketsPro_KB_Content', 'Table'); $row->name = $params['name']; $row->text = $text; $row->category_id = (int) $params['category_id']; $row->published = $params['publish_article']; $row->private = $params['private']; $row->from_ticket_id = (int) $ticket->id; $row->ordering = $row->getNextOrder("`category_id`='" . $row->category_id . "'"); $date =& JFactory::getDate(); $row->created = $date->toUnix(); return $row->store(); }
?> "> <td><?php echo $this->pagination->getRowOffset($i); ?> </td> <td><?php echo $grid; ?> </td> <td><?php echo $this->escape(date($this->date_format, RSTicketsProHelper::getCurrentDate($item->date))); ?> </td> <td><?php echo $this->escape(date($this->date_format, RSTicketsProHelper::getCurrentDate($item->last_reply))); ?> </td> <td align="center"><a href="javascript: void(0);" onclick="rst_flag_ticket('index.php', this, '<?php echo $item->id; ?> ');" class="rst_flag<?php echo $item->flagged ? ' rst_flag_active' : ''; ?> "></a></td> <?php if ($this->permissions->delete_ticket) { ?> <td align="center"><?php echo JHTML::_('rsticketsproicon.deleteticket', $item->id, $this->is_staff, $this->permissions); ?>
function notify($is_staff, $ticket, $attribs = null) { if (!$is_staff) { return; } if (!RSTicketsProHelper::getConfig('autoclose_enabled')) { return; } if ($ticket->last_reply_customer) { return; } if ($ticket->autoclose_sent) { return; } if ($ticket->status_id == 2) { return; } $interval = RSTicketsProHelper::getConfig('autoclose_email_interval') * 86400; if ($interval < 86400) { $interval = 86400; } $date = JFactory::getDate(); $date = $date->toUnix(); $date = RSTicketsProHelper::getCurrentDate($date); $last_reply_interval = RSTicketsProHelper::getCurrentDate($ticket->last_reply) + $interval; if ($last_reply_interval > $date) { return; } $overdue = floor(($date - $last_reply_interval) / 86400); $url = RSTicketsProHelper::route('index.php?option=com_rsticketspro&controller=ticket&task=notify&cid=' . $ticket->id); $img = JHTML::_('image.site', 'notify.gif', '/components/com_rsticketspro/assets/images/', null, null, JText::_('RST_TICKET_NOTIFY'), 'class="rst_notify_ticket"'); $return = '<span class="hasTip" title="' . JText::sprintf('RST_TICKET_NOTIFY_DESC', $overdue) . '" ' . $attribs . '><a href="' . $url . '">' . $img . '</a></span>'; return $return; }