当前位置: 首页>>代码示例>>PHP>>正文


PHP MetaModel::EnumChildClasses方法代码示例

本文整理汇总了PHP中MetaModel::EnumChildClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::EnumChildClasses方法的具体用法?PHP MetaModel::EnumChildClasses怎么用?PHP MetaModel::EnumChildClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetaModel的用法示例。


在下文中一共展示了MetaModel::EnumChildClasses方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DisplaySubclasses

/**
 * Helper for the global list and the details of a given class
 */
function DisplaySubclasses($oPage, $sClass, $sContext)
{
    $aChildClasses = MetaModel::EnumChildClasses($sClass);
    if (count($aChildClasses) != 0) {
        $oPage->add("<ul>\n");
        $aOrderedClasses = array();
        foreach ($aChildClasses as $sClassName) {
            // Skip indirect childs, they will be handled somewhere else
            if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) {
                $aOrderedClasses[$sClassName] = MetaModel::GetName($sClassName);
            }
        }
        // Sort on the display name
        asort($aOrderedClasses);
        foreach ($aOrderedClasses as $sClassName => $sDisplayName) {
            // Skip indirect childs, they will be handled somewhere else
            if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) {
                $oPage->add("<li class=\"open\">" . MakeClassHLink($sClassName, $sContext) . "\n");
                DisplaySubclasses($oPage, $sClassName, $sContext);
                $oPage->add("</li>\n");
            }
        }
        $oPage->add("</ul>\n");
    }
}
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:28,代码来源:schema.php

示例2: DisplayBareRelations


