GetKey();
@@ -86,11 +125,17 @@
}
}
}
- }]]>Set('close_date', time());
return true;
- }]]>Get('contact_list');
$oToImpact = $this->Get('ci_list');
@@ -540,12 +941,22 @@
$this->Set('creation_date', time());
$this->Set('last_update', time());
- }]]>Set('last_update', time());
- }]]>Get('ref');
if (strlen($sCurrRef) == 0)
@@ -559,12 +970,18 @@
$sName = sprintf('C-%06d', $iKey);
$this->Set('ref', $sName);
}
- }]]>Get('status');
switch($this->GetState())
@@ -588,8 +1005,13 @@
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
- }]]> public function ComputeValues()
{
- }]]>m_aOrigValues['connected_if']; // The interface this interface was connected to
@@ -1832,17 +2668,28 @@
self::$m_oCurrChange = $oCurrChange;
}
}
- }]]>UpdateConnectedInterface();
parent::AfterInsert();
- }]]>UpdateConnectedInterface();
parent::AfterUpdate();
- }]]>Get('ref');
if (strlen($sCurrRef) == 0)
@@ -441,8 +673,13 @@
}
return parent::ComputeValues();
- }]]>Get('contact_list');
$oToImpact = $this->Get('ci_list');
@@ -472,12 +709,18 @@
}
}
parent::OnInsert();
- }]]>Get('status');
switch($this->GetState())
@@ -538,8 +781,13 @@
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
- }]]>Set('assignment_date', time());
return true;
- }]]>Set('resolution_date', time());
return true;
- }]]>Set('close_date', time());
return true;
- }]]>Get('impact')][(int)$this->Get('urgency')];
return $iPriority;
- }]]>Set('priority', $this->ComputePriority());
@@ -343,7 +566,8 @@
$sName = sprintf('P-%06d', $iKey);
$this->Set('ref', $sName);
}
- }]]>Get('ref');
if (strlen($sCurrRef) == 0)
@@ -478,12 +754,18 @@
}
return parent::ComputeValues();
- }]]>Get('status');
switch($this->GetState())
@@ -544,8 +826,13 @@
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
- }]]> false, 'block_id' => 'service');
@@ -551,7 +907,8 @@
$oCustomerContracts=new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT CustomerContract AS cc JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id=$ServiceID"));
self::DisplaySet($oPage,$oCustomerContracts,$aExtraParam);
}
- }]]>Set('closure_deadline', time() + $iMaxWaitHours * 3600);
return true;
- }]]>Set('assignment_date', time());
return true;
- }]]>Set('resolution_date', time());
return true;
- }]]>Set('close_date', time());
return true;
- }]]>Get('impact')][(int)$this->Get('urgency')];
return $iPriority;
- }]]>Set('priority', $this->ComputePriority());
@@ -714,10 +1161,16 @@
{
$this->Set('ttr_escalation_deadline', null);
}
- }]]>GetState())
@@ -766,15 +1219,26 @@
break;
}
return $sHilightClass;
- }]]>Set('last_update', time());
- }]]>Set('last_update', time());
- }]]>".str_repeat('+', $iDepth).$oChildNode->getAttribute('name')." was removed...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->getAttribute('id')." was removed...
"; break; case 'added': -echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was created...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was created...
"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Copies all the node's attributes, and the child nodes as well if ($oChildNode instanceof DOMElement) { $oModifiedNode->removeAttribute('_source'); if ($oModifiedNode->tagName == 'class') { -echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." inserting under 'classes'...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." inserting under 'classes'...
"; // classes are always located under the root node $oDoc->firstChild->appendChild($oModifiedNode); @@ -1322,7 +1317,7 @@ echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt } else { -echo "
".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." inserting in the hierarchy...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." inserting in the hierarchy...
"; $oDestNode->appendChild($oModifiedNode); } } @@ -1333,7 +1328,7 @@ echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt break; case 'replaced': -echo "
".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was replaced...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was replaced...
"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Copies all the node's attributes, and the child nodes as well if ($oChildNode instanceof DOMElement) { @@ -1343,7 +1338,7 @@ echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt break; case 'modified': -echo "
".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was modified...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was modified...
"; if ($oChildNode instanceof DOMElement) { echo str_repeat('+', $iDepth)." Copying (NON recursively) the modified node\n"; @@ -1370,11 +1365,11 @@ echo str_repeat('+', $iDepth)." Copying (recursively) the modified node\n"; default: // No change: do nothing -echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was NOT modified...
"; +echo "".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was NOT modified...
"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Importing the node for future recusrsion if needed if ($oChildNode->tagName == 'class') { -echo "".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->getAttribute('name')." was modified...
"; +echo "".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->getAttribute('id')." was modified...
"; // classes are always located under the root node $this->_priv_ImportModifiedChildren($oDoc, $oModifiedNode, $oChildNode); } @@ -1454,15 +1449,22 @@ echo "".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge public function _priv_SetNodeAttribute(DOMNode $oNode, $sAttributeName, $atttribueValue) { } - +} + + +/** + * MFDOMElement: helper to read the information from the DOM + * @package ModelFactory + */ +class MFDOMElement extends DOMElement +{ /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the node directly under the given node, and that is supposed to be always present and unique + * Returns the node directly under the given node */ - protected function GetUniqueElement($oDOMNode, $sTagName, $bMustExist = true) + public function GetUniqueElement($sTagName, $bMustExist = true) { $oNode = null; - foreach($oDOMNode->childNodes as $oChildNode) + foreach($this->childNodes as $oChildNode) { if ($oChildNode->nodeName == $sTagName) { @@ -1478,35 +1480,53 @@ echo "
".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge
}
/**
- * Helper to browse the DOM -could be factorized in ModelFactory
- * Returns the node directly under the given node, or null is missing
+ * Returns the node directly under the current node, or null if missing
*/
- protected function GetOptionalElement($oDOMNode, $sTagName)
+ public function GetOptionalElement($sTagName)
{
- return $this->GetUniqueElement($oDOMNode, $sTagName, false);
+ return $this->GetUniqueElement($sTagName, false);
}
/**
- * Helper to browse the DOM -could be factorized in ModelFactory
- * Returns the TEXT of the given node (possibly from several subnodes)
+ * Returns the TEXT of the current node (possibly from several subnodes)
*/
- protected function GetNodeText($oNode)
+ public function GetText($sDefault = null)
{
- $sText = '';
- foreach($oNode->childNodes as $oChildNode)
+ $sText = null;
+ foreach($this->childNodes as $oChildNode)
{
if ($oChildNode instanceof DOMCharacterData) // Base class of DOMText and DOMCdataSection
{
+ if (is_null($sText)) $sText = '';
$sText .= $oChildNode->wholeText;
}
}
- return $sText;
+ if (is_null($sText))
+ {
+ return $sDefault;
+ }
+ else
+ {
+ return $sText;
+ }
}
/**
- * Helper to browse the DOM -could be factorized in ModelFactory
- * Assumes the given node to be either a text or
+ * Get the TEXT value from the child node
+ */
+ public function GetChildText($sTagName, $sDefault = null)
+ {
+ $sRet = $sDefault;
+ if ($oChild = $this->GetOptionalElement($sTagName))
+ {
+ $sRet = $oChild->GetText($sDefault);
+ }
+ return $sRet;
+ }
+
+ /**
+ * Assumes the current node to be either a text or
* ".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge
* where value can be the either a text or an array of items... recursively
* Returns a PHP array
*/
- public function GetNodeAsArrayOfItems($oNode)
+ public function GetNodeAsArrayOfItems()
{
- $oItems = $this->GetOptionalElement($oNode, 'items');
+ $oItems = $this->GetOptionalElement('items');
if ($oItems)
{
$res = array();
foreach($oItems->childNodes as $oItem)
{
// When an attribute is missing
- if ($oItem->hasAttribute('key'))
+ if ($oItem->hasAttribute('id'))
{
- $key = $oItem->getAttribute('key');
- $res[$key] = $this->GetNodeAsArrayOfItems($oItem);
+ $key = $oItem->getAttribute('id');
+ $res[$key] = $oItem->GetNodeAsArrayOfItems();
}
else
{
- $res[] = $this->GetNodeAsArrayOfItems($oItem);
+ $res[] = $oItem->GetNodeAsArrayOfItems();
}
}
}
else
{
- $res = $this->GetNodeText($oNode);
+ $res = $this->GetText();
}
return $res;
}
-
}
\ No newline at end of file