Ejemplo n.º 1
0
/**
 * Tvorba souboru XML
 *
 * @param string $user
 * @param string $uuid
 * @param string $xsltemplate
 * @param string $xml_from cache|data
 * @return string XML|FALSE
 */
function getXml($user, $uuid, $xsltemplate, $xml_from = 'cache')
{
    setMickaLog("USER={$user}, UUID={$uuid}, XSL={$xsltemplate}", 'DEBUG', 'micka_lib_xml.php (getXML)');
    $xml = FALSE;
    $in = array();
    if ($uuid != '') {
        $in[] = "_UUID_ = '{$uuid}'";
        $export = new MdExport($user);
        $export->xml_from = $xml_from;
        $xml_pom = $export->getXML($in, FALSE);
        setMickaLog('XML=' . $xml_pom, 'DEBUG', 'micka_lib_xml.php (getXML)');
        if ($xsltemplate != '' && $export->xml_from == 'data' && $xml_pom != '') {
            setMickaLog('applyTemplate', 'DEBUG', 'micka_lib_xml.php (getXml)');
            $xml_pom = applyTemplate($xml_pom, $xsltemplate);
            if ($xml_pom === FALSE) {
                setMickaLog('applyTemplate === FALSE', 'ERROR', 'micka_lib_xml.php (getXml)');
                return $xml;
            }
        }
        if ($xml_pom != '') {
            $xml = $xml_pom;
        }
    }
    return $xml;
}
<?php

/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
// Grab the file name and save the output
$_file = $_globals['prefix'] . "Types.cpp";
$_bytes = file_put_contents($_globals['target_dir'] . $_globals['dom_dir'] . 'src/' . $_file, applyTemplate('TYPES_CPP', $bag));
//if ( $_bytes > 0 ) { print "Wrote $_bytes bytes to file '$_file'\n"; }
function printElements(&$bag, &$needsContents, &$indent)
{
    global $_globals;
    global $meta;
    if (count($bag['elements']) > 0 && !$bag['isRestriction'] || $bag['has_any']) {
        print $indent . "protected:  // Element" . (count($bag['elements']) > 1 ? 's' : '') . "\n";
        $needsContents = false;
        for ($i = 0; $i < count($bag['elements']); $i++) {
            $maxOccurs = $bag['element_attrs'][$bag['elements'][$i]]['maxOccurs'];
            //      $minOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['minOccurs'];
            //      print "   // minOccurs=$minOccurs, maxOccurs=$maxOccurs\n";
            $maxOccurs = $maxOccurs == 'unbounded' || $maxOccurs > 1;
            if (isset($bag['element_documentation'][$bag['elements'][$i]])) {
                $bag['element_documentation'][$bag['elements'][$i]] .= " @see " . $_globals['prefix'] . ucfirst($bag['elements'][$i]);
                print applyTemplate('DOXYGEN', $bag['element_documentation'][$bag['elements'][$i]]);
            }
            if (isset($bag['element_attrs'][$bag['elements'][$i]]['type']) && isset($meta[$bag['element_attrs'][$bag['elements'][$i]]['type']])) {
                print $indent . "\t" . $_globals['prefix'] . ucfirst($bag['element_attrs'][$bag['elements'][$i]]['type']) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
            } else {
                print $indent . "\t" . $_globals['prefix'] . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
            }
            if (isset($meta[$bag['elements'][$i]])) {
                if (count($meta[$bag['elements'][$i]]['substitutableWith']) > 0) {
                    $needsContents = true;
                }
            }
        }
        if ($bag['hasChoice'] || $needsContents || $bag['has_any']) {
            print $indent . "\t/**\n" . $indent . "\t * Used to preserve order in elements that do not specify strict sequencing of sub-elements.";
            print "\n" . $indent . "\t */\n";
            print $indent . "\tdaeElementRefArray _contents;\n";
            print $indent . "\t/**\n" . $indent . "\t * Used to preserve order in elements that have a complex content model.";
            print "\n" . $indent . "\t */\n";
            print $indent . "\tdaeUIntArray       _contentsOrder;\n\n";
        }
        if ($bag['hasChoice']) {
            print $indent . "\t/**\n" . $indent . "\t * Used to store information needed for some content model objects.\n";
            print $indent . "\t */\n" . $indent . "\tdaeTArray< daeCharArray * > _CMData;\n\n";
        }
    }
}
Ejemplo n.º 4
0
<?php

