mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
New data model integration...
SVN:trunk[508]
This commit is contained in:
@@ -139,11 +139,13 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
if ($oAttDef->IsLinkset())
|
||||
{
|
||||
$oPage->SetCurrentTab($oAttDef->GetLabel());
|
||||
$oPage->p($oAttDef->GetDescription());
|
||||
|
||||
if (get_class($oAttDef) == 'AttributeLinkedSet')
|
||||
{
|
||||
// 1:n links
|
||||
$sTargetClass = $oAttDef->GetLinkedClass();
|
||||
$oPage->p("<img src=\"".MetaModel::GetClassIcon($sTargetClass)."\" style=\"vertical-align:middle;\"> ".$oAttDef->GetDescription());
|
||||
|
||||
$oFilter = new DBObjectSearch($sTargetClass);
|
||||
$oFilter->AddCondition($oAttDef->GetExtKeyToMe(), $this->GetKey());
|
||||
$oBlock = new DisplayBlock($oFilter, 'list', false);
|
||||
@@ -155,12 +157,17 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
}
|
||||
else // get_class($oAttDef) == 'AttributeLinkedSetIndirect'
|
||||
{
|
||||
$sLinkClass = $oAttDef->GetLinkedClass();
|
||||
// n:n links
|
||||
$sLinkedClass = $oAttDef->GetLinkedClass();
|
||||
$oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $oAttDef->GetExtKeyToRemote());
|
||||
$sTargetClass = $oLinkingAttDef->GetTargetClass();
|
||||
|
||||
$oPage->p("<img src=\"".MetaModel::GetClassIcon($sTargetClass)."\" style=\"vertical-align:middle;\"> ".$oAttDef->GetDescription());
|
||||
// Transform the DBObjectSet into a CMBDObjectSet !!!
|
||||
$aLinkedObjects = $this->Get($sAttCode)->ToArray(false);
|
||||
if (count($aLinkedObjects) > 0)
|
||||
{
|
||||
$oSet = CMDBObjectSet::FromArray($sLinkClass, $aLinkedObjects);
|
||||
$oSet = CMDBObjectSet::FromArray($sLinkedClass, $aLinkedObjects);
|
||||
$aParams = array(
|
||||
'link_attr' => $oAttDef->GetExtKeyToMe(),
|
||||
'object_id' => $this->GetKey(),
|
||||
@@ -1011,6 +1018,9 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
$aFieldsMap = array();
|
||||
$oPage->add("<form id=\"form_{$iFormId}\" enctype=\"multipart/form-data\" method=\"post\" onSubmit=\"return CheckFields('form_{$iFormId}', true)\">\n");
|
||||
|
||||
$oPage->AddTabContainer(OBJECT_PROPERTIES_TAB);
|
||||
$oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
|
||||
$oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
|
||||
$aDetailsList = MetaModel::GetZListItems($sClass, 'details');
|
||||
$aFullList = MetaModel::ListAttributeDefs($sClass);
|
||||
$aList = $aDetailsList;
|
||||
@@ -1076,19 +1086,19 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
}
|
||||
$oPage->details($aDetails);
|
||||
// Now display the relations, one tab per relation
|
||||
$oPage->AddTabContainer('Related Objects');
|
||||
$oPage->SetCurrentTabContainer('Related Objects');
|
||||
foreach($aList as $sAttCode)
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
if ($oAttDef->IsLinkset())
|
||||
{
|
||||
$oPage->SetCurrentTab($oAttDef->GetLabel());
|
||||
$oPage->p($oAttDef->GetDescription());
|
||||
|
||||
if (get_class($oAttDef) == 'AttributeLinkedSet')
|
||||
{
|
||||
// 1:n links
|
||||
$sTargetClass = $oAttDef->GetLinkedClass();
|
||||
$oPage->p("<img src=\"".MetaModel::GetClassIcon($sTargetClass)."\" style=\"vertical-align:middle;\"> ".$oAttDef->GetDescription());
|
||||
|
||||
$oFilter = new DBObjectSearch($sTargetClass);
|
||||
$oFilter->AddCondition($oAttDef->GetExtKeyToMe(), $this->GetKey());
|
||||
|
||||
@@ -1097,6 +1107,12 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
}
|
||||
else // get_class($oAttDef) == 'AttributeLinkedSetIndirect'
|
||||
{
|
||||
// n:n links
|
||||
$sLinkedClass = $oAttDef->GetLinkedClass();
|
||||
$oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $oAttDef->GetExtKeyToRemote());
|
||||
$sTargetClass = $oLinkingAttDef->GetTargetClass();
|
||||
$oPage->p("<img src=\"".MetaModel::GetClassIcon($sTargetClass)."\" style=\"vertical-align:middle;\"> ".$oAttDef->GetDescription());
|
||||
|
||||
$sValue = $this->Get($sAttCode);
|
||||
$sDisplayValue = $this->GetEditValue($sAttCode);
|
||||
$aArgs = array('this' => $this);
|
||||
@@ -1154,6 +1170,9 @@ EOF
|
||||
$sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
|
||||
$oPage->add("<form id=\"creation_form_{$iCreationFormId}\" method=\"post\" enctype=\"multipart/form-data\" onSubmit=\"return CheckFields('creation_form_{$iCreationFormId}', true)\">\n");
|
||||
$aStates = MetaModel::EnumStates($sClass);
|
||||
$oPage->AddTabContainer(OBJECT_PROPERTIES_TAB);
|
||||
$oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
|
||||
$oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
|
||||
if ($oObjectToClone == null)
|
||||
{
|
||||
$sTargetState = MetaModel::GetDefaultState($sClass);
|
||||
@@ -1259,8 +1278,6 @@ EOF
|
||||
}
|
||||
$oPage->details($aDetails);
|
||||
// Now display the relations, one tab per relation
|
||||
$oPage->AddTabContainer('Related Objects');
|
||||
$oPage->SetCurrentTabContainer('Related Objects');
|
||||
foreach($aList as $sAttCode)
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
|
||||
@@ -108,7 +108,7 @@ abstract class Contact extends cmdbAbstractObject
|
||||
"db_table" => "contact",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/team.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -333,7 +333,7 @@ class Licence extends cmdbAbstractObject
|
||||
"db_table" => "licence",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/licence.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -367,7 +367,7 @@ class Subnet extends cmdbAbstractObject
|
||||
"db_table" => "subnet",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/subnet.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -403,7 +403,7 @@ class Patch extends cmdbAbstractObject
|
||||
"db_table" => "patch",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/patch.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -495,7 +495,7 @@ abstract class FunctionalCI extends cmdbAbstractObject
|
||||
"db_table" => "functionalci",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/server.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -598,7 +598,7 @@ class ApplicationSolution extends FunctionalCI
|
||||
"db_table" => "applicationsolution",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"icon" => "../business/templates/",
|
||||
"icon" => "../business/templates/solution.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -688,7 +688,7 @@ class NetworkInterface extends ConnectableCI
|
||||
"db_table" => "networkinterface",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/interface.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -727,7 +727,7 @@ class Device extends ConnectableCI
|
||||
"db_table" => "device",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/server.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -755,7 +755,7 @@ class PC extends Device
|
||||
"db_table" => "pc",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"icon" => "../business/templates/computer.png",
|
||||
"icon" => "../business/templates/laptop.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -814,7 +814,7 @@ class MobilePhone extends MobileCI
|
||||
"db_table" => "mobilephone",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/mobile-phone.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -844,7 +844,7 @@ class InfrastructureCI extends Device
|
||||
"db_table" => "infrastructureci",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/server.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -1105,7 +1105,7 @@ class Contract extends cmdbAbstractObject
|
||||
"db_table" => "contract",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/contract.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -1145,7 +1145,7 @@ class ProviderContract extends cmdbAbstractObject
|
||||
"db_table" => "providercontract",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/contract.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
@@ -1179,7 +1179,7 @@ class CustomerContract extends cmdbAbstractObject
|
||||
"db_table" => "customercontract",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"display_template" => "",
|
||||
"icon" => "../business/templates/contract.png",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_InheritAttributes();
|
||||
|
||||
BIN
business/templates/contract.png
Normal file
BIN
business/templates/contract.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
business/templates/interface.png
Normal file
BIN
business/templates/interface.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
business/templates/licence.png
Normal file
BIN
business/templates/licence.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
business/templates/patch.png
Normal file
BIN
business/templates/patch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
business/templates/solution.png
Normal file
BIN
business/templates/solution.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
business/templates/subnet.png
Normal file
BIN
business/templates/subnet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
@@ -604,11 +604,12 @@ try
|
||||
{
|
||||
$iCount += count($aLeafs);
|
||||
$oP->add("<div class=\"page_header\">\n");
|
||||
$oP->add("<h2><span class=\"hilite\">".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aLeafs), Metamodel::GetName($sClassName))."</h2>\n");
|
||||
$oP->add("<h2><img style=\"vertical-align:middle;\" src=\"".MetaModel::GetClassIcon($sClassName)."\"><span class=\"hilite\">".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aLeafs), Metamodel::GetName($sClassName))."</h2>\n");
|
||||
$oP->add("</div>\n");
|
||||
$oLeafsFilter->AddCondition('id', $aLeafs, 'IN');
|
||||
$oBlock = new DisplayBlock($oLeafsFilter, 'list', false);
|
||||
$oBlock->Display($oP, $iBlock++);
|
||||
$oP->P(' '); // Some space ?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,9 +649,8 @@ try
|
||||
{
|
||||
$oP->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $oObj->GetName(), $sClassLabel));
|
||||
$oP->add("<div class=\"page_header\">\n");
|
||||
$oP->add("<h1>".Dict::Format('UI:ModificationTitle_Class_Object', $sClassLabel, $oObj->GetName())."</h1>\n");
|
||||
$oP->add("<h1><img src=\"".$oObj->GetIcon()."\" style=\"vertical-align:middle\"> ".Dict::Format('UI:ModificationTitle_Class_Object', $sClassLabel, $oObj->GetName())."</h1>\n");
|
||||
$oP->add("</div>\n");
|
||||
$oP->add("<img src=\"".$oObj->GetIcon()."\" style=\"margin-top:-30px; margin-right:10px; float:right\">\n");
|
||||
|
||||
$oP->add("<div class=\"wizContainer\">\n");
|
||||
$oObj->DisplayModifyForm($oP);
|
||||
@@ -733,9 +733,8 @@ try
|
||||
$sClassLabel = MetaModel::GetName($sClass);
|
||||
|
||||
$oP->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel));
|
||||
$oP->add("<h1>".Dict::Format('UI:CreationTitle_Class', $sClassLabel)."</h1>\n");
|
||||
$oP->add("<h1><img src=\"".MetaModel::GetClassIcon($sClass)."\" style=\"vertical-align:middle;\">".Dict::Format('UI:CreationTitle_Class', $sClassLabel)."</h1>\n");
|
||||
$oP->add("<div class=\"wizContainer\">\n");
|
||||
$oP->add("<img src=\"".MetaModel::GetClassIcon($sClass)."\" style=\"margin-top:-30px; margin-right:10px; float:right\">\n");
|
||||
$aDefaults = utils::ReadParam('default', array());
|
||||
$aContext = $oAppContext->GetAsHash();
|
||||
foreach($aContext as $key => $value)
|
||||
|
||||
Reference in New Issue
Block a user