30 lines
881 B
PHP
30 lines
881 B
PHP
<?php
|
|
|
|
class new_messages {
|
|
|
|
private $layout_object;
|
|
|
|
function __construct() {
|
|
$this->layout_object = Registry::get('layout_object');
|
|
$this->base_object = Registry::get('base');
|
|
}
|
|
|
|
function run() {
|
|
$ticket_object = new Cs_ticket($this->base_object);
|
|
$ticket_list = $ticket_object->get_new_messages();
|
|
$cs_ticket_message_object = new Cs_ticket_message($this->base_object);
|
|
foreach($ticket_list as $ticket) {
|
|
// get customer
|
|
if($ticket->customer_id) {
|
|
$this->base_object->customer->customer_id = $ticket->customer_id;
|
|
$ticket->customer = $this->base_object->customer->get_data();
|
|
}
|
|
// get first message
|
|
$ticket->first_message = $cs_ticket_message_object->get_first_message($ticket->id);
|
|
$data[] = $ticket;
|
|
}
|
|
$this->layout_object->assign('ticket_list', $data);
|
|
|
|
return $this->layout_object->fetch('widgets/new_messages.tpl');
|
|
}
|
|
} |