public function showCaviEggs($request) { //List the eggs for the cavicon's website $eggs = Eggs::getCaviconEggs(true); $data = []; $data['eggs'] = $eggs; return new JavaScriptResponse("egg/index.js", $data); }
public function index($request) { $data = []; $data['dv_eggs'] = Eggs::getDreamvidsEggs(); $data['cavi_eggs'] = Eggs::getCaviconEggs(); $now = Utils::tps(); $date_now = new DateTime(date("c", $now)); foreach ($data as $k => $eggs) { foreach ($eggs as $k2 => $egg) { if ($egg->show_timestamp < $now) { $data['intervals'][$egg->id] = ''; } else { $interval = abs($now - $egg->show_timestamp); $futur = new DateTime(date("c", $egg->show_timestamp)); $diff = $futur->diff($date_now)->format("%Y ans, %m mois, %d j et %H:%I:%S restant"); $data['intervals'][$egg->id] = $diff; } } } return new ViewResponse('admin/egg/index', $data); }