當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBObjectSearch::AllowAllData方法代碼示例

本文整理匯總了PHP中DBObjectSearch::AllowAllData方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBObjectSearch::AllowAllData方法的具體用法?PHP DBObjectSearch::AllowAllData怎麽用?PHP DBObjectSearch::AllowAllData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBObjectSearch的用法示例。


在下文中一共展示了DBObjectSearch::AllowAllData方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetUserProfiles

 /**
  * Read and cache profiles of the given user
  */
 protected function GetUserProfiles($iUser)
 {
     if (!array_key_exists($iUser, $this->m_aUserProfiles)) {
         $oSearch = new DBObjectSearch('URP_UserProfile');
         $oSearch->AllowAllData();
         $oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid'));
         $oSearch->AddConditionExpression($oCondition);
         $this->m_aUserProfiles[$iUser] = array();
         $oUserProfileSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser));
         while ($oUserProfile = $oUserProfileSet->Fetch()) {
             $this->m_aUserProfiles[$iUser][$oUserProfile->Get('profileid')] = $oUserProfile;
         }
     }
     return $this->m_aUserProfiles[$iUser];
 }
開發者ID:kira8565,項目名稱:ITOP203-ZHCN,代碼行數:18,代碼來源:userrightsprofile.class.inc.php

示例2: MakeSingleRow

 public static function MakeSingleRow($sClass, $iKey, $bMustBeFound = true, $bAllowAllData = false, $aModifierProperties = null)
 {
     // Build the query cache signature
     //
     $sQuerySign = $sClass;
     if ($bAllowAllData) {
         $sQuerySign .= '_all_';
     }
     if (count($aModifierProperties)) {
         array_multisort($aModifierProperties);
         $sModifierProperties = json_encode($aModifierProperties);
         $sQuerySign .= '_all_' . md5($sModifierProperties);
     }
     if (!array_key_exists($sQuerySign, self::$aQueryCacheGetObject)) {
         // NOTE: Quick and VERY dirty caching mechanism which relies on
         //       the fact that the string '987654321' will never appear in the
         //       standard query
         //       This could be simplified a little, relying solely on the query cache,
         //       but this would slow down -by how much time?- the application
         $oFilter = new DBObjectSearch($sClass);
         $oFilter->AddCondition('id', 987654321, '=');
         if ($aModifierProperties) {
             foreach ($aModifierProperties as $sPluginClass => $aProperties) {
                 foreach ($aProperties as $sProperty => $value) {
                     $oFilter->SetModifierProperty($sPluginClass, $sProperty, $value);
                 }
             }
         }
         if ($bAllowAllData) {
             $oFilter->AllowAllData();
         }
         $sSQL = $oFilter->MakeSelectQuery();
         self::$aQueryCacheGetObject[$sQuerySign] = $sSQL;
         self::$aQueryCacheGetObjectHits[$sQuerySign] = 0;
     } else {
         $sSQL = self::$aQueryCacheGetObject[$sQuerySign];
         self::$aQueryCacheGetObjectHits[$sQuerySign] += 1;
         //			echo " -load $sClass/$iKey- ".self::$aQueryCacheGetObjectHits[$sQuerySign]."<br/>\n";
     }
     $sSQL = str_replace(CMDBSource::Quote(987654321), CMDBSource::Quote($iKey), $sSQL);
     $res = CMDBSource::Query($sSQL);
     $aRow = CMDBSource::FetchArray($res);
     CMDBSource::FreeResult($res);
     if ($bMustBeFound && empty($aRow)) {
         throw new CoreException("No result for the single row query: '{$sSQL}'");
     }
     return $aRow;
 }
開發者ID:henryavila,項目名稱:itop,代碼行數:48,代碼來源:metamodel.class.php

