<div id="user-nav" class="navbar navbar-inverse"> <ul class="nav btn-group"> <?php if ($this->user->hasFunction('REGISTRY_SUPERUSER') && mod_enabled('roles')) { ?> <li class="btn btn-inverse dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">Roles <b class="caret"></b></a> <ul class="dropdown-menu pull-right"> <li class=""><?php echo anchor(roles_url(''), 'List Roles'); ?> </li> <li class=""><?php echo anchor(roles_url('role/#/add/'), '<i class="icon icon-plus"></i> Add New Role'); ?> </li> </ul> </li> <?php } ?> <?php if ($this->user->hasFunction('REGISTRY_USER') && mod_enabled('registry')) { ?> <li class="btn btn-inverse dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">My Data <b class="caret"></b></a> <ul class="dropdown-menu pull-right">
public function search() { header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); $this->load->database(); $like = $this->input->get('query'); $this->db->select('registry_object_id, title'); $this->db->from('registry_objects'); $this->db->like('title', $like); $this->db->or_like('registry_object_id', $like); $this->db->or_like('key', $like); $this->db->or_like('slug', $like); $this->db->limit(10); $query = $this->db->get(); $registry_object_results = array(); foreach ($query->result() as $row) { $item = array('value' => $row->title, 'link' => base_url('registry_object/view/' . $row->registry_object_id)); array_push($registry_object_results, $item); } $query = $this->db->select('title, data_source_id')->from('data_sources')->like('title', $like)->or_like('key', $like)->or_like('data_source_id', $like)->limit(10)->get(); $data_source_results = array(); foreach ($query->result() as $row) { $item = array('value' => $row->title, 'link' => base_url('data_source/manage#!/view/' . $row->data_source_id)); array_push($data_source_results, $item); } $roles_db = $this->load->database('roles', TRUE); $query = $roles_db->select('name, role_id')->from('roles')->like('role_id', $like)->or_like('name', $like)->limit(10)->get(); $roles_results = array(); foreach ($query->result() as $row) { $item = array('value' => $row->name, 'link' => roles_url('#/view/' . rawurlencode($row->role_id))); array_push($roles_results, $item); } $result['ro'] = $registry_object_results; if ($this->user->hasFunction('REGISTRY_SUPERUSER')) { $result['ds'] = $data_source_results; } if ($this->user->hasFunction('REGISTRY_SUPERUSER')) { $result['roles'] = $roles_results; } if (sizeof($result['ro']) > 0 || sizeof($result['ds']) > 0 || sizeof($result['roles']) > 0) { $result['has_result'] = true; } $result = json_encode($result); echo $result; }