コード例 #1
0
ファイル: Map.php プロジェクト: stoo2000/membermap
 /**
  * Do formatation to the array of markers
  * 
  * @param 		array 	Markers
  * @return		array	Markers
  */
 public function formatMemberMarkers(array $markers)
 {
     $markersToKeep = array();
     $groupCache = \IPS\Data\Store::i()->groups;
     if (is_array($markers) and count($markers)) {
         foreach ($markers as $marker) {
             /* Member don't exists or lat/lon == 0 (Middle of the ocean) */
             if ($marker['member_id'] === NULL or $marker['marker_lat'] == 0 and $marker['marker_lon'] == 0) {
                 \IPS\Db::i()->delete('membermap_markers', array('marker_id=?', $marker['marker_id']));
                 continue;
             }
             $photo = \IPS\Member::photoUrl($marker);
             try {
                 $groupName = \IPS\Lang::load(\IPS\Lang::defaultLanguage())->get('core_group_' . $marker['member_group_id']);
             } catch (\UnderflowException $e) {
                 $groupName = '';
             }
             if (isset($groupCache[$marker['member_group_id']]['g_membermap_markerColour'])) {
                 $markerColour = $groupCache[$marker['member_group_id']]['g_membermap_markerColour'];
             } else {
                 $markerColour = 'darkblue';
             }
             $markersToKeep[] = array('type' => "member", 'lat' => round((double) $marker['marker_lat'], 5), 'lon' => round((double) $marker['marker_lon'], 5), 'member_id' => $marker['marker_member_id'], 'parent_id' => $marker['member_group_id'], 'parent_name' => $groupName, 'popup' => \IPS\Theme::i()->getTemplate('map', 'membermap', 'front')->popupContent($marker, $photo), 'markerColour' => $markerColour);
         }
     }
     return $markersToKeep;
 }