foreach ($history_tables as $history_table) {
//если данного менеджера еще нет в массиве, создаем его
$manager_id = $history_table['manager_id'];
if (!isset($data['history_tables'][$manager_id])) {
$data['history_tables'][$manager_id] = array();
}
$data['history_tables'][$manager_id][] = array(
'date' => $history_table['date'],
'text' => $history_table['text'],
'manager' => $history_table['manager'],
'manager_id' => $history_table['manager_id'],
'status' => $history_table['status']
);
}
// $api_json = ''; // тут текст из ответа API
$data = json_decode($api_json, true);
$all_streets = [];
foreach ($data as $city) {
$city_name = $city['name'];
$city_id = $city['id'];
$city_streets = $city['streets'];
foreach ($city_streets as $street) {
$all_streets[] = [
'id' => $street['id'],
'name' => $street['name'],
// может, и параметры города сюда же?
'city' => $city_name,
'city_id' => $city_id,
];
}
}
$data = json_decode($json, true);
$data['group'] = array_reduce(
$data['group'],
function($res, $i) {
$res[$i['id']] = $i['value'];
return $res;
},
[]
);
{"group":{"12":"3","15":"1"}}
$this->db->select('*');
$this->db->from('crawl');
$this->db->join('news', 'crawl.site_id = news.site_id');
$query = $this->db->get();
Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
google.maps.event.addListener(metka_<?php echo $item['id']; ?>, 'click', function() {
var url = "<?php echo '<a href=/'.$item['slug'].'.html>'?>";
window.open(url, "_blank");
});
google.maps.event.addListener(metka_<?php echo $item['id']; ?>, 'click', function() {
window.location.href="<?php echo '<a href=/'.$item['slug'].'.html>'?>";
});