diff --git a/BaseGeocode.php b/BaseGeocode.php deleted file mode 100755 index c667907..0000000 --- a/BaseGeocode.php +++ /dev/null @@ -1,227 +0,0 @@ -setEarthRadius( 3963.1676 ); - $this->setKey( $key ); - } - - /** - * Modifier for the earth mean radius - * - * @param float $rad The new radius of the earth to use. - * @access public - */ - public function setEarthRadius( $rad ) { - $this->earthRadius = $rad; - } - - /** - * Modifier for the API key - * - * @param string $key The geocoding service API key to use. - * @access public - */ - public function setKey( $key ) { - $this->apiKey = $key; - } - - /** - * Load XML from an address - * - * @param string $address The address representing the XML source - * @access protected - */ - protected function loadXML( $address ) { - $retVal = array(); - $contents = file_get_contents( $address ); - - if( !empty( $http_response_header ) ) { - $code = $http_response_header[0]; - $matches = array(); - preg_match('/^HTTP\/\d+\.\d+\s+(\d+)\s+[\w\s]+$/',$code, $matches); - - $retVal['response'] = $matches[1]; - $retVal['contents'] = $contents; - } - - return $retVal; - } - - /** - * Abstract function which will accept a string address - * and return an array of geocoded information for the given address. - * - * Return types for this function are mixed based on HTTP Response Codes: - * Server not found: array() - * - * 404: array( 'Response' => array( - * 'Status' => 404, - * 'Request' => the subclass specific request - * ) - * ); - * - * 200: The returned geocode information will be presented in the following format - * While the example below only contains a single result, multiple results for a single - * geocode request are possible and should be supported by subclasses - * - * array( 'Response' => array( - * 'Status' => ... - * 'Request' => ... - * ), - * 'Placemarks' => array( - * array( - * 'Accuracy' => ..., - * 'Country' => ..., - * 'AdministrativeArea' => ..., - * 'SubAdministrativeArea => ..., - * 'Locality' => ..., - * 'Thoroughfare' => ..., - * 'PostalCode' => ..., - * 'Latitude' => ..., - * 'Longitude' => ... - * ), - * array( - * 'Accuracy' => ..., - * 'Country' => ..., - * . - * . - * . - * ) - * ) - * ) - * - * @param string $address A string representing the address the user wants decoded. - * @return array This function returns an array of geocoded location information for the given address. - * @access public - */ - abstract public function geocode( $address ); - - /** - * Find the distance between the two latitude and longitude coordinates - * Where the latitude and longitude coordinates are in decimal degrees format. - * - * This function uses the haversine formula as published in the article - * "Virtues of the Haversine", Sky and Telescope, vol. 68 no. 2, 1984, p. 159 - * - * References: - * http://en.wikipedia.org/w/index.php?title=Haversine_formula&oldid=176737064 - * http://www.movable-type.co.uk/scripts/gis-faq-5.1.html - * - * @param float $lat1 The first coordinate's latitude - * @param float $ong1 The first coordinate's longitude - * @param float $lat2 The second coordinate's latitude - * @param float $long2 The second coordinate's longitude - * @return float The distance between the two points in the same unit as the earth radius as set by setEarthRadius() (default miles). - * @access public - */ - public function haversinDistance( $lat1, $long1, $lat2, $long2 ) - { - $lat1 = deg2rad( $lat1 ); - $lat2 = deg2rad( $lat2 ); - $long1 = deg2rad( $long1); - $long2 = deg2rad( $long2); - - $dlong = $long2 - $long1; - $dlat = $lat2 - $lat1; - - $sinlat = sin( $dlat/2 ); - $sinlong = sin( $dlong/2 ); - - $a = ($sinlat * $sinlat) + cos( $lat1 ) * cos( $lat2 ) * ($sinlong * $sinlong); - $c = 2 * asin( min( 1, sqrt( $a ) )); - - return $this->earthRadius * $c; - } - - /** - * Find the distance between two latitude and longitude points using the - * spherical law of cosines. - * - * @param float $lat1 The first coordinate's latitude - * @param float $ong1 The first coordinate's longitude - * @param float $lat2 The second coordinate's latitude - * @param float $long2 The second coordinate's longitude - * @return float The distance between the two points in the same unit as the earth radius as set by setEarthRadius() (default miles). - * @access public - */ - public function sphericalLawOfCosinesDistance( $lat1, $long1, $lat2, $long2 ) - { - $lat1 = deg2rad( $lat1 ); - $lat2 = deg2rad( $lat2 ); - $long1 = deg2rad( $long1); - $long2 = deg2rad( $long2); - - return $this->earthRadius * acos( - sin( $lat1 ) * sin( $lat2 ) + - cos( $lat1 ) * cos( $lat2 ) * cos( $long2 - $long1 ) - ); - } - - /** - * Find the distance between two latitude and longitude coordinates - * Where the latitude and the longitude coordinates are in decimal degrees format. - * - * @param float $lat1 The first coordinate's latitude - * @param float $ong1 The first coordinate's longitude - * @param float $lat2 The second coordinate's latitude - * @param float $long2 The second coordinate's longitude - * @return float The distance between the two points in the same unit as the earth radius as set by setEarthRadius() (default miles). - * @access public - */ - public function distanceBetween( $lat1, $long1, $lat2, $long2 ) - { - return $this->haversinDistance( $lat1, $long1, $lat2, $long2 ); - } -} - -?> diff --git a/GoogleGeocode.php b/GoogleGeocode.php deleted file mode 100755 index 8d5084e..0000000 --- a/GoogleGeocode.php +++ /dev/null @@ -1,216 +0,0 @@ -apiKey; - - $nsKml = 'http://earth.google.com/kml/2.0'; - $nsUrn = 'urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'; - - $file = $this->loadXML( $url ); - - if( empty( $file ) ) { - return $retVal; - } - - $retVal['Response'] = array( - 'Status' => (int)$file['response'], - 'Request' => 'geo' - ); - - if( $file['response'] == 200 ) { - $xml = new SimpleXMLElement( $file['contents'] ); - - $xml->registerXPathNamespace( 'kml', $nsKml ); - $xml->registerXPathNamespace( 'urn', $nsUrn ); - - //Now that we have the google request, and we succeeded in getting a response - //from the server, lets replace oure response portion with the google response - $retVal['Response']['Status'] = (int)$xml->Response->Status->code; - $retVal['Response']['Request'] = (string)$xml->Response->Status->request; - - $retVal['Placemarks'] = array(); - if( $xml && $retVal['Response']['Status'] == GoogleGeocode::SUCCESS ) - { - $placemarks = $xml->xpath('//kml:Placemark'); - $countries = $xml->xpath('//urn:CountryNameCode'); - $adminAreas = $xml->xpath('//urn:AdministrativeAreaName'); - $subAdminAreas = $xml->xpath('//urn:SubAdministrativeAreaName'); - $localities = $xml->xpath('//urn:LocalityName'); - $thoroughfares = $xml->xpath('//urn:ThoroughfareName'); - $postalCodes = $xml->xpath('//urn:PostalCodeNumber'); - - for( $i = 0; $i < count( $placemarks ); $i++ ) - { - list($longitude, $latitude) = explode( ',' , $placemarks[$i]->Point->coordinates ); - $attributes = $placemarks[$i]->AddressDetails->attributes(); - - $retVal['Placemarks'][$i] = array(); - $retVal['Placemarks'][$i]['Accuracy'] = (int)$attributes['Accuracy']; - $retVal['Placemarks'][$i]['Country'] = (string)$countries[$i]; - - if( count( $adminAreas ) > $i ) { - $retVal['Placemarks'][$i]['AdministrativeArea'] = (string)$adminAreas[$i]; - } - - if( count( $subAdminAreas ) > $i ) { - $retVal['Placemarks'][$i]['SubAdministrativeArea'] = (string)$subAdminAreas[$i]; - } - - if( count( $localities ) > $i ) { - $retVal['Placemarks'][$i]['Locality'] = (string)$localities[$i]; - } - - if( count( $thoroughfares ) > $i ) { - $retVal['Placemarks'][$i]['Thoroughfare'] = (string)$thoroughfares[$i]; - } - - if( count( $postalCodes ) > $i ) { - $retVal['Placemarks'][$i]['PostalCode'] = (int)$postalCodes[$i]; - } - - $retVal['Placemarks'][$i]['Latitude']= (double)$latitude; - $retVal['Placemarks'][$i]['Longitude'] = (double)$longitude; - } - } - } - return $retVal; - } -} - -?> diff --git a/TODO.md b/TODO.md index 427fc69..019c4cb 100644 --- a/TODO.md +++ b/TODO.md @@ -5,7 +5,6 @@ ## Event Page -+ Clean code + Modify map + connect function @@ -15,13 +14,14 @@ ## Index Page -+ Add event + ENT + Sync with others calendars -## BDD +## Add Event -+ Event: add image, contact, site ++ Add categories ++ php ++ When the event is added, go to the index page ## V1 diff --git a/YahooGeocode.php b/YahooGeocode.php deleted file mode 100755 index 6f42015..0000000 --- a/YahooGeocode.php +++ /dev/null @@ -1,168 +0,0 @@ -apiKey; - - $file = $this->loadXML( $request ); - - if( empty( $file ) ) { - return $retVal; - } - - $retVal['Response'] = array( - 'Status' => $file['response'], - 'Request' => 'geocode' - ); - - if( $retVal['Response']['Status'] == YahooGeocode::SUCCESS ) { - $xml = new SimpleXMLElement( $file['contents'] ); - - $xml->registerXPathNamespace('urn','urn:yahoo:maps'); - - $retVal['Placemarks'] = array(); - if( $xml ) { - $results = $xml->xpath('//urn:Result'); - $countries = $xml->xpath('//urn:Country'); - $adminAreas = $xml->xpath('//urn:State'); - //Yahoo Geocoding has no Sub-Administrative Area (County) support. - $localities = $xml->xpath('//urn:City'); - $thoroughfares = $xml->xpath('//urn:Address'); - $postalCodes = $xml->xpath('//urn:Zip'); - $latitudes = $xml->xpath('//urn:Latitude'); - $longitudes = $xml->xpath('//urn:Longitude'); - - if( $results ) { - for( $i = 0; $i < count( $results ); $i++ ) { - $attributes = $results[$i]->attributes(); - - $retVal['Placemarks'][$i]['Accuracy'] = (string)$attributes['precision']; - $retVal['Placemarks'][$i]['Country'] = (string)$countries[$i]; - - if( count($adminAreas) > $i && !empty($adminAreas[$i]) ) { - $retVal['Placemarks'][$i]['AdministrativeArea'] = (string) $adminAreas[$i]; - } - - if( count($localities) > $i && !empty($localities[$i]) ) { - $retVal['Placemarks'][$i]['Locality'] = (string) $localities[$i]; - } - - if( count($thoroughfares) > $i && !empty($thoroughfares[$i]) ) { - $retVal['Placemarks'][$i]['Thoroughfare'] = (string) $thoroughfares[$i]; - } - - if( count($postalCodes) > $i && !empty($postalCodes[$i]) ) { - $postalCode = explode( '-', $postalCodes[$i] ); - $retVal['Placemarks'][$i]['PostalCode'] = (int) $postalCode[0]; - } - - $retVal['Placemarks'][$i]['Latitude'] = (double)$latitudes[$i]; - $retVal['Placemarks'][$i]['Longitude'] = (double)$longitudes[$i]; - - } - } - } - } - return $retVal; - } -} - -?> diff --git a/addEvent.css b/addEvent.css new file mode 100644 index 0000000..4442db2 --- /dev/null +++ b/addEvent.css @@ -0,0 +1,47 @@ + +#eventForm { + margin-top: 30px; + border: 1px solid #5B5B5B; + padding: 20px; + padding-left: 20%; + padding-top:40px; + -moz-border-radius: 10px; +-webkit-border-radius: 10px; +border-radius: 10px; /* future proofing */ +-khtml-border-radius: 10px; /* for old Konqueror browsers */ +} + +#buttonDiv { + width:80%; + text-align: center; +} + +#submit { + margin-top:30px; + margin-left:auto; + margin-right:auto; + height: 60px; + padding: 0; + padding-left: 20px; + padding-right: 20px; + font-size: 22px; + color:white; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); + background: #454545; + border: 0; + border-bottom: 2px solid #2f2e2e; + cursor: pointer; + -webkit-box-shadow: inset 0 -2px #2f2e2e; + box-shadow: inset 0 -2px #2f2e2e; +} + +#left { + width: 40%; + font-size: 17px; + font-weight: bold; +} + +textarea, input { + width: 80%; +} diff --git a/addEvent.php b/addEvent.php index db38a91..3de851d 100644 --- a/addEvent.php +++ b/addEvent.php @@ -9,6 +9,7 @@ + @@ -20,14 +21,14 @@

Ajouter un Évènement

-
- Titre de l'évènement :
+ +
Titre :

- Adresse du lieu :
+
Adresse :

- Date de début :
+
Date de début :
@@ -35,7 +36,7 @@

- Date de fin :
+
Date de fin :
@@ -43,20 +44,21 @@

- Description de l'évènement :
+
Description de l'évènement :

- Site de l'évènement :
+
Site de l'évènement :

- Image de l'évènement :
+
Image de l'évènement :

- Contact :
+
Contact :
+
+
-