コード例 #1
0
ファイル: links.php プロジェクト: janus57/PHPBoost_v3c
    MenuService::generate_cache();
    redirect('menus.php#m' . $menu->get_id());
}
include 'lateral_menu.php';
lateral_menu();
$tpl = new Template('admin/menus/links.tpl');
$tpl->assign_vars(array('L_REQUIRE_TITLE' => $LANG['require_title'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_NAME' => $LANG['name'], 'L_URL' => $LANG['url'], 'L_IMAGE' => $LANG['img'], 'L_STATUS' => $LANG['status'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => $LANG['enabled'], 'L_DISABLED' => $LANG['disabled'], 'L_ACTIVATION' => $LANG['activation'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $menu_id > 0 ? $LANG['menus_edit'] : $LANG['add'], 'L_ACTION' => $menu_id > 0 ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save', 'L_TYPE' => $LANG['type'], 'L_CONTENT' => $LANG['content'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD' => $LANG['add'], 'J_AUTH_FORM' => to_js_string(Authorizations::generate_select(AUTH_MENUS, array('r-1' => AUTH_MENUS, 'r0' => AUTH_MENUS, 'r1' => AUTH_MENUS), array(), 'menu_element_##UID##_auth')), 'JL_AUTHORIZATIONS' => to_js_string($LANG['authorizations']), 'JL_PROPERTIES' => to_js_string($LANG['properties']), 'JL_NAME' => to_js_string($LANG['name']), 'JL_URL' => to_js_string($LANG['url']), 'JL_IMAGE' => to_js_string($LANG['img']), 'JL_DELETE_ELEMENT' => to_js_string($LANG['confirm_delete_element']), 'JL_MORE' => to_js_string($LANG['more_details']), 'JL_DELETE' => to_js_string($LANG['delete']), 'JL_ADD_SUB_ELEMENT' => to_js_string($LANG['add_sub_element']), 'JL_ADD_SUB_MENU' => to_js_string($LANG['add_sub_menu'])));
$block = BLOCK_POSITION__HEADER;
$array_location = array(BLOCK_POSITION__HEADER => $LANG['menu_header'], BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], BLOCK_POSITION__LEFT => $LANG['menu_left'], BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], BLOCK_POSITION__RIGHT => $LANG['menu_right'], BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], BLOCK_POSITION__FOOTER => $LANG['menu_footer']);
$edit_menu_tpl = new Template('admin/menus/menu_edition.tpl');
$edit_menu_tpl->assign_vars(array('L_NAME' => $LANG['name'], 'L_IMAGE' => $LANG['img'], 'L_URL' => $LANG['url'], 'L_PROPERTIES' => $LANG['properties'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD_SUB_ELEMENT' => $LANG['add_sub_element'], 'L_ADD_SUB_MENU' => $LANG['add_sub_menu'], 'L_MORE' => $LANG['more_details'], 'L_DELETE' => $LANG['delete']));
$menu = null;
if ($menu_id > 0) {
    $menu = MenuService::load($menu_id);
    if (!of_class($menu, LINKS_MENU__CLASS)) {
        redirect('menus.php');
    }
} else {
    $menu = new LinksMenu('', '', '', VERTICAL_MENU);
}
$block = $menu->get_block();
$tpl->assign_vars(array('IDMENU' => $menu_id, 'AUTH_MENUS' => Authorizations::generate_select(AUTH_MENUS, $menu->get_auth(), array(), 'menu_element_' . $menu->get_uid() . '_auth'), 'C_ENABLED' => !empty($menu_id) ? $menu->is_enabled() : true, 'MENU_ID' => $menu->get_id(), 'MENU_TREE' => $menu->display($edit_menu_tpl, LINKS_MENU_ELEMENT__FULL_DISPLAYING), 'MENU_NAME' => $menu->get_title(), 'MENU_URL' => $menu->get_url(true), 'MENU_IMG' => $menu->get_image(true), 'ID' => $menu->get_uid()));
foreach (LinksMenu::get_menu_types_list() as $type_name) {
    $tpl->assign_block_vars('type', array('NAME' => $type_name, 'L_NAME' => $LANG[$type_name . '_menu'], 'SELECTED' => $menu->get_type() == $type_name ? ' selected="selected"' : ''));
}
foreach ($array_location as $key => $name) {
    $tpl->assign_block_vars('location', array('C_SELECTED' => $block == $key, 'VALUE' => $key, 'NAME' => $name));
}
$tpl->assign_vars(array('ID_MAX' => get_uid()));
$tpl->parse();
require_once PATH_TO_ROOT . '/admin/admin_footer.php';
コード例 #2
0
ファイル: links.php プロジェクト: AroundPBT/PHPBoost
lateral_menu();
$tpl = new FileTemplate('admin/menus/links.tpl');
$tpl->put_all(array('L_NAME' => $LANG['name'], 'L_URL' => $LANG['url'], 'L_IMAGE' => LangLoader::get_message('form.picture', 'common'), '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' => $menu_id > 0 ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $menu_id > 0 ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save', 'L_TYPE' => $LANG['type'], 'L_CONTENT' => $LANG['content'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD' => LangLoader::get_message('add', 'common'), 'L_REQUIRE_NAME' => $LANG['require_name'], 'J_AUTH_FORM' => str_replace(array("&quot;", "<!--", "-->"), array('"', "", ""), TextHelper::to_js_string(Authorizations::generate_select(Menu::MENU_AUTH_BIT, array('r-1' => Menu::MENU_AUTH_BIT, 'r0' => Menu::MENU_AUTH_BIT, 'r1' => Menu::MENU_AUTH_BIT), array(), 'menu_element_##UID##_auth'))), 'JL_AUTHORIZATIONS' => TextHelper::to_js_string($LANG['authorizations']), 'JL_PROPERTIES' => TextHelper::to_js_string($LANG['properties']), 'JL_NAME' => TextHelper::to_js_string($LANG['name']), 'JL_URL' => TextHelper::to_js_string($LANG['url']), 'JL_IMAGE' => TextHelper::to_js_string(LangLoader::get_message('form.picture', 'common')), 'JL_DELETE_ELEMENT' => TextHelper::to_js_string(LangLoader::get_message('confirm.delete', 'status-messages-common')), 'JL_MORE' => TextHelper::to_js_string($LANG['more_details']), 'JL_DELETE' => TextHelper::to_js_string(LangLoader::get_message('delete', 'common')), 'JL_ADD_SUB_ELEMENT' => TextHelper::to_js_string($LANG['add_sub_element']), 'JL_ADD_SUB_MENU' => TextHelper::to_js_string($LANG['add_sub_menu'])));
//Localisation possibles.
$block = retrieve(GET, 's', Menu::BLOCK_POSITION__HEADER, TINTEGER);
$array_location = array(Menu::BLOCK_POSITION__HEADER => $LANG['menu_header'], Menu::BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], Menu::BLOCK_POSITION__LEFT => $LANG['menu_left'], Menu::BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], Menu::BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], Menu::BLOCK_POSITION__RIGHT => $LANG['menu_right'], Menu::BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], Menu::BLOCK_POSITION__FOOTER => $LANG['menu_footer']);
$edit_menu_tpl = new FileTemplate('admin/menus/menu_edition.tpl');
$edit_menu_tpl->put_all(array('L_NAME' => $LANG['name'], 'L_IMAGE' => LangLoader::get_message('form.picture', 'common'), 'L_URL' => $LANG['url'], 'L_PROPERTIES' => $LANG['properties'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD_SUB_ELEMENT' => $LANG['add_sub_element'], 'L_ADD_SUB_MENU' => $LANG['add_sub_menu'], 'L_MORE' => $LANG['more_details'], 'L_DELETE' => LangLoader::get_message('delete', 'common')));
$menu = null;
if ($menu_id > 0) {
    $menu = MenuService::load($menu_id);
    if (!$menu instanceof LinksMenu) {
        AppContext::get_response()->redirect('menus.php');
    }
    $block = $menu->get_block();
} else {
    // Create a new generic menu
    $menu = new LinksMenu('', '', '', LinksMenu::AUTOMATIC_MENU);
}
$tpl->put_all(array('IDMENU' => $menu_id, 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $menu->get_auth(), array(), 'menu_element_' . $menu->get_uid() . '_auth'), 'C_ENABLED' => !empty($menu_id) ? $menu->is_enabled() : true, 'C_MENU_HIDDEN_WITH_SMALL_SCREENS' => $menu->is_hidden_with_small_screens(), 'MENU_ID' => $menu->get_id(), 'MENU_TREE' => $menu->display($edit_menu_tpl, LinksMenuElement::LINKS_MENU_ELEMENT__FULL_DISPLAYING), 'MENU_NAME' => $menu->get_title(), 'MENU_URL' => $menu->get_url(true), 'MENU_IMG' => $menu->get_image(true), 'ID' => $menu->get_uid()));
foreach (LinksMenu::get_menu_types_list() as $type_name) {
    $tpl->assign_block_vars('type', array('NAME' => $type_name, 'L_NAME' => $LANG[$type_name . '_menu'], 'SELECTED' => $menu->get_type() == $type_name ? ' selected="selected"' : ''));
}
foreach ($array_location as $key => $name) {
    $tpl->assign_block_vars('location', array('C_SELECTED' => $block == $key, 'VALUE' => $key, 'NAME' => $name));
}
//Filtres
MenuAdminService::add_filter_fieldset($menu, $tpl);
$tpl->put_all(array('ID_MAX' => AppContext::get_uid()));
$tpl->display();
require_once PATH_TO_ROOT . '/admin/admin_footer.php';