本文整理汇总了PHP中MetaModel::HasChildrenClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::HasChildrenClasses方法的具体用法?PHP MetaModel::HasChildrenClasses怎么用?PHP MetaModel::HasChildrenClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::HasChildrenClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HasChildrenClasses
public function HasChildrenClasses($sClass)
{
return MetaModel::HasChildrenClasses($sClass);
}
示例2: DisplayBareRelations
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
{
parent::DisplayBareRelations($oPage, $bEditMode);
$sTicketListAttCode = 'tickets_list';
if (MetaModel::IsValidAttCode(get_class($this), $sTicketListAttCode)) {
// Display one list per leaf class (the only way to display the status as of now)
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sTicketListAttCode);
$sLnkClass = $oAttDef->GetLinkedClass();
$sExtKeyToMe = $oAttDef->GetExtKeyToMe();
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
$iTotal = 0;
$aSearches = array();
foreach (MetaModel::EnumChildClasses('Ticket') as $sSubClass) {
if (!MetaModel::HasChildrenClasses($sSubClass)) {
$sStateAttCode = MetaModel::GetStateAttributeCode($sSubClass);
if ($sStateAttCode != '') {
$oSearch = DBSearch::FromOQL("SELECT {$sSubClass} AS t JOIN {$sLnkClass} AS lnk ON lnk.{$sExtKeyToRemote} = t.id WHERE {$sExtKeyToMe} = :myself AND {$sStateAttCode} NOT IN ('rejected', 'resolved', 'closed')", array('myself' => $this->GetKey()));
$aSearches[$sSubClass] = $oSearch;
$oSet = new DBObjectSet($oSearch);
$iTotal += $oSet->Count();
}
}
}
$sCount = $iTotal > 0 ? ' (' . $iTotal . ')' : '';
$oPage->SetCurrentTab(Dict::S('Class:FunctionalCI/Tab:OpenedTickets') . $sCount);
foreach ($aSearches as $sSubClass => $oSearch) {
$sBlockId = __CLASS__ . '_opened_' . $sSubClass;
$oPage->add('<fieldset>');
$oPage->add('<legend>' . MetaModel::GetName($sSubClass) . '</legend>');
$oBlock = new DisplayBlock($oSearch, 'list', false);
$oBlock->Display($oPage, $sBlockId, array('menu' => false));
$oPage->add('</fieldset>');
}
}
}
示例3: array
$aColumns = utils::ReadParam('columns', array(), false, 'raw_data');
$aClassAliases = utils::ReadParam('class_aliases', array());
$iListId = utils::ReadParam('list_id', 0);
//$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClassName, 'list'));
// Filter the list to removed linked set since we are not able to display them here
$aOrderBy = array();
$iSortIndex = 0;
$aColumnsLoad = array();
foreach ($aClassAliases as $sAlias => $sClassName) {
$aColumnsLoad[$sAlias] = array();
foreach ($aColumns[$sAlias] as $sAttCode => $aData) {
if ($aData['checked'] == 'true') {
$aColumns[$sAlias][$sAttCode]['checked'] = true;
if ($sAttCode == '_key_') {
if ($iSortCol == $iSortIndex) {
if (!MetaModel::HasChildrenClasses($oFilter->GetClass())) {
$aNameSpec = MetaModel::GetNameSpec($oFilter->GetClass());
if ($aNameSpec[0] == '%1$s') {
// The name is made of a single column, let's sort according to the sort algorithm for this column
$aOrderBy[$aNameSpec[1][0]] = utils::ReadParam('sort_order', 'asc') == 'asc';
} else {
$aOrderBy['friendlyname'] = utils::ReadParam('sort_order', 'asc') == 'asc';
}
} else {
$aOrderBy['friendlyname'] = utils::ReadParam('sort_order', 'asc') == 'asc';
}
}
} else {
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
if ($oAttDef instanceof AttributeLinkedSet) {
// Removed from the display list
示例4: DisplayClassDetails
/**
* Display the details of a given class of objects
*/
function DisplayClassDetails($oPage, $sClass, $sContext)
{
$oPage->add("<h2>" . MetaModel::GetName($sClass) . " ({$sClass}) - " . MetaModel::GetClassDescription($sClass) . "</h2>\n");
if (MetaModel::IsAbstract($sClass)) {
$oPage->p(Dict::S('UI:Schema:AbstractClass'));
} else {
$oPage->p(Dict::S('UI:Schema:NonAbstractClass'));
}
// $oPage->p("<h3>".Dict::S('UI:Schema:ClassHierarchyTitle')."</h3>");
$aParentClasses = array();
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
$aParentClasses[] = MakeClassHLink($sParentClass, $sContext);
}
if (count($aParentClasses) > 0) {
$sParents = implode(' >> ', $aParentClasses) . " >> <b>{$sClass}</b>";
} else {
$sParents = '';
}
$oPage->p("[<a href=\"schema.php?operation=list{$sContext}\">" . Dict::S('UI:Schema:AllClasses') . "</a>] {$sParents}");
if (MetaModel::HasChildrenClasses($sClass)) {
$oPage->add("<ul id=\"ClassHierarchy\">");
$oPage->add("<li class=\"closed\">" . $sClass . "\n");
DisplaySubclasses($oPage, $sClass, $sContext);
$oPage->add("</li>\n");
$oPage->add("</ul>\n");
$oPage->add_ready_script('$("#ClassHierarchy").treeview();');
}
$oPage->p('');
$oPage->AddTabContainer('details');
$oPage->SetCurrentTabContainer('details');
// List the attributes of the object
$aForwardChangeTracking = MetaModel::GetTrackForwardExternalKeys($sClass);
$aDetails = array();
foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
if ($oAttDef->IsExternalKey()) {
$sValue = Dict::Format('UI:Schema:ExternalKey_To', MakeClassHLink($oAttDef->GetTargetClass(), $sContext));
if (array_key_exists($sAttCode, $aForwardChangeTracking)) {
$oLinkSet = $aForwardChangeTracking[$sAttCode];
$sRemoteClass = $oLinkSet->GetHostClass();
$sValue = $sValue . "<span title=\"Forward changes to {$sRemoteClass}\">*</span>";
}
} elseif ($oAttDef->IsLinkSet()) {
$sValue = MakeClassHLink($oAttDef->GetLinkedClass(), $sContext);
} else {
$sValue = $oAttDef->GetDescription();
}
$sType = $oAttDef->GetType() . ' (' . $oAttDef->GetTypeDesc() . ')';
$sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode);
$sAllowedValues = "";
$sMoreInfo = "";
$aCols = array();
foreach ($oAttDef->GetSQLColumns() as $sCol => $sFieldDesc) {
$aCols[] = "{$sCol}: {$sFieldDesc}";
}
if (count($aCols) > 0) {
$sCols = implode(', ', $aCols);
$aMoreInfo = array();
$aMoreInfo[] = Dict::Format('UI:Schema:Columns_Description', $sCols);
$aMoreInfo[] = Dict::Format('UI:Schema:Default_Description', $oAttDef->GetDefaultValue());
$aMoreInfo[] = $oAttDef->IsNullAllowed() ? Dict::S('UI:Schema:NullAllowed') : Dict::S('UI:Schema:NullNotAllowed');
$sMoreInfo .= implode(', ', $aMoreInfo);
}
if ($oAttDef instanceof AttributeEnum) {
// Display localized values for the enum (which depend on the localization provided by the class)
$aLocalizedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, array());
$aDescription = array();
foreach ($aLocalizedValues as $val => $sDisplay) {
$aDescription[] = htmlentities("{$val} => ", ENT_QUOTES, 'UTF-8') . $sDisplay;
}
$sAllowedValues = implode(', ', $aDescription);
} else {
$sAllowedValues = '';
}
$aDetails[] = array('code' => $oAttDef->GetCode(), 'type' => $sType, 'origin' => $sOrigin, 'label' => $oAttDef->GetLabel(), 'description' => $sValue, 'values' => $sAllowedValues, 'moreinfo' => $sMoreInfo);
}
$oPage->SetCurrentTab(Dict::S('UI:Schema:Attributes'));
$aConfig = array('code' => array('label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')), 'label' => array('label' => Dict::S('UI:Schema:Label'), 'description' => Dict::S('UI:Schema:Label+')), 'type' => array('label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')), 'origin' => array('label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')), 'description' => array('label' => Dict::S('UI:Schema:Description'), 'description' => Dict::S('UI:Schema:Description+')), 'values' => array('label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')), 'moreinfo' => array('label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')));
$oPage->table($aConfig, $aDetails);
// List the search criteria for this object
$aDetails = array();
foreach (MetaModel::GetClassFilterDefs($sClass) as $sFilterCode => $oFilterDef) {
$aOpDescs = array();
foreach ($oFilterDef->GetOperators() as $sOpCode => $sOpDescription) {
$sIsTheLooser = $sOpCode == $oFilterDef->GetLooseOperator() ? " (loose search)" : "";
$aOpDescs[] = "{$sOpCode} ({$sOpDescription}){$sIsTheLooser}";
}
$aDetails[] = array('code' => $sFilterCode, 'description' => $oFilterDef->GetLabel(), 'operators' => implode(" / ", $aOpDescs));
}
$oPage->SetCurrentTab(Dict::S('UI:Schema:SearchCriteria'));
$aConfig = array('code' => array('label' => Dict::S('UI:Schema:FilterCode'), 'description' => Dict::S('UI:Schema:FilterCode+')), 'description' => array('label' => Dict::S('UI:Schema:FilterDescription'), 'description' => Dict::S('UI:Schema:FilterDescription+')), 'operators' => array('label' => Dict::S('UI:Schema:AvailOperators'), 'description' => Dict::S('UI:Schema:AvailOperators+')));
$oPage->table($aConfig, $aDetails);
$oPage->SetCurrentTab(Dict::S('UI:Schema:ChildClasses'));
DisplaySubclasses($oPage, $sClass, $sContext);
$oPage->SetCurrentTab(Dict::S('UI:Schema:ReferencingClasses'));
DisplayReferencingClasses($oPage, $sClass, $sContext);
$oPage->SetCurrentTab(Dict::S('UI:Schema:RelatedClasses'));
DisplayRelatedClasses($oPage, $sClass, $sContext);
//.........这里部分代码省略.........