Class ThemeRuta

Description

/program/themes/ruta/ruta.class.php - the class that implements the theme

Located in /program/themes/ruta/ruta.class.php (line 27)

Theme
   |
   --ThemeRuta
Variable Summary
Method Summary
 void ThemeRuta (array $theme_record, int $area_id, int $node_id)
 string alt_show_tree_walk ([string $m = ''], int $subtree_id, int $max_level)
 string get_altnavigation ([string $m = ''], [bool $textonly = FALSE])
 string get_bazaar_style_style ([string $m = ''])
 string get_bottomline ([string $m = ''])
 void get_html ()
 string get_menu ([string $m = ''], [int $menu_id = NULL])
 string get_menunavigation ([string $m = ''], [bool $textonly = FALSE])
 string get_navigation ([string $m = ''], [bool $textonly = FALSE])
 string ruta_get_background (int $index, [bool $fully_qualified = FALSE], [string $m = ''])
 string ruta_get_sidebar (array $sidebar_nodes, [string $m = ''])
 string ruta_get_sidebar_htmlpage (in $index, int $node_id, [string $m = ''])
 bool|array ruta_sidebar_nodes_modules (int $index)
 string show_menu_js ([ $m = ''])
Variables
Methods
Constructor ThemeRuta (line 40)

construct a ThemeRuta object

