1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
<?php
namespace WPGMZA\MarkerListing;
class BasicList extends \WPGMZA\MarkerListing
{
public function __construct($map_id)
{
\WPGMZA\MarkerListing::__construct($map_id);
}
public function getAjaxResponse($request)
{
global $wpgmza;
$response = $this->getRecords($request);
$document = new \WPGMZA\DOMDocument();
$document->loadPHPFile($this->getItemHTMLPath() . 'basic-list-item.html.php');
$template = $document->querySelector("body>*");
$template->remove();
$imageDimensions = $this->getImageDimensions();
foreach($response->data as $marker)
{
$item = $template->cloneNode(true);
if($wpgmza->settings->useLegacyHTML)
{
$item->setAttribute('id', "wpgmza_marker_{$marker->id}");
$item->setAttribute('mid', $marker->id);
$item->setAttribute('mapid', $request['map_id']);
if(!empty($marker->icon))
$item->querySelector('.wpgmza_marker_icon')->setAttribute('src', $marker->icon);
else
$item->querySelector('.wpgmza_marker_icon')->setAttribute('src', \WPGMZA\Marker::DEFAULT_ICON);
$item->querySelector('.wpgmza_div_title')->appendText($marker->title);
$item->querySelector('.wpgmza_div_address')->appendText($marker->address);
}
$this->appendListingItem($document, $item, $marker);
}
$response->html = $document->saveInnerBody();
unset($response->data);
return $response;
}
}