Example #1
0
 private function getEventMapCmp($backUri = null)
 {
     if (!OW::getPluginManager()->isPluginActive('event')) {
         throw new Redirect404Exception();
     }
     $map = new GOOGLELOCATION_CMP_Map();
     $map->setHeight('600px');
     $map->setZoom(2);
     $map->setCenter(30, 10);
     $map->setMapOption('scrollwheel', 'false');
     $locationList = GOOGLELOCATION_BOL_LocationService::getInstance()->getAllLocationsForEntityType('event');
     $entityIdList = array();
     $entityLocationList = array();
     foreach ($locationList as $location) {
         $entityIdList[$location['entityId']] = $location['entityId'];
         $entityLocationList[$location['entityId']] = $location;
     }
     $locationList = $entityLocationList;
     $eventsList = EVENT_BOL_EventService::getInstance()->findPublicEvents(null, 1000);
     $publicEventsId = array();
     $tmpEventList = array();
     foreach ($eventsList as $event) {
         $publicEventsId[$event->id] = $event->id;
         $tmpEventList[$event->id] = $event;
     }
     $eventsList = $tmpEventList;
     $entityIdList = array_intersect($entityIdList, $publicEventsId);
     $publicLocationList = array();
     $publicEventList = array();
     foreach ($entityIdList as $entityId) {
         $publicLocationList[$entityId] = $locationList[$entityId];
         $publicEventList[$entityId] = $eventsList[$entityId];
     }
     $events = EVENT_BOL_EventService::getInstance()->getListingDataWithToolbar($publicEventList);
     $pointList = GOOGLELOCATION_BOL_LocationService::getInstance()->getPointList($publicLocationList);
     foreach ($pointList as $point) {
         if (!empty($point['entityIdList'])) {
             $content = "";
             if ($point['count'] > 1) {
                 $listCmp = new GOOGLELOCATION_CMP_MapEventList($point['entityIdList'], $point['location']['lat'], $point['location']['lng'], $backUri);
                 $content .= $listCmp->render();
                 unset($listCmp);
             } else {
                 $eventId = current($point['entityIdList']);
                 if (!empty($events[$eventId])) {
                     $cmp = new GOOGLELOCATION_CMP_MapItem();
                     $cmp->setAvatar(array('src' => $events[$eventId]['imageSrc']));
                     $content = "<a href='{$events[$eventId]['eventUrl']}'>" . $events[$eventId]['title'] . "</a>\n                            <div>{$events[$eventId]['content']}</div>\n                            <div>{$publicLocationList[$eventId]['address']}</div> ";
                     $cmp->setContent($content);
                     $content = $cmp->render();
                 }
             }
             if (!empty($content)) {
                 $map->addPoint($point['location'], '', $content);
             }
         }
     }
     return $map;
 }
Example #2
0
 protected function renderMap()
 {
     $locationList = $this->locationList;
     $userIdList = array();
     $userLocationList = array();
     foreach ($locationList as $location) {
         $userIdList[$location->entityId] = $location->entityId;
         $userLocationList[$location->entityId] = $location;
     }
     unset($locationList);
     $avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIdList, true, true, true, false);
     $userUrlList = BOL_UserService::getInstance()->getUserUrlsForList($userIdList);
     $displayNameList = BOL_UserService::getInstance()->getDisplayNamesForList($userIdList);
     $displayedFields = $this->getUserFields($userIdList);
     foreach ($userLocationList as $userId => $location) {
         $cmp = new GOOGLELOCATION_CMP_MapItem();
         $cmp->setAvatar($avatarList[$userId]);
         $content = "<a href='{$userUrlList[$userId]}'>" . $displayNameList[$userId] . "</a>\n                        <div>{$displayedFields[$userId]}</div>\n                        <div>{$location->address}</div>";
         $cmp->setContent($content);
         $this->map->addPoint($location->lat, $location->lng, '', $cmp->render());
     }
     $this->addComponent("map", $this->map);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate(OW::getPluginManager()->getPlugin('googlelocation')->getMobileCmpViewDir() . 'map_item.html');
 }