예제 #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;
 }
예제 #2
0
 public function __construct($location = array(), $params = null)
 {
     //$this->setHeight('200px');
     $this->setZoom(9);
     $this->setMapOptions(array('disableDefaultUI' => "false", 'draggable' => "false", 'mapTypeControl' => "false", 'overviewMapControl' => "false", 'panControl' => "false", 'rotateControl' => "false", 'scaleControl' => "false", 'scrollwheel' => "false", 'streetViewControl' => "false", 'zoomControl' => "false"));
     if (!empty($location)) {
         //$this->setCenter($location['latitude'], $location['longitude']);
         $this->setBounds($location['southWestLat'], $location['southWestLng'], $location['northEastLat'], $location['northEastLng']);
         $this->addPoint($location, $location['address']);
     }
     parent::__construct($params);
     $this->setTemplate(OW::getPluginManager()->getPlugin('googlelocation')->getCmpViewDir() . 'map.html');
 }
예제 #3
0
 protected function getMap(BASE_CLASS_WidgetParameter $params)
 {
     $lat = isset($params->customParamList['map_center_lat']) ? (double) $params->customParamList['map_center_lat'] : 30;
     $lng = isset($params->customParamList['map_center_lng']) ? (double) $params->customParamList['map_center_lng'] : 10;
     $zoom = isset($params->customParamList['map_zoom']) ? (int) $params->customParamList['map_zoom'] : 2;
     $height = isset($params->customParamList['map_height']) ? (int) $params->customParamList['map_height'] : 350;
     $map = new GOOGLELOCATION_CMP_Map();
     $map->setHeight($height . 'px');
     $map->setZoom($zoom);
     $map->setCenter($lat, $lng);
     $map->setMapOption('scrollwheel', 'false');
     return $map;
 }
예제 #4
0
 function addEventMapOnViewPage(BASE_CLASS_EventCollector $e)
 {
     $uriParams = OW::getRequest()->getUriParams();
     if (!empty($uriParams['eventId'])) {
         $location = GOOGLELOCATION_BOL_LocationService::getInstance()->findByEntityIdAndEntityType((int) $uriParams['eventId'], 'event');
         if (!empty($location) && $location instanceof GOOGLELOCATION_BOL_Location) {
             $value = array('address' => $location->address, 'lat' => $location->lat, 'lng' => $location->lng, 'northEastLat' => $location->northEastLat, 'northEastLng' => $location->northEastLng, 'southWestLat' => $location->southWestLat, 'southWestLng' => $location->southWestLng, 'json' => $location->json);
             $map = new GOOGLELOCATION_CMP_Map();
             $map->setHeight('180px');
             $map->setZoom(9);
             $map->setMapOptions(array('disableDefaultUI' => "false", 'draggable' => "true", 'mapTypeControl' => "false", 'overviewMapControl' => "false", 'panControl' => "false", 'rotateControl' => "true", 'scaleControl' => "false", 'scrollwheel' => "true", 'streetViewControl' => "false", 'zoomControl' => "true"));
             $map->setCenter($value['lat'], $value['lng']);
             $map->setBounds($value['southWestLat'], $value['southWestLng'], $value['northEastLat'], $value['northEastLng']);
             $map->addPoint($value, $value['address']);
             $map->setBox('Location', 'ow_ic_bookmark', 'ow_std_margin clearfix');
             $mapHtml = $map->render();
             $e->add($mapHtml);
         }
     }
 }
예제 #5
0
 public function getUserListMapCmp($userIdList, $backUri = null)
 {
     $map = new GOOGLELOCATION_CMP_Map();
     $map->setHeight('600px');
     $map->setZoom(2);
     $map->setCenter(30, 10);
     $map->setMapOption('scrollwheel', 'true');
     $locationObjectList = array();
     $hash = null;
     if (!empty($userIdList) && is_array($userIdList)) {
         $locationObjectList = $this->findByUserIdList($userIdList);
     } else {
         if (strtolower($userIdList) == 'all') {
             $locationObjectList = $this->getAllLocationsForEntityType(GOOGLELOCATION_BOL_LocationDao::ENTITY_TYPE_USER);
         }
     }
     $userList = array();
     $userLocationList = array();
     $locationList = array();
     foreach ($locationObjectList as $location) {
         if ($location instanceof OW_Entity) {
             $userList[$location->entityId] = $location->entityId;
             $locationList[] = get_object_vars($location);
         }
         if (is_array($location)) {
             $userList[$location['entityId']] = $location['entityId'];
             $locationList[] = $location;
         }
     }
     $dtoList = BOL_UserService::getInstance()->findUserListByIdList($userList);
     $userDtoList = array();
     foreach ($dtoList as $userDto) {
         $userDtoList[$userDto->id] = $userDto;
     }
     $avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($userList, true, true, true, false);
     $userUrlList = BOL_UserService::getInstance()->getUserUrlsForList($userList);
     $displayNameList = BOL_UserService::getInstance()->getDisplayNamesForList($userList);
     $displayedFields = $this->getUserFields($userList);
     $pointList = $this->getInstance()->getPointList($locationList);
     foreach ($pointList as $point) {
         if (!empty($point['entityIdList'])) {
             $content = "";
             if ($point['count'] > 1) {
                 $listCmp = OW::getClassInstance('GOOGLELOCATION_CMP_MapUserList', $point['entityIdList'], $point['location']['lat'], $point['location']['lng'], $backUri);
                 $content .= $listCmp->render();
                 unset($listCmp);
             } else {
                 $userId = current($point['entityIdList']);
                 $content = null;
                 if (!empty($userDtoList[$userId])) {
                     $cmp = OW::getClassInstance('GOOGLELOCATION_CMP_MapItem');
                     $cmp->setAvatar($avatarList[$userId]);
                     $content = "<a href='{$userUrlList[$userId]}'>" . $displayNameList[$userId] . "</a>\n                            <div>{$displayedFields[$userId]}</div>\n                            <div>{$point['location']['address']}</div>";
                     $cmp->setContent($content);
                     $content = $cmp->render();
                 }
             }
             if (!empty($content)) {
                 $map->addPoint($point['location'], '', $content);
             }
         }
     }
     return $map;
 }