Source for file interfaces.php

Documentation is available at interfaces.php

  1. <?php
  2.  
  3. class net_nemein_reservations_midcom {
  4.  
  5. function initialize() {
  6. global $midcom;
  7.  
  8. debug_push("net.nemein.reservationsmidcom::initialize");
  9. $prefix = MIDCOM_ROOT . "/net/nemein/reservations";
  10. require("{$prefix}/viewer.php");
  11. require("{$prefix}/navigation.php");
  12. require("{$prefix}/admin.php");
  13. require("{$prefix}/_base.php");
  14. require("{$prefix}/auth.php");
  15. require("{$prefix}/resource.php");
  16. require("{$prefix}/reservation.php");
  17. $midcom->load_library("midcom.helper.datamanager");
  18. // default configuration
  19. debug_add("Loading default configuration", MIDCOM_LOG_DEBUG);
  20. $data = file_get_contents("${prefix}/config/config_default.dat");
  21. eval("\$component_default = Array ( {$data} );");
  22. $default_config = new midcom_helper_configuration($component_default);
  23. if (mgd_snippet_exists("/sitegroup-config/net.nemein.reservations/config")) {
  24. $snippet = mgd_get_snippet_by_path("/sitegroup-config/net.nemein.reservations/config");
  25. eval("\$local_default = Array ( " . $snippet->code . ");");
  26. if (!$default_config->store($local_default)) {
  27. debug_add("Sitegroup configuration is invalid, configuration management failed, aborting", MIDCOM_LOG_CRIT);
  28. debug_pop();
  29. return FALSE;
  30. }
  31. }
  32. $GLOBALS["net_nemein_reservations__default_config"] = new midcom_helper_configuration($default_config->get_all());
  33. debug_pop();
  34. return TRUE;
  35. }
  36.  
  37. function properties() {
  38. $i18n =& $GLOBALS["midcom"]->get_service("i18n");
  39. $l10n = $i18n->get_l10n("net.nemein.reservations");
  40. return array(
  41. MIDCOM_PROP_NAME => $l10n->get("net.nemein.reservations"),
  42. MIDCOM_PROP_PURECODE => FALSE,
  43. MIDCOM_PROP_VERSION => 1
  44. );
  45. }
  46.  
  47. } // midcom
  48.  
  49.  
  50.  
  51. class net_nemein_reservations_component {
  52.  
  53. var $configs;
  54. var $components;
  55.  
  56. function net_nemein_reservations_component() {
  57. $this->configs = Array ();
  58. $this->components = Array ();
  59. }
  60.  
  61. function configure($configuration, $contextid) {
  62. $tmp = $GLOBALS["net_nemein_reservations__default_config"];
  63.  
  64. if (!$tmp->store($configuration))
  65. return FALSE;
  66. $this->configs[$contextid] = $tmp;
  67. return TRUE;
  68. }
  69.  
  70. function can_handle($current_object, $argc, $argv, $contextid) {
  71. $this->components[$contextid] = new net_nemein_reservations_viewer($current_object, $this->configs[$contextid]);
  72. return $this->components[$contextid]->can_handle($argc, $argv);
  73. }
  74. function handle($current_object, $argc, $argv, $contextid) {
  75. return $this->components[$contextid]->handle($argc, $argv);
  76. }
  77.  
  78. function errcode($contextid) {
  79. return $this->components[$contextid]->errcode;
  80. }
  81. function errstr($contextid) {
  82. return $this->components[$contextid]->errstr;
  83. }
  84.  
  85. function get_metadata($contextid) {
  86. return $this->components[$contextid]->get_metadata();
  87. }
  88.  
  89. function show_content($contextid) {
  90. $this->components[$contextid]->show();
  91. }
  92.  
  93. } // component
  94.  
  95.  
  96.  
  97. class net_nemein_reservations_contentadmin {
  98.  
  99. var $configs;
  100. var $components;
  101.  
  102. function net_nemein_reservations_contentadmin() {
  103. $this->configs = Array ();
  104. $this->components = Array ();
  105. }
  106.  
  107. function configure($configuration, $contextid) {
  108. $tmp = $GLOBALS["net_nemein_reservations__default_config"];
  109.  
  110. if (!$tmp->store($configuration))
  111. return FALSE;
  112. $this->configs[$contextid] = $tmp;
  113. return TRUE;
  114. }
  115.  
  116. function can_handle($current_object, $argc, $argv, $contextid) {
  117. $this->components[$contextid] = new net_nemein_reservations_admin($current_object, $this->configs[$contextid]);
  118. return $this->components[$contextid]->can_handle($argc, $argv);
  119. }
  120.  
  121. function handle($current_object, $argc, $argv, $contextid) {
  122. return $this->components[$contextid]->handle($argc, $argv);
  123. }
  124.  
  125. function errcode($contextid) {
  126. return $this->components[$contextid]->errcode;
  127. }
  128. function errstr($contextid) {
  129. return $this->components[$contextid]->errstr;
  130. }
  131.  
  132. function get_metadata($contextid) {
  133. return $this->components[$contextid]->get_metadata();
  134. }
  135.  
  136. function show_content($contextid) {
  137. $this->components[$contextid]->show();
  138. }
  139.  
  140. } // contentadmin
  141.  
  142.  
  143.  
  144. class net_nemein_reservations_nap {
  145.  
  146. var $napclass;
  147.  
  148. function net_nemein_reservations_nap() {
  149. $this->napclass = new net_nemein_reservations_navigation();
  150. }
  151.  
  152. function is_internal() {
  153. return $this->napclass->is_internal();
  154. }
  155.  
  156. function set_object($object) {
  157. return $this->napclass->set_object($object);
  158. }
  159.  
  160. function get_node() {
  161. return $this->napclass->get_node();
  162. }
  163.  
  164. function get_current_leaf() {
  165. return $this->napclass->get_current_leaf();
  166. }
  167.  
  168. function get_leaves() {
  169. return $this->napclass->get_leaves();
  170. }
  171.  
  172. } // nap
  173.  
  174. ?>

Documentation generated on Mon, 21 Nov 2005 18:16:51 +0100 by phpDocumentor 1.3.0RC3