/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
// Grab the file name and save the output
$_file = $_globals['prefix'] . ucfirst($bag['element_name']) . ".h";
$_bytes = file_put_contents($_globals['target_dir'] . $_globals['dom_dir'] . 'include/' . $_file, applyTemplate('HEADER', $bag));
//if ( $_bytes > 0 ) { print "dom/" . $_globals['prefix'] . ucfirst( $bag['element_name'] ) . ".obj "; }
function saveTemplate($file, $template, &$bag)
{
    $bytes = file_put_contents($file, applyTemplate($template, $bag));
}
Ejemplo n.º 6
0
 public function getMdXmlData($uuid, $xsltemplate = 'micka2one19139.xsl')
 {
     setMickaLog("UUID={$uuid}, XSL={$xsltemplate}", 'DEBUG', 'MdRecord.getMdXmlData');
     require_once PHPPRG_DIR . '/MdExport.php';
     $rs = '';
     if ($uuid != '') {
         //$in = array();
         //$in[] = "_UUID_ = '$uuid'";
         $export = new MdExport($this->user);
         if ($this->table_mode == 'tmp') {
             $export->setTableMode('tmp');
             $xml = $export->getXmlTmpMd($uuid);
         } else {
             $in = array();
             $params = array();
             $in[] = "_UUID_ = '{$uuid}'";
             // TODO: použít params
             $export->xml_from = 'data';
             $pom = $export->getXML($in, $params, FALSE);
             $xml = $pom[0];
         }
         //setMickaLog('XML=' . $xml_pom, 'DEBUG', 'micka_lib_xml.php (getXML)');
         if ($xsltemplate == '' && $xml != '') {
             $rs = $xml;
         } elseif ($xsltemplate != '' && $xml != '') {
             setMickaLog("applyTemplate {$xsltemplate}", 'DEBUG', 'MdRecord.getMdXmlData');
             $xml = applyTemplate($xml, $xsltemplate);
             if ($xml === FALSE) {
                 setMickaLog('applyTemplate === FALSE', 'ERROR', 'MdRecord.getMdXmlData');
             } else {
                 if ($xml != '') {
                     $rs = $xml;
                 }
             }
         }
     }
     if ($rs == '') {
         setMickaLog("XML empty", 'ERROR', 'MdRecord.getMdXmlData');
     }
     return $rs;
 }
Ejemplo n.º 7
0
?>
>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaCMPolicy.h>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaSequence.h>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaChoice.h>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaGroup.h>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaAny.h>
#include <<?php 
echo $_globals['meta_prefix'];
?>
/daeMetaElementAttribute.h>

