本文整理匯總了PHP中VTCacheUtils::updateOwnerType方法的典型用法代碼示例。如果您正苦於以下問題:PHP VTCacheUtils::updateOwnerType方法的具體用法?PHP VTCacheUtils::updateOwnerType怎麽用?PHP VTCacheUtils::updateOwnerType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類VTCacheUtils
的用法示例。
在下文中一共展示了VTCacheUtils::updateOwnerType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRecordOwnerId
/** Function to get a user id or group id for a given entity
* @param $record -- entity id :: Type integer
* @returns $ownerArr -- owner id :: Type array
*/
function getRecordOwnerId($record)
{
global $log;
$log->debug("Entering getRecordOwnerId(" . $record . ") method ...");
global $adb;
$ownerArr = array();
// Look at cache first for information
$ownerId = VTCacheUtils::lookupRecordOwner($record);
if ($ownerId === false) {
$query = "select smownerid from vtiger_crmentity where crmid = ?";
$result = $adb->pquery($query, array($record));
if ($adb->num_rows($result) > 0) {
$ownerId = $adb->query_result($result, 0, 'smownerid');
// Update cache for re-use
VTCacheUtils::updateRecordOwner($record, $ownerId);
}
}
if ($ownerId) {
// Look at cache first for information
$count = VTCacheUtils::lookupOwnerType($ownerId);
if ($count === false) {
$sql_result = $adb->pquery("select count(*) as count from vtiger_users where id = ?", array($ownerId));
$count = $adb->query_result($sql_result, 0, 'count');
// Update cache for re-use
VTCacheUtils::updateOwnerType($ownerId, $count);
}
if ($count > 0) {
$ownerArr['Users'] = $ownerId;
} else {
$ownerArr['Groups'] = $ownerId;
}
}
$log->debug("Exiting getRecordOwnerId method ...");
return $ownerArr;
}
示例2: getRecordOwnerId
/** Function to get a user id or group id for a given entity
* @param $record -- entity id :: Type integer
* @returns $ownerArr -- owner id :: Type array
*/
function getRecordOwnerId($record)
{
$log = vglobal('log');
$log->debug("Entering getRecordOwnerId(" . $record . ") method ...");
$adb = PearDatabase::getInstance();
$ownerArr = [];
$recordMetaData = Vtiger_Functions::getCRMRecordMetadata($record);
if ($recordMetaData) {
$ownerId = $recordMetaData['smownerid'];
// Look at cache first for information
$count = VTCacheUtils::lookupOwnerType($ownerId);
if ($count === false) {
$sql_result = $adb->pquery("select count(*) as count from vtiger_users where id = ?", array($ownerId));
$count = $adb->query_result($sql_result, 0, 'count');
// Update cache for re-use
VTCacheUtils::updateOwnerType($ownerId, $count);
}
if ($count > 0) {
$ownerArr['Users'] = $ownerId;
} else {
$ownerArr['Groups'] = $ownerId;
}
}
$log->debug("Exiting getRecordOwnerId method ...");
return $ownerArr;
}