<?php
/**
* For internal use only
*
* @author tobias
*/
require("../../lithron/PropertyDefinition.php");
class PropertyDocsHelper extends PropertyDefinition {
public $basePath;
function __construct()
{
$this->basePath = realpath(dirname(__FILE__)."/../../");
}
function getPropertyDefinitions($sort = false)
{
$def = self::$def;
#var_dump($def);
if ($sort) ksort(&$def);
#var_dump($def);
$str = "";
foreach($def AS $propName => $props)
{
$str .= "====".$propName."====\n";
foreach($props AS $propOption => $propValue)
{
$trans = array("|" => " | ");
$str .="//".$propOption.":// ".strtr($propValue,$trans)."\\\\\n";
}
$str .="\n";
}
$str .= $this->getFooterString();
return $str;
}
function getWorkerDefinitions()
{
$trans = array(".php" => "", "Worker" => "");
$trans2 = array(".php" => ".html");
$str = "";
$str = "====== Workers ======";
$str .="\n\n";
$dir = $this->basePath."/lithron/workers";
#echo $dir;exit;
foreach(scandir($dir) AS $file)
{
if (substr($file, 0, 6) == "Worker")
{
$str .= "==== ".strtr($file, $trans)." ====\n";
$str .= "[[http://docs.lithron.de/1.0-beta/lithron/";
$str .= strtr($file, $trans2)."]]";
$str .="\n";
}
}
$str .= $this->getFooterString();
return $str;
}
function getFooterString()
{
return "\n\ncreated with docs/internal/PropertyDocsHelper.php - ".date("c")."\n";
}
}
$helper = new PropertyDocsHelper;
$data = $helper->getPropertyDefinitions();
file_put_contents($helper->basePath."/docs/internal/pages/xml-attribute.txt", $data);
file_put_contents($helper->basePath."/docs/internal/pages/en/xml-attribute.txt", $data);
$data = $helper->getPropertyDefinitions(true);
file_put_contents($helper->basePath."/docs/internal/pages/xml-attribute_alphabetisch.txt", $data);
file_put_contents($helper->basePath."/docs/internal/pages/en/xml-attribute_alphabetisch.txt", $data);
$data = $helper->getWorkerDefinitions();
file_put_contents($helper->basePath."/docs/internal/pages/workers.txt", $data);
file_put_contents($helper->basePath."/docs/internal/pages/en/workers.txt", $data);
echo "done.";
?>