<?php 
echo applyTemplate('CPP_METHODS', $bag);
echo applyTemplate('CPP_STATIC', $bag);
Ejemplo n.º 8
0
// ATTRIBUTES
if (count($bag['attributes']) > 0 || $bag['useXMLNS']) {
    print $indent . "protected:  // Attribute" . (count($bag['attributes']) > 1 ? 's' : '') . "\n";
    if ($bag['useXMLNS']) {
        print $indent . "\t/**\n" . $indent . "\t * This element may specify its own xmlns.\n" . $indent . "\t */\n";
        print $indent . "\txsAnyURI attrXmlns;\n";
    }
    foreach ($bag['attributes'] as $attr_name => &$a_list) {
        $type = $a_list['type'];
        $pre = '';
        getTypeNameAndPrefix($type, $pre);
        if ($type == '') {
            $type = "String";
        }
        if (isset($a_list['documentation'])) {
            print applyTemplate('DOXYGEN', $a_list['documentation']);
        }
        print $indent . "\t" . $pre . ucfirst($type) . " attr" . ucfirst($attr_name) . ";\n";
    }
}
// ELEMENTS
if (count($bag['attributes'] > 0)) {
    print "\n";
}
printElements($bag, $needsContents, $indent);
printAccessorsAndMutators($bag, $needsContents, $indent);
//VALUE
// NOTE: special casing any element with 'mixed' content model to ListOfInts type _value
if (($bag['content_type'] != '' || $bag['mixed']) && !$bag['abstract'] && !isset($bag['baseTypeViaRestriction'])) {
    print $indent . "protected:  // Value\n";
    $content_type = $bag['content_type'];
Ejemplo n.º 9
0
<?php

/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
// INCLUDES
$inc = array();
global $includeList;
for ($i = 0; $i < count($bag['ref_elements']); $i++) {
    if (!in_array($_globals['prefix'] . ucfirst($bag['ref_elements'][$i]), $includeList)) {
        $inc[] = "#include <" . $_globals['prefix'] . "/" . $_globals['prefix'] . ucfirst($bag['ref_elements'][$i]) . ".h>";
        $includeList[] = $_globals['prefix'] . ucfirst($bag['ref_elements'][$i]);
    }
}
if (count($inc)) {
    //only print if you have to include something
    print implode("\n", $inc) . "\n";
}
$keys = array_keys($bag['inline_elements']);
if (count($keys) > 0) {
    foreach ($keys as $k) {
        print applyTemplate('INCLUDES', $bag['inline_elements'][$k]);
    }
}
                if (isset($meta['enum_documentation'][$i])) {
                    $_globals['constStrings'][] = "/**\n * " . $meta['enum_documentation'][$i] . "\n */\n";
                }
                $conststrnm = strtoupper($type) . "_" . $meta['enum'][$i];
                $conststr = "\"" . $meta['enum'][$i] . "\";\n";
                $_globals['constStrings'][$conststrnm] = $conststr;
            }
            $_globals['constStrings'][] = "\n";
        }
    }
}
//UNIONS
foreach ($bag as $type => &$meta) {
    if ($meta['union_type']) {
        if (isset($meta['documentation']['en'])) {
            print applyTemplate('DOXYGEN', $meta['documentation']['en']);
        }
        print "enum " . $_globals['prefix'] . ucfirst($type) . " {\n";
        //tokenize memberTypes string
        $types = explode(' ', $meta['union_members']);
        //look up the members
        $cnt = 1;
        foreach ($types as $typeName) {
            if (isset($bag[$typeName]) && count($bag[$typeName]['enum']) > 0) {
                //print all of their enum children
                for ($i = 0; $i < count($bag[$typeName]['enum']); $i++) {
                    $val = $bag[$typeName]['enum'][$i];
                    $val = str_replace('.', '_', $val);
                    if (in_array($val, $meta['enum'])) {
                        continue;
                    }
Ejemplo n.º 11
0
<?php

/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
$_context = $bag['context'];
for ($i = 0; $i < count($_context); $i++) {
    $_context[$i] = $_globals['prefix'] . ucfirst($_context[$i]);
    //. "_element";
}
//}
$keys = array_keys($bag['inline_elements']);
if (count($keys) > 0) {
    foreach ($keys as $k) {
        $inner = $bag['inline_elements'][$k];
        if (!$inner['complex_type'] || $inner['isRestriction'] || $inner['isExtension']) {
            print applyTemplate('CPP_STATIC', $inner);
        }
    }
}
Ejemplo n.º 12
0
    $meta[$local_meta['element_name']] =& $local_meta;
}
// Grab global elements and collect meta-data for code-gen
$e_list = $pop->getElementsByType('xsElement');
print "ELEMENTS\n";
for ($i = 0; $i < count($e_list); $i++) {
    $local_meta =& $e_list[$i]->generate($element_context, $_globals['global_elements']);
    $meta[$local_meta['element_name']] =& $local_meta;
}
//propogate the substitutableWith lists and attributes inherited by type
foreach ($meta as $k => &$local_meta) {
    if ($local_meta['substitution_group'] != '') {
        $meta[$local_meta['substitution_group']]['substitutableWith'][] = $k;
        //$meta[$local_meta['substitution_group']]['ref_elements'][] = $k;
        //print $local_meta['substitution_group'] ." sub with ". $k ."\n";
    }
}
$indentNum = 0;
// Generate header files
$includeList = array();
foreach ($meta as $k => &$local_meta) {
    // Generate the dom
    print applyTemplate('HEADER_FILE', $local_meta);
    print applyTemplate('CPP_FILE', $local_meta);
}
print applyTemplate('TYPES_HEADER_FILE', $typemeta);
print applyTemplate('TYPES_CPP_FILE', $typemeta);
print applyTemplate('ELEMENTS_FILE', $meta);
print applyTemplate('CONSTANTS_FILE', $_globals['constStrings']);
print applyTemplate('CONSTANTS_CPP_FILE', $_globals['constStrings']);
cleanupGen();
        ?>
 );
<?php 
    }
    ?>
	
		meta->appendAttribute(ma);
	}
<?php 
}
?>

	meta->setElementSize(sizeof(<?php 
echo $scoped_element;
?>
));
	meta->validate();

	return meta;
}

