Esempio n. 1
0
    }
    return $link . 'id=' . $menu->get_id() . '&token=' . AppContext::get_session()->get_token();
}
if (!empty($id)) {
    $menu = MenuService::load($id);
    if ($menu == null) {
        AppContext::get_response()->redirect('menus.php');
    }
    // In GET mode so we check it
    AppContext::get_session()->csrf_get_protect();
    switch ($action) {
        case 'enable':
            MenuService::enable($menu);
            break;
        case 'disable':
            MenuService::disable($menu);
            break;
        case 'delete':
            MenuService::delete($id);
            break;
        case 'up':
        case 'down':
            // Move up or down a Menu in a block
            if ($action == 'up') {
                MenuService::change_position($menu, MenuService::MOVE_UP);
            } else {
                MenuService::change_position($menu, MenuService::MOVE_DOWN);
            }
            break;
        default:
            if (!empty($move)) {
 function enable_all($enable = true)
 {
     global $Sql;
     $menus = MenuService::get_menu_list();
     foreach ($menus as $menu) {
         if ($enable === true) {
             MenuService::enable($menu);
         } else {
             MenuService::disable($menu);
         }
     }
 }