public function autocomplete()
{
$json = array();
if ($this->input->get('term')) {
$filter = array('menu_name' => $this->input->get('term'));
$results = $this->Menus_model->getAutoComplete($filter);
if ($results) {
foreach ($results as $result) {
$json['results'][] = array('id' => $result['menu_id'], 'text' => utf8_encode($result['menu_name']));
}
} else {
$json['results'] = array('id' => '0', 'text' => $this->lang->line('text_no_match'));
}
}
$this->output->set_output(json_encode($json));
}