- <?php
- /**
- * class file.
- *
- * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
- * @copyright 2005, diemeisterei GmbH. All rights reserved.
- * @author $Author: spheenik $
- * @version $Revision: 235 $ $Date: 2006-05-30 19:01:31 +0200 (Di, 30 Mai 2006) $
- * @package Lithron.LVirtualNodes
- * @subpackage Pages
- */
-
- /**
- * Displays LVirtualNodes configuration options (sitemap)
- *
- * @package Lithron.LVirtualNodes
- * @subpackage Pages
- */
- class Administration extends TPage
- {
- function updateCachingTime($sender, $param)
- {
- $this->Application->Cache->flush();
- $time = TPropertyValue :: ensureInteger($sender->getText());
- $this->Application->setGlobalState("LVirtualNodes:cachingTime", $time);
- }
-
- function checkVirtualNodes()
- {
- if ($this->Off->Checked || $this->Application->Service->areNodesAvailable() === false)
- {
- $this->Application->setGlobalState("LVirtualNodes:available", false);
- } else
- {
- $this->Application->setGlobalState("LVirtualNodes:available", true);
- }
- }
-
- public function addPage($sender, $param)
- {
- $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
- $path = $this->SNSelectAdd->SelectedValue;
- $name = $this->NewPageName->Text ? $this->NewPageName->Text : "noname";
- $type = $this->NewPageType->getSelectedValue();
-
- //echo "adding page at ".$path." with name ".$name." and type ".$type."<br>";
-
- $p = explode(".", $path);
- $node = $this->Service->getNodes();
- for ($i = 1; $i < count($p)-1; $i++)
- $node = $node->getChildNodeAt($p[$i]);
-
- $newpage = new LVirtualNodesSiteNode();
- $newpage->setAlias($name);
- $newpage->setPage($type);
- $node->insertNewNodeAt($p[count($p)-1], $newpage, $conn);
- $this->Service->reload();
- }
-
- public function renamePage($sender, $param)
- {
- $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
- $path = $this->SNSelectExisting->SelectedValue;
- $name = $this->RenamePageTo->Text ? $this->RenamePageTo->Text : "noname";
-
- //echo "renaming page ".$path." to ".$name."<br>";
-
- $p = explode(".", $path);
- $node = $this->Service->getNodes();
- for ($i = 1; $i < count($p); $i++)
- $node = $node->getChildNodeAt($p[$i]);
-
- $node->setAlias($name);
- $node->save($conn);
- $this->Service->reload();
- }
-
- public function deletePage($sender, $param)
- {
- $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
- $path = $this->SNSelectExisting->SelectedValue;
-
- //echo "deleting page ".$path."<br>";
-
- $p = explode(".", $path);
- $node = $this->Service->getNodes();
- for ($i = 1; $i < count($p)-1; $i++)
- $node = $node->getChildNodeAt($p[$i]);
-
- $node->deleteChildNodeAt($p[count($p)-1], $conn);
- $this->Service->reload();
- }
-
- public function changePageType($sender, $param)
- {
- $conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
- $path = $this->SNSelectExisting->SelectedValue;
- $type = $this->ChangePageType->getSelectedValue();
-
- //echo "renaming page ".$path." to ".$name."<br>";
-
- $p = explode(".", $path);
- $node = $this->Service->getNodes();
- for ($i = 1; $i < count($p); $i++)
- $node = $node->getChildNodeAt($p[$i]);
-
- $node->setPage($type);
- $node->save($conn);
- $this->Service->reload();
- }
-
- }
- ?>