//.........这里部分代码省略.........
         $bReadOnly = $iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE);
         if ($bEditMode && !$bReadOnly) {
             $sInputId = $this->m_iFormId . '_' . $sAttCode;
             $sLinkedClass = $oAttDef->GetLinkedClass();
             if ($oAttDef->IsIndirect()) {
                 $oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $oAttDef->GetExtKeyToRemote());
                 $sTargetClass = $oLinkingAttDef->GetTargetClass();
             } else {
                 $sTargetClass = $sLinkedClass;
             }
             $oPage->p(MetaModel::GetClassIcon($sTargetClass) . "&nbsp;" . $oAttDef->GetDescription() . '<span id="busy_' . $sInputId . '"></span>');
             $oValue = $this->Get($sAttCode);
             $sDisplayValue = '';
             // not used
             $sHTMLValue = "<span id=\"field_{$sInputId}\">" . self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $oValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs) . '</span>';
             $this->AddToFieldsMap($sAttCode, $sInputId);
             $oPage->add($sHTMLValue);
         } else {
             // Display mode
             if (!$oAttDef->IsIndirect()) {
                 // 1:n links
                 $sTargetClass = $oAttDef->GetLinkedClass();
                 $aDefaults = array($oAttDef->GetExtKeyToMe() => $this->GetKey());
                 $oAppContext = new ApplicationContext();
                 foreach ($oAppContext->GetNames() as $sKey) {
                     // The linked object inherits the parent's value for the context
                     if (MetaModel::IsValidAttCode($sClass, $sKey)) {
                         $aDefaults[$sKey] = $this->Get($sKey);
                     }
                 }
                 $aParams = array('target_attr' => $oAttDef->GetExtKeyToMe(), 'object_id' => $this->GetKey(), 'menu' => false, 'default' => $aDefaults, 'table_id' => $sClass . '_' . $sAttCode);
             } else {
                 // n:n links
                 $sLinkedClass = $oAttDef->GetLinkedClass();
                 $oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $oAttDef->GetExtKeyToRemote());
                 $sTargetClass = $oLinkingAttDef->GetTargetClass();
                 $bMenu = $this->Get($sAttCode)->Count() > 0;
                 // The menu is enabled only if there are already some elements...
                 $aParams = array('link_attr' => $oAttDef->GetExtKeyToMe(), 'object_id' => $this->GetKey(), 'target_attr' => $oAttDef->GetExtKeyToRemote(), 'view_link' => false, 'menu' => false, 'display_limit' => true, 'table_id' => $sClass . '_' . $sAttCode);
             }
             $oPage->p(MetaModel::GetClassIcon($sTargetClass) . "&nbsp;" . $oAttDef->GetDescription());
             $oBlock = new DisplayBlock($this->Get($sAttCode)->GetFilter(), 'list', false);
             $oBlock->Display($oPage, 'rel_' . $sAttCode, $aParams);
         }
         if (array_key_exists($sAttCode, $aRedundancySettings)) {
             foreach ($aRedundancySettings[$sAttCode] as $oRedundancyAttDef) {
                 $sRedundancyAttCode = $oRedundancyAttDef->GetCode();
                 $sValue = $this->Get($sRedundancyAttCode);
                 $iRedundancyFlags = $this->GetFormAttributeFlags($sRedundancyAttCode);
                 $bRedundancyReadOnly = $iRedundancyFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE);
                 $oPage->add('<fieldset>');
                 $oPage->add('<legend>' . $oRedundancyAttDef->GetLabel() . '</legend>');
                 if ($bEditMode && !$bRedundancyReadOnly) {
                     $sInputId = $this->m_iFormId . '_' . $sRedundancyAttCode;
                     $oPage->add("<span id=\"field_{$sInputId}\">" . self::GetFormElementForField($oPage, $sClass, $sRedundancyAttCode, $oRedundancyAttDef, $sValue, '', $sInputId, '', $iFlags, $aArgs) . '</span>');
                 } else {
                     $oPage->add($oRedundancyAttDef->GetDisplayForm($sValue, $oPage, false, $this->m_iFormId));
                 }
                 $oPage->add('</fieldset>');
             }
         }
     }
     $oPage->SetCurrentTab('');
     foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) {
         $oExtensionInstance->OnDisplayRelations($this, $oPage, $bEditMode);
     }
     // Display Notifications after the other tabs since this tab disappears in edition
     if (!$bEditMode) {
         // Look for any trigger that considers this object as "In Scope"
         // If any trigger has been found then display a tab with notifications
         //
         $oTriggerSet = new CMDBObjectSet(new DBObjectSearch('Trigger'));
         $aTriggers = array();
         while ($oTrigger = $oTriggerSet->Fetch()) {
             if ($oTrigger->IsInScope($this)) {
                 $aTriggers[] = $oTrigger->GetKey();
             }
         }
         if (count($aTriggers) > 0) {
             $iId = $this->GetKey();
             $sTriggersList = implode(',', $aTriggers);
             $aNotifSearches = array();
             $iNotifsCount = 0;
             $aNotificationClasses = MetaModel::EnumChildClasses('EventNotification', ENUM_CHILD_CLASSES_EXCLUDETOP);
             foreach ($aNotificationClasses as $sNotifClass) {
                 $aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT {$sNotifClass} AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN ({$sTriggersList}) AND Ev.object_id = {$iId}");
                 $oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass]);
                 $iNotifsCount += $oNotifSet->Count();
             }
             // Display notifications regarding the object: on block per subclass to have the intersting columns
             $sCount = $iNotifsCount > 0 ? ' (' . $iNotifsCount . ')' : '';
             $oPage->SetCurrentTab(Dict::S('UI:NotificationsTab') . $sCount);
             foreach ($aNotificationClasses as $sNotifClass) {
                 $oPage->p(MetaModel::GetClassIcon($sNotifClass, true) . '&nbsp;' . MetaModel::GetName($sNotifClass));
                 $oBlock = new DisplayBlock($aNotifSearches[$sNotifClass], 'list', false);
                 $oBlock->Display($oPage, 'notifications_' . $sNotifClass, array('menu' => false));
             }
         }
     }
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:101,代码来源:cmdbabstract.class.inc.php

