本文整理汇总了PHP中MetaModel::GetRelationDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::GetRelationDescription方法的具体用法?PHP MetaModel::GetRelationDescription怎么用?PHP MetaModel::GetRelationDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::GetRelationDescription方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DOMDocument
break;
case 'xml':
default:
$oPage->SetContentType('text/xml');
$oObj = MetaModel::GetObject($sClass, $id, true);
// Build the root XML part
$oXmlDoc = new DOMDocument('1.0', 'UTF-8');
$oXmlRoot = $oXmlDoc->CreateElement('root');
$oXmlNode = $oXmlDoc->CreateElement('node');
$oXmlNode->SetAttribute('id', $oObj->GetKey());
$oXmlNode->SetAttribute('obj_class', get_class($oObj));
$oXmlNode->SetAttribute('obj_class_name', htmlspecialchars(MetaModel::GetName(get_class($oObj))));
$oXmlNode->SetAttribute('name', htmlspecialchars($oObj->GetRawName()));
$oXmlNode->SetAttribute('icon', BuildIconPath($oObj->GetIcon(false)));
// Hard coded for the moment
AddNodeDetails($oXmlNode, $oObj);
$oLinks = $oXmlDoc->CreateElement("links");
$oXmlRoot->SetAttribute('position', 'left');
$oXmlRoot->SetAttribute('title', MetaModel::GetRelationDescription($sRelation) . ' ' . htmlspecialchars($oObj->GetRawName()));
IssueLog::Info(__FUNCTION__ . " Rel: {$sRelation}");
GetRelatedObjectsAsXml($oObj, $sRelation, $oLinks, $oXmlDoc, $oXmlNode, 0, $aExcludedClasses);
$oXmlRoot->AppendChild($oXmlNode);
$oXmlDoc->AppendChild($oXmlRoot);
$oPage->add($oXmlDoc->SaveXML());
break;
}
}
$oPage->output();
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
示例2: DisplayRelationDetails
/**
* 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();');
}
示例3: DisplayNavigatorListTab
function DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj)
{
$oP->SetCurrentTab(Dict::S('UI:RelationshipList'));
$oP->add("<div id=\"impacted_objects\" style=\"width:100%;background-color:#fff;padding:10px;\">");
$iBlock = 1;
// Zero is not a valid blockid
foreach ($aResults as $sListClass => $aObjects) {
$oSet = CMDBObjectSet::FromArray($sListClass, $aObjects);
$oP->add("<h1>" . MetaModel::GetRelationDescription($sRelation) . ' ' . $oObj->GetName() . "</h1>\n");
$oP->add("<div class=\"page_header\">\n");
$oP->add("<h2>" . MetaModel::GetClassIcon($sListClass) . " <span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sListClass)) . "</h2>\n");
$oP->add("</div>\n");
$oBlock = DisplayBlock::FromObjectSet($oSet, 'list');
$oBlock->Display($oP, $iBlock++);
$oP->P(' ');
// Some space ?
}
$oP->add("</div>");
}
示例4: DisplayRelationDetails
/**
* 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();');
}