Resources/contao/dca/tl_content.php
public function get_baselayers(DataContainer $dc)
    {
        $id = 0;
        if ($dc->activeRecord->c4g_map_id != 0) {
            $id = $dc->activeRecord->c4g_map_id;
        } else {
            // take firstMapId, because it will be chosen as DEFAULT value for c4g_map_id
            $id = $this->firstMapId;
        }

        $profile = $this->Database->prepare(
                "SELECT b.baselayers ".
                "FROM tl_c4g_maps a, tl_c4g_map_profiles b ".
                "WHERE a.id = ? and a.profile = b.id")
                ->execute($id);

        $ids = deserialize($profile->baselayers,true);
        if (count($ids)>0) {
            $baseLayers = $this->Database->prepare("SELECT id,name FROM tl_c4g_map_baselayers WHERE id IN (".implode(',',$ids).") ORDER BY name")->execute();
        } else {
            $baseLayers = $this->Database->prepare("SELECT id,name FROM tl_c4g_map_baselayers ORDER BY name")->execute();
        }


        if ($baseLayers->numRows > 0) {
            while ( $baseLayers->next () ) {
                $return [$baseLayers->id] = $baseLayers->name;
            }
        }
        return $return;
    }
public function get_baselayers(DataContainer $dc)
    {
        $id = 0;
        if ($dc->activeRecord->c4g_map_id != 0) {
            $id = $dc->activeRecord->c4g_map_id;
        } else {
            // take firstMapId, because it will be chosen as DEFAULT value for c4g_map_id
            $id = $this->firstMapId;
        }

        $profile = $this->Database->prepare(
                "SELECT b.baselayers ".
                "FROM tl_c4g_maps a, tl_c4g_map_profiles b ".
                "WHERE a.id = ? and a.profile = b.id")
                ->execute($id);

        $ids = deserialize($profile->baselayers,true);
        if (count($ids)>0) {
            $baseLayers = $this->Database->prepare("SELECT id,name FROM tl_c4g_map_baselayers WHERE id IN (".implode(',',$ids).") ORDER BY name")->execute();
        } else {
            $baseLayers = $this->Database->prepare("SELECT id,name FROM tl_c4g_map_baselayers ORDER BY name")->execute();
        }


        if ($baseLayers->numRows > 0) {
            while ( $baseLayers->next () ) {
                $return [$baseLayers->id] = $baseLayers->name;
            }
        }
        return $return;
    }
public function get_baselayers ( DataContainer $ dc ) { $ id = 0 ; if ( $ dc -> activeRecord -> c4g_map_id != 0 ) { $ id = $ dc -> activeRecord -> c4g_map_id ; } else { // take firstMapId, because it will be chosen as DEFAULT value for c4g_map_id $ id = $ this -> firstMapId ; } $ profile = $ this -> Database -> prepare ( "SELECT b.baselayers " . "FROM tl_c4g_maps a, tl_c4g_map_profiles b " . "WHERE a.id = ? and a.profile = b.id" ) -> execute ( $ id ) ; $ ids = deserialize ( $ profile -> baselayers , true ) ; if ( count ( $ ids ) > 0 ) { $ baseLayers = $ this -> Database -> prepare ( "SELECT id,name FROM tl_c4g_map_baselayers WHERE id IN (" . implode ( ',' , $ ids ) . ") ORDER BY name" ) -> execute ( ) ; } else { $ baseLayers = $ this -> Database -> prepare ( "SELECT id,name FROM tl_c4g_map_baselayers ORDER BY name" ) -> execute ( ) ; } if ( $ baseLayers -> numRows > 0 ) { while ( $ baseLayers -> next ( ) ) { $ return [ $ baseLayers -> id ] = $ baseLayers -> name ; } } return $ return ; }
Return all base layers for current Map Profile as array
@param object
@return array
Return all base layers for current Map Profile as array