function query() { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $query_settings_sess = $this->application->get_session_userdata('current_search'); $query_parameters = $this->application->get_config('query', 'actions'); $search_settings = $this->usermeta_model->get_usermeta(0, array('meta_key' => 'settings_search')); $um_search_settings = array_merge($query_parameters, $search_settings, $parameters); $raw = $this->idol->QueryAction($um_search_settings); $raw = array_get_value($raw, 'autn:hit'); $results = clean_json_response($raw); header('Content-Type: application/json'); echo json_encode($results, true); } }
elseif($page): // This call is pagination load options from session $query_settings = array_merge($um_search_settings, $query_settings_sess); $start = $page-1; $query_settings = array_merge($query_settings, array('start' => ($start*$query_settings['maxresults'])+1)); else: //Its not a post Give all results $query_settings = $um_search_settings; endif; **/ // Call Search $search_results = $this->idol->QueryAction($query_settings); $message = $this->notification->errors() ? $this->notification->errors() : ($this->notification->messages() ? $this->notification->messages() : $this->session->flashdata('message')); if (!empty($search_results)) { $results = clean_json_response($search_results); $responsedata = get_responsedata($results); $sort = array_key_exists('sort', $query_settings) ? element('sort', $query_settings) : ''; $maxresults = array_key_exists('maxresults', $query_settings) ? element('maxresults', $query_settings) : 0; $totalresults = array_key_exists('autn:totalhits', $responsedata) ? element('autn:totalhits', $responsedata) : 0; $numhits = array_key_exists('autn:numhits', $responsedata) ? element('autn:numhits', $responsedata) : 0; $info = $this->search_model->search_info(array('total_rows' => intval($totalresults), 'per_page' => intval($maxresults), 'start' => intval(element('start', $query_settings)))); ?> <div class="box box-default o-hidden"> <div class="box-header with-border"> <h3 class="box-title"> <i class="fa <?php echo element('icon', $options); ?>
Received Parameters: $widget_key $meta_key $query_settings **/ $query_config = $this->application->get_config('query', 'actions'); $page = $this->session->userdata('current_page'); $is_page = $this->application->is_page(); $options = isset($meta_key) ? $this->application->get_settings($meta_key) : array(); $query_options = array_key_exists('query', $options) ? element('query', $options) : array(); $results = array(); if ($query_settings) { $query_settings = isset($query_settings) ? $query_settings : $this->application->get_session_userdata('current_search'); $query = array_merge($query_config, $query_options, $query_settings, array('action' => 'query', 'print' => 'all', 'server' => $page->server)); $results = $this->idol->QueryAction($query); $results = clean_json_response($results); } $numhits = array_get_value($results, 'autn:numhits'); $document_options = $this->application->get_config('document_options', 'template'); if (intval($numhits) == 1) { $hit = array_get_value($results, 'autn:hit'); $document = array_get_value($hit, 'DOCUMENT'); $this->session->set_userdata('dbs_customer', $document); ?> <div class="box box-solid"> <div class="box-body no-padding"> <div class="text-center p-10 <?php echo element('bgcolor', $options) ? 'bg-' . element('bgcolor', $options) . '-gradient' : 'bg-aqua-gradient'; ?> "> <img alt="User Image" class="img-circle" src="<?php
function search($start = null) { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $search_results = $this->idol->QueryAction($parameters); $message = $this->notification->errors() ? $this->notification->errors() : ($this->notification->messages() ? $this->notification->messages() : $this->session->flashdata('message')); if (!empty($search_results)) { $results = clean_json_response($search_results); $responsedata = get_responsedata($results); $data['responsedata'] = $responsedata; $data['template'] = element('template', $parameters); $data['search_parameters'] = $parameters; $template = isset($parameters['template']) ? $parameters['template']['name'] : 'document-template-chat'; echo $this->load->view('template/' . $template, $data); } else { echo 'No results...'; } } }
* @Description: Feed widget for dashboard. With selections from predefined Feed Rules. */ ?> <?php $mode = $this->application->get_mode('dashboard_mode'); $query_parameters = $this->application->get_config('query', 'actions'); $options = $this->application->get_settings($widget_key); $feed = $this->rules_model->get_rule(element('feed', $options)); $feed_setting = unserialize(element('rule_settings', $feed)); $keywords = element('keywords', $feed_setting); $query_settings = array_merge($query_parameters, $this->usermeta_model->get_usermeta(0, array('meta_key' => 'settings_query_query')), array('text' => $keywords, 'maxresults' => 5)); $results = $this->search_model->call_search($query_settings); if (!empty($results)) { $responsedata = clean_json_response(get_responsedata($results)); $numhits = array_key_exists('autn:numhits', $responsedata) ? element('autn:numhits', $responsedata) : 0; $default_elements = array_keys($this->document_lib->default_elements()); ?> <div class="box box-success o-hidden"> <?php if ($mode) { ?> <div class="removable-widget-tools"> <ul class="list list-inline m-0"> <li class="<?php echo $mode ? 'handle' : 'hidden'; ?> ">
public function call_get_tag_values($post_opts = array()) { $response = array(); //$server = array_merge($this->server , $this->usermeta_model->get_usermeta(0, array( 'meta_key' => 'server_status'))); $config = $this->application->get_config('gettagvalues', 'actions'); $search = array(); if ($this->session->userdata('search_settings')) { $search = $this->session->userdata('search_settings'); } $post_data = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts))); //$data = //$this->curl->simple_post( element('url', $server) . ':' . element('port', $server), $post_data); $this->curl->create(element('server', $post_opts)); $this->curl->option('buffersize', 10); $this->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)'); $this->curl->option('returntransfer', 1); $this->curl->option('followlocation', 1); $this->curl->option('connecttimeout', 1); $this->curl->post($post_data); $data = $this->curl->execute(); if ($data && $data !== false) { $response = json_decode($data, true); $response = clean_json_response($response); } if (is_response_success($response)) { $response = get_responsedata($response); } $this->curl->close(); return $response; }
public function get_pid($post_opts = array()) { $response = false; $config = $this->CI->application->get_config('getpid', 'actions'); $config = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts))); $this->CI->curl->create(element('server', $post_opts)); $this->CI->curl->option('buffersize', 10); $this->CI->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)'); $this->CI->curl->option('returntransfer', 1); $this->CI->curl->option('followlocation', 1); //$this->CI->curl->option('HEADER', true); $this->CI->curl->option('connecttimeout', 1); $this->CI->curl->option('POST', true); $this->CI->curl->option('POSTFIELDS', $config); $data = $this->CI->curl->execute(); if ((bool) $data) { $data = json_decode($data, true); $response = clean_json_response($data); } else { $this->set_error('An error encountered while accessing the server, please try again.'); } $this->CI->curl->close(); return $response; }