midcom_baseclasses_components_navigationBase class to encaspulate a NAP interface. Does all the neccessary work for setting the object to the right topic. you just have to fill the gaps for getting the leaves and node data.
Normally, it is enough if you override the members list_leaves() and get_node(). You usually don't even need to write a constructor, as the default one should be enough for your purposes. If you need extra initialization work done when "entering" a topic, use the event handler _on_set_object().
Located in /midcom/baseclasses/components/navigation.php (line 23)
| Class | Description |
|---|---|
midcom_helper_helloworld_navigation
|
MidCOM Hello World NAP interface class. |
midcom_helper_search_navigation
|
MidCOM Indexer Front-End, NAP interface Class |
net_nemein_calendar_navigation
|
Calendar NAP interface class. |
net_nemein_hourview_navigation
|
Net.nemein.hourview NAP interface class. |
no_odindata_quickform_navigation
|
Base class to encaspulate a NAP interface. Does all the neccessary work for setting the object to the right topic. you just have to fill the gaps for getting the leaves and node data. |
string
$_component
= '' (line 38)
Internal helper, holds the name of the component. Should be used whenever the components' name is required instead of hardcoding it.
Component state variable, set during startup. There should be no need to change it in most cases.
Array
$_component_data
= null (line 45)
Component data storage area.
Component state variable, set during startup. There should be no need to change it in most cases.
midcom_helper_configuration
$_config
= null (line 59)
The current configuration.
Component state variable, set during startup. There should be no need to change it in most cases.
midcom_helper_services_i18n
$_i18n
= null (line 66)
A handle to the i18n service.
Component state variable, set during startup. There should be no need to change it in most cases.
midcom_services__i18n_l10n
$_l10n
= null (line 73)
The components' L10n string database
Component state variable, set during startup. There should be no need to change it in most cases.
midcom_services__i18n_l10n
$_l10n_midcom
= null (line 80)
The global MidCOM string database
Component state variable, set during startup. There should be no need to change it in most cases.
MidgardTopic
$_topic
= null (line 52)
The topic for which we are handling a requiest.
Component state variable, set during startup. There should be no need to change it in most cases.
Create the navigation instance, the constructor doesn't do anything yet, startup is handled by initialize().
Leaf listing function, the default implementation returns an empty array indicating no leaves. Note, that the active leaf index set by the other parts of the component must match one leav out of this list.
Here are some code fragments, that you usually connect through some kind of while $articles->fetch() loop:
- <?php
- // Prepare the toolbar
- $toolbar[50] = Array(
- MIDCOM_TOOLBAR_URL => '',
- MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'),
- MIDCOM_TOOLBAR_HELPTEXT => null,
- MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
- MIDCOM_TOOLBAR_ENABLED => true
- );
- $toolbar[51] = Array(
- MIDCOM_TOOLBAR_URL => '',
- MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'),
- MIDCOM_TOOLBAR_HELPTEXT => null,
- MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png',
- MIDCOM_TOOLBAR_ENABLED => true
- );
- while ($articles->fetch ()) {
- // Match the toolbar to the correct URL.
- $toolbar[50][MIDCOM_TOOLBAR_URL] = "edit/{$articles->id}.html";
- $toolbar[51][MIDCOM_TOOLBAR_URL] = "delete/{$articles->id}.html";
- $leaves[$articles->id] = array
- (
- MIDCOM_NAV_SITE => Array
- (
- MIDCOM_NAV_URL => $articles->name . ".html",
- MIDCOM_NAV_NAME => ($articles->title != "") ? $articles->title : $articles->name
- ),
- MIDCOM_NAV_ADMIN => Array
- (
- MIDCOM_NAV_URL => "view/" . $articles->id,
- MIDCOM_NAV_NAME => ($articles->title != "") ? $articles->title : $articles->name
- ),
- MIDCOM_NAV_GUID => $articles->guid(),
- MIDCOM_NAV_TOOLBAR => $toolbar,
- MIDCOM_META_CREATOR => $articles->creator,
- MIDCOM_META_EDITOR => $articles->revisor,
- MIDCOM_META_CREATED => $articles->created,
- MIDCOM_META_EDITED => $articles->revised
- )
- }
- return $leaves;
- ?>
Return the node configuration. This defaults to use the topic the NAP instance has been set to directly. You can usually fall back to this behavoir safely, adding a toolbar using the $toolbar parameter in child classes.
So you'd probably do something like this:
- <?php
- $toolbar = Array();
- $toolbar[100] = Array
- (
- MIDCOM_TOOLBAR_URL => 'config.html',
- MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'),
- MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'),
- MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png',
- MIDCOM_TOOLBAR_ENABLED => true
- );
- return parent::get_node($toolbar);
- ?>
The default uses the extra field of the topic as NAV_NAME, which is the default set by MidCOM AIS and shouldn't be changed therefore.
Initialize the NAP class, sets all state variables.
Set a new content object. This updates the local configuration copy with the topic in question. It calls the event handler _on_set_object after initializing everything in case you need to do some custom initializations as well.
Event handler called after a new topic has been set. The configuration is already loaded at this point.
Documentation generated on Mon, 21 Nov 2005 18:20:32 +0100 by phpDocumentor 1.3.0RC3