/** * Prepare some data for chat for both user and operator * * @param Thread $thread thread object * @return array Array of chat view data */ function setup_chatview(Thread $thread) { $data = prepare_chat_app_data(); // Get group info if (!empty($thread->groupId)) { $group = group_by_id($thread->groupId); $group = get_top_level_group($group); } else { $group = array(); } // Create some empty arrays $data['chat'] = array('messageForm' => array(), 'links' => array(), 'windowsParams' => array()); // Set thread params $data['chat']['thread'] = array('id' => $thread->id, 'token' => $thread->lastToken, 'agentId' => $thread->agentId, 'userId' => $thread->userId); $data['page.title'] = empty($group['vcchattitle']) ? Settings::get('chattitle') : $group['vcchattitle']; $data['chat']['page'] = array('title' => $data['page.title']); // Setup logo $data = array_merge_recursive($data, setup_logo($group)); // Set enter key shortcut if (Settings::get('sendmessagekey') == 'enter') { $data['chat']['messageForm']['ignoreCtrl'] = true; } else { $data['chat']['messageForm']['ignoreCtrl'] = false; } // Load dialogs style options $chat_style = new ChatStyle(ChatStyle::getCurrentStyle()); $style_config = $chat_style->getConfigurations(); $data['chat']['windowsParams']['mail'] = $style_config['mail']['window']; // Load core style options $page_style = new PageStyle(PageStyle::getCurrentStyle()); $style_config = $page_style->getConfigurations(); $data['chat']['windowsParams']['history'] = $style_config['history']['window']; $data['startFrom'] = 'chat'; return $data; }