function getMessageAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'])); // message id @($hide = DevblocksPlatform::importGPC($_REQUEST['hide'], 'integer', 0)); $tpl = DevblocksPlatform::getTemplateService(); $tpl->cache_lifetime = "0"; $tpl->assign('path', $this->_TPL_PATH); $message = DAO_Ticket::getMessage($id); $tpl->assign('message', $message); $tpl->assign('message_id', $message->id); // Sender info $message_senders = array(); $message_sender_orgs = array(); if (null != ($sender_addy = DAO_Address::get($message->address_id))) { $message_senders[$sender_addy->id] = $sender_addy; if (null != ($sender_org = DAO_ContactOrg::get($sender_addy->contact_org_id))) { $message_sender_orgs[$sender_org->id] = $sender_org; } } $tpl->assign('message_senders', $message_senders); $tpl->assign('message_sender_orgs', $message_sender_orgs); // Workers $workers = DAO_Worker::getAll(); $tpl->assign('workers', $workers); // Ticket $ticket = DAO_Ticket::getTicket($message->ticket_id); $tpl->assign('ticket', $ticket); $tpl->assign('requesters', $ticket->getRequesters()); if (empty($hide)) { $content = DAO_MessageContent::get($id); $tpl->assign('content', $content); $notes = DAO_MessageNote::getByTicketId($message->ticket_id); $message_notes = array(); // Index notes by message id if (is_array($notes)) { foreach ($notes as $note) { if (!isset($message_notes[$note->message_id])) { $message_notes[$note->message_id] = array(); } $message_notes[$note->message_id][$note->id] = $note; } } $tpl->assign('message_notes', $message_notes); } // Message toolbar items $messageToolbarItems = DevblocksPlatform::getExtensions('cerberusweb.message.toolbaritem', true); if (!empty($messageToolbarItems)) { $tpl->assign('message_toolbaritems', $messageToolbarItems); } // [TODO] Workers? $tpl->assign('expanded', empty($hide) ? true : false); $tpl->register_modifier('makehrefs', array('CerberusUtils', 'smarty_modifier_makehrefs')); $tpl->display('file:' . $this->_TPL_PATH . 'display/modules/conversation/message.tpl'); }
function getContent() { return DAO_MessageContent::get($this->id); }
private function _getMessageXML($id) { $message = DAO_Ticket::getMessage($id); /* @var $message CerberusMessage */ if (is_null($message)) { $this->_error("ID {$id} not valid."); } $message_content = DAO_MessageContent::get($id); $message_headers = DAO_MessageHeader::getAll($id); $message_notes = DAO_MessageNote::getByMessageId($id); $xml_out = new SimpleXMLElement("<message></message>"); $xml_out->addChild('id', $message->id); $xml_out->addChild('ticket_id', $message->ticket_id); $xml_out->addChild('created_date', $message->created_date); $xml_out->addChild('address_id', $message->address_id); $xml_out->addChild('is_outgoing', $message->is_outgoing); $xml_out->addChild('worker_id', $message->worker_id); $xml_out->addChild('content', $message_content); $headers = $xml_out->addChild('headers'); foreach ($message_headers as $header_name => $header_value) { $headers->addChild($header_name, $header_value); } $xml_notes = $xml_out->addChild('notes'); foreach ($message_notes as $note) { $xml_note = $xml_notes->addChild('note'); $xml_note->addChild('id', $note->id); $xml_note->addChild('type', $note->type); $xml_note->addChild('message_id', $note->message_id); $xml_note->addChild('created', $note->created); $xml_note->addChild('worker_id', $note->worker_id); $xml_note->addChild('content', $note->content); } return $xml_out; }
function showPreviewAction() { @($tid = DevblocksPlatform::importGPC($_REQUEST['tid'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = $this->_TPL_PATH; $tpl->assign('path', $tpl_path); $tpl->assign('view_id', $view_id); if (null != ($ticket = DAO_Ticket::getTicket($tid))) { /* @var $ticket CerberusTicket */ $tpl->assign('ticket', $ticket); } if (null != ($messages = DAO_Ticket::getMessagesByTicket($tid))) { if (!empty($messages)) { @($last = array_pop($messages)); @($content = DAO_MessageContent::get($last->id)); $tpl->assign('message', $last); $tpl->assign('content', $content); } } $teams = DAO_Group::getAll(); $tpl->assign('teams', $teams); $team_categories = DAO_Bucket::getTeams(); $tpl->assign('team_categories', $team_categories); $workers = DAO_Worker::getAllActive(); $tpl->assign('workers', $workers); // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Ticket::ID, $ticket->id); if (isset($custom_field_values[$ticket->id])) { $tpl->assign('custom_field_values', $custom_field_values[$ticket->id]); } // Display $tpl->display('file:' . $this->_TPL_PATH . 'tickets/rpc/preview_panel.tpl'); }