Example #1
0
 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);
 }
Example #2
0
 public static function hide_place($id)
 {
     $user = getenv('BACKEND_USER');
     $pass = getenv('BACKEND_PASS');
     if (http_login($user, $pass)) {
         $place = Place::find($id);
         $place->confirmed = 0;
         $place->save();
     }
     Flight::redirect('/backend/places', 302);
 }
Example #3
0
 public static function update_place($id)
 {
     $user = getenv('BACKEND_USER');
     $pass = getenv('BACKEND_PASS');
     if (http_login($user, $pass)) {
         $post_data = Flight::request()->data;
         $place = Place::find($id);
         $place->name = $post_data['name'];
         $place->address = $post_data['address'];
         $place->start_hour = $post_data['start_hour'];
         $place->end_hour = $post_data['end_hour'];
         $place->days = $post_data['days'];
         $place->comments = $post_data['comments'];
         $place->save();
     }
     Flight::redirect('/backend/places', 302);
 }