예제 #1
0
 public static function show_search_results()
 {
     $params = $_GET;
     $search_word = $params['search'];
     if ($params['option'] == 'reseptit') {
         $recipes = Recipe::search_default($search_word);
         $path = 'results?search=' . $search_word . '&option=reseptit&';
         self::make_paged_view($recipes, $path, 'results.html');
     } else {
         ChefController::index($search_word);
     }
 }
예제 #2
0
$routes->group('/my_profile', function () use($routes) {
    $routes->get('/', 'check_logged_in', function () {
        ChefController::show(BaseController::get_user_logged_in()->id);
    });
    $routes->get('/edit', 'check_logged_in', function () {
        ChefController::edit();
    });
    $routes->post('/', 'check_logged_in', function () {
        ChefController::update();
    });
    $routes->post('/destroy', 'check_logged_in', function () {
        ChefController::destroy();
    });
});
$routes->get('/chefs/index', function () {
    ChefController::index();
});
$routes->group('/admin', function () use($routes) {
    $routes->post('/change_account_activity/:id', 'check_if_admin', function ($id) {
        ChefController::toggle_activity($id);
    });
    $routes->post('/change_account_admin_status/:id', 'check_if_admin', function ($id) {
        ChefController::toggle_admin_status($id);
    });
});
$routes->post('/search', function () {
    SearchController::search();
});
$routes->get('/results', function () {
    SearchController::show_search_results();
});