case 'edit': echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/marker_edit.php"); exit; break; //Edit marker sumission //Edit marker sumission case 'editsubmission': $id = $_REQUEST['id']; echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/marker_edit.php?mode=editsubmission&mkid={$id}"); exit; break; case 'setgeolocation': MAPS_setGeoLocation(); echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/index.php?msg=" . urlencode($LANG_MAPS_1['set_geo_location'])); exit; break; default: $display = COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']); $display .= MAPS_admin_menu(); if (!empty($_REQUEST['msg'])) { $display .= COM_startBlock($LANG_MAPS_1['message'], '', 'blockheader-message.thtml'); $display .= $_REQUEST['msg']; $display .= COM_endBlock('blockfooter-message.thtml'); } $display .= '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/maps.png" alt="" align="left" hspace="5">' . '<p>' . $LANG_MAPS_1['plugin_doc'] . ' <a href="http://geeklog.fr/downloads/index.php/maps" target="_blank">' . $LANG_MAPS_1['online'] . '</a>.</p>'; $display .= '<br /><h1>' . $LANG_MAPS_1['maps_list'] . '</h1>'; $display .= '<p>' . $LANG_MAPS_1['you_can'] . '<a href="' . $_CONF['site_url'] . '/admin/plugins/maps/map_edit.php">' . $LANG_MAPS_1['create_map'] . '</a>.</p><p> </p>'; $display .= MAPS_listmaps(); $display .= COM_siteFooter(0); } COM_output($display);
function MAPS_exportCSV($map, $separator = ";", $fields = array()) { global $_CONF, $_MAPS_CONF, $_TABLES, $LANG_MAPS_1; $count = count($fields); $i = 1; $selected_fields = ''; $valid_fieds = MAPS_getFieldsImportExport(); foreach ($fields as $value) { if (in_array($value, $valid_fieds)) { $selected_fields .= $value; if ($i < $count) { $selected_fields .= ', '; } } $i++; } //if ( $selected_fields == '' ) return; $result = DB_query("SELECT \n\t\t\t\t\t\t\t{$selected_fields} \n\t\t\t\t\t\t\tFROM {$_TABLES['maps_markers']} WHERE mid={$map}"); //Check if there is at least 1 marker $rows = DB_numRows($result); if ($rows < 1 || $selected_fields == '') { $display .= COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']); $display .= MAPS_admin_menu(); $display .= MAPS_message($LANG_MAPS_1['no_marker_to_export']); $display .= COM_siteFooter(0); COM_output($display); exit; } $search = array(',', '\'', ' ', '.', '!', ':'); $sitename = str_replace($search, "_", $_CONF['site_name']); // send response headers to the browser header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=map_' . $map . '_' . $sitename . '.csv'); $fp1 = fopen('php://output', 'w'); while ($row = DB_fetchArray($result, false)) { if ($separator == ',') { fputcsv($fp1, $row, ",", '"'); } else { if ($separator == 'tab') { fputcsv($fp1, $row, "\t", '"'); } else { fputcsv($fp1, $row, ";", '"'); } } } fclose($fp1); //header("Refresh: 0;url={$_CONF['site_admin_url']}/plugins/maps/import_export.php"); }