当前位置: 首页>>代码示例>>PHP>>正文


PHP DBObjectSet::GetClass方法代码示例

本文整理汇总了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;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:22,代码来源:displayblock.class.inc.php

示例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);
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:45,代码来源:portalwebpage.class.inc.php

示例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);
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:26,代码来源:cmdbabstract.class.inc.php

示例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);
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:19,代码来源:testlist.inc.php


注:本文中的DBObjectSet::GetClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。