Shortcodes:Admin

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page

logo_wiki.png

Current Release 1.0.4 | e107.org | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes


e107 Shortcode Guide
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes



These shortcodes are those used in the admin area of your site.

Contents

{ADMIN_ALT_NAV}

New to .7 is the inclusion in core of the nice drop down navigation menu created by Mike Hall of Brainjar. To use this menu in your admin theme you can use the {ADMIN_ALT_NAV} shortcode in your admin_template.php. If you have not already done so, copy e107_themes/templates/admin_template.php to your themes root directory before editing it.

Unlike most shortcodes, this shortcode requires an additional measure to use. You need to add this code to your theme.php:

Code: theme.php snippet
function theme_head() {
   return "<link rel='stylesheet' href='".e_FILE."nav_menu.css' />\n";
} 

If you would like to style the menu by overriding the default style, copy e107_files/nav_menu.css to your themes root directory. Edit the CSS as you wish and then change the above code you entered into your theme.php to:

Code: theme.php snippet
function theme_head() {
   return "<link rel='stylesheet' href='".THEME."nav_menu.css' />\n";
} 


You can also tailor the javascript itself to your requirements by copying e107_files/nav_menu.js to your themes root directory and editing it as needed.

To change the image icons displayed in the menu please read the section of this manual on admin icons.

A front end version of this menu is also available in core by adding the shortcode {SITELINKS_ALT} to your theme.php. This will share the same stylesheet as your admin menu that we required above so the two menus will match in style.

{ADMIN_DOCS}

This shortcode displays a menu containing links to all the admin help documentation.

{ADMIN_HELP}

This shortcode displays a menu containing help documentation for the core admin page or plugin admin config page that the user is currently viewing. If no help for the page exists, the menu isnt rendered.

{ADMIN_ICON}

Every core admin page has a corresponding 32px x 32px icon registered to it. This shortcode will display this icon in the location you place it in your themes admin_template.php.

Plugins are also able to register a 32px x 32px icon which will also be displayed by this shortcode when the user is on the plugins admin config page(s). If the plugin doesnt have this icon, then a generic plugins icon will be displayed instead.

{ADMIN_LANG}

This shortcode outputs a menu containing a language selector for use with multilanguage. If multilanguage is not enabled, the menu will not be displayed.

{ADMIN_LATEST}

This shortcode displays information regarding latest details of the sites activity since the administrator was last logged in. This includes details such as number of news items submitted, files uploaded, etc.

Plugins are also able to register to display information in this menu, for example, the forum plugin registers with the menu to display the number of reported forum posts since the admins last visit. For details of how to enable your own plugin to display in this menu, please see the relevant page in the plugin coding section of this manual.

There is an optional parameter with this shortcode which instructs it only to display when a page requests it. To use this feature, add the =request parameter to the shortcode in your admin_template.php like this:

 1. {ADMIN_LATEST=request} 

Currently the only page that requests the menu is the admin front page, admin.php. With this parameter specified, the menu will only display on this page and not the rest of the site.

{ADMIN_LOG}

This shortcode displays a menu which contains a log of all admin activity so the admin can keep track of all changes that they and other admins of the site have made.

{ADMIN_LOGGED}

This shortcode displays the username of the admin who is currently logged in and a list of all the permissions the admin has.

{ADMIN_LOGO}

This shortcode displays the admin area logo located at e107_images/adminlogo.png.

{ADMIN_MENU}

This shortcode displays a menu on some core and plugin admin pages which contains extra navigation buttons for navigating to other pages of the configuration for that area.

You can style this menu by copying the show_admin_menu() function in e107_admin/header.php to your themes admin_template.php and editing it as required. Here is a copy of that function:

Code: example
function show_admin_menu($title, $page, $e107_vars, $js = FALSE, $js_include = FALSE) {
global $ns;
$text = "<div style='text-align:center; width:100%'><table class='fborder' style='width:98%;'>";
foreach ($e107_vars as $act => $value) {
    $pre = "";
    $post = "";
		if ($page == $act) {
			$pre = "<b>« ";
            $post = " »</b>";
        }
		$t = str_replace(" ", " ", $value['text']);
        if (!$value['perm'] || getperms($value['perm'])) {
            $on_click = $js ? "href=\"javascript:showhideit('".$act."');\"" : "href='{$value['link']}'";
            $text .= "<tr><td class='button'><div style='width:100%; text-align:center'>
	    <a style='cursor:hand; cursor:pointer; text-decoration:none;' ".$on_click." ".$js_include.">
	    {$pre}{$t}{$post}</a></div></td></tr>";
		}
    }
$text .= "</table></div>";
if ($title == "") {
        return $text;
}
$ns->tablerender($title, $text);
} 

You can see an edited version of this function in the core theme Jayya's admin_template.php as an example.


{ADMIN_MSG}

This shortcode displays a menu displaying a message to the administrator under certain circumstance. Its not often visible.

{ADMIN_NAV}

This shortcode displays a navigation menu to the admin for navigating their way around the admin area.

{ADMIN_PLUGINS}

This shortcode is designed for plugins to show information.

{ADMIN_PRESET}

This shortcode displays a menu on some admin pages which allows the administrator to take snapshots of their form entries and setting once they have filled them in, so that the next time they are editing the form they can copy this snapshot to the form to quicken the form filling process.

{ADMIN_PWORD}

This shortcode displays a menu warning the admin that they should change their password. It only displays if it has been 30 days since the admin last update their password.

{ADMIN_SEL_LAN}

This shortcode displays a line of text to indicate what language the administrator is currently working in. This shortcode only displays when multilaguage is activated.

{ADMIN_SITEINFO}

This shortcode displays a menu containing information about the site, including the site name, details of the theme in use, server details etc.

{ADMIN_STATUS}

This shortcode displays information regarding the overall status of the site. This includes details such as number of members, number of comments, number of banned users etc.

Plugins are also able to register to display information in this menu, for example, the forum plugin registers with the menu to display the total number of forum posts. For details of how to enable your own plugin to display in this menu, please see the relevant page in the plugin coding section of this manual.

There is an optional parameter with this shortcode which instructs it only to display when a page requests it. To use this feature, add the =request parameter to the shortcode in your admin_template.php like this:

  {ADMIN_STATUS=request} 

Currently the only page that requests the menu is the admin front page, admin.php. With this parameter specified, the menu will only display on this page and not the rest of the site.

{ADMIN_USERLAN}

This menu displays only if mulitlanguage is enabled. It displays the language currently selected.

{ADMIN_CREDITS}

Comming soon.