Example #1
0
 public static function message_success($message)
 {
     $f3 = Base::instance();
     $f3->set('SESSION.alert_type', 'alert-success');
     AlertControl::set_message($message, $f3);
 }
Example #2
0
 function post_delete_ingredient($f3)
 {
     $orm = $f3->get('ingredient_orm');
     $id = $f3->get('PARAMS.id');
     $orm->load(array('id=?', $id));
     AlertControl::message_info("Ainesosa {$orm->name} on poistettu");
     $orm->erase();
     $f3->reroute("/ainesosa/listaa");
 }
Example #3
0
 function post_edit_food($f3)
 {
     $meal = $f3->get('meal_orm');
     $id = $f3->get('PARAMS.id');
     $meal->load(array('id=?', $id));
     $meal->copyfrom('POST', function ($val) {
         return array_intersect_key($val, array_flip(array('name', 'info', 'category_id', 'menu_id')));
     });
     if (trim($meal->name) == '') {
         $f3->reroute("/annos/{$id}");
     }
     $data_arr = array();
     $data_arr["id"] = $f3->get('POST.ingredients');
     $data_arr["optional"] = $f3->get('POST.optional');
     Ingredient::add_to_meal($id, $data_arr, $f3);
     $meal->save();
     $menu_id = $f3->get('POST.menu_id');
     AlertControl::message_info("Annosta on muokattu");
     $f3->reroute("/menu/{$menu_id}");
 }
Example #4
0
 function afterRoute($f3, $params)
 {
     AlertControl::reset();
 }