public static function display_places() { // places markers $places = Place::where('confirmed', 1)->get(); $list_places = $places->toArray(); $final_list = array(); foreach ($list_places as $place) { $complete = "<strong>{$place['name']}</strong>"; $complete .= "<br>{$place['address']}"; if (!empty($place['start_hour'])) { $complete .= "<br><small><u>Horario:</u> "; $complete .= "{$place['start_hour']}"; if (!empty($place['end_hour']) && $place['start_hour'] != $place['end_hour']) { $complete .= " - {$place['end_hour']}"; } if (!empty($place['days'])) { $complete .= " - {$place['days']}"; } $complete .= "</small>"; } if (!empty($place['comments'])) { $complete .= "<br><br>{$place['comments']}"; } $place['complete'] = $complete; $place['name'] = "{$place['name']} - {$place['address']}"; $final_list[] = $place; } Flight::json($final_list); }
public static function places() { $user = getenv('BACKEND_USER'); $pass = getenv('BACKEND_PASS'); if (http_login($user, $pass)) { $places = Place::where('confirmed', 1)->orderBy('id', 'desc')->get(); Flight::view()->set("places", $places->toArray()); Flight::view()->set("total_places", $places->count()); Flight::view()->set("base_path", getBasePath()); Flight::render('backend/places', array(), 'yield'); Flight::render('backend/layout', array()); } }