/** * Prepare image name from string * * @param string $sText * @return string */ function prepareImageName($sText) { $sText = clearDiacritics($sText); $sText = strtolower($sText); $sText = str_replace(' ', '-', $sText); $sText = preg_replace('/[^0-9a-z\\-._]+/', '', $sText); $sText = preg_replace('/[\\-]+/', '-', $sText); $sText = trim($sText, '-'); return $sText; }
public function export() { $date = date("Y-m-d", strtotime($_REQUEST["fecha"])); //Force order Evento::actualizarFechas($date); $eventos = Evento::select(array("fecha" => $date)); $output = ""; if (count($eventos)) { foreach ($eventos as $i => $evento) { $output .= $evento->telson($i == 0) . "\n"; } $filename = date("Ymd", strtotime($evento->getFecha())) . "Tribo.txt"; header('Content-Type: text/plain'); header("Content-Disposition: attachment; filename=" . $filename); echo clearDiacritics($output); //Log Log::add(LOG_EXPORT_PARRILLA, $_REQUEST); exit; } else { Registry::addMessage("Esta parrilla no tiene eventos", "error"); Url::redirect(Url::site("parrilla")); } }