Source for file _cmddata.php

Documentation is available at _cmddata.php

  1. <?php
  2.  
  3. class midcom_admin_content__cmddata {
  4. var $_argv;
  5. var $_contentadm;
  6. var $_component;
  7. var $_path;
  8. var $_topic;
  9. function midcom_admin_content__cmddata ($argv, &$contentadm) {
  10. $loader =& $GLOBALS["midcom"]->get_component_loader();
  11.  
  12. $this->_argv = $argv;
  13. $this->_contentadm = &$contentadm;
  14. $this->_path = $GLOBALS["midcom"]->get_context_data(MIDCOM_CONTEXT_COMPONENT);
  15. $this->_component =& $loader->get_contentadmin_class($this->_path);
  16. $this->_topic = $GLOBALS["midcom"]->get_context_data(MIDCOM_CONTEXT_CONTENTTOPIC);
  17. }
  18.  
  19.  
  20. function execute () {
  21. global $midcom;
  22.  
  23. debug_push("Content Admin, Data Command");
  24. $context = $this->_contentadm->viewdata["context"];
  25.  
  26. $config = new midcom_helper_configuration($this->_topic, $this->_path);
  27. if (! $config)
  28. {
  29. debug_add("No custom configuration data found");
  30. $config = Array();
  31. }
  32. else
  33. {
  34. $config = $config->get_all();
  35. }
  36. if (! $this->_component->configure($config, $context, true))
  37. {
  38. debug_add("Data Component configuration was unsuccessful.");
  39. $this->_contentadm->errcode = MIDCOM_ERRCRIT;
  40. $this->_contentadm->errstr = $this->_component->errstr($context);
  41. debug_pop();
  42. return false;
  43. }
  44. if (! $this->_component->can_handle($this->_topic, count($this->_argv), $this->_argv, $context) )
  45. {
  46. debug_add("Data Component declared unable to handle the request.");
  47. $this->_contentadm->errcode = MIDCOM_ERRCRIT;
  48. $this->_contentadm->errstr = $this->_component->errstr($context);
  49. debug_pop();
  50. return false;
  51. }
  52. debug_add("Data Component Configured and ready to handle the request.");
  53.  
  54. if (! $this->_component->handle($this->_topic, count($this->_argv), $this->_argv, $context))
  55. {
  56. debug_add("Data Component failed to handle the request.");
  57. $this->_contentadm->errcode = $this->_component->errcode($context);
  58. $this->_contentadm->errstr = $this->_component->errstr($context);
  59. debug_pop();
  60. return false;
  61. }
  62.  
  63. debug_add("Data Component successfully handled the request.");
  64.  
  65. // Retrieve Metadata
  66. $nav = new midcom_helper_nav();
  67. if ($nav->get_current_leaf() === false)
  68. {
  69. $meta = $nav->get_node($nav->get_current_node());
  70. }
  71. else
  72. {
  73. $meta = $nav->get_leaf($nav->get_current_leaf());
  74. }
  75. $this->_context[$this->_contentadm->_context][MIDCOM_META_CREATOR] = $meta[MIDCOM_META_CREATOR];
  76. $this->_context[$this->_contentadm->_context][MIDCOM_META_EDITOR] = $meta[MIDCOM_META_EDITOR];
  77. $this->_context[$this->_contentadm->_context][MIDCOM_META_CREATED] = $meta[MIDCOM_META_CREATED];
  78. $this->_context[$this->_contentadm->_context][MIDCOM_META_EDITED] = $meta[MIDCOM_META_EDITED];
  79. debug_pop();
  80. return true;
  81. }
  82.  
  83. function show () {
  84. global $midcom;
  85. debug_push("Content Admin, Data Command");
  86.  
  87. debug_add("Executing Show");
  88. debug_add("Context is " . $this->_contentadm->viewdata["context"]);
  89. ob_start();
  90. $this->_component->show_content($this->_contentadm->viewdata["context"]);
  91. $midcom->_set_context_data(ob_get_contents(), MIDCOM_CONTEXT_OUTPUT);
  92. ob_end_flush();
  93. debug_add("Complete");
  94. }
  95. }
  96.  
  97. ?>

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