Ejemplo n.º 1
0
}
// 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();
Ejemplo n.º 2
0
 /**
  * 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;
 }