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


PHP DBObjectSet::GetColumnAsArray方法代码示例

本文整理汇总了PHP中DBObjectSet::GetColumnAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObjectSet::GetColumnAsArray方法的具体用法?PHP DBObjectSet::GetColumnAsArray怎么用?PHP DBObjectSet::GetColumnAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBObjectSet的用法示例。


在下文中一共展示了DBObjectSet::GetColumnAsArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PurgeData

 /**
  * Helper to remove selected objects without calling any handler
  * Surpasses BulkDelete as it can handle abstract classes, but has the other limitation as it bypasses standard objects handlers 
  * 	 
  * @param string $oFilter Scope of objects to wipe out
  * @return The count of deleted objects
  */
 public static function PurgeData($oFilter)
 {
     $sTargetClass = $oFilter->GetClass();
     $oSet = new DBObjectSet($oFilter);
     $oSet->OptimizeColumnLoad(array($sTargetClass => array('finalclass')));
     $aIdToClass = $oSet->GetColumnAsArray('finalclass', true);
     $aIds = array_keys($aIdToClass);
     if (count($aIds) > 0) {
         $aQuotedIds = CMDBSource::Quote($aIds);
         $sIdList = implode(',', $aQuotedIds);
         $aTargetClasses = array_merge(self::EnumChildClasses($sTargetClass, ENUM_CHILD_CLASSES_ALL), self::EnumParentClasses($sTargetClass, ENUM_PARENT_CLASSES_EXCLUDELEAF));
         foreach ($aTargetClasses as $sSomeClass) {
             $sTable = MetaModel::DBGetTable($sSomeClass);
             $sPKField = MetaModel::DBGetKey($sSomeClass);
             $sDeleteSQL = "DELETE FROM `{$sTable}` WHERE `{$sPKField}` IN ({$sIdList})";
             CMDBSource::DeleteFrom($sDeleteSQL);
         }
     }
     return count($aIds);
 }
开发者ID:henryavila,项目名称:itop,代码行数:27,代码来源:metamodel.class.php

示例2: GetObjectActionGrant

 protected function GetObjectActionGrant($oUser, $sClass, $iActionCode, $oObject = null)
 {
     if (is_null($oObject)) {
         $iObjectRef = -999;
     } else {
         $iObjectRef = $oObject->GetKey();
     }
     // load and cache permissions for the current user on the given object
     //
     $aTest = @$this->m_aObjectActionGrants[$oUser->GetKey()][$sClass][$iObjectRef][$iActionCode];
     if (is_array($aTest)) {
         return $aTest;
     }
     $sAction = self::$m_aActionCodes[$iActionCode];
     $iInstancePermission = UR_ALLOWED_NO;
     $aAttributes = array();
     foreach ($this->GetMatchingProfiles($oUser, $sClass, $oObject) as $iProfile) {
         $oGrantRecord = $this->GetClassActionGrant($iProfile, $sClass, $sAction);
         if (is_null($oGrantRecord)) {
             continue;
             // loop to the next profile
         } else {
             $iInstancePermission = UR_ALLOWED_YES;
             // update the list of attributes with those allowed for this profile
             //
             $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_AttributeGrant WHERE actiongrantid = :actiongrantid");
             $oSet = new DBObjectSet($oSearch, array(), array('actiongrantid' => $oGrantRecord->GetKey()));
             $aProfileAttributes = $oSet->GetColumnAsArray('attcode', false);
             if (count($aProfileAttributes) == 0) {
                 $aAllAttributes = array_keys(MetaModel::ListAttributeDefs($sClass));
                 $aAttributes = array_merge($aAttributes, $aAllAttributes);
             } else {
                 $aAttributes = array_merge($aAttributes, $aProfileAttributes);
             }
         }
     }
     $aRes = array('permission' => $iInstancePermission, 'attributes' => $aAttributes);
     $this->m_aObjectActionGrants[$oUser->GetKey()][$sClass][$iObjectRef][$iActionCode] = $aRes;
     return $aRes;
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:40,代码来源:userrightsprojection.class.inc.php

示例3: GetCreationForm

 public static function GetCreationForm($sOQL = null, $sTableSettings = null)
 {
     $oForm = new DesignerForm();
     // Find a unique default name
     // -> The class of the query + an index if necessary
     if ($sOQL == null) {
         $sDefault = '';
     } else {
         $oBMSearch = new DBObjectSearch('Shortcut');
         $oBMSearch->AddCondition('user_id', UserRights::GetUserId(), '=');
         $oBMSet = new DBObjectSet($oBMSearch);
         $aNames = $oBMSet->GetColumnAsArray('name');
         $oSearch = DBObjectSearch::FromOQL($sOQL);
         $sDefault = utils::MakeUniqueName($oSearch->GetClass(), $aNames);
     }
     $oField = new DesignerTextField('name', Dict::S('Class:Shortcut/Attribute:name'), $sDefault);
     $oField->SetMandatory(true);
     $oForm->AddField($oField);
     /*
     $oField = new DesignerComboField('auto_reload', Dict::S('Class:ShortcutOQL/Attribute:auto_reload'), 'none');
     $oAttDef = MetaModel::GetAttributeDef(__class__, 'auto_reload');
     $oField->SetAllowedValues($oAttDef->GetAllowedValues());
     $oField->SetMandatory(true);
     $oForm->AddField($oField);
     */
     $oField = new DesignerBooleanField('auto_reload', Dict::S('Class:ShortcutOQL/Attribute:auto_reload'), false);
     $oForm->AddField($oField);
     $oField = new DesignerTextField('auto_reload_sec', Dict::S('Class:ShortcutOQL/Attribute:auto_reload_sec'), MetaModel::GetConfig()->GetStandardReloadInterval());
     $oField->SetValidationPattern('^$|^0*([5-9]|[1-9][0-9]+)$');
     // Can be empty, or a number > 4
     $oField->SetMandatory(false);
     $oForm->AddField($oField);
     $oField = new DesignerHiddenField('oql', '', $sOQL);
     $oForm->AddField($oField);
     $oField = new DesignerHiddenField('table_settings', '', $sTableSettings);
     $oForm->AddField($oField);
     return $oForm;
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:38,代码来源:shortcut.class.inc.php


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