This class is the basic building stone of the Navigation Access Point System of MidCOM.
It is responsible for collecting the available Information and for building the navigational Tree out of it. This class is only the internal interface to the NAP System and is used by midcom_helper_nav as a node cache. The framework should ensure that only one class of this type is active at one time.
Basicnav will give you a very abstract view of the content tree, modified by the NAP classes of the components. You can retrieve a node/leaf tree of the content, and for each element you can retrieve a URL name and a long name for Navigation display.
Leaves and Nodes are both indexed by Integer constants which are assigned by the framework. The framework defines two starting points in this tree: The root node and the "current" node. The current node defined through the topic of the component that declared to be able to handle the request.
The class will load the necessary information on demand to minimize database traffic.
The interface functions should enable you to build any navigation tree you desire. The public nav class will give you some of those high-level functions.
Node data interchange format
Node NAP data consists of a simple key => value array with the following keys required by the component:
Basically for each leaf the usual meta information is returned:
Backwards support for MIDCOM_NAV_SITE is an array that contains both MIDCOM_NAV_URL and MIDCOM_NAV_NAME
MIDCOM_NAV_SITE => array
(
MIDCOM_NAV_URL => URL of the leaf element
MIDCOM_NAV_NAME => Name of the leaf element
),The Datamanager will automatically transform (3) to the syntax described in (1) by copying the values.
Important note: The difference outlined above is only valid for leaves (read "articles"), because the topic structure is essentially the same in both AIS and live Site.
Toolbar Syntax
You can add toolbars to your NAP information, that can be used for simple on-site editing. They are indexed using integers and consist of an midcom_helper_toolbar::add_item() compatible array with one exception: The URL is always relative to the AIS topic welcome page, but see the example (it assumes that the referenced l10n libraries are available, of course):
You can now use a similar in your leaf data and place further buttons between these two using indexes like 50,51,52.
DEPRECATED INFORMATION
Key MIDCOM_NAV_VISIBLE is deprecated from MidCOM 2.4.0 on, visibility is taken into account automatically. The key is set to true for all values now for backwards compatibility and will be removed entirely in MidCOM 2.6.0
Keys MIDCOM_NAV_ADMIN and MIDCOM_NAV_SITE are both deprecated as of MidCOM 2.8. MIDCOM_NAV_ADMIN will not work at all and MIDCOM_NAV_SITE will still be supported during the transition phase, but only if either MIDCOM_NAV_URL or MIDCOM_NAV_NAME are empty.
Located in /midcom.core/midcom/helper/_basicnav.php (line 129)
Constructor
The only constructor of the Basicnav class. It will initialize Root-Topic, Current-Topic and all cache arrays. The function will load all nodes between root and current node.
If the current node is behind an invisible or undescendable node, the last known good node will be used instead for the current node.
The constructor retrieves all initialisation data from the component context. A special process is used, if the context in question is of the type MIDCOM_REQUEST_CONTENTADM: The system then goes into Administration Mode, querying the components for the administrative data instead of their regular data. In addition, the root topic is set to the administrated topic instead of the regular root topic. This way you can build up Admin Interface Navigation for "external" trees.
Retrieve the ID of the currently displayed leaf. This is a leaf that is displayed by the handling topic. If no leaf is active, this function returns FALSE. (Remember to make a type sensitve check, e.g.
nav::get_current_leaf() !== false to distinguish "0" and "false".)
Retrieve the ID of the currently displayed node. Defined by the topic of the component that declared able to handle the request.
This will give you a key-value pair describeing the leaf with the ID $node_id. The defined keys are described above in leaf data interchange format. You will get false if the leaf ID is invalid.
Returns the ID of the node to which $leaf_id is associated to, false on failure.
This is a helper function used by midcom_helper_nav::resolve_guid(). It checks if the object denoted by the passed GUID is already loaded into memory and returns it, if available. This should speed up GUID lookup heavy code.
Access is restricted to midcom_helper_nav::resolve_guid().
This will give you a key-value pair describeing the node with the ID $node_id. The defined keys are described above in Node data interchange format. You will get false if the node ID is invalid.
Returns the ID of the node to which $node_id is associated to, false on failure. The root node's uplink is -1.
Retrieve the ID of the root node. Note that this ID is dependent from the ID of the MidCOM Root topic and therefore will change as easily as the root topic ID might. The MIDCOM_NAV_URL entry of the root node's data will always be empty.
Lists all leaves of $parent_node. If there are no leaves you will get an empty array, if there was an error (for instance an unknown parent node ID) you will get FALSE.
Lists all Sub-nodes of $parent_node. If there are no subnodes you will get an empty array, if there was an error (for instance an unknown parent node ID) you will get FALSE.
Verifies the existence of a given leaf. Call this before getting a leaf from the $_leaves cache. It will load all necessary nodes/leaves as necessary.
Load the Navigational information associated with the topic $param, which can be passed as an ID or as a MidgardTopic object. This is differentiated by the flag $idmode (true for id, false for MidgardTopic).
This method does query the topic for all information and completes it to build up a full NAP data structure
It determines the URL_NAME of the topic automatically using the name of the topic in question.
The currently active leaf is only queried if and only if the currently processed topic is equal to the current context's content topic. This should prevent dynamically loaded components from disrupting active leaf information, as this can happen if dynamic_load is called before showing the navigation.
Loads the leaves for a given node from the cache or database.
It will relay the code to _get_leaves() and check the object visibility upon return.
Documentation generated on Fri, 10 Oct 2008 22:15:19 +0300 by phpDocumentor 1.4.2