Lithron.LVirtualNodes
[ class tree: Lithron.LVirtualNodes ] [ index: Lithron.LVirtualNodes ] [ all elements ]

Source for file Administration.php

Documentation is available at Administration.php

  1. <?php
  2. /**
  3. * class file.
  4. *
  5. * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  6. * @copyright 2005, diemeisterei GmbH. All rights reserved.
  7. * @author $Author: spheenik $
  8. * @version $Revision: 235 $ $Date: 2006-05-30 19:01:31 +0200 (Di, 30 Mai 2006) $
  9. * @package Lithron.LVirtualNodes
  10. * @subpackage Pages
  11. */
  12.  
  13. /**
  14. * Displays LVirtualNodes configuration options (sitemap)
  15. *
  16. * @package Lithron.LVirtualNodes
  17. * @subpackage Pages
  18. */
  19. class Administration extends TPage
  20. {
  21. function updateCachingTime($sender, $param)
  22. {
  23. $this->Application->Cache->flush();
  24. $time = TPropertyValue :: ensureInteger($sender->getText());
  25. $this->Application->setGlobalState("LVirtualNodes:cachingTime", $time);
  26. }
  27.  
  28. function checkVirtualNodes()
  29. {
  30. if ($this->Off->Checked || $this->Application->Service->areNodesAvailable() === false)
  31. {
  32. $this->Application->setGlobalState("LVirtualNodes:available", false);
  33. } else
  34. {
  35. $this->Application->setGlobalState("LVirtualNodes:available", true);
  36. }
  37. }
  38.  
  39. public function addPage($sender, $param)
  40. {
  41. $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
  42. $path = $this->SNSelectAdd->SelectedValue;
  43. $name = $this->NewPageName->Text ? $this->NewPageName->Text : "noname";
  44. $type = $this->NewPageType->getSelectedValue();
  45.  
  46. //echo "adding page at ".$path." with name ".$name." and type ".$type."<br>";
  47.  
  48. $p = explode(".", $path);
  49. $node = $this->Service->getNodes();
  50. for ($i = 1; $i < count($p)-1; $i++)
  51. $node = $node->getChildNodeAt($p[$i]);
  52.  
  53. $newpage = new LVirtualNodesSiteNode();
  54. $newpage->setAlias($name);
  55. $newpage->setPage($type);
  56. $node->insertNewNodeAt($p[count($p)-1], $newpage, $conn);
  57. $this->Service->reload();
  58. }
  59.  
  60. public function renamePage($sender, $param)
  61. {
  62. $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
  63. $path = $this->SNSelectExisting->SelectedValue;
  64. $name = $this->RenamePageTo->Text ? $this->RenamePageTo->Text : "noname";
  65.  
  66. //echo "renaming page ".$path." to ".$name."<br>";
  67.  
  68. $p = explode(".", $path);
  69. $node = $this->Service->getNodes();
  70. for ($i = 1; $i < count($p); $i++)
  71. $node = $node->getChildNodeAt($p[$i]);
  72.  
  73. $node->setAlias($name);
  74. $node->save($conn);
  75. $this->Service->reload();
  76. }
  77.  
  78. public function deletePage($sender, $param)
  79. {
  80. $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
  81. $path = $this->SNSelectExisting->SelectedValue;
  82.  
  83. //echo "deleting page ".$path."<br>";
  84.  
  85. $p = explode(".", $path);
  86. $node = $this->Service->getNodes();
  87. for ($i = 1; $i < count($p)-1; $i++)
  88. $node = $node->getChildNodeAt($p[$i]);
  89.  
  90. $node->deleteChildNodeAt($p[count($p)-1], $conn);
  91. $this->Service->reload();
  92. }
  93.  
  94. public function changePageType($sender, $param)
  95. {
  96. $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
  97. $path = $this->SNSelectExisting->SelectedValue;
  98. $type = $this->ChangePageType->getSelectedValue();
  99.  
  100. //echo "renaming page ".$path." to ".$name."<br>";
  101.  
  102. $p = explode(".", $path);
  103. $node = $this->Service->getNodes();
  104. for ($i = 1; $i < count($p); $i++)
  105. $node = $node->getChildNodeAt($p[$i]);
  106.  
  107. $node->setPage($type);
  108. $node->save($conn);
  109. $this->Service->reload();
  110. }
  111.  
  112. }
  113. ?>

Documentation generated on Tue, 20 Jun 2006 05:14:53 +0200 by phpDocumentor 1.3.0RC4