예제 #1
0
            $incident = new Incident();
            $incident->description = $row['Incident description'];
            $incident->date = $row['Incident date'];
            $incident->created_at = $row['Timestamp'];
            $incident->city = $row['Incident city'];
            $incident->country = $row['Incident country'];
            $incident->type = $row['Type of Incident'];
            $incident->link = $row['LINK TO ARTICLE OR SOURCE OF INFORMATION'];
            $incident->victimCountry = $row['Victim\'s country of origin'];
            $incident->victimGender = $row['Victim\'s gender'];
            $incident->reporterType = $row['Who is reporting?'];
            $incident->reporterContact = $row['Your contact information (Optional)'];
            //get geocode
            $geocode = new Geocode($incident->address());
            $incident->lat = $geocode->getLatitude();
            $incident->long = $geocode->getLongitude();
            $incidents[] = $incident;
            //dump($incident);
        }
        return $incidents;
    });
    // dd($categoriesCount);
    return $incidents;
});
// $categoriesCount = [];
// $categoriesCount[0] = 0; //    Others
// $categoriesCount[1] = 0; //    Verbal Harrassment
// $categoriesCount[2] = 0; //    Physical Harrassment
// $categoriesCount[3] = 0; //    Destruction of property
// $categoriesCount[4] = 0; //    Physical attack on the victim
// $categoriesCount[5] = 0; //    Exclusion
 public function geocode_address()
 {
     require_once WTD_PLUGIN_PATH . '/includes/libs/GeoCoder.php';
     $address = $_POST['address'];
     $geocode = new Geocode($address);
     die(json_encode(array('lat' => $geocode->getLatitude(), 'lng' => $geocode->getLongitude())));
 }