Class ThemeRosalina

Description

this class implements the rosalina theme (based on HV Menu

Located in /program/themes/rosalina/rosalina.class.php (line 31)

Theme
   |
   --ThemeRosalina
Variable Summary
 array $menu_sub
 array $menu_top
Method Summary
 void ThemeRosalina (array $theme_record, int $area_id, int $node_id)
 string get_html ()
 string get_logo ([string $m = ''])
 string get_menu_areas ([string $m = ''])
 string get_quickbottom ([string $m = ''])
 string rosalina_get_page_head ([string $m = ''])
 string rosalina_hotspot_map (bool $logged_in, string $mapname, int $hotspots, array $parameters, [string $m = ''])
 string rosalina_hvmenu ([string $m = ''])
 string rosalina_hvmenu_config ([string $m = ''])
 int rosalina_menucount (int $node_id)
 int rosalina_menuwidth (int $node_id)
 string rosalina_navigation_menu ([string $m = ''])
 string rosalina_show_tree_walk ([string $m = ''], int $subtree_id, string $menu_name, int $width_px)
Variables
Methods
Constructor ThemeRosalina (line 55)

construct a ThemeRosalina object

First we do the regular initialisation, and subsequently we calculate the areas available to this user in $this->jumps; Also we set all hvmenu-parameters that are not already set in $this->config. This makes it possible to drop certain parameters from the configuration (see rosalina_install()) and still construct a valid hvmenu config.

Finally we pre-calculate the limits $menu_top and $menu_width for use in the treewalker (see rosalina_show_tree_walk()).

void ThemeRosalina (array $theme_record, int $area_id, int $node_id)
  • array $theme_record: the record straight from the database
  • int $area_id: the area of interest
  • int $node_id: the node that will be displayed
get_html (line 137)

construct an output page in HTML

This constructs a full HTML-page, starting at the DTD and ending with the html closing tag.

  • return: complete HTML-page, ready for output
string get_html ()

Redefinition of:
Theme::get_html()
construct an output page in HTML
get_logo (line 259)

construct an image tag with the area logo

This constructs HTML-code that displays the logo, maybe in the form of a clickable map.

This routine honours the preview_mode by replacing the URLs with a bare "#" in order to prevent the visiter to actually surf away from a preview

  • return: constructed image tag
  • todo: should we take path_info into account here too???? how about /area/aaa/node/nnn instead of /aaa/nnn???
string get_logo ([string $m = ''])
  • string $m: left margin for increased readability

Redefinition of:
Theme::get_logo()
construct an image tag with the area logo
get_menu_areas (line 607)

construct a simple UL-based jump menu to select another area (when no Javascript is available)

this constructs a list of clickable links to navigate to other areas. This function is only used when the user has disabled Javascript (it is sandwiched between noscript-tags, see get_html()). Note that there is no point in having a jump menu when there is not at least another area. If there is only one, an empty string is returned

  • return: ready-to-use HTML or empty string if not at least 2 areas are available
  • uses: $WAS_SCRIPT_NAME
string get_menu_areas ([string $m = ''])
  • string $m: left margin for increased readability
get_quickbottom (line 635)

construct a list of quicklinks for bottom of page (if any) ending with a separator

This is a slight variation of parent::get_quickbottom(): if there is at least one quicklink at the bottom, we append a quickbottom separator to the result in order to visually separate the quicklinks at the left from the appropriate legal notices.

string get_quickbottom ([string $m = ''])
  • string $m: left margin for increased readability

Redefinition of:
Theme::get_quickbottom()
construct a list of quicklinks for bottom of page (if any)
rosalina_get_page_head (line 224)

construct the page top

  • return: ready to use HTML
string rosalina_get_page_head ([string $m = ''])
  • string $m: left margin for increased readability
rosalina_hotspot_map (line 337)

create a hotspot map for the logo

This constructs an HTML map called $mapname, with $hotspots shapes linked to the corresponding URLs. Note that this routine honours the the preview_mode by replacing URLs with a bare "#".

The construction of this map is performed by consulting the theme configuration. The shapes are defined via a single string per item, e.g. $parameters['logo_hotspot_1']. However, note that $parameters may contain more information than just these shape definitions (as a matter of fact it is simply a copy of the _full_ theme configuration of this area).

A shape definition line should look like this:

shape ";" coords ":" href ";" title ";" alt_href ";" alt_title ";" target

where the first three components are mandatory (shape, coords, href) and the rest is optional. As a rule a hotspot is linked to 'href' and 'title'. However, if the user is logged_in, the alternative parameters 'alt_href' and 'alt_title' area used instead. This allows for a single hotspot acting diffently based on the logged in status. If no alternative href/title is defined, the standard href/title are used. The last parameter indicates the target of the link. By default it is undefined which implies the same browser window. It could be '_blank' to open in a fresh window. Note that the target parameter only works when NOT in preview mode (otherwise they could still escape from the preview window).

Example: If the definition would be

    "rectangle;0,0,284,71;/index.php?login=1;Login;/index.php?logout=1;Logout"
the hotspot would link to the login-box when the user is NOT logged in, and the user would be logged out when she was already logged in.

  • return: ready to use HTML
string rosalina_hotspot_map (bool $logged_in, string $mapname, int $hotspots, array $parameters, [string $m = ''])
  • bool $logged_in: use the alternative href/title if available
  • string $mapname: name of the HTML-map
  • int $hotspots: the number of hotspots to create
  • array $parameters: an array holding (among other items) the $hotspots hotspot definition lines
  • string $m: left margin for increased readability
rosalina_hvmenu (line 472)

construct the necessary JavaScript code for definition of HV Menu

this constructs the necessary configuration Array's for HV Menu. The first menu (menu at the top level) can be either Horizontal or Vertical. In the latter case we need to calculate the width of the menu in pixels (#width_px) based on the longest menu item. In the former case every item has its own individual length. This is indicated to the treewalker by setting $width_px to 0.

  • return: ready to use HTML
  • uses: $CFG
string rosalina_hvmenu ([string $m = ''])
  • string $m: left margin for increased readability
rosalina_hvmenu_config (line 430)

construct the necessary JavaScript that HV Menu needs

the configuration of HV Menu is stored in the theme configuration in $this->config. Note that the names of the parameters are carefully chosen to match those that HV Menu expects. These parameters can be recognised by the first 7 ASCII-characters in their names, i.e. they all start with 'hvmenu_'.

The PHP variable type determines how we translate the value of these parameters to the correct JavaScript form. The array with pointers to images of arrows Arrws is a special case. The values 'float' parameters get 2 decimals for completeness' sake. Booleans map to integers 1 (True) and 0 (False).

Another exception is the HV Menu-parameter NoOffFirstLineMenus (sic), The number of top level menu items is the number of (visible) items in the tree.

  • return: ready to use HTML
string rosalina_hvmenu_config ([string $m = ''])
  • string $m: left margin for increased readability
rosalina_menucount (line 585)

calculate the number of items in the section (menu) starting at $node_id

this steps through the linked list (section ) starting at $node_id and simply counts the number of visible items

  • return: number of menu items
int rosalina_menucount (int $node_id)
  • int $node_id: indicates where to start
rosalina_menuwidth (line 566)

calculate the maximum-width of the items in the section (menu) starting at $node_id

this steps through the linked list (section ) starting at $node_id and determines the maximum width of the link text of visible items, expressed in characters (not bytes)

  • return: maximum width in characters
int rosalina_menuwidth (int $node_id)
  • int $node_id: indicates where to start
rosalina_navigation_menu (line 374)

construct the navigation menu

This implements the HV Menu by Ger Versluis.

  • return: ready to use HTML (including JavaScript)
  • uses: $CFG
string rosalina_navigation_menu ([string $m = ''])
  • string $m: left margin for increased readability
rosalina_show_tree_walk (line 509)

this treewalker shows the current menu and descends recursively

this routine creates a menu and descends intoe any submenus (sections)

Note that we expect the caller to pre-calculate the width of the menu items (in $width_px). However, if $width_px is 0, we calculate individual widths per item, using the limits from $tis->menu_top, because only rosalina_hvmenu() can call us with $width_px = 0 and thus we are creating the top level menu. Any submenus are constructed by recursion and this routine never calls itself with $width_px = 0.

  • return: ready to use HTML
string rosalina_show_tree_walk ([string $m = ''], int $subtree_id, string $menu_name, int $width_px)
  • string $m: left margin for increased readability
  • int $subtree_id: starting node of this menu
  • string $menu_name: base name of the corresponding JavaScript menu
  • int $width_px: the precalculated width of this menu OR 0 if individual widths wanted (only at top level)

Inherited Methods

Inherited From Theme

 Theme::Theme()
 Theme::add_content()
 Theme::add_html_header()
 Theme::add_http_header()
 Theme::add_message()
 Theme::add_meta()
 Theme::add_meta_http_equiv()
 Theme::add_popup_bottom()
 Theme::add_popup_top()
 Theme::add_stylesheet()
 Theme::calc_breadcrumb_trail()
 Theme::construct_tree()
 Theme::dump_subtree()
 Theme::get_address()
 Theme::get_bazaar_style_style()
 Theme::get_bottomline()
 Theme::get_content()
 Theme::get_div_breadcrumbs()
 Theme::get_div_messages()
 Theme::get_html()
 Theme::get_html_head()
 Theme::get_jumpmenu()
 Theme::get_lines()
 Theme::get_logo()
 Theme::get_menu()
 Theme::get_navigation()
 Theme::get_popups()
 Theme::get_properties()
 Theme::get_quickbottom()
 Theme::get_quicklinks()
 Theme::get_quicktop()
 Theme::node2anchor()
 Theme::queue_alert()
 Theme::send_headers()
 Theme::send_output()
 Theme::set_preview_mode()
 Theme::show_tree_walk()

Documentation generated on Tue, 28 Jun 2016 19:11:22 +0200 by phpDocumentor 1.4.0