/**
  * @brief Create a basic Location Based POI (Textual representation with default design)
  * @param String $id Id of the AREL Object
  * @param String $title Title of the AREL Object to be displayed in the popup (if added) as well as list and map
  * @param Array $location An array given all location parameters (latitude, longitude and altitude)
  * @param String $thumbnail provides an thumbnail to be displayed in the liveview and on the list
  * @param String $icon provides an icon how the model will be displayed on a map (optional)
  * @param String $description The description to be written in the pop up or the additional information
  * @param Array $buttons An array defining buttons to be shown in the pop up / detail display 
  */
 public static function createLocationBasedPOI($id, $title, $location, $thumbnail, $icon, $description, $buttons = array())
 {
     $obj = new ArelObjectPoi($id);
     $obj->setTitle($title);
     $obj->setLocation($location);
     $obj->setThumbnail($thumbnail);
     $obj->setIcon($icon);
     if (!empty($description) || !empty($buttons)) {
         $popup = new ArelPopup();
         $popup->setDescription($description);
         $popup->setButtons($buttons);
         $obj->setPopup($popup);
     }
     return $obj;
 }
Example #2
0
/**
 * @param $pois SQLite3Result with POIs
 * @return string An AREL XML with all the POIs in SQLite3Result
 */
function build_xml($pois, $lang = "en")
{
    $array_objects = array();
    //Loop through all the results from query and create POI objects
    while ($row = $pois->fetchArray()) {
        //Create ArelObjectPOI using AREL Library.
        $obj = new ArelObjectPoi($row['id']);
        //Set properties of the POI object
        $obj->setTitle($row['title']);
        $obj->setLocation(array($row['latitude'], $row['longitude'], 0));
        $obj->setThumbnail($row['thumbnailURL']);
        $obj->setIcon($row['iconURL']);
        //Create localized buttons. The localized string are in "jsonTranslator.php" file.
        $array_buttons = array();
        if ($row['phoneNumber'] != "") {
            array_push($array_buttons, array('BTN_CALL', 'Call', 'tel:' . $row['phoneNumber']));
        }
        if ($row['homepage'] != "") {
            array_push($array_buttons, array('BTN_OPEN_WEB', 'Web Page', $row['homepage']));
        }
        if ($row['imageURL'] != '') {
            array_push($array_buttons, array('BTN_VIEW_IMAGE', 'Image', $row['imageURL']));
        }
        if ($row['videoURL'] != '') {
            array_push($array_buttons, array('BTN_PLAY_VIDEO', 'Video', $row['videoURL']));
        }
        if ($row['soundURL'] != '') {
            array_push($array_buttons, array('BTN_PLAY_AUDIO', 'Sound', $row['soundURL']));
        }
        array_push($array_buttons, array('BTN_ROUTE', 'Sound', 'route:daddr=' . $row['latitude'] . ',' . $row['longitude']));
        //Setting up POI object popup properties
        $popup = new ArelPopup();
        $popup->setDescription($row['description']);
        $popup->setButtons($array_buttons);
        $obj->setPopup($popup);
        array_push($array_objects, $obj);
    }
    $log_file = fopen("logFile.log", "a");
    //Write to file how many POIs have been retrieved
    if ($log_file) {
        fwrite($log_file, "Total POIs retrieved from sqlite database: " . count($array_objects) . ".\n");
        fclose($log_file);
    }
    //call function to create XML response using AREL Library
    createLocationBasedAREL($array_objects, $lang);
}