/** * move the map feature into an active layer using * a icon set map to choose the layer id. * * @param int $id unique id for a map feature */ function unarchive_map_feature($id) { $prefix = 'components/com_geolive/users_files/user_files_983/Uploads/'; // $icons = array('[ImAgE]_JYp_[G]_rP7_SHq.png', 'ivy_[ImAgE]_lwU_[G]_VVF.png', 'tEk_[G]_[ImAgE]_L7_xIy.png', '[G]_aAJ_hLP_RDn_[ImAgE].png'); $layers = array(1, 2, 3, 4); $archive = array('[G]_[ImAgE]_gZf_JiS_E65.png', '[G]_LGt_eGZ_kDt_[ImAgE].png', 'AQc_zn7_[G]_[ImAgE]_sTC.png', '0o6_Je3_[ImAgE]_[G]_PMR.png'); $iconToLayerMap = array_combine($icons, $layers); $archiveToLayerMap = array_combine($archive, $layers); $archiveToIconMap = array_combine($archive, $icons); Core::Get('Maps'); $marker = MapController::LoadMapItem($id); $iconUrl = $marker->getIcon(); $icon = substr($iconUrl, strrpos($iconUrl, '/') + 1); $layer = 6; $newIcon = $icon; if (key_exists($icon, $iconToLayerMap)) { $layer = $iconToLayerMap[$icon]; } if (key_exists($icon, $archiveToLayerMap)) { $layer = $archiveToLayerMap[$icon]; $newIcon = $archiveToIconMap[$icon]; } $marker->setLayerId($layer); $marker->setIcon($prefix . $newIcon); MapController::StoreMapFeature($marker); file_put_contents(__DIR__ . DS . '.custom.log', 'unarchive (' . $id . ')' . $icon . " -> " . $newIcon . ', layer -> ' . $layer . "\n\n", FILE_APPEND); }
public function init() { MapController::$dataTableUrl = adminAppUrl('operation/map/dataTable'); MapController::$addUrl = adminAppUrl('operation/map/add'); MapController::$modUrl = adminAppUrl('operation/map/mod?id='); MapController::$delUrl = adminAppUrl('operation/map/del?id='); MapController::$city = DBproxy::getProcedure('Manage')->setDimension(2)->getCityList(); }
private function map_row_query($controller, $params) { if (isset($params['id'])) { $table = DB_CONTENT; $where = "contentid"; $field = array($params['id']); //build single query from BuildQuery class $db_results = BuildQuery::single_row_query($table, $where, $field); self::$db_content_row = $db_results; } }
public static function ArticlesForSites() { $args = json_decode(UrlVar('json', '{}')); $sites = array(); if (is_array($args->sites)) { foreach ($args->sites as $id) { $site = MapController::LoadMapItem((int) $id); if (Auth('read', $site, 'mapitem')) { $sites[] = array_merge(array('id' => $site->getId(), 'name' => $site->getName()), self::ItemMetadata($site)); } else { echo json_encode(array('success' => false, 'message' => 'invalid id:' . $id . ' in list, or no access'), JSON_PRETTY_PRINT); return; } } } echo json_encode(array('sites' => $sites, 'success' => true), JSON_PRETTY_PRINT); }
/** * Test controller when type is invalid */ public function testInvalidType(){ $builder = $this->buildData(); $this->simulateLogin('*****@*****.**'); $_GET["pid"] = '1001'; $_GET["t"] = 'notavalidtype'; $controller = new MapController(true); $results = $controller->go(); $this->assertPattern("/This post has not been geoencoded yet; cannot display map./", $results); }
* ThinkUp/webapp/post/map.php * * Copyright (c) 2009-2010 Gina Trapani * * LICENSE: * * This file is part of ThinkUp (http://thinkupapp.com). * * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any * later version. * * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with ThinkUp. If not, see * <http://www.gnu.org/licenses/>. * * * @author Gina Trapani <ginatrapani[at]gmail[dot]com> * @license http://www.gnu.org/licenses/gpl.html * @copyright 2009-2010 Gina Trapani */ chdir('..'); chdir('..'); require_once 'init.php'; require_once 'plugins/geoencoder/controller/class.MapController.php'; $controller = new MapController(); echo $controller->go();
} img { height: 30px; vertical-align: middle; } </style><?php foreach ($iconMap as $name => $icon) { echo '<div>' . $name . '=><img src="../' . $icon . '"/></div>'; } echo "\n\n" . ' var iconSetMap=' . htmlspecialchars(json_encode($iconMap, JSON_PRETTY_PRINT)) . "\n\n"; $tableMetadata = AttributesTable::GetMetadata('newsAttributes'); EasyCsv::IterateRows_Assoc($csv, function ($row) use($tableMetadata, $iconMap) { $iconKey = trim($row['0']); $iconKey = str_replace(' ', ' ', $iconKey); $marker = MapController::GetFeatureWithName($row['Name']); if ($marker) { if (key_exists($iconKey, $iconMap)) { if ($marker->getIcon() != $iconMap[$iconKey]) { $marker->setIcon($iconMap[$iconKey]); // MapController::StoreMapFeature($marker); } } else { echo '<br/>missing key for: ' . $iconKey . ' | ' . $row['Name'] . '<br/></br/>'; } } else { echo '<br/>missing marker for: ' . $row["Name"] . '<br/></br/>'; } }); ?>
/** * @covers Application\Controller\MapController::setEntityManager */ public function testSetEntityManager() { $value = 'entityManager'; $this->assertSame($this->object, $this->object->setEntityManager($value)); }
// The user is logged in return View::make('editor'); } else { return View::make('landing'); } }); // Routes that only respond to logged-in requests Route::group(array('prefix' => 'api', 'before' => 'auth.api'), function () { Route::any('maps', function () { $output = array(); $output['maps'] = Auth::user()->viewableMaps()->toArray(); return Response::json($output); }); Route::controller('map/{mapid}', 'MapController'); Route::post('map/create', function () { $map_id = MapController::create(); return Response::json(array('id' => $map_id)); }); }); Route::get('logout', function () { Auth::logout(); return Redirect::to('/')->with('loggedout', true); }); /** * Facebook */ Route::get('login/fb', function () { // Sometimes the user comes from #mapid-X and want to end up there later if (Input::has('loadmap')) { $mapToGoBackTo = intval(Input::get('loadmap')); Session::put('loadmap', $mapToGoBackTo);
<!DOCTYPE html> <html> <head> <title>MapController Tests</title> </head> <body> <h1>MapController Tests</h1> <h3>Should call MapController::run()</h3> <hr/> <?php include_once "../includer.php"; MapController::run(); ?> </body> </html>
<?php // decide whether to archive or unarchive if (!empty($eventArgs)) { Core::LoadPlugin('Attributes'); Core::LoadPlugin('Maps'); $marker = MapController::LoadMapItem($eventArgs->mapitem); $tableMetadata = AttributesTable::GetMetadata('markerAttributes'); $values = AttributesRecord::GetFields($marker->getId(), $marker->getType(), 'sessionDate', $tableMetadata); $sessionDate = $values['sessionDate']; $date = strtotime($sessionDate); $limit = time() - 30 * 24 * 3600; // Unarchive items without data, or within date range if (empty($sessionDate) || $date > $limit) { file_put_contents(__DIR__ . DS . '.custom.log', 'detect revive (' . $marker->getId() . ': ' . $sessionDate . ')' . "\n\n", FILE_APPEND); Core::Emit('custom.revive', $eventArgs); } else { file_put_contents(__DIR__ . DS . '.custom.log', 'detect expire (' . $marker->getId() . ': ' . $sessionDate . ')' . "\n\n", FILE_APPEND); Core::Emit('custom.expire', $eventArgs); } }
public static function VisibleLayers($accessGroups = null) { if (is_null($accessGroups)) { $accessGroups = Core::Client()->getAccessGroups(); } if (is_null(self::$visibleLayers)) { $readAccessFilter = array('readAccess' => array('comparator' => 'IN', 'value' => '(\'' . implode('\', \'', $accessGroups) . '\')', 'qoutes' => false)); $layers = MapController::GetAllLayers($readAccessFilter); self::$visibleLayers = $layers; } return self::$visibleLayers; }
/** * Test controller when type is invalid */ public function testControlInvalidType() { $builder = $this->testInstantiateFixtureBuilder(); $this->simulateLogin('*****@*****.**'); $_GET["pid"] = '1001'; $_GET["t"] = 'notavalidtype'; $controller = new MapController(true); $results = $controller->go(); $this->assertTrue(strpos($results, "No visualization data found for this post") > 0, "no post"); }
/** * Test controller when type is invalid */ public function testInvalidType() { $builder = $this->buildData(); $this->simulateLogin('*****@*****.**'); $_GET["pid"] = '1001'; $_GET["t"] = 'notavalidtype'; $controller = new MapController(true); $results = $controller->go(); $this->assertPattern("/No visualization data found for this post/", $results); }
$ShowExisting = false; ?> <pre><?php foreach ($layers as $layer) { /* @var $layer Layer */ print_r(array($layer->getId(), $layer->getName())); } $layerMap = array('community paper' => 1, 'daily paper - free' => 1, 'daily paper - paid' => 1, 'online' => 4, 'TV - private' => 3, 'TV - public' => 3, 'radio - public' => 2, 'radio - private' => 2); if (!EasyCsv::DistinctValues($csv, 'Name')) { die('Expected \'Name\' field to contain unique values'); } EasyCsv::IterateRows_Assoc($csv, function ($row) use($layerMap, $ShowNew, $ShowExisting) { //$typeOfNews=$row['Type of news']; $typeOfNews = trim(array_shift(explode(':', $row['0']))); if (key_exists($typeOfNews, $layerMap)) { if (MapController::GetFeatureWithName($row['Name'])) { if ($ShowSkipped) { echo 'Existing Marker: ' . $row['Name'] . "\n"; } return; // skip. } else { } $marker = new Marker(); $marker->setCoordinates($row['LAT_Y'], $row['LONG_X'])->setName($row['Name'])->setDescription($row['What happened?'])->setLayerId($layerMap[$typeOfNews]); if ($ShowNew) { echo 'New Marker: ' . print_r(json_encode($marker->getMetadata(), JSON_PRETTY_PRINT)) . "\n"; } // MapController::StoreMapFeature($marker); } else { die('Unknown value in \'Type of News\': ' . $typeOfNews);
###(SECTION) Redirect switch ($control) { case "sign-up": SignUpController::run(null); break; case "log-in": LogInController::run(null); break; case "dashboard": DashboardController::run(null); break; case "profile": ProfileController::run(null); break; case "edit-profile": EditProfileController::run(null); break; case "build-map": MapController::run(null); break; case "log-out": LogOutController::run(null); break; default: if (array_key_exists("session", $_COOKIE)) { DashboardController::run(null); } else { LandingView::show(null); } } ###(ENDSECTION) Redirect