Ejemplo n.º 1
0
 public function usermapAction()
 {
     $dom = new DOMDocument("1.0");
     $node = $dom->createElement("markers");
     $parnode = $dom->appendChild($node);
     if ($this->getAccount() == true) {
         $mapdata = new Finds();
         $mapdatas = $mapdata->getUserMap($this->getAccount()->peopleID, 2000);
         if (count($mapdatas)) {
             foreach ($mapdatas as $mapdata) {
                 $lat = $mapdata['declat'];
                 $long = $mapdata['declong'];
                 $html = '';
                 if (isset($mapdata['i'])) {
                     $html .= '<div id="tmb">' . '<img src="http://' . $_SERVER['SERVER_NAME'] . '/images/thumbnails/' . $mapdata['i'] . '.jpg"/></div>';
                 }
                 $html .= '<div id="detailsmap"><p>' . ucwords(strtolower($mapdata['county'])) . ' - <a href="http://' . $_SERVER['SERVER_NAME'] . $this->view->url(array('module' => 'database', 'controller' => 'artefacts', 'action' => 'record', 'id' => $mapdata['id']), null, true) . '" title="View record\'s details">' . $mapdata['old_findID'] . '</a><br />' . $mapdata['objecttype'] . '<br />' . $mapdata['broadperiod'] . '</p></div>';
                 $node = $dom->createElement("marker");
                 $newnode = $parnode->appendChild($node);
                 $newnode->setAttribute("name", $html);
                 $newnode->setAttribute("broadperiod", $mapdata['broadperiod']);
                 $newnode->setAttribute("lat", $lat);
                 $newnode->setAttribute("lng", $long);
                 $newnode->setAttribute("type", $mapdata['objecttype']);
                 $newnode->setAttribute("workflow", str_replace(array('1', '2', '3', '4'), array('quarantine', 'review', 'published', 'validation'), $mapdata['secwfstage']));
             }
         }
     }
     header('Content-Type: text/xml');
     echo $dom->saveXML();
 }