Ejemplo n.º 1
0
function generateStyles(array $styles)
{
    debug(count($styles) . " styles found");
    foreach ($styles as $style) {
        if (property_exists($style, 'styles') && count($style->styles) == 1 && property_exists($style, 'substyles') && count($style->substyles) > 0) {
            $sourceCode = generateCode($style->styles[0], $style->substyles, true);
            writeClass(filterKeyword($style->styles[0]), $sourceCode);
        } elseif (property_exists($style, 'styles') && count($style->styles) > 0 && !property_exists($style, 'substyles') && count($style->elements) == 1) {
            switch ($style->elements[0]) {
                case 'label':
                    $_style = 'LabelStyles';
                    break;
                case 'frame3d':
                    $_style = 'Frame3dStyles';
                    break;
                default:
                    throw new UnexpectedValueException('Woot');
            }
            $sourceCode = generateCode($_style, $style->styles, false);
            writeClass($_style, $sourceCode);
        } else {
            debug("Cannot process element");
        }
    }
}
Ejemplo n.º 2
0
function writeClasses()
{
    global $myClasses;
    foreach ($myClasses as $name => &$class) {
        writeClass($name, $class['attr'], $class['var']);
    }
}
Ejemplo n.º 3
0
            if ($nm == 'rect') {
                echo "\"x\":" . getAttr($r, 'x') . ",";
                echo "\"y\":" . getAttr($r, 'y') . ",";
                echo "\"h\":" . getAttr($r, 'height') . ",";
                echo "\"w\":" . getAttr($r, 'width') . ",";
            } elseif ($nm == 'path') {
                echo "\"d\":\"" . getAttr($r, 'd') . "\",";
            } elseif ($nm == 'text') {
                echo "\"x\":" . getAttr($r, 'x') . ",";
                echo "\"y\":" . getAttr($r, 'y') . ",";
            }
            echo "\"tr\":\"" . getAttr($r, 'transform') . "\"";
            echo "},";
        }
        echo "null]";
    }
    function getAttr($nd, $nm)
    {
        return $nd->attributes->getNamedItem($nm)->nodeValue;
    }
    echo "{";
    $numMap = array("roomNr" => "nr", "floorNr" => "fnr");
    writeClass($xpath, 'room', 'rooms', $numMap);
    echo ",";
    writeClass($xpath, 'floor', 'floors', $numMap);
    echo ",";
    writeClass($xpath, 'street', 'streets', array());
    echo ",";
    writeClass($xpath, 'label', 'labels', array("labelTarget" => "trg"));
    echo "}";
}
Ejemplo n.º 4
0
<?php

/*
 * Generate PHPDoc description files for given classes from an extension
 */
include 'reflector.conf.php';
$ext = new ReflectionExtension($argv[1]);
echo "<?php\n";
foreach ($ext->getClasses() as $class) {
    echo writeClass($class);
}
function writeClass($class)
{
    $parent = $class->getParentClass();
    if ($parent) {
        $extends = "extends {$parent->name} ";
    } else {
        $extends = "";
    }
    $str = <<<END
/**
 * Class {$class->name}
 */
class {$class->name} {$extends}{

END;
    foreach ($class->getMethods() as $method) {
        $str .= writeMethod($method, $class);
    }
    $str .= "}\n";
    return $str;
Ejemplo n.º 5
0
<h1>Class Constructor</h1>
<form id="tableselector" action="constructor.jay.php">
    Class to create:
    <select name="table" onchange="document.getElementById('tableselector').submit()">
        <option value="">Select a Table</option>
        <?php 
getTableOptions();
?>
    </select>
</form>
<?php 
writeTable();
if (isset($_REQUEST['pageaction'])) {
    switch ($_REQUEST['pageaction']) {
        case 'c':
            writeClass();
            break;
        case 'alist':
            writeAdminList();
            break;
        case 'elist':
            writeAdminEdit();
            break;
    }
}
?>
<script type="text/javascript" charset="utf-8">
    ZeroClipboard.setMoviePath( 'http://ben.soundenterprises.net/constructor/zeroclipboard/ZeroClipboard.swf' );
    var clip = new ZeroClipboard.Client();
    clip.setText( '' );
    clip.glue( 'd_clip_button', 'd_clip_container' );