Ejemplo n.º 1
0
 * This page will be visited by the user when he clicks on the
 * shared link and the user has no app installed in his device.
 *
 * In such case this page must handle the shared link of the
 * user's shared poi and thus display the brief information about the poi.
 *
 * If the poi is user created then we will only display the shared name of that poi.
 *
 * This page will also message the user to download our app from the play store and will
 * provide a option to display the location in the map.
 *
 * If the user chooses to view it in the map we will simply display the poi in the map.
 *
 */
if (array_key_exists('p', $_GET) && array_key_exists('lat', $_GET) && array_key_exists('long', $_GET)) {
    $poi = new POI();
    /* these request data eed to be properly verified before we process with any data*/
    $p = decodeInput($_REQUEST['p']);
    $pSplit = explode("_", $p);
    if (count($pSplit) != 2) {
        redirectIndex();
    } else {
        $prefix = strtolower($pSplit[0]);
        $postfix = $pSplit[1];
        if ($prefix == "u" || $prefix == "p") {
            if ($prefix == "u") {
                if (array_key_exists('n', $_GET)) {
                    $name = decodeInput($_REQUEST['n']);
                    //it is a user created location
                    $lat = decodeInput($_REQUEST['lat']);
                    $long = decodeInput($_REQUEST['long']);
Ejemplo n.º 2
0
     $name = $row[0];
     $name = str_replace("'", "''", $name);
     $address = $row[1];
     $contacts = relinquishContacts($row[2]);
     $phone = $contacts[0];
     $email = $contacts[1];
     $website = $contacts[2];
     $categoryLabel = $row[3];
     $position = $row[4];
     //create the category for the poi
     $category = new Category();
     $category->init($parentController->getParentCategory($categoryLabel), $categoryLabel, $user);
     if ($id = $categoryController->add($category)) {
         $category->setId($id);
         //create the poi object
         $poi = new POI();
         $poi->init($name, $address, $position, $category, $phone, $email, $website, "", $user);
         if ($poiController->add($poi)) {
             $insertCount++;
         } else {
             $skippedData[] = $line . "\n";
         }
     } else {
         $skippedData[] = $line . "\n";
     }
 } else {
     /* skip this data as it contains invalid number of data*/
     $skippedData[] = $line . "\n";
 }
 //need to execute javascript here to increment the progress bar and update the progress text
 send_message($insertCount, $insertCount, $insertCount);
Ejemplo n.º 3
0
$userId = $_SESSION['userId'];
if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') {
    /* get all the post data from */
    $poiName = decodeInput($_POST['poiName']);
    $poiAddress = decodeInput($_POST['poiAddress']);
    $poiCategory = decodeInput($_POST['poiCategory']);
    $poiPhone = decodeInput($_POST['poiPhone']);
    $poiEmail = decodeInput($_POST['poiEmail']);
    $poiWebsite = decodeInput($_POST['poiWebsite']);
    $poiLatitude = decodeInput($_POST['poiLat']);
    $poiLongitude = decodeInput($_POST['poiLong']);
    $poiPosition = $poiLatitude . "," . $poiLongitude;
    $poiContribution = decodeInput($_POST['poiContribution']);
    $userController = new UsersController();
    $poiController = new PoiController();
    $categoryController = new CategoryController();
    $contributionController = new ContributionController();
    /* since we are letting the validation of the data on the client side, we will
       skip the validation here and just go on with insertion */
    /* so first create the poi object, also the required objects to initialize the poi */
    $poi = new POI();
    $poi->init($poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", $userController->find($user->getId()));
    if ($poiContribution != 0) {
        if (is_numeric($poiContribution)) {
            if ($contribution = $contributionController->find($poiContribution)) {
                $poi->setContribution($contribution);
            }
        }
    }
    $poiController->add($poi);
}
Ejemplo n.º 4
0
 * Created by Yogesh on 11/20/2015.
 * 
 */
include_once "../model/PoiController.php";
include_once "../model/UsersController.php";
include_once "../model/objects/User.php";
include_once "../model/objects/POI.php";
include_once "../model/objects/Contribution.php";
include_once "../model/objects/Category.php";
include_once "../model/objects/ParentCategory.php";
include_once "../model/CategoryController.php";
include_once "../model/ContributionController.php";
header("Content-Type: text/plain");
$cont = new ContributionController();
$data = $cont->getAll();
print_r($data);
exit;
$dataArray = array("Pokhara||Gandaki Zone, Kaski District, Nepal||http://en.wikipedia.org/wiki/Pokhara||city||28.2095379,83.9914028", "Hyatt Regency||Nepal||null||bus station||27.7193693,85.3541166", "Ason||Nepal||null||neighbourhood||27.7075079,85.3122521", "Lainchour Chowk Bus Stop||Nepal||null||bus station||27.7169967,85.316039", "Airport Bus Station||Nepal||null||bus station||27.7007168,85.3537173", "Dillibazaar stop||Nepal||null||bus station||27.7053698,85.3267594");
$currentUser = $userController->find(3);
$poiIdDummy = 56;
foreach ($dataArray as $key => $value) {
    $row = $value;
    $data = explode("||", $row);
    $category = new Category();
    $category->setUser($currentUser);
    $category->setSubCategory($data[3]);
    $poi = new POI();
    $poi->init($poiIdDummy, $data[0], $data[1], $data[4], $category, "", "", "", "", $currentUser);
    $contributionController->add($poi);
    $poiIdDummy++;
}
Ejemplo n.º 5
0
 */
include_once "../model/objects/POI.php";
include_once "../model/CategoryController.php";
include_once "../model/PoiController.php";
include_once "../model/ContributionController.php";
include_once "../model/UsersController.php";
$userId = $_SESSION['userId'];
if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') {
    /* get all the post data from */
    $id = decodeInput($_POST['id']);
    $poiName = decodeInput($_POST['poiName']);
    $poiAddress = decodeInput($_POST['poiAddress']);
    $poiCategory = decodeInput($_POST['poiCategory']);
    $poiPhone = decodeInput($_POST['poiPhone']);
    $poiEmail = decodeInput($_POST['poiEmail']);
    $poiWebsite = decodeInput($_POST['poiWebsite']);
    $poiLatitude = decodeInput($_POST['poiLat']);
    $poiLongitude = decodeInput($_POST['poiLong']);
    $poiPosition = $poiLatitude . "," . $poiLongitude;
    $poiContribution = decodeInput($_POST['poiContribution']);
    $userController = new UsersController();
    $poiController = new PoiController();
    $categoryController = new CategoryController();
    $contributionController = new ContributionController();
    /* since we are letting the validation of the data on the client side, we will
       skip the validation here and just go on with insertion */
    /* so first create the poi object, also the required objects to initialize the poi */
    $poi = new POI();
    $poi->initWithId($id, $poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", "", new Contribution(), $userController->find($user->getId()));
    $poiController->update($poi);
}
Ejemplo n.º 6
0
$x = $_REQUEST["x"];
$y = $_REQUEST["y"];
$format = $_REQUEST["format"];
if ($format == "") {
    $format = "xml";
}
if ($format != "xml") {
    echo "Only XML format is supported right now.";
    die;
}
// instantiate object
$tree = new XML_Tree();
// add the root element
$root =& $tree->addRoot("POICollection");
$root->setAttribute("x", $x);
$root->setAttribute("y", $y);
$root->setAttribute("timestamp", time());
// fetch poi child elements
$terms = array(array("quadrant_x", "=", $x), array("quadrant_y", "=", $y));
$handle = new POI();
$pois = $handle->GetList($terms, '', true, 1000);
foreach ($pois as $poi) {
    $node =& $root->addChild("POI");
    $node->setAttribute("name", $poi->title);
    $node->setAttribute("lat", $poi->lat);
    $node->setAttribute("lon", $poi->lon);
    $node->addChild("description", $poi->description);
    $node->addChild("url", $poi->url);
}
// print tree
$tree->dump();
Ejemplo n.º 7
0
 public function parsePoi($row)
 {
     $parentCat = new ParentCategory();
     $subCat = new Category();
     $poiUser = new User();
     $poiUser->initWithId($row['supUid'], $row['username'], $row['password'], $row['email'], $row['previlege'], $row['status']);
     $parentCatUser = $this->userController->find($row['supUid']);
     $subCatUser = $this->userController->find($row['subUid']);
     $parentCat->initWithId($row['supId'], $row['supCategory'], $parentCatUser, $row['supDate']);
     $subCat->initWithId($row['subId'], $parentCat, $row['subCategory'], $subCatUser, $row['subDate']);
     $contribution = new Contribution();
     $contribution->setId($row['contributionId']);
     $poi = new POI();
     $poi->initWithId($row['pId'], $row['name'], $row['address'], $row['position'], $subCat, $row['phone'], $row['poiEmail'], $row['website'], $row['poiDate'], $row['update_date'], $contribution, $poiUser);
     return $poi;
 }
Ejemplo n.º 8
0
 function attrs()
 {
     $this->load->library('POI');
     $this->load->library('geo/*');
     $this->load->model('POIModel');
     $pois = POIModel::loadAll();
     $con = new MongoClient();
     $db = $con->pocketsail;
     $tbl = $db->poi;
     $tbl->remove([]);
     $tbl->ensureIndex(['id' => 1, 'lat' => 1, 'lng' => 1, 'contact.type' => 1]);
     foreach ($pois as $poi) {
         //            $id = $poi->id();
         //            $url = $poi->url();
         //            $name = $poi->name();
         //            $label = $poi->label();
         //            $nearId = $poi->nearId();
         //            $countryId = $poi->countryId();
         //            $cat = $poi->cat();
         //            $sub = $poi->sub();
         //            $userId = $poi->userId();
         //            $lat = $poi->lat();
         //            $lng = $poi->lng();
         //            $border = $poi->border();
         //            $rank = $poi->rank();
         //            $timestamp = $poi->timestamp();
         $attrs = $poi->attrs();
         $new = [];
         $new['id'] = (int) $poi->id();
         $new['url'] = (string) $poi->url();
         $new['name'] = (string) $poi->name();
         $new['label'] = (string) $poi->label();
         $new['near'] = (string) $poi->nearName();
         $new['country'] = (string) $poi->countryName();
         $new['cat'] = (string) $poi->cat();
         $new['sub'] = (string) $poi->cat();
         $new['lat'] = (double) $poi->lat();
         $new['lng'] = (double) $poi->lng();
         if (gettype($attrs) === 'object') {
             /**
              * Description
              */
             if (isset($attrs->description->details)) {
                 $new["description"] = $attrs->description->details;
             }
             /**
              * Approach
              */
             if (isset($attrs->approach)) {
                 $new['approach']['text'] = $attrs->approach->details;
                 $new['approach']['drying']['value'] = @$attrs->approach->drying->value;
                 $new['approach']['drying']['details'] = @$attrs->approach->drying->details;
             }
             /**
              * Hazards
              */
             if (isset($attrs->hazards->details)) {
                 $new['hazards']['val'] = $attrs->hazards->details;
             }
             /**
              * Exposure
              */
             if (isset($attrs->exposure)) {
                 // Wind
                 $winds = explode(",", @$attrs->exposure->wind);
                 if (count($winds) > 0 && $winds[0] != "") {
                     //                        echo "Specific, yet ";
                     //                        print_r($winds);
                     $new['exposure']['wind']['value'] = 'specific';
                     foreach ($winds as $wind) {
                         $new['exposure']['wind']['dir'][] = trim($wind);
                     }
                 } else {
                     $new['exposure']['wind']['value'] = 'na';
                 }
                 // Swell
                 $swells = explode(",", @$attrs->exposure->swell);
                 if (count($swells) > 0) {
                     $new['exposure']['swell']['value'] = 'specific';
                     foreach ($swells as $swell) {
                         $new['exposure']['swell']['dir'][] = trim($swell);
                     }
                 } else {
                     $new['exposure']['swell']['value'] = 'na';
                 }
             }
             /**
              * Attractions & Nightlife
              */
             if (isset($attrs->attractions->details)) {
                 $new['attractions'] = $attrs->attractions->details;
             }
             /**
              * Nightlife
              */
             if (isset($attrs->nightlife->details)) {
                 $new['nightlife'] = $attrs->nightlife->details;
             }
             /**
              * Contact
              */
             if (isset($attrs->contact->types)) {
                 $new['contact']['type'] = [];
                 $new['contact']['value'] = [];
                 for ($i = 0; $i < count($attrs->contact->types); $i++) {
                     $new['contact']['value'][] = $attrs->contact->values[$i];
                     $new['contact']['type'][] = $attrs->contact->types[$i];
                 }
             }
             /**
              * Facilities
              */
             if (isset($attrs->facilities->water->value)) {
                 $new['facilities']['water']['val'] = $attrs->facilities->water->value;
                 $new['facilities']['water']['details']['val'] = @$attrs->facilities->water->details;
             }
             if (isset($attrs->facilities->electricity->value)) {
                 $new['facilities']['electricity']['val'] = $attrs->facilities->electricity->value;
                 $new['facilities']['electricity']['details']['val'] = @$attrs->facilities->electricity->details;
             }
             if (isset($attrs->facilities->showers->value)) {
                 $new['facilities']['showers']['val'] = $attrs->facilities->showers->value;
                 $new['facilities']['showers']['details']['val'] = @$attrs->facilities->showers->details;
             }
             if (isset($attrs->facilities->toilets->value)) {
                 $new['facilities']['toilets']['val'] = $attrs->facilities->toilets->value;
                 $new['facilities']['toilets']['details']['val'] = @$attrs->facilities->toilets->details;
             }
             if (isset($attrs->facilities->waste->value)) {
                 $new['facilities']['waste']['val'] = $attrs->facilities->waste->value;
                 $new['facilities']['waste']['details']['val'] = @$attrs->facilities->waste->details;
             }
             if (isset($attrs->facilities->reception->value)) {
                 $new['facilities']['reception']['val'] = $attrs->facilities->reception->value;
                 $new['facilities']['reception']['details']['val'] = @$attrs->facilities->reception->details;
             }
             if (isset($attrs->facilities->customs->value)) {
                 $new['facilities']['customs']['val'] = $attrs->facilities->customs->value;
                 $new['facilities']['customs']['details']['val'] = @$attrs->facilities->customs->details;
             }
             if (isset($attrs->facilities->enquiries->value)) {
                 $new['facilities']['enquiries']['val'] = $attrs->facilities->enquiries->value;
                 $new['facilities']['enquiries']['details']['val'] = @$attrs->facilities->enquiries->details;
             }
             if (isset($attrs->facilities->laundry->value)) {
                 $new['facilities']['laundry']['val'] = $attrs->facilities->laundry->value;
                 $new['facilities']['laundry']['details']['val'] = @$attrs->facilities->laundry->details;
             }
             if (isset($attrs->facilities->wifi->value)) {
                 $new['facilities']['wifi']['val'] = $attrs->facilities->wifi->value;
                 $new['facilities']['wifi']['details']['val'] = @$attrs->facilities->wifi->details;
             }
             if (isset($attrs->facilities->disability->value)) {
                 $new['facilities']['disability']['val'] = $attrs->facilities->disability->value;
                 $new['facilities']['disability']['details']['val'] = @$attrs->facilities->disability->details;
             }
             if (isset($attrs->facilities->pets->value)) {
                 $new['facilities']['pets']['val'] = $attrs->facilities->pets->value;
                 $new['facilities']['pets']['details']['val'] = @$attrs->facilities->pets->details;
             }
             /**
              * Sources
              */
             if (isset($attrs->sources->details)) {
                 $sources = explode("\r\n", $attrs->sources->details);
                 foreach ($sources as $source) {
                     $new['sources'][] = trim($source);
                 }
             }
             /**
              * Charts
              */
             if (isset($attrs->charts->details)) {
                 $chartsStr = trim($attrs->charts->details, " .");
                 $charts = explode(",", $chartsStr);
                 foreach ($charts as $chart) {
                     $charts_and = $charts = explode(" and ", $chart);
                     foreach ($charts_and as $chart_and) {
                         $new['charts'][] = trim($chart_and, " .");
                     }
                 }
             }
             /**
              * Anchoring info
              */
             if (isset($attrs->anchoring)) {
                 $new['anchoring']['depth']['from'] = $attrs->anchoring->depth->from;
                 $new['anchoring']['depth']['to'] = $attrs->anchoring->depth->to;
                 $new['anchoring']['holding']['value'] = @$attrs->anchoring->holding->values;
                 $new['anchoring']['holding']['details'] = @$attrs->anchoring->holding->details;
                 $new['anchoring']['cost']['value'] = @$attrs->anchoring->price->value !== "";
                 $new['anchoring']['cost']['price'] = @$attrs->anchoring->price->value;
                 $new['anchoring']['cost']['currency'] = @$attrs->anchoring->price->currency;
                 $new['anchoring']['cost']['type'] = @$attrs->anchoring->price->type;
                 $new['anchoring']['cost']['details'] = @$attrs->anchoring->price->details;
                 $new['anchoring']['tax']['value'] = @$attrs->berthing->soujourn->value;
                 $new['anchoring']['tax']['currency'] = @$attrs->berthing->soujourn->currency;
                 $new['anchoring']['tax']['type'] = @$attrs->berthing->soujourn->type;
                 $new['anchoring']['tax']['details'] = @$attrs->berthing->soujourn->details;
             }
             /**
              * Buoys mooring
              */
             if (isset($attrs->mooring)) {
                 $new['mooring']['number']['val'] = $attrs->mooring->number->value;
                 $new['mooring']['number']['details']['val'] = @$attrs->mooring->number->details;
                 $new['mooring']['maxdraught']['val'] = $attrs->mooring->maxdraught->value;
                 $new['mooring']['maxdraught']['type']['val'] = $attrs->mooring->maxdraught->type;
                 $new['mooring']['maxdraught']['details']['val'] = @$attrs->mooring->maxdraught->details;
                 $new['mooring']['maxlength']['val'] = $attrs->mooring->maxlength->value;
                 $new['mooring']['maxlength']['type']['val'] = $attrs->mooring->maxlength->type;
                 $new['mooring']['maxlength']['details']['val'] = @$attrs->mooring->maxlength->details;
                 $new['mooring']['price']['val'] = @$attrs->mooring->price->value;
                 $new['mooring']['price']['currency']['val'] = @$attrs->mooring->price->currency;
                 $new['mooring']['price']['type']['val'] = @$attrs->mooring->price->type;
                 $new['mooring']['price']['details']['val'] = @$attrs->mooring->price->details;
                 $new['mooring']['soujourn']['val'] = @$attrs->mooring->soujourn->value;
                 $new['mooring']['soujourn']['currency']['val'] = @$attrs->mooring->soujourn->currency;
                 $new['mooring']['soujourn']['type']['val'] = @$attrs->mooring->soujourn->type;
                 $new['mooring']['soujourn']['details']['val'] = @$attrs->mooring->soujourn->details;
             }
             /**
              * Berthing, mooring, anchoring
              */
             if (isset($attrs->mba->details) && $attrs->mba->details !== '') {
                 $new['bma']['val'] = $attrs->mba->details;
             }
             /**
              * Services
              */
             if (isset($attrs->services->slipway->value)) {
                 $new['services']['slipway']['val'] = $attrs->services->slipway->value;
                 $new['services']['slipway']['details']['val'] = @$attrs->services->slipway->details;
             }
             if (isset($attrs->services->pumpout->value)) {
                 $new['services']['pumpout']['val'] = $attrs->services->pumpout->value;
                 $new['services']['pumpout']['details']['val'] = @$attrs->services->pumpout->details;
             }
             if (isset($attrs->services->repairs->value)) {
                 $new['services']['repairs']['val'] = $attrs->services->repairs->value;
                 $new['services']['repairs']['details']['val'] = @$attrs->services->repairs->details;
             }
             if (isset($attrs->services->travelift->value)) {
                 $new['services']['travelift']['val'] = $attrs->services->travelift->value;
                 $new['services']['travelift']['maxtonnage']['val'] = @$attrs->services->travelift->maxtonnage;
                 $new['services']['travelift']['details']['val'] = @$attrs->services->travelift->details;
             }
             if (isset($attrs->services->storage->value)) {
                 $new['services']['storage']['val'] = $attrs->services->storage->value;
                 $new['services']['storage']['details']['val'] = @$attrs->services->storage->details;
             }
             if (isset($attrs->services->divers->value)) {
                 $new['services']['divers']['val'] = $attrs->services->divers->value;
                 $new['services']['divers']['details']['val'] = @$attrs->services->divers->details;
             }
             /**
              * Opening
              */
             if (isset($attrs->opening)) {
                 $new['opening']['val'] = $attrs->opening->value;
                 $new['opening']['details']['val'] = @$attrs->opening->details;
                 if (isset($attrs->opening->everyday)) {
                     $new['opening']['everyday']['val'] = $attrs->opening->everyday->value;
                     $new['opening']['everyday']['from']['val'] = @$attrs->opening->everyday->from;
                     $new['opening']['everyday']['to']['val'] = @$attrs->opening->everyday->to;
                 }
                 if (isset($attrs->opening->somedays)) {
                     foreach (['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] as $day) {
                         $new['opening']['somedays'][$day]['val'] = $attrs->opening->somedays->{$day}->value;
                         $new['opening']['somedays'][$day]['from']['val'] = @$attrs->opening->somedays->{$day}->from;
                         $new['opening']['somedays'][$day]['to']['val'] = @$attrs->opening->somedays->{$day}->to;
                     }
                 }
             }
             /**
              * Season
              */
             if (isset($attrs->season)) {
                 $new['season']['val'] = $attrs->season->value;
                 $new['season']['details']['val'] = @$attrs->season->details;
                 $new['season']['from']['val'] = @$attrs->season->from;
                 $new['season']['to']['val'] = @$attrs->season->to;
             }
             /**
              * Berthing info
              */
             if (isset($attrs->berthing)) {
                 // Assistance
                 if (isset($attrs->berthing->assistance)) {
                     $new['berthing']['assistance']['val'] = $attrs->berthing->assistance->value;
                 } else {
                     $new['berthing']['assistance']['val'] = 'na';
                 }
                 $new['berthing']['assistance']['details']['val'] = @$attrs->berthing->assistance->details;
                 // Type
                 if (isset($attrs->berthing->type)) {
                     $new['berthing']['type']['val'] = $attrs->berthing->type->values;
                 } else {
                     $new['berthing']['type']['val'] = 'na';
                 }
                 $new['berthing']['type']['details']['val'] = @$attrs->berthing->type->details;
                 // Seaberths
                 if (isset($attrs->berthing->seaberths)) {
                     $new['berthing']['seaberths']['total']['val'] = $attrs->berthing->seaberths->total->value;
                     $new['berthing']['seaberths']['visitor']['val'] = $attrs->berthing->seaberths->total->value;
                 }
                 $new['berthing']['seaberths']['details']['val'] = @$attrs->berthing->seaberths->details;
                 // Dryberths
                 if (isset($attrs->berthing->dryberths)) {
                     $new['berthing']['dryberths']['val'] = $attrs->berthing->dryberths->value;
                     $new['berthing']['dryberths']['details']['val'] = @$attrs->berthing->dryberths->details;
                 }
                 // Maxdraught
                 if (isset($attrs->berthing->maxdraught)) {
                     $new['berthing']['maxdraught']['val'] = $attrs->berthing->maxdraught->value;
                     $new['berthing']['maxdraught']['type']['val'] = $attrs->berthing->maxdraught->type;
                     $new['berthing']['maxdraught']['details']['val'] = @$attrs->berthing->maxdraught->details;
                 }
                 // Maxlength
                 if (isset($attrs->berthing->maxlength)) {
                     $new['berthing']['maxlength']['val'] = $attrs->berthing->maxlength->value;
                     $new['berthing']['maxlength']['type']['val'] = $attrs->berthing->maxlength->type;
                     $new['berthing']['maxlength']['details']['val'] = @$attrs->berthing->maxlength->details;
                 }
                 // Price
                 if (isset($attrs->berthing->price)) {
                     if (isset($attrs->berthing->price->value)) {
                         $new['berthing']['price']['val'] = $attrs->berthing->price->value;
                         $new['berthing']['price']['currency']['val'] = $attrs->berthing->price->currency;
                         $new['berthing']['price']['type']['val'] = $attrs->berthing->price->type;
                     } else {
                         $new['berthing']['price']['val'] = 0;
                         $new['berthing']['price']['currency']['val'] = 'gbp';
                         $new['berthing']['price']['type']['val'] = 'm';
                     }
                     $new['berthing']['price']['details']['val'] = @$attrs->berthing->price->details;
                 }
                 // Soujourn
                 if (isset($attrs->berthing->soujourn)) {
                     if (isset($attrs->berthing->soujourn->value)) {
                         $new['berthing']['soujourn']['val'] = $attrs->berthing->soujourn->value;
                         $new['berthing']['soujourn']['currency']['val'] = $attrs->berthing->soujourn->currency;
                         $new['berthing']['soujourn']['type']['val'] = $attrs->berthing->soujourn->type;
                     } else {
                         $new['berthing']['soujourn']['val'] = 0;
                         $new['berthing']['soujourn']['currency']['val'] = 'gbp';
                         $new['berthing']['soujourn']['type']['val'] = 'person';
                     }
                     $new['berthing']['soujourn']['details']['val'] = @$attrs->berthing->soujourn->details;
                 }
             }
         }
         //$new = json_decode(json_encode($new), TRUE);
         $attributes = POI::fromPostData($new);
         //            print_r($attributes->toDoc());
         //            var_dump($tbl->insert($attributes->toDoc()));
         //            print_r($new);
         //            echo "<br /><br />";
     }
     $con->close();
 }