本文整理汇总了PHP中DBObjectSet::GetClass方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObjectSet::GetClass方法的具体用法?PHP DBObjectSet::GetClass怎么用?PHP DBObjectSet::GetClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectSet
的用法示例。
在下文中一共展示了DBObjectSet::GetClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FromObjectSet
/**
* Constructs a DisplayBlock object from a DBObjectSet already in memory
* @param $oSet DBObjectSet
* @return DisplayBlock The DisplayBlock object, or null if the creation failed
*/
public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = array())
{
$oDummyFilter = new DBObjectSearch($oSet->GetClass());
$aKeys = array();
while ($oObject = $oSet->Fetch()) {
$aKeys[] = $oObject->GetKey();
}
$oSet->Rewind();
if (count($aKeys) > 0) {
$oDummyFilter->AddCondition('id', $aKeys, 'IN');
} else {
$oDummyFilter->AddCondition('id', 0, '=');
}
$oBlock = new DisplayBlock($oDummyFilter, $sStyle, false, $aParams);
// DisplayBlocks built this way are synchronous
return $oBlock;
}
示例2: DisplaySet
/**
* Displays a list of objects, without any hyperlink (except for the object's details)
* @param DBObjectSet $oSet The set of objects to display
* @param Array $aZList The ZList (list of field codes) to use for the tabular display
* @param String $sEmptyListMessage Message displayed whenever the list is empty
* @return string The HTML text representing the list
*/
public function DisplaySet($oSet, $aZList, $sEmptyListMessage = '')
{
if ($oSet->Count() > 0) {
$sClass = $oSet->GetClass();
if (is_subclass_of($sClass, 'cmdbAbstractObject')) {
// Home-made and very limited display of an object set
$sUniqueId = $sClass . $this->GetUniqueId();
$this->add("<div id=\"{$sUniqueId}\">\n");
// The id here MUST be the same as currentId, otherwise the pagination will be broken
cmdbAbstractObject::DisplaySet($this, $oSet, array('currentId' => $sUniqueId, 'menu' => false, 'toolkit_menu' => false, 'zlist' => false, 'extra_fields' => implode(',', $aZList)));
$this->add("</div>\n");
} else {
// Home-made and very limited display of an object set
$aAttribs = array();
$aValues = array();
$aAttribs['key'] = array('label' => MetaModel::GetName($sClass), 'description' => '');
foreach ($aZList as $sAttCode) {
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
$aAttribs[$sAttCode] = array('label' => $oAttDef->GetLabel(), 'description' => $oAttDef->GetDescription());
}
while ($oObj = $oSet->Fetch()) {
$aRow = array();
$aRow['key'] = '<a href="./index.php?operation=details&class=' . get_class($oObj) . '&id=' . $oObj->GetKey() . '">' . $oObj->GetName() . '</a>';
$sHilightClass = $oObj->GetHilightClass();
if ($sHilightClass != '') {
$aRow['@class'] = $sHilightClass;
}
foreach ($aZList as $sAttCode) {
$aRow[$sAttCode] = $oObj->GetAsHTML($sAttCode);
}
$aValues[$oObj->GetKey()] = $aRow;
}
$this->table($aAttribs, $aValues);
}
} elseif (strlen($sEmptyListMessage) > 0) {
$this->add($sEmptyListMessage);
}
}
示例3: GetDisplaySetForPrinting
/**
* Simplifed version of GetDisplaySet() with less "decoration" around the table (and no paging)
* that fits better into a printed document (like a PDF or a printable view)
* @param WebPage $oPage
* @param DBObjectSet $oSet
* @param hash $aExtraParams
* @return string The HTML representation of the table
*/
public static function GetDisplaySetForPrinting(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array())
{
$iListId = empty($aExtraParams['currentId']) ? $oPage->GetUniqueId() : $aExtraParams['currentId'];
$sTableId = isset($aExtraParams['table_id']) ? $aExtraParams['table_id'] : null;
$bViewLink = true;
$sSelectMode = 'none';
$iListId = $sTableId;
$sClassAlias = $oSet->GetClassAlias();
$sClassName = $oSet->GetClass();
$sZListName = 'list';
$aClassAliases = array($sClassAlias => $sClassName);
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName));
$oDataTable = new PrintableDataTable($iListId, $oSet, $aClassAliases, $sTableId);
$oSettings = DataTableSettings::GetDataModelSettings($aClassAliases, $bViewLink, array($sClassAlias => $aList));
$oSettings->iDefaultPageSize = 0;
$oSettings->aSortOrder = MetaModel::GetOrderByDefault($sClassName);
return $oDataTable->Display($oPage, $oSettings, false, $sSelectMode, $bViewLink, $aExtraParams);
}
示例4: DBObjectSearch
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);
}