void ThemeRuta (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
alt_show_tree_walk (line 756)

workhorse for constructing alternative recursive menu (walk the tree)

construct nested (sub)menus for a depth of at most $max_level, unless we hit the breadcrumb trail in which case we carry on nesting. The (sub)menus are constructed in the form of nested UL's with LI's.

The level of recursion of the list items (LI) is indicated via class='levelNNN'. The type of item is indicated via class='page' or class='section'. Also, the item has an addional class='current' when it is part of the breadcrumb trail. Finally a current item also has the additional class 'activepage' or 'activesection' which makes the CSS easier.

The actual A-tag of the link only indicates being part of the breadcrumb trail via class='current'.

It is up to the style sheet to visualise these items taking all variants into account. Note that we only process visible pages and sections.

Note: this routine looks very much like {@see show_tree_walk()}. The difference is the limit $max_level.

  • return: properly indented ready-to-use HTML
string alt_show_tree_walk ([string $m = ''], int $subtree_id, int $max_level)
  • string $m: left margin for increased readability
  • int $subtree_id: indicates where to start this (sub)menu
  • int $max_level: maximum nesting displayed if not breadcrumbs
get_altnavigation (line 709)

create alternative navigation in case Javascript is not available

This creates separated DIVs, one for each item in the main navigation bar, each containing the corresponding submenu. This whole alternative navigation DIV is set to display: none using Javascript. If there is no Javascript, it remains visible. The submenus are displayed for up to 2 levels deep, unless the current breadcrumb trail leads deeper into the tree. This way most of the important nodes are reachable.

  • return: properly indented ready-to-use HTML
string get_altnavigation ([string $m = ''], [bool $textonly = FALSE])
  • string $m: left margin for increased readability
  • bool $textonly: forces a text-type link even when a navigation image is stipulated
get_bazaar_style_style (line 616)

insert special rotating background banner in bazaar style style in header

the background style is precomputed onceand stored in $this->ruta_header_background. This extends the original routine in such a way that the calculated background is inserted _before_ the used-defined BSSS. This means that the user can overrule the background image information if she wants to.

  • return: empty string or ready to use HTML with header and Bazaar Style Style
string get_bazaar_style_style ([string $m = ''])
  • string $m: margin for increased readability

Redefinition of:
Theme::get_bazaar_style_style()
collect bazaar style style from area and nodes
get_bottomline (line 269)

show footer text, maybe some quicklinks and 'powered by'

  • return: performance report
string get_bottomline ([string $m = ''])
  • string $m: left margin for increased readability

Redefinition of:
Theme::get_bottomline()
show 'powered by' and (maybe) report basic performance indicators
get_html (line 115)
void get_html ()

Redefinition of:
Theme::get_html()
construct an output page in HTML
get_menu (line 237)

construct the submenu starting at $menu_id OR the first breadcrumb in the top level menu

this constructs an 'infinitely' nested set of submenus, starting at $menu_id or at the first breadcrumb in the top level menu (if any). If there are no suitable nodes, an empty string is returned.

this is largely the same routine as parent::get_menu(). Difference is that here we may add a menu title to the menu IF the first item in the breadcrumb trail is a visible section

string get_menu ([string $m = ''], [int $menu_id = NULL])
  • string $m: left margin for increased readability
  • int $menu_id: indicates where to start the menu (NULL = first breadcrumb in top level menu)

Redefinition of:
Theme::get_menu()
construct the submenu starting at $menu_id OR the first breadcrumb in the top level menu
get_menunavigation (line 675)

construct a top level menu (navigation bar)

walk through the top level of the menu tree and create a link for each node. This variant of the top level navigation is to be displayed under the submenu in the left hand margin in case the screen is small (<650). In that case the main navigation bar is limited to 'MENU' and 'HOME' and the rest of the main navigation has to be available elsewhere. Different entries here are all members of the class 'menunavsub'.

  • return: properly indented ready-to-use HTML
string get_menunavigation ([string $m = ''], [bool $textonly = FALSE])
  • string $m: left margin for increased readability
  • bool $textonly: forces a text-type link even when a navigation image is stipulated
get_navigation (line 636)

construct a top level menu (navigation bar) with an additional menu button

start with a menu-button (that can be made invisible via CSS) and subsequently walk through the top level of the menu tree and create a link for each node. the first real link gets a different class so we can keep the first real link visible while hiding the others via CSS. This is used to create a navbar with two links 'MENU' and 'HOME' on the small (<650px) screen.

Note that this MENU-button uses a tiny snippet of Javascript to toggle the menu.

  • return: properly indented ready-to-use HTML
string get_navigation ([string $m = ''], [bool $textonly = FALSE])
  • string $m: left margin for increased readability
  • bool $textonly: forces a text-type link even when a navigation image is stipulated

Redefinition of:
Theme::get_navigation()
construct a top level menu (navigation bar) as an unnumbered list (UL) of list items (LI)
ruta_get_background (line 502)

compute background image(s) based on current time and index

this routine returns a snippet of ready-to-use code to set a background image for #header. The images are different depending on the time of day and the $index parameter. The latter is thought to be the position of the current item in the main navigation (starting at 1) or 0 in case no item in the main navigation is current.

Configuration is done via two parameters: the paths in $this->config['header_banners_directories'] (one per line) and the interval in $this->config['header_banners_interval'].

The interval is expressed in minutes. It means that a particular page has the same background image for the duration of the interval and another one in the next interval. The banners directories are supposed to contain banner files of the correct dimensions, e.g. 650x71 (small), 980x170 (medium) or 1440x240 (large).

If the specified directory starts with a '/' it is assumed to start in the data root, e.g. something like /areas/exemplum/banners. This will eventually lead to a URL of the form /file.php/areas/exemplum/banners/mentha-banner.jpg using was_file_url()

If the specified directory does NOT start with a '/' it is assumed to be a directory relative to the directory where index.php and friends live, unless it starts with 'program/' in which case it is a static dir somewhere in the program hierarchy. This is done via was_url().

Note: if files are found in a directory, the names are sort()ed so there is a chance that the three files are the same ones independent of the physical order in the file system directory.

string ruta_get_background (int $index, [bool $fully_qualified = FALSE], [string $m = ''])
  • int $index: indicates current main navigation item or 0 for none
  • bool $fully_qualified: TRUE forces URLs with scheme, authority etc.
  • string $m: margin added for readability
ruta_get_sidebar (line 411)

retrieve data for sidebar

this retrieves the content of the various sidebar blocks (if any) currently only the htmlpage module is supported.

  • return: ready-to-use HTML-code
string ruta_get_sidebar (array $sidebar_nodes, [string $m = ''])
  • array $sidebar_nodes: contains node-module pairs to show
  • string $m: add to human readability
ruta_get_sidebar_htmlpage (line 444)

retrieve page data for htmlpage module on a node

this retrieves data from the page $node_id (requires knowledge of internals of htmlpage module/table) in order to show that in a box in the 3rd column. The content is wrapped in a div which has a unique ID of the form sidebar_blockN where N counts from 1 upward and a common class sidebar_htmlpage. This allows for connecting style information to a particular sidebar block in a flexible way.

  • return: ready-to-use HTML-code
string ruta_get_sidebar_htmlpage (in $index, int $node_id, [string $m = ''])
  • in $index: block number (1-based)
  • int $node_id: identifies the pagedata to retrieve
  • string $m: increased readbility
ruta_navigation_index (line 290)

calculate the index of the current main navigation item

this routine determines which main menu item is the current one, starting at 1. if no menu item is current, the function returns 0.

This index is used for two purposes:

  • calculating an ever changing background image for the header, and
  • determining which item of the comma-delimited pagenumbers to use for the sidebar.

  • return: index of current main menu item or 0 if none
int ruta_navigation_index ()
ruta_sidebar_nodes_modules (line 343)

compute the list of sidebar blocks for a main menu item

this constructs an ordered array of node_id's corresponding to the current main menu item. If the current main menu_item indicates no sidebar then FALSE is returned.

The basis for the node_ids to return is the contents of the parameter 'sidebar_nodelist'. This is a comma-delimited string containing node_ids, zeros or dashes.

Example: suppose sidebar_nodelist contains "5,0,0,0,-". If the first item of the main menu is current (ie. is part of the breadcrumb trail), the node with node_id = 5 is examined. If it is a page and the module is supported, this page's node_id is returned. If, however, this is a section, all supported pages within that section are returned. For main menu items 2, 3 and 4 a '0' is specified. This means that no pages will be displayed (an empty array is returned). For main menu item 5 a dash ('-') is specified. This yields a return value of FALSE which must be interpreted as 'suppress the complete 3rd column of the page, including rightmargin_top and rightmargin_bottom. This effectively reduces the 3-column layout to a 2-column layout.

Note that the node_ids in the sidebar_nodelist themselves must not be under embargo but a hidden section (with visible pages) is OK.

Note that when there are more main menu items than entries in the sidebar_nodelist, the value '0' is assumed.

Finally, if no main menu item is current (eg. the visitor arrived on a page via quicktop entries) then the value of '0' is assumed, too.

  • return: FALSE if no sidebar at all or an array node=>module pairs
bool|array ruta_sidebar_nodes_modules (int $index)
  • int $index: is the current main menu item or 0 for none
show_menu_js (line 799)

insert code for toggling the menu/free HTML in the left hand margin

  • return: ready-to-use Javascript-code sandwiched between script-tags
string show_menu_js ([ $m = ''])
  • $m

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:30 +0200 by phpDocumentor 1.4.0