예제 #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->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();
});
$routes->get('/keyword/:key', function ($keyword) {
    SearchController::find_by_keyword($keyword);
});
$routes->group('/recipe', function () use($routes) {
    $routes->get('s', function () {
        RecipeController::index();
    });