示例3: GetReferencingObjects

 public function GetReferencingObjects($bAllowAllData = false)
 {
     $aDependentObjects = array();
     $aRererencingMe = MetaModel::EnumReferencingClasses(get_class($this));
     foreach ($aRererencingMe as $sRemoteClass => $aExtKeys) {
         foreach ($aExtKeys as $sExtKeyAttCode => $oExtKeyAttDef) {
             // skip if this external key is behind an external field
             if (!$oExtKeyAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
                 continue;
             }
             $oSearch = new DBObjectSearch($sRemoteClass);
             $oSearch->AddCondition($sExtKeyAttCode, $this->GetKey(), '=');
             if ($bAllowAllData) {
                 $oSearch->AllowAllData();
             }
             $oSet = new CMDBObjectSet($oSearch);
             if ($oSet->Count() > 0) {
                 $aDependentObjects[$sRemoteClass][$sExtKeyAttCode] = array('attribute' => $oExtKeyAttDef, 'objects' => $oSet);
             }
         }
     }
     return $aDependentObjects;
 }
開發者ID:kira8565,項目名稱:ITOP203-ZHCN,代碼行數:23,代碼來源:dbobject.class.php

示例4: MakeSelectFilter

 /**
  *	...
  */
 public function MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings = array(), $sAttCode = null)
 {
     if ($sAttCode == null) {
         $sAttCode = $this->GetOwnerOrganizationAttCode($sClass);
     }
     if (empty($sAttCode)) {
         return $oFilter = new DBObjectSearch($sClass);
     }
     $oExpression = new FieldExpression($sAttCode, $sClass);
     $oFilter = new DBObjectSearch($sClass);
     $oListExpr = ListExpression::FromScalars($aAllowedOrgs);
     $oCondition = new BinaryExpression($oExpression, 'IN', $oListExpr);
     $oFilter->AddConditionExpression($oCondition);
     if ($this->HasSharing()) {
         if ($sAttCode == 'id' && isset($aSettings['bSearchMode']) && $aSettings['bSearchMode']) {
             // Querying organizations (or derived)
             // and the expected list of organizations will be used as a search criteria
             // Therefore the query can also return organization having objects shared with the allowed organizations
             //
             // 1) build the list of organizations sharing something with the allowed organizations
             // Organization <== sharing_org_id == SharedObject having org_id IN {user orgs}
             $oShareSearch = new DBObjectSearch('SharedObject');
             $oOrgField = new FieldExpression('org_id', 'SharedObject');
             $oShareSearch->AddConditionExpression(new BinaryExpression($oOrgField, 'IN', $oListExpr));
             $oSearchSharers = new DBObjectSearch('Organization');
             $oSearchSharers->AllowAllData();
             $oSearchSharers->AddCondition_ReferencedBy($oShareSearch, 'sharing_org_id');
             $aSharers = array();
             foreach ($oSearchSharers->ToDataArray(array('id')) as $aRow) {
                 $aSharers[] = $aRow['id'];
             }
             // 2) Enlarge the overall results: ... OR id IN(id1, id2, id3)
             if (count($aSharers) > 0) {
                 $oSharersList = ListExpression::FromScalars($aSharers);
                 $oFilter->MergeConditionExpression(new BinaryExpression($oExpression, 'IN', $oSharersList));
             }
         }
         $aShareProperties = SharedObject::GetSharedClassProperties($sClass);
         if ($aShareProperties) {
             $sShareClass = $aShareProperties['share_class'];
             $sShareAttCode = $aShareProperties['attcode'];
             $oSearchShares = new DBObjectSearch($sShareClass);
             $oSearchShares->AllowAllData();
             $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization');
             $oOrgField = new FieldExpression('org_id', $sShareClass);
             $oSearchShares->AddConditionExpression(new BinaryExpression($oOrgField, 'IN', $oListExpr));
             $aShared = array();
             foreach ($oSearchShares->ToDataArray(array($sShareAttCode)) as $aRow) {
                 $aShared[] = $aRow[$sShareAttCode];
             }
             if (count($aShared) > 0) {
                 $oObjId = new FieldExpression('id', $sClass);
                 $oSharedIdList = ListExpression::FromScalars($aShared);
                 $oFilter->MergeConditionExpression(new BinaryExpression($oObjId, 'IN', $oSharedIdList));
             }
         }
     }
     // if HasSharing
     return $oFilter;
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:63,代碼來源:userrights.class.inc.php


注:本文中的DBObjectSearch::AllowAllData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。