-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.php
25 lines (19 loc) · 775 Bytes
/
Map.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Map extends Kohana_Controller {
public function action_index() {
$id = Arr::get($_GET, 'id');
$result = DB::select()->from('maps')->where('map_id', '=', $id)->and_where('expire', '>=', time())->execute()->as_array();
if (!$result) throw new HTTP_Exception_404('Not found');
$items = array();
foreach ($result as $item) {
$items[] = array(
'lng' => $item['lng'],
'lat' => $item['lat'],
'id' => $item['job_key'],
'data' => json_decode($item['info'], true),
);
}
header('Content-type: application/json');
die(json_encode($items));
}
}