コード例 #1
0
 public function action_get()
 {
     try {
         if (is_numeric($id_location = $this->request->param('id'))) {
             $location = new Model_location($id_location);
             if ($location->loaded()) {
                 $loc = $location->as_array();
                 $loc['siblings'] = $location->get_siblings_ids();
                 $loc['icon'] = $location->get_icon();
                 $this->rest_output(array('location' => $loc));
             } else {
                 $this->_error(__('Location not found'), 404);
             }
         } else {
             $this->_error(__('Location not found'), 404);
         }
     } catch (Kohana_HTTP_Exception $khe) {
         $this->_error($khe);
     }
 }