mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 17:18:51 +02:00
- In the "actions" menu, list only the relations that have a meaning for the selected class.
SVN:trunk[490]
This commit is contained in:
@@ -835,7 +835,7 @@ class MenuBlock extends DisplayBlock
|
||||
//if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Clone...', 'url' => "../pages/$sUIPage?operation=clone&class=$sClass&id=$id&$sContext"); }
|
||||
if ($bIsModifyAllowed) { $aActions[] = array ('label' => Dict::S('UI:Menu:Modify'), 'url' => "../pages/$sUIPage?operation=modify&class=$sClass&id=$id&$sContext"); }
|
||||
if ($bIsDeleteAllowed) { $aActions[] = array ('label' => Dict::S('UI:Menu:Delete'), 'url' => "../pages/$sUIPage?operation=delete&class=$sClass&id=$id&$sContext"); }
|
||||
$aRelations = MetaModel::EnumRelations();
|
||||
$aRelations = MetaModel::EnumRelations($sClass);
|
||||
foreach($aRelations as $sRelationCode)
|
||||
{
|
||||
$aActions[] = array ('label' => MetaModel::GetRelationVerbUp($sRelationCode), 'url' => "../pages/$sUIPage?operation=swf_navigator&relation=$sRelationCode&class=$sClass&id=$id&$sContext");
|
||||
|
||||
@@ -722,12 +722,24 @@ abstract class MetaModel
|
||||
|
||||
public static function EnumRelations($sClass = '')
|
||||
{
|
||||
if (empty($sClass))
|
||||
$aResult = array_keys(self::$m_aRelationInfos);
|
||||
if (!empty($sClass))
|
||||
{
|
||||
return array_keys(self::$m_aRelationInfos);
|
||||
// Return only the relations that have a meaning (i.e. for which at least one query is defined)
|
||||
// for the specified class
|
||||
$aClassRelations = array();
|
||||
foreach($aResult as $sRelCode)
|
||||
{
|
||||
$aQueries = self::EnumRelationQueries($sClass, $sRelCode);
|
||||
if (count($aQueries) > 0)
|
||||
{
|
||||
$aClassRelations[] = $sRelCode;
|
||||
}
|
||||
}
|
||||
return $aClassRelations;
|
||||
}
|
||||
|
||||
return array_keys(self::EnumRelationQueries($sClass, $sRelCode));
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
public static function EnumRelationProperties($sRelCode)
|
||||
|
||||
Reference in New Issue
Block a user