/** * Controller for mChat * * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object */ public function handle() { $ret = $this->render_helper->render_data_for_page(); // If this was an ajax request, we just create an json_response and return that. It's not ours to handle here. if ($this->request->is_ajax() && is_array($ret) && isset($ret['json']) && $ret['json'] === true) { return new \Symfony\Component\HttpFoundation\JsonResponse($ret); } // If error occured, render it if (isset($ret['error']) && $ret['error'] == true) { return $this->helper->error($ret['error_text'], $ret['error_type']); } return $this->helper->render($ret['filename'], $ret['lang_title']); }
/** * Check if mchat should be displayed on index. * * @param object $event The event object * @return null * @access public */ public function display_mchat_on_index($event) { $mchat_on_index = $this->config['mchat_on_index']; $mchat_view = $this->auth->acl_get('u_mchat_view') ? true : false; if ($mchat_on_index && $mchat_view) { $this->template->assign_var('S_MCHAT_ON_INDEX', true); $this->render_helper->render_data_for_page(true); } }
/** * Check if mchat should be displayed on index. * * @param object $event The event object * @return null * @access public */ public function display_mchat_on_index($event) { $mchat_on_index = $this->config['mchat_on_index']; $mchat_view = $this->auth->acl_get('u_mchat_view') ? true : false; if ($mchat_on_index && $mchat_view) { $sql = 'SELECT style_name FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $this->user->data['user_style']; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->template->assign_vars(array('S_MCHAT_ON_INDEX' => true, 'S_IS_NOT_PBTECH_STYLE' => $row['style_name'] != "PBTech" ? TRUE : FALSE)); $this->db->sql_freeresult($result); $this->render_helper->render_data_for_page(true); } }