<?php 
$_keys = array_keys($bag['inline_elements']);
if (count($_keys) > 0) {
    foreach ($_keys as $_k) {
        $inner = $bag['inline_elements'][$_k];
        if (!$inner['complex_type'] || $inner['isRestriction'] || $inner['isExtension']) {
            print applyTemplate('CPP_METHODS', $inner);
        }
    }
}
Ejemplo n.º 14
0
function listUsers()
{
    global $auth, $url;
    if ($auth->isLoggedIn()) {
        if ($auth->isServerManager()) {
            header("Cache-Control: no-cache, must-revalidate");
            header("Content-Type: application/json");
            echo "{\"users\":[";
            $usrs = $auth->getUsers();
            for ($i = 0; $i < count($usrs); $i++) {
                if ($i > 0) {
                    echo ",";
                }
                echo "{\n\t\t\t\t\t\"userId\" : \"{$usrs[$i]["userId"]}\",\n\t\t\t\t\t\"firstName\" : \"{$usrs[$i]["FirstName"]}\",\n\t\t\t\t\t\"lastName\" : \"{$usrs[$i]["LastName"]}\",\n\t\t\t\t\t\"email\" : \"{$usrs[$i]["Email"]}\",\n\t\t\t\t\t\"active\" : {$usrs[$i]["active"]}\n\t\t\t\t}";
            }
            echo "]}";
        } else {
            echo applyTemplate("./base.html", "./error.html", array("errorType" => 403, "error" => "Permission denied"));
        }
    } else {
        loginHandler($url);
    }
}
Ejemplo n.º 15
0
}
// ELEMENTS
if (count($bag['attributes'] > 0)) {
    print "\n";
}
if (count($bag['elements']) > 0 && !$bag['isRestriction'] || $bag['has_any']) {
    print $indent . "protected:  // Element" . (count($bag['elements']) > 1 ? 's' : '') . "\n";
    $needsContents = false;
    for ($i = 0; $i < count($bag['elements']); $i++) {
        $maxOccurs = $bag['element_attrs'][$bag['elements'][$i]]['maxOccurs'];
        //      $minOccurs = $bag['element_attrs'][ $bag['elements'][$i] ]['minOccurs'];
        //      print "   // minOccurs=$minOccurs, maxOccurs=$maxOccurs\n";
        $maxOccurs = $maxOccurs == 'unbounded' || $maxOccurs > 1;
        if (isset($bag['element_documentation'][$bag['elements'][$i]])) {
            $bag['element_documentation'][$bag['elements'][$i]] .= " @see " . $_globals['prefix'] . ucfirst($bag['elements'][$i]);
            print applyTemplate('DOXYGEN', $bag['element_documentation'][$bag['elements'][$i]]);
        }
        if (isset($bag['element_attrs'][$bag['elements'][$i]]['type']) && isset($meta[$bag['element_attrs'][$bag['elements'][$i]]['type']])) {
            print $indent . "\t" . $_globals['prefix'] . ucfirst($bag['element_attrs'][$bag['elements'][$i]]['type']) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
        } else {
            print $indent . "\t" . $_globals['prefix'] . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_Array" : "Ref") . " elem" . ucfirst($bag['elements'][$i]) . ($maxOccurs ? "_array" : "") . ";\n";
        }
        if (isset($meta[$bag['elements'][$i]])) {
            if (count($meta[$bag['elements'][$i]]['substitutableWith']) > 0) {
                $needsContents = true;
            }
        }
    }
    if ($bag['hasChoice'] || $needsContents || $bag['has_any']) {
        print $indent . "\t/**\n" . $indent . "\t * Used to preserve order in elements that do not specify strict sequencing of sub-elements.";
        print "\n" . $indent . "\t */\n";
Ejemplo n.º 16
0
echo $_globals['prefix'] . ucfirst($bag['element_name']);
?>
_h__
#define __<?php 
echo $_globals['prefix'] . ucfirst($bag['element_name']);
?>
_h__

#include <dae/daeDocument.h>
#include <<?php 
echo $_globals['prefix'] . '/' . $_globals['prefix'];
?>
Types.h>
#include <<?php 
echo $_globals['prefix'] . '/' . $_globals['prefix'];
?>
Elements.h>

<?php 
global $includeList;
$includeList = array();
print applyTemplate('INCLUDES', $bag);
?>
class DAE;

<?php 
echo applyTemplate('CLASS', $bag);
?>

#endif