$msg] ); } /** * Checks if target method is available to be called using AJAX. * * @param string $method Target method. * * @return boolean True allowed, false not. */ public function ajaxMethod($method) { global $config; // Check access. check_login(); return in_array($method, $this->AJAXMethods); } /** * Constructor. * * @param boolean $must_run Must run or not. * @param string $ajax_controller Controller. * * @return object * @throws Exception On error. */ public function __construct( $ajax_controller='include/ajax/order_interpreter' ) { $this->ajaxController = $ajax_controller; $this->pages_name = [ 0 => __('Agent view'), 1 => __('Agent Management'), 2 => __('Manage Agents'), 3 => __('Manage Policies'), ]; $this->pages_url = [ 0 => ui_get_full_url(), 1 => ui_get_full_url(), 2 => ui_get_full_url(), 3 => ui_get_full_url(), ]; } /** * Method to print order interpreted on header search input. * * @return array */ public function getResult():array { // Take value from input search. $text = get_parameter('text', ''); $array_found = []; foreach ($this->pages_name as $key => $value) { if (preg_match('/.*'.$text.'.*/', $value)) { $array_found[$key] = ''.$value.''; } } return $array_found; } /** * Load JS content. * function that enables the functions to the buttons when its action is * completed. * Assign the url of each button. * * @return string HTML code for javascript functionality. */ public function loadJS() { ob_start(); ?>