Source of file ElementMapsPortal.php

Size: 1,940 Bytes - Last Modified: 2016-05-18T03:08:26+02:00

buildproject/core/module_maps/portal/elements/ElementMapsPortal.php

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
<?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2016 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
********************************************************************************************************/

namespace Kajona\Maps\Portal\Elements;

use Kajona\Pages\Portal\ElementPortal;
use Kajona\Pages\Portal\PortalElementInterface;


/**
 * Portal-Part of the maps
 *
 * @author jschroeter@kajona.de
 * @targetTable element_universal.content_id
 */
class ElementMapsPortal extends ElementPortal implements PortalElementInterface {


    /**
     * Does a little "make-up" to the contents
     *
     * @return string
     */
    public function loadData() {

        $strReturn = "";

        $strTemplate = $this->arrElementData["char3"];
        //fallback
        if($strTemplate == "") {
            $strTemplate = "maps.tpl";
        }

        $floatLat = "0.0";
        $floatLng = "0.0";

        $arrLatLng = explode(',', $this->arrElementData["char2"]);
        if(count($arrLatLng) == 2) {
            $floatLat = $arrLatLng[0];
            $floatLng = $arrLatLng[1];
        }

        $this->arrElementData["address"] = $this->arrElementData["char1"];
        $this->arrElementData["lat"] = $floatLat;
        $this->arrElementData["lng"] = $floatLng;
        $this->arrElementData["infotext"] = str_replace(array("\r", "\r\n", "\n"), '', $this->arrElementData["text"]);
        $this->arrElementData["systemid"] = $this->getSystemid();

        $strReturn .= $this->objTemplate->fillTemplateFile($this->arrElementData, "/module_maps/".$strTemplate, "map");

        return $strReturn;
    }

}