Class midcom_baseclasses_components_interface

Description

Baseclass to use for the component interface in MIDCOM.

The interface presented here superseeds all original component interface classes (COMPONENT, CONTENTADMIN, MIDCOM and NAP). The class uses an event based approache for subclasses to influence the default behavoir.

The actual implementation should be enough for most smaller components, as the classes behavoir is widely configurable. You should not override any of the base classes interface methods if you can avoid it. If you find that an event handler is missing, please contact the MidCOM development team for some advise.

Quick start

This class does a lot of things automatically for you, described below. If you are not interested in the gory details though, here is a quick list of what you have to know (but don't complain if I have missed anything), and do these things after calling the base class constructor:

  • Inherit the class as {$component}_interface (e.g. de_linkm_taviewer_interface).
  • Prepare a component manifest for your component, see the class midcom_core_manifest for details.
  • You need to set the values of all Component configuration variables to something suitable to your component. Especially: $_autoload_files, $_autoload_libraries and $_component. The defaults of the other variables should be suitable for basic operation.
  • The components data storage area will contain two keys when the initialized event handler is called: The NAP active id, defaulting to false and stored as active_leaf and the components' default configuration, stored as a midcom_helper_configuration object in the key $_config_snippet_name. The active leaf check now automatically returns the contents of the component data storage area, the components get_active_leaf NAP function is no longer called.
  • Put your component wide default configuration into $component_dir/config/config.inc.
Class parameters

TODO: Document

The following options can be used to parametrize the components startup and operation. See the individual member documentation for now.

  • $_ais_class_suffix
  • $_autoload_files
  • $_autoload_libraries
  • $_component
  • $_config_snippet_name
  • $_nap_class_suffix
  • $_site_class_suffix
Class operation

This class now does an awful lot of work for you, you just need to configure it to have the right names and places to look for. It is designed to fit in the current component wildlife with as little collateral damage as possible, but as always, a 100% transparent implementation is both not wanted and not sensible.

The most important change is that all four original component interface concepts have been unified into a single class supporting the full interface. Obviously, MidCOMs component loader had to be adapted to this operation.

At this time, the core will not be able to handle the original pre-2.4 interface any longer. Though it would be possible to implement an according proxy class, I have not yet done that, so right now all components need to be adapted to the new interface.

Actually, you should not need to overwrite any event handler for almost all components I currently know of. Ultimately, this is a proxy class to the actual component code. Its main goals are to automate these tasks:

  • Component startup (loading of the right script files and libraries)
  • Default configuration (loading of the various configuration files, see the _load_configuration() method for details)
  • Component data storage initialization
  • Context separation during runtime
When inheriting the class, you, obviously, start with the constructor. First, as always, call the base class constructor. After that, set all configuration variables outlined below to values suitable to your needs.

Usually you will be done at this point, as all other interaction can safely be done by the component. Unless, of course, you have some special requirements.

One thing, which I have seen quite often in components, is the initialize method loading the default schema. While I actually do not endorse this behavoir, schemas should only be loaded on demand during runtime (especially since they are configurable), you should now add code like that to the _on_initialize() event handler, which will be exectued at about the same time as the original implementation would have been.

Advanced notes for Core Developers

The biggest change relevant for the core is the fact, that the various interface directives for on-site and content-admin usage have changed (they were named equally in both of the original concepts). Therefore, if you handle components directly, you need to adapt your code to match the new interface outlined below.

Example usage

The average component will require something like this, part one is the component Manifest:

 'name' => 'de.linkm.taviewer',
 'purecode' => false,
 'version' => 1,
 'privileges' =>  Array
 (
     'read' => MIDCOM_PRIVILEGE_ALLOW,
     'write' => Array (MIDCOM_PRIVILEGE_DENY, MIDCOM_PRIVILEGE_ALLOW)
 ),
 'class_definitions' => Array('my_sepcial_mgd_schema_class.inc'),

See the class midcom_core_manifest for further details.

Built on this, we add the following interface class:

  1. class de_linkm_taviewer_interface extends midcom_baseclasses_components_interface
  2. {
  3. function de_linkm_taviewer_interface()
  4. {
  5. parent::midcom_baseclasses_components_interface();
  6.  
  7. $this->_component = 'de.linkm.taviewer';
  8. $this->_autoload_files = Array('viewer.php', 'admin.php', 'navigation.php', 'my_special_mgd_schema_class.php');
  9. $this->_autoload_libraries = Array('midcom.helper.datamanager');
  10. }
  11.  
  12. function _on_reindex($topic, $config, &$indexer)
  13. {
  14. $qb = $_MIDCOM->dbfactory->new_query_builder('midcom_baseclasses_database_article');
  15. $qb->add_constraint('topic', '=', $topic->id);
  16. $result = $_MIDCOM->dbfactory->exec_query_builder($qb);
  17.  
  18. if ($result === false)
  19. {
  20. debug_add("Could not query the articles for {$topic->id}, skipping indexing.");
  21. }
  22.  
  23. foreach ($articles as $article)
  24. {
  25. $datamanager = new midcom_helper_datamanager($config->get('schemadb'));
  26. if (! $datamanager)
  27. {
  28. debug_add('Warning, failed to create a datamanager instance with this schemapath:' . $this->_config->get('schemadb'),
  29. MIDCOM_LOG_WARN);
  30. continue;
  31. }
  32.  
  33. if (! $datamanager->init($article))
  34. {
  35. debug_add("Warning, failed to initialize datamanager for Article {$article->id}. See Debug Log for details.", MIDCOM_LOG_WARN);
  36. debug_print_r('Article dump:', $article);
  37. continue;
  38. }
  39.  
  40. $indexer->index($datamanager);
  41. }
  42. }
  43.  
  44. function _on_resolve_permalink($topic, $config, $guid)
  45. {
  46. $article = new midcom_baseclasses_database_article($guid);
  47. if ( ! $article
  48. || $article->topic != $topic->id)
  49. {
  50. return null;
  51. }
  52. if ($article->name == 'index')
  53. {
  54. return '';
  55. }
  56.  
  57. return "{$article->name}.html";
  58. }
  59. }

Located in /midcom.core/midcom/baseclasses/components/interface.php (line 196)

PEAR
   |
   --midcom_baseclasses_core_object
      |
      --midcom_baseclasses_components_interface
Direct descendents
Class Description
 class de_bitfolge_feedcreator_interface RSS and Atom feed generator library http://www.bitfolge.de/rsscreator-en.html Available under LGPL license
 class de_linkm_events_interface Events MidCOM interface class.
 class de_linkm_fontrenderer_interface fontrenderer MidCOM interface class.
 class de_linkm_newsticker_interface Newsticker MidCOM interface class.
 class de_linkm_sitemap_interface Sitemap MidCOM interface class.
 class de_linkm_taviewer_interface TAViewer MidCOM interface class.
 class fi_mik_lentopaikkakisa_interface Flight competition MidCOM interface class.
 class midcom_admin_acls_interface
 class
 class midcom_admin_aegir_interface Created on Aug 3, 2005
 class midcom_admin_content_interface MidCOM AIS interface class.
 class midcom_admin_content2_interface
 class midcom_admin_core_interface
 class midcom_admin_help_interface
 class midcom_admin_simplecontent_interface
 class midcom_admin_styleeditor_interface
 class midcom_tests_interface
 class midcom_helper_datamanager2_interface Datamanger 2 Component Interface Class. This is a pure code library.
 class midcom_helper_helloworld_interface MidCOM Hello World component interface class.
 class midcom_helper_imagepopup_interface
 class midcom_helper_search_interface MidCOM Indexer Front-End
 class midcom_helper_xml_interface XML Component Interface Class. This is a pure code library.
 class midcom_services_at_interface At service library, this interface class is used to register jobs to the service.
 class midgard_admin_acl_interface ACL editor handler
 class midgard_admin_sitegroup_interface XML Component Interface Class. This is a pure code library.
 class midgard_admin_sitewizard_interface Midgard Site Wizard interface
 class net_nehmer_account_interface Account Manager MidCOM interface class.
 class net_nehmer_blog_interface TAViewer MidCOM interface class.
 class net_nehmer_branchenbuch_interface Branchenbuch (Yellow Pages) MidCOM interface class.
 class net_nehmer_buddylist_interface Marketplace component.
 class net_nehmer_comments_interface Comments component.
 class net_nehmer_jobmarket_interface Job market component.
 class net_nehmer_mail_interface On-Site E-Mail System MidCOM interface class.
 class net_nehmer_markdown_interface Markdown library, based on lib_markdown.
 class net_nehmer_marketplace_interface Marketplace component.
 class net_nehmer_publications_interface Publications MidCOM interface class.
 class net_nehmer_static_interface TAViewer MidCOM interface class.
 class net_nemein_bookmarks_interface Bookmarks MidCOM interface class.
 class net_nemein_calendar_interface Calendar MidCOM interface class.
 class net_nemein_discussion_interface Forum MidCOM interface class.
 class net_nemein_hourview_interface Net.nemein.hourview component interface class.
 class net_nemein_hourview2_interface Net.nemein.hourview2 component interface class.
 class net_nemein_incidentdb_interface IncidentDB MidCOM interface class.
 class net_nemein_opendeploydumper_interface Net.nemein.opendeploydumper component interface class.
 class net_nemein_orders_interface Orders MidCOM interface class.
 class net_nemein_organizations_interface Group viewer MidCOM interface class.
 class net_nemein_payment_interface Payment library MidCOM interface class.
 class net_nemein_personnel_interface Person viewer MidCOM interface class.
 class net_nemein_ping_interface Weblog pinger library based on Weblog_Pinger PHP Class Library by Rogers Cadenhead http://www.cadenhead.org/workbench/weblog-pinger
 class net_nemein_quickpoll_interface Quickpoll MidCOM interface class.
 class net_nemein_redirector_interface Redirector MidCOM interface class.
 class net_nemein_registrations_interface Event registration system.
 class net_nemein_repeathandler_interface OpenPSA contact widget for displaying a contact person as hCard
 class net_nemein_rss_interface RSS Aggregator MidCOM interface class.
 class net_nemein_simpledb_interface Simpledb MidCOM interface class.
 class net_nemein_supportview_interface OpenPSA Supporview MidCOM interface class.
 class net_nemein_wiki_interface Wiki MidCOM interface class.
 class net_siriux_photos_interface Photo Gallery MidCOM interface class.
 class no_bergfald_objectbrowser_interface
 class no_bergfald_rcs_interface
 class no_odindata_quickform_interface
 class org_openpsa_calendar_interface OpenPSA group calendar
 class org_openpsa_calendarwidget_interface OpenPSA calendar widget for displaying week, month and day calendars
 class org_openpsa_contacts_interface OpenPSA Contact registers/user manager
 class org_openpsa_contactwidget_interface OpenPSA contact widget for displaying a contact person as hCard
 class org_openpsa_core_interface OpenPSA core stuff
 class org_openpsa_directmarketing_interface OpenPSA direct marketing and mass mailing component
 class org_openpsa_documents_interface OpenPSA Documents document management system
 class org_openpsa_helpers_interface OpenPSA helpers library, helpers used around OpenPSA.
 class org_openpsa_imp_interface OpenPSA Jabber Instant Messaging Component
 class org_openpsa_interviews_interface Phone interview MidCOM interface class.
 class org_openpsa_invoices_interface Invoice management MidCOM interface class.
 class org_openpsa_jabber_interface OpenPSA Jabber Instant Messaging Component
 class org_openpsa_mail_interface OpenPSA mail library, handles encoding/sending and decoding.
 class org_openpsa_mypage_interface OpenPSA Personal Summary component
 class org_openpsa_notifications_interface OpenPSA notifications manager
 class org_openpsa_products_interface
 class org_openpsa_projects_interface OpenPSA group projects
 class org_openpsa_qbpager_interface OpenPSA qbpager library, handles paging of QB resultsets.
 class org_openpsa_queries_interface OpenPSA queries library, handles encoding/sending and decoding.
 class org_openpsa_relatedto_interface OpenPSA relatedto library, handled saving and retvieving "related to" information
 class org_openpsa_reports_interface OpenPSA Projects reporting engine
 class org_openpsa_sales_interface OpenPSA direct marketing and mass mailing component
 class org_openpsa_smslib_interface OpenPSA SMS library, handles sending SMS/MMS
 class org_routamc_positioning_interface Positioning library interface
 class se_anykey_activecalendar_interface Active Calendar is PHP Class, that generates calendars (month or year view) as a HTML Table (XHTML-Valid).
 class se_anykey_mmslib_interface mms library http://www.hellkvist.org/software/ Available under GPL license
Variable Summary
Method Summary
 midcom_baseclasses_components_interface midcom_baseclasses_components_interface ()
 bool can_handle (MidgardTopic $current_object, int $argc, Array $argv, int $contextid)
 bool check_document_permissions (midcom_services_indexer_document &$document, MidgardTopic $topic)
 bool configure (mixed $configuration, int $contextid, [bool $adminmode = false])
 int errcode (int $contextid)
 string errstr (int $contextid)
 Array get_leaves ()
 Array get_node ()
 bool handle (MidgardTopic $current_object, int $argc, Array $argv, int $contextid)
 bool initialize ()
 bool is_internal ()
 Array read_array_from_file (string $filename)
 Array read_array_from_snippet (string $snippetpath)
 bool reindex (MidgardTopic $topic)
 string resolve_permalink (midcom_baseclasses_database_topic $topic, string $guid)
 Array retrieve_vgroup_members (string $groupname)
 bool set_object (MidgardTopic $object)
 void show_content (int $contextid)
 void trigger_watch (int $operation, mixed $object)
 bool _on_initialize ()
 bool _on_reindex (MidgardTopic $topic, midgard_helper_config $config, midcom_service_indexer &$indexer)
 Array _on_retrieve_vgroup_members (string $groupname)
 void _on_watched_dba_create (obect $object)
 void _on_watched_dba_delete (obect $object)
 void _on_watched_dba_update (obect $object)
 void _on_watched_operation (int $operation, obect $object)
Variables
mixed $_acl_privileges = array() (line 287)
  • deprecated: This has been superseeded by the component manifest as of 2005-09-08
string $_ais_class_suffix = 'admin' (line 251)

This is the class suffix used when constructing the AIS handler class.

Component configuration variable, must set during the construction of the inherited classes.

It is appended to the component class prefix, f.x. resulting in de_linkm_taviewer_admin (as a default).

  • access: protected
mixed $_autoload_class_definitions = array() (line 282)
  • deprecated: This has been superseeded by the component manifest as of 2005-09-08
Array $_autoload_files = array() (line 219)

A list of files, relative to the components root directory, that should be loaded during initialization.

Component configuration variable, must set during the construction of the inherited classes.

  • access: protected
Array $_autoload_libraries = array() (line 228)

A list of libraries which should by loaded during initialization.

Component configuration variable, must set during the construction of the inherited classes.

This will be done before actually loading the script files from _autoload_files.

  • access: protected
string $_component = '' (line 211)

The name of the component, e.g. de.linkm.taviewer

Component configuration variable, must set during the construction of the inherited classes.

  • access: protected
string $_component_path = '' (line 309)

The full path to the components' root directory. Used for loading files.

Current object state, useful during initialization and automatically populated before _on_initialization is called.

  • access: protected
string $_config_snippet_name = 'config' (line 242)

This is used during initialization when loading the default configurations from the filesystem ($prefix/config/$name.inc) and the snippetdirs ($GLOBALS['midcom_config']['midcom_sgconfig_basedir']/$component/$name).

Component configuration variable, must set during the construction of the inherited classes.

They will be merged and placed into the component data store under a key with the same name then the snippet as a midcom_helper_configuration object.

Set this to null to disable automatic configuration handling.

  • access: protected
mixed $_context_data = array() (line 531)

This variable holds the context-specific data during processing.

it is indexed first by context ID and second by a string key. Currently defined keys are:

  • config holds the configuration for this context
  • admin A flag indicating wether we are in Admin mode or not (set during configure)
  • handler The class handling the request.

Array $_data = null (line 321)

The component-specific data storage, hold in the global Array $midcom_component_data, which is indexed by the component name.

Current object state, useful during initialization and automatically populated before _on_initialization is called.

It is created during initialization, and a referenc to the actual storagte is put into $_data.

midcom_core_manifest $_manifest = null (line 329)

The component manifest instance accociated with this component. Read-Only and automatically populated during initialization.

Current object state, useful during initialization and automatically populated before _on_initialization is called.

  • access: protected
string $_nap_class_suffix = 'navigation' (line 260)

This is the class suffix used when constructing the NAP handler class.

Component configuration variable, must set during the construction of the inherited classes.

It is appended to the component class prefix, f.x. resulting in de_linkm_taviewer_navigation (as a default).

  • access: protected
object $_nap_instance = null (line 654)

The NAP interface instance from the component, initialized on demand.

  • access: private
mixed $_purecode = false (line 292)
  • deprecated: This has been superseeded by the component manifest as of 2005-09-08
string $_site_class_suffix = 'viewer' (line 269)

This is the class suffix used when constructing the on-site handler class.

Component configuration variable, must set during the construction of the inherited classes.

It is appended to the component class prefix, f.x. resulting in de_linkm_taviewer_viewer (as a default).

  • access: protected
mixed $_version = 0 (line 277)
  • deprecated: This has been superseeded by the component manifest as of 2005-09-08
Methods
Constructor midcom_baseclasses_components_interface (line 342)

Initialize the class, nothing to do yet.

midcom_baseclasses_components_interface midcom_baseclasses_components_interface ()
can_handle (line 585)

Relays the can_handle call to the component, instantinating a new AIS or Site class respecitvly. It will execute can_handle of that class, retruning its result to MidCOM.

  • return: True, if the component can handle the request, false otherwise.
bool can_handle (MidgardTopic $current_object, int $argc, Array $argv, int $contextid)
  • MidgardTopic $current_object: The topic in question.
  • int $argc: The count of the remaining URL arguments.
  • Array $argv: The argument listing
  • int $contextid: The id of the context we are operating in.
check_document_permissions (line 763)

Verif an indexer document's permissions.

It will call the corresponding event handler reading the topic configuration beforehand.

  • return: True if the object may be shown, false otherwise.
bool check_document_permissions (midcom_services_indexer_document &$document, MidgardTopic $topic)
  • midcom_services_indexer_document $document: The document to check. This object is passed by reference and may therefore be modified to match the current security policy.
  • MidgardTopic $topic: The topic this document is assigned to.
configure (line 543)

Configures the component for usage. The configuration is merged, and, if neccessary, an existing handler object is purged.

  • return: Indication success.
bool configure (mixed $configuration, int $contextid, [bool $adminmode = false])
  • mixed $configuration: A configuration data list, suitable for merging with a midcom_helper_configuration object.
  • int $contextid: The ID of the context we are accociated with.
  • bool $adminmode: Flag, indicating wether we are on-site (false) or in AIS (true).

Redefined in descendants as:
  • net_nemein_orders_interface::configure() : Override the configure component API function to support the symlink config topic feature ("product categories"). This will load the configuration from the symlinked topic instead of the current one. The symlink_config_topic configuration key will contain the loaded topic object or null, if no symlick config topic is set.
errcode (line 619)

Returns the last error code of the component.

  • return: One of the MGD_ERR* constants
int errcode (int $contextid)
  • int $contextid: The id of the context we are operating in.
errstr (line 630)

Returns the last error message of the component.

  • return: The error message of the last error.
string errstr (int $contextid)
  • int $contextid: The id of the context we are operating in.
get_config_for_topic (line 851)

This is a small helper function which gets the full configuration set active for a given topic. If no topic is passed, the systemwide default configuration is returned.

Be aware, that this call does not check if the passed topic is actually handled by this component, as it is theoretically possible for components to drop configuration information on other topics as well.

  • return: MidCOM configuration object
midcom_helper_configuration get_config_for_topic ([midcom_baseclasses_database_topic $topic = null])
get_current_leaf (line 732)

Returns the currently selected leaf of the request.

Originally, this was relayed to the NAP instance. With the new component data framework, the NAP active leaf ID can be returned directly using the data key active_leaf.

  • return: The active leaf ID out of the component data storage.
int get_current_leaf ()
get_leaves (line 718)

Relays the get_leaves call to the NAP instance.

  • return: An Array of NAP compilant leaf structures.
Array get_leaves ()
get_node (line 708)

Relays the get_node call to the NAP instance.

  • return: A NAP compilant NODE structure.
Array get_node ()
handle (line 608)

Relays the handle call to the component.

  • return: True, if the component successfully handle the request, false otherwise.
bool handle (MidgardTopic $current_object, int $argc, Array $argv, int $contextid)
  • MidgardTopic $current_object: The topic in question.
  • int $argc: The count of the remaining URL arguments.
  • Array $argv: The argument listing
  • int $contextid: The id of the context we are operating in.
initialize (line 361)

Initializes the component. It will first load all dependent libraries and then include the snippets referenced by the component. The components local data storage area is initialized and referenced into the global storage area.

Finally, the on_init event handler is called.

This should not be overwritten by the client. Instead, use the on_initialize event handler.

bool initialize ()
is_internal (line 685)

Relays the is_internal check for the current object.

  • return: True, if internal.
  • deprecated: This function has been deprecated with the MidCOM 2.4 NAP rewrite and will be removed in 2.6.
bool is_internal ()
read_array_from_file (line 474)

This helper function reads a file from disk and evaluates its content as array.

This is essentially a simple Array($data\n) eval construct.

If the file does not exist, false is returned.

This function may be called statically.

Array read_array_from_file (string $filename)
  • string $filename: The name of the file that should be parsed.
read_array_from_snippet (line 503)

This helper function reads a snippet and evaluates its content as array.

This is essentially a simple Array($data\n) eval construct.

If the snippet does not exist, false is returned.

This function may be called statically.

Array read_array_from_snippet (string $snippetpath)
  • string $snippetpath: The full path to the snippet that should be returned.
reindex (line 748)

This new interface function will initiate a reindex run for the given component and topic. See the _on_reindex() event handler for details.

bool reindex (MidgardTopic $topic)
  • MidgardTopic $topic: The topic that should be reindexed.
resolve_permalink (line 834)

This interface function is used to check wether a component can handle a given GUID or not on site only. A topic is provided which limits the "scope" of the search accordingly. It can be safely assumed that the topic given is a valid topic in the MidCOM content tree (it is checked through NAP).

If the guid could be successfully resolved, an URL local to the given topic without a leading slash must be returned (f.x. 'article.html'), emtpy strings ('') are allowed indicating root page access. If the GUID is invalid, null will be returned.

This call is realyed to the component using the event handler _on_resolve_permalink(). Before that it will deduce the active configuration for the given topic.

Note, that this is the only event handler which has some kind of default implementation, see its documentation for details.

string resolve_permalink (midcom_baseclasses_database_topic $topic, string $guid)
retrieve_vgroup_members (line 776)

Retrieve all members of a given virtual group. This information may be cached by the framework.

Executio0n is relayed to the corresponding event handler.

  • return: Accociative user->id => user_object listing of all member users or null on failure.
Array retrieve_vgroup_members (string $groupname)
  • string $groupname: The local groupname (that is, without the component prefix) of the virtual group to query.
set_object (line 697)

Releays the set_object call to the nap instance. Checks if the NAP instance has already been created beforehand.

  • return: Indicating success.
bool set_object (MidgardTopic $object)
  • MidgardTopic $object: The MidgardTopic that should be processed.
show_content (line 640)

Relays the show content call to the component, invoking output.

void show_content (int $contextid)
  • int $contextid: The id of the context we are operating in.
trigger_watch (line 871)

This function delegates all watched operations, in two phases. First, the general _on_watched_operation handler is called, to allow for handling generic operations. After that, the individual watches are called, to allow for more specific processing.

void trigger_watch (int $operation, mixed $object)
  • int $operation: The operation that has occured.
  • mixed $object: The object on which the operation occured. The system will do is_a checks against any registered class restriction on the watch.
_check_nap_instance (line 665)

Checks, wether an instance of the NAP interface class has already been created and creates it if not.

This check is only done during the set_object calls, which will always be the first calls in a sequence of NAP calls. (For performance reasons.)

  • access: private
void _check_nap_instance ()
_load_configuration (line 427)

Loads the configuration file specified by the component configuration

and constructs a midcom_helper_configuration object out of it. Both Component defaults and sitegroup-configuration gets merged. The resulting object is stored under the key 'config' in the components' data storage area.

Errors will be logged as MIDCOM_LOG_WARN but silently ignored. This should be viable, since as of MidCOM 2.4 the configuration class is more flexible when local and global configurations do not match.

Three files will be loaded in order:

  1. The components default configuration, placed in $prefix/config/$name.inc
  2. Any systemwide default configuration, currently palced in /etc/midgard/midcom/$component/$name.inc.
  3. Any site configuration in the snippet $GLOBALS['midcom_config']['midcom_sgconfig_basedir']/$component/$name.
If $_config_snippet_name is set to null, no configuration will be done.

void _load_configuration ()
_on_check_document_permissions (line 1011)

Verif an indexer document's permissions. This is used for custom, advanced access control within a components domain.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

The topic and configuration objects are passed for ease of use and performance, as they have already been prepared by the framework.

Usally, you want to limit the visibility of a document in the search result. You can do this by returning false in this function, the indexer will then skip this object before returning the resultset to the callee. You may modify the document that has been passed, to limit the information available to the client, though this should be avoided if possible.

  • return: True if the object may be shown, false otherwise.
  • access: protected
bool _on_check_document_permissions (midcom_services_indexer_document &$document, midcom_helper_configuration $config, MidgardTopic $topic)
  • midcom_services_indexer_document $document: The document to check. This object is passed by reference and may therefore be modified to match the current security policy.
  • midcom_helper_configuration $config: The configuration accociated with the topic.
  • MidgardTopic $topic: The topic this document is assigned to.

Redefined in descendants as:
_on_initialize (line 970)

This is an event handler, called after the basic component initialization has been done just before the initialize call will return to MidCOM.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

It should prepare all neccessary information to start processing requests.

Unless you need more functionality then snippet and library loading, configuration merging and basic component data storage initialization, no further modification needs to be done.

  • return: Indicating wether the initialization has been successful.
  • access: protected
bool _on_initialize ()

Redefined in descendants as:
_on_reindex (line 987)

Reindex the given topic. The complete configuration set is already available in $config. The original index records are already deleted, so you do not need to bother about this.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

The default event handler does nothing.

  • return: Indicating success.
  • access: protected
bool _on_reindex (MidgardTopic $topic, midgard_helper_config $config, midcom_service_indexer &$indexer)
  • MidgardTopic $topic: The topic to reindex.
  • midgard_helper_config $config: The configuration accociated with this topic.
  • midcom_service_indexer &$indexer: The indexer object to use for indexing. (Passed by reference!)

Redefined in descendants as:
_on_resolve_permalink (line 1065)

This interface function is used to check wether a component can handle a given GUID or not on site only. A topic is provided which limits the "scope" of the search accordingly. It can be safely assumed that the topic given is a valid topic in the MidCOM content tree (it is checked through NAP).

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

If the guid could be successfully resolved, an URL local to the given topic without a leading slash must be returned (f.x. 'article.html'), emtpy strings ('') are allowed indicating root page access. If the GUID is invalid, null will be returned.

This call is realyed to the component using the event handler _on_resolve_permalink(). Before that it will deduce the active configuration for the given topic.

The information you return with this call (if no-null) will be considered cacheable by the content caching engine. Therefore you have to ensure that either the resolution is stable or that you configure the content cache accordingly if you have a match. The hard way is setting the no_cache flag in cases where you need full flexibility, but this should be avoided for the sake of performance if somehow possible. The more sophisticated alternative is therefore to selectivly invalidate all GUIDs that have their Permalink lookup affected.

Important Note:

Be aware that this is the only event handler at this time which has a real default implementation: If you do not override the base class implementation, it will iterate through all NAP leaves applicable to the node accociated with the topic. If a match is found, its local URL will be returned. This will not be terribly efficient, so you are strongly encouraged to have some more efficient solution instead. Obviously, if you override the function, you shouldn't call the base class implementation unless you really need it.

  • return: The local URL (without leading slashes) or null on failure.
  • access: protected
string _on_resolve_permalink (midcom_baseclasses_database_topic $topic, midcom_helper_configuration $config, string $guid)

Redefined in descendants as:
_on_retrieve_vgroup_members (line 1024)

Retrieve all members of a given virtual group. This information may be cached by the framework.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

  • return: List of members. You may add either one of the following types to this array: Person IDs, Person GUIDs, midcom_core_baseclasses_person objects (or derived classes), MgdSchema or legacy Person objects, midcom_core_user objects.
  • access: protected
Array _on_retrieve_vgroup_members (string $groupname)
  • string $groupname: The local groupname (that is, without the component prefix) of the virtual group to query.

Redefined in descendants as:
_on_watched_dba_create (line 930)

This function is triggered at the end of the request for each watched create operation that has been done during the request.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

It is called after the generic _on_watched_operation event handler.

  • access: protected
void _on_watched_dba_create (obect $object)
  • obect $object: The object on which the operation has occured.

Redefined in descendants as:
_on_watched_dba_delete (line 958)

This function is triggered at the end of the request for each watched delete operation that has been done during the request.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

It is called after the generic _on_watched_operation event handler.

  • access: protected
void _on_watched_dba_delete (obect $object)
  • obect $object: The object on which the operation has occured.

Redefined in descendants as:
_on_watched_dba_update (line 944)

This function is triggered at the end of the request for each watched update operation that has been done during the request.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

It is called after the generic _on_watched_operation event handler.

  • access: protected
void _on_watched_dba_update (obect $object)
  • obect $object: The object on which the operation has occured.

Redefined in descendants as:
_on_watched_operation (line 916)

This function is triggered at the end of the request for each watched operation that has been done during the request.

This is an event handler which is called during MidCOMs component interaction. For most basic components, the default implementation should actually be enough.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

  • access: protected
void _on_watched_operation (int $operation, obect $object)
  • int $operation: The operation identifier (one of the MIDCOM_OPERATION constants) which applies.
  • obect $object: The object on which the operation has occured.

Redefined in descendants as:

Inherited Methods

Inherited From midcom_baseclasses_core_object

 midcom_baseclasses_core_object::midcom_baseclasses_core_object()

Documentation generated on Tue, 15 Aug 2006 12:35:59 +0300 by phpDocumentor 1.3.0RC3