public function index($name) { $fsdata = dirname(__FILE__) . '/../../data/' . $name; $filelist = Utils::fileList($fsdata, 5); $files = array(); foreach ($filelist as $file) { $ts2 = strtok($file, "."); $mins = (time() - filename2date($ts2, 'U')) / 60; $unixtime = filename2date($ts2, $mins > 1440 ? 'Y M j D H:i' : 'D H:i'); $files[] = array('filename' => $file, 'ts' => date2es($unixtime) . ' (hace ' . timespan($mins) . ')'); } return array('name' => $name, 'files' => $files); }
function printFiles() { $overlay = file_exists('data/' . $this->name . '/overlay.png'); $str = ""; $str .= '<div class="actions"><div id="logo" onclick="redir(\'' . $_SESSION['url_back'] . '\')"></div></div>'; if ($overlay) { $str .= '<div class="overlay-cities"></div>'; } $fTitle = ""; $j = $this->range + 1; $str .= '<div id="ss_image">'; for ($i = 0; $i < count($this->files); $i++) { $filename = $this->files[count($this->files) - ($i + 1)][0]; if ($this->settings['x'] && $this->settings['y']) { $filepath = '/static/crop/?t=' . $this->name . '/files/' . $filename . '&sx=' . $this->settings['x'] . '&sy=' . $this->settings['y'] . '&w=' . $this->dw . '&h=' . $this->dh . '&st=0'; } else { $filepath = '/data/' . $this->name . '/files/' . $filename; } $display = $i == 0 ? "display:block;" : ""; $unixtime = Timelapse::filename2date($filename, 'M j D H:i'); $mins = (time() - Timelapse::filename2date($filename, 'U')) / 60; $timestamp = date2es($unixtime) . ' (hace ' . timespan($mins) . ')'; $j--; $offs = $this->range - $j; $title = $offs; if ($offs > -1) { $title = @str_repeat("█", $i + 1) . str_repeat("_", $j - 1) . ' ' . $timestamp; } if ($i == 0) { $fTitle = $title; } $str .= ' <div class="slide' . $index . '"><span>' . $title . '</span> <a href="#' . $i . '"> <img title="' . $title . '" src="' . $filepath . '" width="' . $this->dw . '" height="' . $this->dh . '"> </a> </div>'; } $str .= ' </div> <div id="ss_controls" class="no-js"></div>'; /* <!--div id="timestamp">'.$fTitle.'</div-->'; if($this->settings['historic']) { //$str.='<a href="'.WWWFILEPATH . 'tl/' . $this->name .'/'.'">'. __($this->data['title'] . ' ' . $this->data['subtitle']) . ' Ahora/a>'; } $str.='<!--input type="button" class="button" style="width: 40px" id="prev" value="‹" onclick="prev()"> <input type="button" class="button" style="width: 40px" id="play" value="»" onclick="play()"> <input type="button" class="button" style="width: 40px" id="next" value="›" onclick="next()"--> <!--select name="date" onchange="setparams(this);" title="Fecha desde">'; $datestarts= Timelapse::filename2date($this->startdate); $dateends= Timelapse::filename2date($this->enddate); $startyear= date('Y',$datestarts); $startmonth= date('n',$datestarts); $startday= date('j',$datestarts); $diffdays = abs($dateends - $datestarts); //var_dump(date('Y m d H:i',$datestarts)); //var_dump(date('Y m d H:i',$dateends)); $fullDays = floor($diffdays/(60*60*24)); $today= mktime(0,0,0,date('n'),date('j'),date('Y')); if($datestarts > mktime(12,0,0,$startmonth,$startday,$startyear)) { if($today != mktime(0,0,0,$startmonth,$startday,$startyear)) { $fullDays++; } } for($d=$fullDays;$d>= 0;$d--) { $day= mktime(0,0,0,$startmonth,$startday + $d,$startyear); if($day == $today) { $strdate1 = "Hoy"; $strdate2 = ""; } else { $strdate1 = date2es(date('M d D',$day)); $strdate2 = date('ymd',$day); } $sel = $strdate2 == substr($this->viewdate,0,6) ? " selected" : ""; $str.='<option value="' . $strdate2 . '"' . $sel . '>'. $strdate1 . '</option>'; } $str.=' </select> <select name="time" onchange="setparams(this);" title="Hora desde">'; for($i=0;$i<24;$i++){ $val = sprintf("%02s",$i).'00'; $sel = substr($this->viewdate,6,4) == $val ? " selected":""; $str.='<option value="'.$val.'"'.$sel.'>'.$i.':00</option>'; } $str.=' </select> <select name="frames" onchange="setparams(this);" title="Fotogramas">'; $flag=false; foreach($this->validframess as $frames) { if($frames > $this->filestotal) { $frames = $this->filestotal; $flag=true; } $sel = $frames == $this->range ? " selected" : ""; $str.= '<option value="' . $frames . '"' . $sel . '>' . $frames; if($flag) break; } $str.= '</select> <select name="speed" onchange="setparams(this);" title="Velocidad">'; $dis= $this->filestotal > 1 ? '' : ' disabled'; foreach($this->validspeeds as $speed) { $sel = $speed == $this->viewspeed ? " selected" : ""; $str.= '<option value="' . $speed . '"' . $sel . $dis . '>' . $speed; } $str.= '</select> <input type="button" class="button" value="Actualizar Vista" onclick="updateQueryString()"> <input type="button" class="button" value="Personalizar Área" onclick="showdragbox()"--> <!--input type="text" name="showdate" value="desde URL" onclick="setDate(this)"--> </div>'; $str.=$str2; */ return $str; }
function get_mapo_timelapse() { $name = $_REQUEST['permalinks'][1]; if ($name == '') { return false; } $data = MySQLAdmin::get_timelapse($name); $imgpath = "./data/{$name}/files/"; if (!is_dir($imgpath)) { die('<div class="messagebox">No se encontraron registros para el timelapse <strong>' . $name . '</strong>.</div>'); } $files = Utils::fileList($imgpath); sort($files); rsort($files); array_splice($files, 5); sort($files); $filestotal = count($files); $limit = $filestotal > 5 ? 5 : $filestotal; $temp = array(); for ($i = 0; $i < $limit; $i++) { $mins = (time() - filename2date($files[$i], 'U')) / 60; $unixtime = filename2date($files[$i], $mins > 1440 ? 'Y M j D H:i' : 'D H:i'); $timestamp = "" . date2es($unixtime) . ' (hace ' . timespan($mins) . ')'; $temp[] = array($files[$i], $timestamp); } ?> <div id="clicmap" style="position:absolute;top:0;left:0;background:transparent url(<?php echo WWWPATH; ?> /static/resize/?t=<?php echo implode("/", array('data', $name, 'overlay.png')); ?> &w=1020&h=500) no-repeat;width:1020px;height:500px; display:block;z-index:101;cursor:pointer;"></div> <div id='slideshow'> <div id="ss_image"> <?php $i = 0; foreach ($temp as $row) { $i++; ?> <div class="slide<?php echo $i > 1 ? ' no-js' : ''; ?> "><span><?php echo $row[1]; ?> </span> <a href="#<?php echo $i; ?> "> <img src="<?php echo WWWPATH; ?> /static/resize/?t=<?php echo implode("/", array('data', $name, 'files', $row[0])); ?> &w=1020&h=500" width="1020" height="500" /> </a> </div> <?php } ?> </div> <div id="ss_controls" class="no-js"> </div> </div> <?php }