Class ThemeCornelia

Description

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

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

Theme
   |
   --ThemeCornelia
Method Summary
 ThemeCornelia ThemeCornelia ( $theme_record,  $area_id,  $node_id)
 string cornelia_get_background_url (int $index, [bool $fully_qualified = FALSE])
 string cornelia_get_sidebar (array $sidebar_nodes, [string $m = ''])
 string cornelia_get_sidebar_htmlpage (in $index, int $node_id, [string $m = ''])
 bool|array cornelia_sidebar_nodes_modules (int $index)
 string get_bottomline ([string $m = ''])
 string get_html ()
 string get_menu ([string $m = ''], [int $menu_id = NULL])
 string get_quicktop ([string $m = ''])
Variables
Methods
Constructor ThemeCornelia (line 29)
ThemeCornelia ThemeCornelia ( $theme_record,  $area_id,  $node_id)
  • $theme_record
  • $area_id
  • $node_id
cornelia_get_background_url (line 536)

compute URL for a background image based on current time and index

this routine returns a URL to be used as a background image. The URL is 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 path in $this->config['header_banners_directory'] 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 directory is supposed to contain banner files of the correct dimensions, e.g. 980x170.

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().

string cornelia_get_background_url (int $index, [bool $fully_qualified = FALSE])
  • int $index: indicates current main navigation item or 0 for none
  • bool $fully_qualified: if TRUE forces the URL to contain a scheme, authority etc.
cornelia_get_sidebar (line 432)

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 cornelia_get_sidebar (array $sidebar_nodes, [string $m = ''])
  • array $sidebar_nodes: contains node-module pairs to show
  • string $m: add to human readability
cornelia_get_sidebar_htmlpage (line 465)

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 cornelia_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
cornelia_navigation_index (line 311)

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 cornelia_navigation_index ()
cornelia_sidebar_nodes_modules (line 364)

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 cornelia_sidebar_nodes_modules (int $index)
  • int $index: is the current main menu item or 0 for none
get_bottomline (line 289)

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 80)

construct an output page in HTML

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

The page is constructed using nested DIVs, the layout is taken care of in separate style sheets. All knowledge about the structure of the page is contained in this routine.

As a rule the layout is based on three columns. The left hand column contains free form HTML, the menu and more free form HTML. The right hand column contains free form HTML, the contents of 0, 1 or more html-pages and more free form HTML. The column in the middle holds the actual content.

The list of html-pages to show in the right hand column is configurable per main menu item. A '0' (zero) means: no page, a page number means that page, a section number means all html-pages in that section and a dash ('-') means: suppress the right hand side column completely. This also inserts an additional stylesheet to style the 2-column layout. There is also a speial print stylesheet. This is included after the user clicks the special print link. Note that the stylesheets are added only once, in the order 'style.css', 'style2.css' and finally 'print.css' (if applicable).

The contents of the various DIVs is constructed in various helper routines in order to make this routine easy to read (by humans that is). The various helper routines all are called with a string of space characters; this should improve the the readability of the page that is generated eventually.

The header background changes every N minutes (N=configurable between 0 and 60). Also, the choice of background image is linked to the currently selected item in the main navigation.

Note that the routine $this->get_div_messages() does in fact generate its own DIV tags. This is done in order to completely get rid of the message DIV, we do not even want to see an empty DIV if there are no messages.

The same logic applies to the breadcrumb trail.

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

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

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_quicktop (line 217)

construct a list of quicklinks for top of page (if any) + (maybe) a print-button

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

Redefinition of:
Theme::get_quicktop()
construct a list of quicklinks for top of page (if any)

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