コード例 #1
0
ファイル: schema.php プロジェクト: kira8565/ITOP203-ZHCN
/**
 * Display the details of a given relation (e.g. "impacts")
 */
function DisplayRelationDetails($oPage, $sRelCode, $sContext)
{
    $sDesc = MetaModel::GetRelationDescription($sRelCode);
    $sVerbDown = MetaModel::GetRelationVerbDown($sRelCode);
    $sVerbUp = MetaModel::GetRelationVerbUp($sRelCode);
    $oPage->add("<h1>" . Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc) . "</h1>");
    $oPage->p(Dict::Format('UI:Schema:RelationDown_Description', $sVerbDown));
    $oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sVerbUp));
    $oPage->add("<ul id=\"RelationshipDetails\" class=\"treeview\">\n");
    foreach (MetaModel::GetClasses() as $sClass) {
        $aRelQueries = MetaModel::EnumRelationQueries($sClass, $sRelCode);
        if (count($aRelQueries) > 0) {
            $oPage->add("<li>class " . MakeClassHLink($sClass, $sContext) . "\n");
            $oPage->add("<ul>\n");
            foreach ($aRelQueries as $sRelKey => $aQuery) {
                $sQuery = $aQuery['sQuery'];
                $iDistance = $aQuery['iDistance'];
                if ($aQuery['bPropagate']) {
                    $oPage->add("<li>" . Dict::Format('UI:Schema:RelationPropagates', $sRelKey, $iDistance, $sQuery) . "</li>\n");
                } else {
                    $oPage->add("<li>" . Dict::Format('UI:Schema:RelationDoesNotPropagate', $sRelKey, $iDistance, $sQuery) . "</li>\n");
                }
            }
            $oPage->add("</ul>\n");
            $oPage->add("</li>\n");
        }
    }
    $oPage->add_ready_script('$("#RelationshipDetails").treeview();');
}
コード例 #2
0
ファイル: schema.php プロジェクト: leandroborgeseng/bhtm
/**
 * Display the details of a given relation (e.g. "impacts")
 */
function DisplayRelationDetails($oPage, $sRelCode, $sContext)
{
    $sDesc = MetaModel::GetRelationDescription($sRelCode);
    $sLabel = MetaModel::GetRelationLabel($sRelCode);
    $oPage->add("<h1>" . Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc) . "</h1>");
    $oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sLabel));
    $oPage->add("<ul id=\"RelationshipDetails\" class=\"treeview\">\n");
    foreach (MetaModel::GetClasses() as $sClass) {
        $aRelQueries = MetaModel::EnumRelationQueries($sClass, $sRelCode);
        if (count($aRelQueries) > 0) {
            $oPage->add("<li>class " . MakeClassHLink($sClass, $sContext) . "\n");
            $oPage->add("<ul>\n");
            foreach ($aRelQueries as $sRelKey => $aQuery) {
                $sQueryDown = isset($aQuery['sQueryDown']) ? $aQuery['sQueryDown'] : '';
                $sQueryUp = isset($aQuery['sQueryUp']) ? $aQuery['sQueryUp'] : '';
                $sAttribute = isset($aQuery['sAttribute']) ? $aQuery['sAttribute'] : '';
                /*
                if ($aQuery['bPropagate'])
                {
                	$oPage->add("<li>".Dict::Format('UI:Schema:RelationPropagates', $sRelKey, $iDistance, $sQuery)."</li>\n");
                }
                else
                {
                	$oPage->add("<li>".Dict::Format('UI:Schema:RelationDoesNotPropagate', $sRelKey, $iDistance, $sQuery)."</li>\n");
                }
                */
                $sLabel = strlen($sQueryDown) > 0 ? $sQueryDown : $sAttribute;
                if ($aQuery['_legacy_']) {
                    $sLabel .= ' (<b>Old style specification</b>: it is recommended to upgrade to XML)';
                }
                $oPage->add("<li>" . $sLabel . "</li>\n");
            }
            $oPage->add("</ul>\n");
            $oPage->add("</li>\n");
        }
    }
    $oPage->add_ready_script('$("#RelationshipDetails").treeview();');
}