function output_list($type, $list, $fields, $idstr) { switch ($type) { case 'xml': xml_header($fields); xml_data($list, $fields); xml_footer(); break; case 'dom': dom_header($fields); dom_data($list, $fields); dom_footer(); break; case 'img': img_header($fields); img_data($list, $fields, $idstr); img_footer(); break; case 'csv': default: csv_header($fields); csv_data($list, $fields); csv_footer(); break; } }
function csv_file($data, $cols, $filename = '') { csv_header($filename); echo csv_row(csv_cols($cols)); foreach ($data as $row) { $data = array(); foreach ($cols as $i => $name) { $data[] = !is_int($i) && is_callable($name) ? $name($row) : $row->{$name}; } echo csv_row($data); } if ($filename) { exit; } }
$to_date['month'] = parse($_POST['to_month'], 'int'); } unset($_POST['to_month']); } if (isset($_POST['to_year'])) { if ($_POST['to_year'] == 0) { $to_date['year'] = 1; } else { $to_date['year'] = parse($_POST['to_year'], 'int'); } unset($_POST['to_year']); } if (isset($_POST['cmt_filter'])) { if ($_POST['cmt_filter'] == 'export') { $start_export = true; csv_header(strtoupper($modul)); } unset($_POST['cmt_filter'], $_SESSION['filter'][$modul]); foreach ($_POST as $key => $value) { $_SESSION['filter'][$modul][$key] = $value; } } if (isset($_SESSION['filter'][$modul])) { foreach ($_SESSION['filter'][$modul] as $key => $value) { preg_match("/(.*)_q_(.*)/i", $key, $q_key); preg_match("/(.*)_activate_(.*)/i", $key, $activate_key); preg_match("/(.*)_option_(.*)/i", $key, $option_key); if ($activate_key) { ${$key} = $value; if (preg_match("/not/", $activate_key[2])) { $string = "c_" . str_replace('not', '', $activate_key[2]);
padding:5 10px; z-index:10; } #overlay{ position:absolute; top:0; left:0; width:672px; height:591px; z-index:20; } </style> </head> <body> <?php csv_header(); ?> <h2>ISC Team Editor</h2> <form id="query"> <input type="text" size="10" id="q" value="Ide írj valamit!" /> <input type="submit" value="Mondjad" /> </form> <div id="image-container"> <img src="team.jpg"/> </div> <p class="center">permalink: <span id="permalink"></span></p> <?php csv_footer(); ?>
} else { foreach ($arrContents as $i => $row) { $subdata = array(); foreach ($row as $name => $value) { // Header if (!isset($data[1])) { $data[0][] = $cell($name, true); } // Column $subdata[] = $cell($value, false); } $data[] = $subdata; } } if ($export) { csv_header('export.csv'); echo csv_rows($data); exit; } } require_once 'tpl.header.php'; require_once 'tpl.database.php'; require_once 'tpl.table.php'; ?> <style> .form { position: relative; } .form .favorite { position: absolute; top: 0;