$home = 'locations/'; if ($context['with_friendly_urls'] == 'Y') { $prefix = $home . 'index.php/'; } elseif ($context['with_friendly_urls'] == 'R') { $prefix = $home; } else { $prefix = $home . '?page='; } $context['page_menu'] += Skin::navigate($home, $prefix, $stats['count'], LOCATIONS_PER_PAGE, $page); } // page main content $cache_id = 'locations/index.php#text#' . $page; if (!($text = Cache::get($cache_id))) { // query the database and layout that stuff $offset = ($page - 1) * LOCATIONS_PER_PAGE; if (!($items = Locations::list_by_date($offset, LOCATIONS_PER_PAGE, 'full'))) { $text .= '<p>' . i18n::s('No location has been created yet.') . '</p>'; } // we have an array to format if (is_array($items)) { $text =& Skin::build_list($items, 'rows'); } // cache this to speed subsequent queries Cache::put($cache_id, $text, 'locations'); } $context['text'] .= $text; } // page tools if (Surfer::is_associate()) { $context['page_tools'][] = Skin::build_link('locations/check.php', i18n::s('Maintenance'), 'basic'); }
} // not found if (!is_object($anchor) && $id != 'all' && $id != 'users') { Logger::error(i18n::s('Reference a valid anchor, or all users.')); } elseif (!isset($context['google_api_key']) || !$context['google_api_key']) { Logger::error(i18n::s('Use the configuration panel for web services to enter your Google API key.')); } else { // insert anchor prefix if (is_object($anchor)) { $context['text'] .= $anchor->get_prefix(); } // get markers $items = array(); switch ($id) { case 'all': default: $items = Locations::list_by_date(0, 100, 'raw'); break; case 'users': $items = Locations::list_users_by_date(0, 100, 'raw'); break; } // integrate with google maps $context['text'] .= Locations::map_on_google($items, 2); // insert anchor suffix if (is_object($anchor)) { $context['text'] .= $anchor->get_suffix(); } } // render the skin render_skin();
/** * render several locations * * @param string 'all' or 'users' * @return string the rendered text **/ public static function render_locations($id = 'all') { global $context; // the required library include_once $context['path_to_root'] . 'locations/locations.php'; // get markers $items = array(); switch ($id) { case 'all': $items = Locations::list_by_date(0, 100, 'raw'); break; case 'users': $items = Locations::list_users_by_date(0, 100, 'raw'); break; default: if (Surfer::is_member()) { $output = '[locations=' . $id . ']'; return $output; } else { $output = ''; return $output; } } // integrate with google maps $output = Locations::map_on_google($items); return $output; }