Пример #1
0
function generateInterfaceMap()
{
    global $allInterfaceObjects;
    global $selectedRoleNr;
    echo 'function getInterfacesMap() {';
    // TODO: use Json for this
    echo '  var interfacesMap = new Array();';
    foreach ($allInterfaceObjects as $interface) {
        if (isInterfaceForRole($interface, $selectedRoleNr)) {
            $conceptOrSpecs = array_merge(array($interface['srcConcept']), getSpecializations($interface['srcConcept']));
            foreach ($conceptOrSpecs as $concept) {
                echo '  mapInsert(interfacesMap, ' . showHtmlAttrStr($concept) . ', ' . showHtmlAttrStr($interface['name']) . ');';
            }
        }
    }
    echo '  return interfacesMap;';
    echo '}';
}
function getTopLevelInterfacesForConcept($concept, $roleNr)
{
    global $allInterfaceObjects;
    $interfacesForConcept = array();
    foreach ($allInterfaceObjects as $interface) {
        if (($interface['srcConcept'] == $concept || in_array($concept, getSpecializations($interface['srcConcept']))) && isInterfaceForRole($interface, $roleNr)) {
            $interfacesForConcept[] = $interface;
        }
    }
    return $interfacesForConcept;
}