Exemple #1
0
        $menu = MenuService::load($id_post);
        $menu->set_title($menu_name);
        $menu->set_module_id($matches[1]);
        $menu->set_cat($matches[2]);
        $menu->set_name($matches[3]);
        $menu->set_number($menu_items_number);
    } else {
        // Add the new Menu
        $menu = new FeedMenu($menu_name, $matches[1], $matches[2], $matches[3], $menu_items_number);
    }
    if (!$menu instanceof FeedMenu) {
        AppContext::get_response()->redirect('menus.php');
    }
    $menu->enabled(retrieve(POST, 'activ', Menu::MENU_NOT_ENABLED));
    $menu->set_hidden_with_small_screens((bool) retrieve(POST, 'hidden_with_small_screens', false));
    if ($menu->is_enabled()) {
        $menu->set_block(retrieve(POST, 'location', Menu::BLOCK_POSITION__NOT_ENABLED));
    }
    $menu->set_auth(Authorizations::build_auth_array_from_form(Menu::MENU_AUTH_BIT));
    //Filters
    MenuAdminService::set_retrieved_filters($menu);
    MenuService::move($menu, $menu->get_block());
    MenuService::generate_cache();
    AppContext::get_response()->redirect('menus.php#m' . $menu->get_id());
}
// Display the Menu administration
$edit = !empty($id);
include 'lateral_menu.php';
lateral_menu();
$tpl = new FileTemplate('admin/menus/feed.tpl');
$tpl->put_all(array('L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'JL_REQUIRE_NAME' => TextHelper::to_js_string($LANG['require_name']), 'JL_REQUIRE_FEED' => TextHelper::to_js_string($LANG['choose_feed_in_list']), 'JL_REQUIRE_ITEMS_NUMBER' => TextHelper::to_js_string($LANG['require_items_number']), 'L_FEED' => $LANG['feed'], 'L_AVAILABLES_FEEDS' => $LANG['availables_feeds'], 'L_NAME' => $LANG['name'], 'L_STATUS' => $LANG['status'], 'L_HIDDEN_WITH_SMALL_SCREENS' => $LANG['hidden_with_small_screens'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $edit ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $edit ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save'));