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 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 }