本文整理汇总了PHP中VTCacheUtils::lookupCachedInformation方法的典型用法代码示例。如果您正苦于以下问题:PHP VTCacheUtils::lookupCachedInformation方法的具体用法?PHP VTCacheUtils::lookupCachedInformation怎么用?PHP VTCacheUtils::lookupCachedInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTCacheUtils
的用法示例。
在下文中一共展示了VTCacheUtils::lookupCachedInformation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVariable
public static function getVariable($var, $default, $module = '', $gvuserid = '')
{
global $adb, $current_user, $gvvalidationinfo, $currentModule;
$gvvalidationinfo[] = "search for variable '{$var}' with default value of '{$default}'";
if (empty($module)) {
$module = $currentModule;
}
if (empty($gvuserid)) {
$gvuserid = $current_user->id;
}
$key = md5('gvcache' . $var . $module . $gvuserid);
list($value, $found) = VTCacheUtils::lookupCachedInformation($key);
if ($found) {
$gvvalidationinfo[] = "variable found in cache";
return $value;
}
$value = '';
$list_of_modules = array();
$focus = CRMEntity::getInstance('GlobalVariable');
$select = 'SELECT *
FROM vtiger_globalvariable
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_globalvariable.globalvariableid ';
$where = ' where vtiger_crmentity.deleted=0 and gvname=? ';
$mandatory = " and mandatory='1'";
$sql = $select . $where . $mandatory;
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as mandatory in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
if (!is_numeric($gvuserid) and $gvuserid > 0) {
return $default;
}
$user = $adb->convert2Sql(' and vtiger_crmentity.smownerid=?', array($gvuserid));
$sql = $select . $where . $user;
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as set per user {$gvuserid} in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
$gvvalidationinfo[] = '---';
require_once 'include/utils/GetUserGroups.php';
$UserGroups = new GetUserGroups();
$UserGroups->getAllUserGroups($gvuserid);
if (count($UserGroups->user_groups) > 0) {
$groups = implode(',', $UserGroups->user_groups);
$group = ' and vtiger_crmentity.smownerid in (' . $groups . ') ';
$sql = $select . $where . $group;
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as set per group {$groups} in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
} else {
$gvvalidationinfo[] = 'no groups to search in';
}
$sql = $select . $where . " and default_check='1'";
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as default variable in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
$gvvalidationinfo[] = '---';
$gvvalidationinfo[] = "return default value give: {$default}";
return $default;
}
示例2: to_html
/** Function to convert the given string to html
* @param $string -- string:: Type string
* @returns $string -- string:: Type string
*/
function to_html($string)
{
global $doconvert, $default_charset;
if ($doconvert == true) {
list($cachedresult, $found) = VTCacheUtils::lookupCachedInformation('to_html::' . $string);
if ($found) {
return $cachedresult;
}
$key = $string;
if ($default_charset == 'UTF-8') {
$string = htmlentities($string, ENT_QUOTES, $default_charset);
} else {
$string = preg_replace(array('/</', '/>/', '/"/'), array('<', '>', '"'), $string);
}
VTCacheUtils::updateCachedInformation('to_html::' . $key, $string);
}
return $string;
}
示例3: getTableNameForField
// Sorting
if (!empty($order_by)) {
if ($order_by == 'smownerid') {
$list_query .= ' ORDER BY user_name ' . $sorder;
} else {
$tablename = getTableNameForField($currentModule, $order_by);
$tablename = $tablename != '' ? $tablename . '.' : '';
$list_query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
}
}
if (GlobalVariable::getVariable('Debug_ListView_Query', '0') == '1') {
echo '<br>' . $list_query . '<br>';
}
try {
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
list($specialPermissionWithDuplicateRows, $cached) = VTCacheUtils::lookupCachedInformation('SpecialPermissionWithDuplicateRows');
if ($specialPermissionWithDuplicateRows) {
$count_result = $adb->query(mkCountWithFullQuery($list_query));
} else {
$count_result = $adb->query(mkCountQuery($list_query));
}
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$noofrows = null;
}
$queryMode = isset($_REQUEST['query']) && $_REQUEST['query'] == 'true';
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
$limit_start_rec = ($start - 1) * $list_max_entries_per_page;
$list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
} catch (Exception $e) {
示例4: GetRelatedListBase
//.........这里部分代码省略.........
$_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
$_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
}
} elseif ($_SESSION['rlvs'][$module][$relatedmodule]) {
$sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
$order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
} else {
$order_by = $focus->default_order_by;
$sorder = $focus->default_sort_order;
}
// AssignedTo ordering issue in Related Lists
$query_order_by = $order_by;
if ($order_by == 'smownerid') {
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end ";
} elseif ($order_by != 'crmid' && !empty($order_by)) {
$tabname = getTableNameForField($relatedmodule, $order_by);
if ($tabname !== '' and $tabname != NULL) {
$query_order_by = $tabname . "." . $query_order_by;
}
}
if (!empty($query_order_by)) {
$query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
}
if ($relatedmodule == 'Calendar') {
$mod_listquery = "activity_listquery";
} else {
$mod_listquery = strtolower($relatedmodule) . "_listquery";
}
$_SESSION[$mod_listquery] = $query;
$url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder;
$computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : '';
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
// Retreiving the no of rows
list($specialPermissionWithDuplicateRows, $cached) = VTCacheUtils::lookupCachedInformation('SpecialPermissionWithDuplicateRows');
if (FALSE and ($specialPermissionWithDuplicateRows or $relatedmodule == 'Calendar')) {
// FIXME FIXME FIXME FIXME
// the FALSE above MUST be eliminated, we need to execute mkCountWithFullQuery for modified queries
// the problem is that related list queries are hardcoded and can (mostly do) repeat columns which is not supported as a
// subquery which is what mkCountWithFullQuery does
// This works on ListView because we use query generator that eliminates those repeated columns
// It is currently incorrect and will produce wrong count on related lists when special permissions are active
// FIXME FIXME FIXME FIXME
// for calendar (with multiple contacts for single activity) and special permissions, count will change
$count_result = $adb->query(mkCountWithFullQuery($query));
} else {
$count_result = $adb->query(mkCountQuery($query));
}
$noofrows = $adb->query_result($count_result, 0, 'count');
} else {
$noofrows = null;
}
//Setting Listview session object while sorting/pagination
if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
$relmodule = vtlib_purify($_REQUEST['relmodule']);
if ($_SESSION['rlvs'][$module][$relmodule]) {
setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
}
}
global $relationId;
$start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
$navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
$limit_start_rec = ($start - 1) * $list_max_entries_per_page;
$list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
/* Save the related list in session for when we click in a register
* from this list we will can navigate with the arrows left and right, to move only in this related list
*/
$relcv = new CustomView();
$relviewId = $relcv->getViewId($relatedmodule);
ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId);
$_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start;
//Retreive the List View Table Header
$id = vtlib_purify($_REQUEST['record']);
$listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions);
//"Accounts");
if ($noofrows > 15) {
$smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
$smarty->assign('SCROLLSTOP', '</div>');
}
$smarty->assign("LISTHEADER", $listview_header);
if ($module == 'PriceBook' && $relatedmodule == 'Products') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
}
if ($module == 'Products' && $relatedmodule == 'PriceBooks') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions);
} elseif ($relatedmodule == 'SalesOrder') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions);
} else {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
}
$navigationOutput = array();
$navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
if (empty($id) && !empty($_REQUEST['record'])) {
$id = vtlib_purify($_REQUEST['record']);
}
$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id);
$related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
$log->debug("Exiting GetRelatedList method ...");
return $related_entries;
}
示例5: getQuery
public function getQuery($distinct = false)
{
if (empty($this->query)) {
$conditionedReferenceFields = array();
$allFields = array_merge($this->whereFields, $this->fields);
foreach ($allFields as $fieldName) {
if (in_array($fieldName, $this->referenceFieldList)) {
$moduleList = $this->referenceFieldInfoList[$fieldName];
foreach ($moduleList as $module) {
if (empty($this->moduleNameFields[$module])) {
$meta = $this->getMeta($module);
}
}
} elseif (in_array($fieldName, $this->ownerFields)) {
$meta = $this->getMeta('Users');
$meta = $this->getMeta('Groups');
}
}
$query = $this->getSelectClauseColumnSQL();
$query .= $this->getFromClause();
$query .= $this->getWhereClause();
list($specialPermissionWithDuplicateRows, $cached) = VTCacheUtils::lookupCachedInformation('SpecialPermissionWithDuplicateRows');
$query = 'SELECT ' . (($distinct or $specialPermissionWithDuplicateRows) ? 'DISTINCT ' : '') . $query;
$this->query = $query;
return $query;
} else {
return $this->query;
}
}