/** * Builds the Json Document for the storage w.r.t their docId * * @param document * - document for storage * @param jsonObjDoc * - jsonDoc object for storage * */ function buildJsonDocument($document, $jsonObjDoc) { $jsonObjDoc = new JSONObject($jsonObjDoc); if ($jsonObjDoc->has("loc") && $jsonObjDoc->__get("loc") != null) { $geoArray = $jsonObjDoc->getJSONArray("loc"); for ($i = 0; $i < count($geoArray); $i++) { if (count($geoArray) == 2) { $geoTag = new GeoTag(); $geoTag->setLat($geoArray[0]); $geoTag->setLng($geoArray[1]); $document->setLocation($geoTag); $jsonObjDoc->remove("loc"); } } } if ($jsonObjDoc->has("_id") && $jsonObjDoc->__get("_id") != null) { $idObj = $jsonObjDoc->__get("_id"); $oIdObj = $idObj->__get("\$oid"); $document->setDocId($oIdObj); $jsonObjDoc->remove("_id"); } if ($jsonObjDoc->has("_\$updatedAt") && $jsonObjDoc->__get("_\$updatedAt") != null) { $updatedObj = $jsonObjDoc->__get("_\$updatedAt"); $document->setUpdatedAt($updatedObj); $jsonObjDoc->remove("_\$updatedAt"); } if ($jsonObjDoc->has("_\$createdAt") && $jsonObjDoc->__get("_\$createdAt") != null) { $createdAtObj = $jsonObjDoc->__get("_\$createdAt"); $document->setCreatedAt($createdAtObj); $jsonObjDoc->remove("_\$createdAt"); } if ($jsonObjDoc->has("_\$event") && $jsonObjDoc->__get("_\$event") != null) { $eventObj = $jsonObjDoc->__get("_\$event"); $document->setEvent($eventObj); $jsonObjDoc->remove("_\$event"); } if ($jsonObjDoc->has("_\$owner") && $jsonObjDoc->__get("_\$owner") != null) { $idObj = $jsonObjDoc->__get("_\$owner"); $ownerObj = $idObj->__get("owner"); $document->setOwner($ownerObj); $jsonObjDoc->remove("_\$owner"); } $document->setJsonDoc($jsonObjDoc); }
public function testRenderWithGeotagAndCaption() { $script = <<<'JSON' { "type": "Feature", "geometry": { "type": "Point", "coordinates": [23.166667, 89.216667] }, "properties": { "title": "Jessore, Bangladesh", "radius": 750000, "pivot": true, "style": "satellite" } } JSON; $map = Map::create()->withGeoTag(GeoTag::create()->withScript($script))->withCaption(Caption::create()->withTitle('Title of Image caption')->withCredit('Some caption to the image')->withPosition(Caption::POSITION_BELOW)); $expected = '<figure class="op-map">' . '<script type="application/json" class="op-geotag">' . $script . '</script>' . '<figcaption class="op-vertical-below">' . '<h1>Title of Image caption</h1>' . '<cite>Some caption to the image</cite>' . '</figcaption>' . '</figure>'; $rendered = $map->render(); $this->assertEquals($expected, $rendered); }
public function testRenderWithGeotag() { $script = <<<'JSON' { "type": "Feature", "geometry": { "type": "Point", "coordinates": [23.166667, 89.216667] }, "properties": { "title": "Jessore, Bangladesh", "radius": 750000, "pivot": true, "style": "satellite" } } JSON; $geo_tag = GeoTag::create()->withScript($script); $expected = '<script type="application/json" class="op-geotag">' . $script . '</script>'; $rendered = $geo_tag->render(); $this->assertEquals($expected, $rendered); }
public function testRenderWithGeotag() { $script = <<<'JSON' { "type": "Feature", "geometry": { "type": "Point", "coordinates": [23.166667, 89.216667] }, "properties": { "title": "Jessore, Bangladesh", "radius": 750000, "pivot": true, "style": "satellite" } } JSON; $image = Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg')->withGeoTag(GeoTag::create()->withScript($script)); $expected = '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '<script type="application/json" class="op-geotag">' . $script . '</script>' . '</figure>'; $rendered = $image->render(); $this->assertEquals($expected, $rendered); }
public function testRenderWithGeotag() { $geotag = <<<'JSON' { "type": "Feature", "geometry": { "type": "Point", "coordinates": [23.166667, 89.216667] }, "properties": { "title": "Jessore, Bangladesh", "radius": 750000, "pivot": true, "style": "satellite" } } JSON; $video = Video::create()->withURL('http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4')->withGeoTag(GeoTag::create()->withScript($geotag)); $expected = '<figure>' . '<video>' . '<source src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4"/>' . '</video>' . '<script type="application/json" class="op-geotag">' . $geotag . '</script>' . '</figure>'; $rendered = $video->render(); $this->assertEquals($expected, $rendered); }
public function editGeotagFoto(Request $request) { $objectid = $request->objectid; $foto = $request->foto; if ($request->ajax()) { $GeoTag = GeoTag::where('objectid', '=', $objectid)->first(); $GeoTag->foto = $foto; //$GeoTag->personil = \Auth::user()->name; //$GeoTag->tanggal = Carbon::now(); $GeoTag->save(); } print $objectid . ' - ' . $foto; }