/**
  * Handle GET requests.
  */
 public function action_index()
 {
     try {
         if (is_numeric($this->request->param('id'))) {
             $this->action_get();
         } else {
             $output = array();
             $locs = new Model_Location();
             //make a search with q? param
             if (isset($this->_params['q']) and strlen($this->_params['q'])) {
                 $locs->where_open()->where('name', 'like', '%' . $this->_params['q'] . '%')->or_where('description', 'like', '%' . $this->_params['q'] . '%')->where_close();
             }
             //filter results by param, verify field exists and has a value and sort the results
             $locs->api_filter($this->_filter_params)->api_sort($this->_sort);
             //how many? used in header X-Total-Count
             $count = $locs->count_all();
             $locs = $locs->cached()->find_all();
             //as array
             foreach ($locs as $location) {
                 $loc = $location->as_array();
                 //$loc['siblings'] = $location->get_siblings_ids();
                 $loc['icon'] = $location->get_icon();
                 $output[] = $loc;
             }
             $this->rest_output(array('locations' => $output), 200, $count);
         }
     } catch (Kohana_HTTP_Exception $khe) {
         $this->_error($khe);
         return;
     }
 }