本文整理汇总了PHP中MetaModel::GetDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::GetDescription方法的具体用法?PHP MetaModel::GetDescription怎么用?PHP MetaModel::GetDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::GetDescription方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DisplayObjectDetails
/**
* Display the attributes of an object (no title, no form)
* @param Object $oObj Any kind of object
* @param aAttList The list of attributes to display
* @return void
*/
public function DisplayObjectDetails($oObj, $aAttList)
{
$sClass = get_class($oObj);
$aDetails = array();
foreach ($aAttList as $sAttCode) {
$iFlags = $oObj->GetAttributeFlags($sAttCode);
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
if (!$oAttDef->IsLinkSet() && ($iFlags & OPT_ATT_HIDDEN) == 0) {
// Don't display linked set and non-visible attributes (in this state)
$sDisplayValue = $oObj->GetAsHTML($sAttCode);
$aDetails[] = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
}
}
$this->details($aDetails);
}
示例2: GetFieldAsHtml
protected function GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode)
{
$retVal = null;
if ($this->IsNew()) {
$iFlags = $this->GetInitialStateAttributeFlags($sAttCode);
} else {
$iFlags = $this->GetAttributeFlags($sAttCode);
}
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if (!$oAttDef->IsLinkSet() && ($iFlags & OPT_ATT_HIDDEN) == 0) {
// The field is visible in the current state of the object
if ($sStateAttCode == $sAttCode) {
// Special display for the 'state' attribute itself
$sDisplayValue = $this->GetStateLabel();
} else {
if ($oAttDef->GetEditClass() == 'Document') {
$oDocument = $this->Get($sAttCode);
$sDisplayValue = $this->GetAsHTML($sAttCode);
$sDisplayValue .= "<br/>" . Dict::Format('UI:OpenDocumentInNewWindow_', $oDocument->GetDisplayLink(get_class($this), $this->GetKey(), $sAttCode)) . ", \n";
$sDisplayValue .= "<br/>" . Dict::Format('UI:DownloadDocument_', $oDocument->GetDownloadLink(get_class($this), $this->GetKey(), $sAttCode)) . ", \n";
} else {
$sDisplayValue = $this->GetAsHTML($sAttCode);
}
}
$retVal = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
}
return $retVal;
}
示例3: DisplayBareProperties
function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
{
if ($bEditMode) {
return;
}
// Not editable
$oPage->add('<table style="vertical-align:top"><tr style="vertical-align:top"><td>');
$aDetails = array();
$sClass = get_class($this);
$oPage->add('<fieldset>');
$oPage->add('<legend>' . Dict::S('Core:SynchroReplica:PrivateDetails') . '</legend>');
$aZList = MetaModel::FlattenZlist(MetaModel::GetZListItems($sClass, 'details'));
foreach ($aZList as $sAttCode) {
$sDisplayValue = $this->GetAsHTML($sAttCode);
$aDetails[] = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
}
$oPage->Details($aDetails);
$oPage->add('</fieldset>');
if (strlen($this->Get('dest_class')) > 0) {
$oDestObj = MetaModel::GetObject($this->Get('dest_class'), $this->Get('dest_id'), false);
if (is_object($oDestObj)) {
$oPage->add('<fieldset>');
$oPage->add('<legend>' . Dict::Format('Core:SynchroReplica:TargetObject', $oDestObj->GetHyperlink()) . '</legend>');
$oDestObj->DisplayBareProperties($oPage, false, $sPrefix, $aExtraParams);
$oPage->add('<fieldset>');
}
}
$oPage->add('</td><td>');
$oPage->add('<fieldset>');
$oPage->add('<legend>' . Dict::S('Core:SynchroReplica:PublicData') . '</legend>');
$oSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'));
$sSQLTable = $oSource->GetDataTable();
$aData = $this->LoadExtendedDataFromTable($sSQLTable);
$aHeaders = array('attcode' => array('label' => 'Attribute Code', 'description' => ''), 'data' => array('label' => 'Value', 'description' => ''));
$aRows = array();
foreach ($aData as $sKey => $value) {
$aRows[] = array('attcode' => $sKey, 'data' => $value);
}
$oPage->Table($aHeaders, $aRows);
$oPage->add('</fieldset>');
$oPage->add('</td></tr></table>');
}
示例4: DisplayBareProperties
function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
{
if ($bEditMode) {
return array();
}
// Not editable
$aDetails = array();
$sClass = get_class($this);
$aZList = MetaModel::FlattenZlist(MetaModel::GetZListItems($sClass, 'details'));
foreach ($aZList as $sAttCode) {
$sDisplayValue = $this->GetAsHTML($sAttCode);
$aDetails[] = array('label' => '<span title="' . MetaModel::GetDescription($sClass, $sAttCode) . '">' . MetaModel::GetLabel($sClass, $sAttCode) . '</span>', 'value' => $sDisplayValue);
}
$oPage->Details($aDetails);
return array();
}
示例5: test_search
function test_search()
{
echo "<h4>Two searches</h4>";
$oFilterAllDevs = new DBObjectSearch("cmdbTeam");
$oAllDevs = new DBObjectSet($oFilterAllDevs);
echo "Found " . $oAllDevs->Count() . " items.</br>\n";
while ($oDev = $oAllDevs->Fetch()) {
$aValues = array();
foreach (MetaModel::GetAttributesList($oAllDevs->GetClass()) as $sAttCode) {
$aValues[] = MetaModel::GetLabel(get_class($oDev), $sAttCode) . " (" . MetaModel::GetDescription(get_class($oDev), $sAttCode) . ") = " . $oDev->GetAsHTML($sAttCode);
}
echo $oDev->GetKey() . " => " . implode(", ", $aValues) . "</br>\n";
}
// a second one
$oMyFilter = new DBObjectSearch("cmdbContact");
//$oMyFilter->AddCondition("name", "aii", "Finishes with");
$oMyFilter->AddCondition("name", "aii");
$this->search_and_show_list($oMyFilter);
}
示例6: DisplayImportHistoryDetails
/**
* Display the details of an import
*/
static function DisplayImportHistoryDetails(iTopWebPage $oPage, $iChange)
{
if ($iChange == 0) {
throw new Exception("Missing parameter changeid");
}
$oChange = MetaModel::GetObject('CMDBChange', $iChange, false);
if (is_null($oChange)) {
throw new Exception("Unknown change: {$iChange}");
}
$oPage->add("<div><p><h1>" . Dict::Format('UI:History:BulkImportDetails', $oChange->Get('date'), $oChange->GetUserName()) . "</h1></p></div>\n");
// Assumption : change made one single class of objects
$aObjects = array();
$aAttributes = array();
// array of attcode => occurences
$oOpSearch = DBObjectSearch::FromOQL("SELECT CMDBChangeOp WHERE change = :change_id");
$oOpSet = new DBObjectSet($oOpSearch, array(), array('change_id' => $iChange));
while ($oOperation = $oOpSet->Fetch()) {
$sClass = $oOperation->Get('objclass');
$iKey = $oOperation->Get('objkey');
$iObjId = "{$sClass}::{$iKey}";
if (!isset($aObjects[$iObjId])) {
$aObjects[$iObjId] = array();
$aObjects[$iObjId]['__class__'] = $sClass;
$aObjects[$iObjId]['__id__'] = $iKey;
}
if (get_class($oOperation) == 'CMDBChangeOpCreate') {
$aObjects[$iObjId]['__created__'] = true;
} elseif ($oOperation instanceof CMDBChangeOpSetAttribute) {
$sAttCode = $oOperation->Get('attcode');
if (get_class($oOperation) == 'CMDBChangeOpSetAttributeScalar') {
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if ($oAttDef->IsExternalKey()) {
$sOldValue = Dict::S('UI:UndefinedObject');
if ($oOperation->Get('oldvalue') != 0) {
$oOldTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('oldvalue'));
$sOldValue = $oOldTarget->GetHyperlink();
}
$sNewValue = Dict::S('UI:UndefinedObject');
if ($oOperation->Get('newvalue') != 0) {
$oNewTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('newvalue'));
$sNewValue = $oNewTarget->GetHyperlink();
}
} else {
$sOldValue = $oOperation->GetAsHTML('oldvalue');
$sNewValue = $oOperation->GetAsHTML('newvalue');
}
$aObjects[$iObjId][$sAttCode] = $sOldValue . ' -> ' . $sNewValue;
} else {
$aObjects[$iObjId][$sAttCode] = 'n/a';
}
if (isset($aAttributes[$sAttCode])) {
$aAttributes[$sAttCode]++;
} else {
$aAttributes[$sAttCode] = 1;
}
}
}
$aDetails = array();
foreach ($aObjects as $iUId => $aObjData) {
$aRow = array();
$oObject = MetaModel::GetObject($aObjData['__class__'], $aObjData['__id__'], false);
if (is_null($oObject)) {
$aRow['object'] = $aObjData['__class__'] . '::' . $aObjData['__id__'] . ' (deleted)';
} else {
$aRow['object'] = $oObject->GetHyperlink();
}
if (isset($aObjData['__created__'])) {
$aRow['operation'] = Dict::S('Change:ObjectCreated');
} else {
$aRow['operation'] = Dict::S('Change:ObjectModified');
}
foreach ($aAttributes as $sAttCode => $iOccurences) {
if (isset($aObjData[$sAttCode])) {
$aRow[$sAttCode] = $aObjData[$sAttCode];
} elseif (!is_null($oObject)) {
// This is the current vaslue: $oObject->GetAsHtml($sAttCode)
// whereas we are displaying the value that was set at the time
// the object was created
// This requires addtional coding...let's do that later
$aRow[$sAttCode] = '';
} else {
$aRow[$sAttCode] = '';
}
}
$aDetails[] = $aRow;
}
$aConfig = array();
$aConfig['object'] = array('label' => MetaModel::GetName($sClass), 'description' => MetaModel::GetClassDescription($sClass));
$aConfig['operation'] = array('label' => Dict::S('UI:History:Changes'), 'description' => Dict::S('UI:History:Changes+'));
foreach ($aAttributes as $sAttCode => $iOccurences) {
$aConfig[$sAttCode] = array('label' => MetaModel::GetLabel($sClass, $sAttCode), 'description' => MetaModel::GetDescription($sClass, $sAttCode));
}
$oPage->table($aConfig, $aDetails);
}