示例3: EnumChildClasses

 public function EnumChildClasses($sClass, $iOption = ENUM_CHILD_CLASSES_EXCLUDETOP)
 {
     return MetaModel::EnumChildClasses($sClass, $iOption);
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:4,代码来源:modelreflection.class.inc.php

示例4: IsEnabled

 /**
  * Overload the check of the "enable" state of this menu to take into account
  * derived classes of objects
  */
 public function IsEnabled()
 {
     // Enable this menu, only if the current user has enough rights to create such an object, or an object of
     // any child class
     $aSubClasses = MetaModel::EnumChildClasses($this->sClass, ENUM_CHILD_CLASSES_ALL);
     // Including the specified class itself
     $bActionIsAllowed = false;
     foreach ($aSubClasses as $sCandidateClass) {
         if (!MetaModel::IsAbstract($sCandidateClass) && UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
             $bActionIsAllowed = true;
             break;
             // Enough for now
         }
     }
     return $bActionIsAllowed;
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:20,代码来源:menunode.class.inc.php

示例5: array

 $iCount = utils::ReadParam('count', 0);
 $iCurrentPos = utils::ReadParam('position', 0);
 $iTune = utils::ReadParam('tune', 0);
 if (empty($sFullText)) {
     $oPage->p(Dict::S('UI:Search:NoSearch'));
     break;
 }
 // Search in full text mode in all the classes
 $aMatches = array();
 // Build the ordered list of classes to search into
 //
 if (empty($sClassName)) {
     $aSearchClasses = MetaModel::GetClasses('searchable');
 } else {
     // Search is limited to a given class and its subclasses
     $aSearchClasses = MetaModel::EnumChildClasses($sClassName, ENUM_CHILD_CLASSES_ALL);
 }
 // Skip abstract classes, since we search in all the child classes anyway
 foreach ($aSearchClasses as $idx => $sClass) {
     if (MetaModel::IsAbstract($sClass)) {
         unset($aSearchClasses[$idx]);
     }
 }
 $sMaxChunkDuration = MetaModel::GetConfig()->Get('full_text_chunk_duration');
 $aAccelerators = MetaModel::GetConfig()->Get('full_text_accelerators');
 foreach (array_reverse($aAccelerators) as $sClass => $aRestriction) {
     $bSkip = false;
     $iPos = array_search($sClass, $aSearchClasses);
     if ($iPos !== false) {
         unset($aSearchClasses[$iPos]);
     } else {
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:ajax.render.php

示例6: GetDescription

 /**
  * Describe (as a text string) the modifications corresponding to this change
  */
 public function GetDescription()
 {
     $sResult = '';
     $oTargetObjectClass = $this->Get('objclass');
     $oTargetObjectKey = $this->Get('objkey');
     $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
     $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
     $oMonoObjectSet = new DBObjectSet($oTargetSearch);
     if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) {
         if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) {
             return '';
         }
         // Protects against renamed attributes...
         $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
         $sAttName = $oAttDef->GetLabel();
         $sLinkClass = $oAttDef->GetLinkedClass();
         $aLinkClasses = MetaModel::EnumChildClasses($sLinkClass, ENUM_CHILD_CLASSES_ALL);
         // Search for changes on the corresponding link
         //
         $oSearch = new DBObjectSearch('CMDBChangeOpSetAttribute');
         $oSearch->AddCondition('change', $this->Get('change'), '=');
         $oSearch->AddCondition('objkey', $this->Get('link_id'), '=');
         if (count($aLinkClasses) == 1) {
             // Faster than the whole building of the expression below for just one value ??
             $oSearch->AddCondition('objclass', $sLinkClass, '=');
         } else {
             $oField = new FieldExpression('objclass', $oSearch->GetClassAlias());
             $sListExpr = '(' . implode(', ', CMDBSource::Quote($aLinkClasses)) . ')';
             $sOQLCondition = $oField->Render() . " IN {$sListExpr}";
             $oNewCondition = Expression::FromOQL($sOQLCondition);
             $oSearch->AddConditionExpression($oNewCondition);
         }
         $oSet = new DBObjectSet($oSearch);
         $aChanges = array();
         while ($oChangeOp = $oSet->Fetch()) {
             $aChanges[] = $oChangeOp->GetDescription();
         }
         if (count($aChanges) == 0) {
             return '';
         }
         $sItemDesc = MetaModel::GetHyperLink($this->Get('item_class'), $this->Get('item_id'));
         $sResult = $sAttName . ' - ';
         $sResult .= Dict::Format('Change:LinkSet:Modified', $sItemDesc);
         $sResult .= ' : ' . implode(', ', $aChanges);
     }
     return $sResult;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:50,代码来源:cmdbchangeop.class.inc.php

示例7: 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>');
         }
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:35,代码来源:model.itop-config-mgmt.php

示例8: GetAllowedValues

 public function GetAllowedValues($aArgs = array(), $sContains = '')
 {
     $aRawValues = MetaModel::EnumChildClasses($this->GetHostClass(), ENUM_CHILD_CLASSES_ALL);
     $aLocalizedValues = array();
     foreach ($aRawValues as $sClass) {
         $aLocalizedValues[$sClass] = MetaModel::GetName($sClass);
     }
     return $aLocalizedValues;
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:9,代码来源:attributedef.class.inc.php

示例9: Check

 /**
  * Check the validity of the expression with regard to the data model
  * and the query in which it is used
  * 	 	 
  * @param ModelReflection $oModelReflection MetaModel to consider	 	
  * @throws OqlNormalizeException
  */
 public function Check(ModelReflection $oModelReflection, $sSourceQuery)
 {
     $aColumnToClasses = array();
     foreach ($this->aQueries as $iQuery => $oQuery) {
         $oQuery->Check($oModelReflection, $sSourceQuery);
         $aAliasToClass = array($oQuery->GetClassAlias() => $oQuery->GetClass());
         $aJoinSpecs = $oQuery->GetJoins();
         if (is_array($aJoinSpecs)) {
             foreach ($aJoinSpecs as $oJoinSpec) {
                 $aAliasToClass[$oJoinSpec->GetClassAlias()] = $oJoinSpec->GetClass();
             }
         }
         $aSelectedClasses = $oQuery->GetSelectedClasses();
         if ($iQuery != 0) {
             if (count($aSelectedClasses) < count($aColumnToClasses)) {
                 $oLastClass = end($aSelectedClasses);
                 throw new OqlNormalizeException('Too few selected classes in the subquery', $sSourceQuery, $oLastClass);
             }
             if (count($aSelectedClasses) > count($aColumnToClasses)) {
                 $oLastClass = end($aSelectedClasses);
                 throw new OqlNormalizeException('Too many selected classes in the subquery', $sSourceQuery, $oLastClass);
             }
         }
         foreach ($aSelectedClasses as $iColumn => $oClassDetails) {
             $sAlias = $oClassDetails->GetValue();
             $sClass = $aAliasToClass[$sAlias];
             $aColumnToClasses[$iColumn][] = array('alias' => $sAlias, 'class' => $sClass, 'class_name' => $oClassDetails);
         }
     }
     foreach ($aColumnToClasses as $iColumn => $aClasses) {
         foreach ($aClasses as $iQuery => $aData) {
             if ($iQuery == 0) {
                 // Establish the reference
                 $sRootClass = MetaModel::GetRootClass($aData['class']);
             } else {
                 if (MetaModel::GetRootClass($aData['class']) != $sRootClass) {
                     $aSubclasses = MetaModel::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_ALL);
                     throw new OqlNormalizeException('Incompatible classes: could not find a common ancestor', $sSourceQuery, $aData['class_name'], $aSubclasses);
                 }
             }
         }
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:50,代码来源:oqlquery.class.inc.php

示例10: GetFieldList

 /**
  * Read a list of attribute codes from a Rest/Json structure.
  * 	 
  * @param string $sClass Name of the class
  * @param StdClass $oData Structured input data.
  * @param string $sParamName Name of the parameter to fetch from the input data
  * @return An array of class => list of attributes (see RestResultWithObjects::AddObject that uses it)
  * @throws Exception
  * @api
  */
 public static function GetFieldList($sClass, $oData, $sParamName)
 {
     $sFields = self::GetOptionalParam($oData, $sParamName, '*');
     $aShowFields = array();
     if ($sFields == '*') {
         foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
             $aShowFields[$sClass][] = $sAttCode;
         }
     } elseif ($sFields == '*+') {
         foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sRefClass) {
             foreach (MetaModel::ListAttributeDefs($sRefClass) as $sAttCode => $oAttDef) {
                 $aShowFields[$sRefClass][] = $sAttCode;
             }
         }
     } else {
         foreach (explode(',', $sFields) as $sAttCode) {
             $sAttCode = trim($sAttCode);
             if ($sAttCode != 'id' && !MetaModel::IsValidAttCode($sClass, $sAttCode)) {
                 throw new Exception("{$sParamName}: invalid attribute code '{$sAttCode}'");
             }
             $aShowFields[$sClass][] = $sAttCode;
         }
     }
     return $aShowFields;
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:35,代码来源:applicationextension.inc.php

示例11: GetExtendedNameExpression

 /**
  *	Get the friendly name for the class and its subclasses (if finalclass = 'subclass' ...)
  *	Simplifies the final expression by grouping classes having the same name expression	 
  *	Used when querying a parent class 	 
  */
 protected static function GetExtendedNameExpression($sClass)
 {
     // 1st step - get all of the required expressions (instantiable classes)
     //            and group them using their OQL representation
     //
     $aFNExpressions = array();
     // signature => array('expression' => oExp, 'classes' => array of classes)
     foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sSubClass) {
         if ($sSubClass != $sClass && MetaModel::IsAbstract($sSubClass)) {
             continue;
         }
         $oSubClassName = MetaModel::GetNameExpression($sSubClass);
         $sSignature = $oSubClassName->Render();
         if (!array_key_exists($sSignature, $aFNExpressions)) {
             $aFNExpressions[$sSignature] = array('expression' => $oSubClassName, 'classes' => array());
         }
         $aFNExpressions[$sSignature]['classes'][] = $sSubClass;
     }
     // 2nd step - build the final name expression depending on the finalclass
     //
     if (count($aFNExpressions) == 1) {
         $aExpData = reset($aFNExpressions);
         $oNameExpression = $aExpData['expression'];
     } else {
         $oNameExpression = null;
         foreach ($aFNExpressions as $sSignature => $aExpData) {
             $oClassListExpr = ListExpression::FromScalars($aExpData['classes']);
             $oClassExpr = new FieldExpression('finalclass', $sClass);
             $oClassInList = new BinaryExpression($oClassExpr, 'IN', $oClassListExpr);
             if (is_null($oNameExpression)) {
                 $oNameExpression = $aExpData['expression'];
             } else {
                 $oNameExpression = new FunctionExpression('IF', array($oClassInList, $aExpData['expression'], $oNameExpression));
             }
         }
     }
     return $oNameExpression;
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:43,代码来源:dbobjectsearch.class.php

示例12: DBObjectSearch

$oP->add(Dict::S('UI:NotificationsMenu:HelpContent'));
$oP->add('</div>');
$oP->add('');
$oP->add('');
$oP->EndCollapsibleSection();
$oP->add('<p>&nbsp;</p>');
$oP->AddTabContainer('Tabs_0');
$oP->SetCurrentTabContainer('Tabs_0');
$oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Triggers'));
$oP->add('<h2>' . Dict::S('UI:NotificationsMenu:AvailableTriggers') . '</h2>');
$oFilter = new DBObjectSearch('Trigger');
$aParams = array();
$oBlock = new DisplayBlock($oFilter, 'list', false, $aParams);
$oBlock->Display($oP, 'block_0', $aParams);
$aActionClasses = array();
foreach (MetaModel::EnumChildClasses('Action', ENUM_CHILD_CLASSES_EXCLUDETOP) as $sActionClass) {
    if (!MetaModel::IsAbstract($sActionClass)) {
        $aActionClasses[] = $sActionClass;
    }
}
$oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Actions'));
if (count($aActionClasses) == 1) {
    // Preserve old style
    $oP->add('<h2>' . Dict::S('UI:NotificationsMenu:AvailableActions') . '</h2>');
}
$iBlock = 0;
foreach ($aActionClasses as $sActionClass) {
    if (count($aActionClasses) > 1) {
        // New style
        $oP->add('<h2>' . MetaModel::GetName($sActionClass) . '</h2>');
    }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:31,代码来源:notifications.php

示例13: ApplicationException

 ///////////////////////////////////////////////////////////////////////////////////////////
 case 'new':
     // Form to create a new object
     $sClass = utils::ReadParam('class', '', false, 'class');
     $sStateCode = utils::ReadParam('state', '');
     $bCheckSubClass = utils::ReadParam('checkSubclass', true);
     if (empty($sClass)) {
         throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class'));
     }
     $aArgs = utils::ReadParam('default', array(), false, 'raw_data');
     $aContext = $oAppContext->GetAsHash();
     foreach ($oAppContext->GetNames() as $key) {
         $aArgs[$key] = $oAppContext->GetCurrentValue($key);
     }
     // If the specified class has subclasses, ask the user an instance of which class to create
     $aSubClasses = MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL);
     // Including the specified class itself
     $aPossibleClasses = array();
     $sRealClass = '';
     if ($bCheckSubClass) {
         foreach ($aSubClasses as $sCandidateClass) {
             if (!MetaModel::IsAbstract($sCandidateClass) && UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
                 $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass);
             }
         }
         // Only one of the subclasses can be instantiated...
         if (count($aPossibleClasses) == 1) {
             $aKeys = array_keys($aPossibleClasses);
             $sRealClass = $aKeys[0];
         }
     } else {
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:UI.php

示例14: GetObjectCreationDlg

 public function GetObjectCreationDlg(WebPage $oPage, $sProposedRealClass = '')
 {
     // For security reasons: check that the "proposed" class is actually a subclass of the linked class
     // and that the current user is allowed to create objects of this class
     $sRealClass = '';
     $oPage->add('<div class="wizContainer" style="vertical-align:top;"><div>');
     $aSubClasses = MetaModel::EnumChildClasses($this->sLinkedClass, ENUM_CHILD_CLASSES_ALL);
     // Including the specified class itself
     $aPossibleClasses = array();
     foreach ($aSubClasses as $sCandidateClass) {
         if (!MetaModel::IsAbstract($sCandidateClass) && UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES) {
             if ($sCandidateClass == $sProposedRealClass) {
                 $sRealClass = $sProposedRealClass;
             }
             $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass);
         }
     }
     // Only one of the subclasses can be instantiated...
     if (count($aPossibleClasses) == 1) {
         $aKeys = array_keys($aPossibleClasses);
         $sRealClass = $aKeys[0];
     }
     if ($sRealClass != '') {
         $oPage->add("<h1>" . MetaModel::GetClassIcon($sRealClass) . "&nbsp;" . Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($sRealClass)) . "</h1>\n");
         $oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode);
         $sExtKeyToMe = $oLinksetDef->GetExtKeyToMe();
         $aFieldFlags = array($sExtKeyToMe => OPT_ATT_HIDDEN);
         cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, null, array(), array('formPrefix' => $this->sInputid, 'noRelations' => true, 'fieldsFlags' => $aFieldFlags));
     } else {
         $sClassLabel = MetaModel::GetName($this->sLinkedClass);
         $oPage->add('<p>' . Dict::Format('UI:SelectTheTypeOf_Class_ToCreate', $sClassLabel));
         $oPage->add('<nobr><select name="class">');
         asort($aPossibleClasses);
         foreach ($aPossibleClasses as $sClassName => $sClassLabel) {
             $oPage->add("<option value=\"{$sClassName}\">{$sClassLabel}</option>");
         }
         $oPage->add('</select>');
         $oPage->add('&nbsp; <button type="button" onclick="$(\'#' . $this->sInputid . '\').directlinks(\'subclassSelected\');">' . Dict::S('UI:Button:Apply') . '</button><span class="indicator" style="display:inline-block;width:16px"></span></nobr></p>');
     }
     $oPage->add('</div></div>');
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:41,代码来源:ui.linksdirectwidget.class.inc.php


注:本文中的MetaModel::EnumChildClasses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。