本文整理汇总了PHP中VTCacheUtils::lookupFieldInfo_Module方法的典型用法代码示例。如果您正苦于以下问题:PHP VTCacheUtils::lookupFieldInfo_Module方法的具体用法?PHP VTCacheUtils::lookupFieldInfo_Module怎么用?PHP VTCacheUtils::lookupFieldInfo_Module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTCacheUtils
的用法示例。
在下文中一共展示了VTCacheUtils::lookupFieldInfo_Module方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldByReportLabel
/**
* Function to get the field information from module name and field label
*/
function getFieldByReportLabel($module, $label)
{
// this is required so the internal cache is populated or reused.
getColumnFields($module);
//lookup all the accessible fields
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if ($module == 'Calendar') {
$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
if ($cachedModuleFields == false) {
$cachedModuleFields = $cachedEventsFields;
} else {
$cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
}
}
if (empty($cachedModuleFields)) {
return null;
}
$label = decode_html($label);
foreach ($cachedModuleFields as $fieldInfo) {
$fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
if ($label == $fieldLabel) {
return $fieldInfo;
}
}
return null;
}
示例2: getFieldByReportLabel
/**
* Function to get the field information from module name and field label
*/
function getFieldByReportLabel($module, $label)
{
// this is required so the internal cache is populated or reused.
getColumnFields($module);
//lookup all the accessible fields
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if (empty($cachedModuleFields)) {
return null;
}
foreach ($cachedModuleFields as $fieldInfo) {
$fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
if ($label == $fieldLabel) {
return $fieldInfo;
}
}
return null;
}
示例3: getFieldByReportLabel
/**
* Function to get the field information from module name and field label
*/
function getFieldByReportLabel($module, $label)
{
$cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
if ($cacheLabel) {
return $cacheLabel;
}
// this is required so the internal cache is populated or reused.
getColumnFields($module);
//lookup all the accessible fields
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
$label = decode_html($label);
if ($module == 'Calendar') {
$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
if ($cachedEventsFields) {
if (empty($cachedModuleFields)) {
$cachedModuleFields = $cachedEventsFields;
} else {
$cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
}
}
if ($label == 'Start_Date_and_Time') {
$label = 'Start_Date_&_Time';
}
}
if (empty($cachedModuleFields)) {
return null;
}
foreach ($cachedModuleFields as $fieldInfo) {
$fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
$fieldLabel = decode_html($fieldLabel);
//SalesPlatform.ru begin fix get field info by label
if ($label == $fieldLabel || $label == getTranslatedString($fieldLabel, $module)) {
//if($label == $fieldLabel) {
//SalesPlatform.ru end
VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
return $fieldInfo;
}
}
return null;
}
示例4: getColumnFields
/** Function to get column fields for a given module
* @param $module -- module:: Type string
* @returns $column_fld -- column field :: Type array
*
*/
function getColumnFields($module)
{
global $log;
$log->debug("Entering getColumnFields(" . $module . ") method ...");
$log->debug("in getColumnFields " . $module);
// Lookup in cache for information
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if ($cachedModuleFields === false) {
global $adb;
$tabid = getTabid($module);
if ($module == 'Calendar') {
$tabid = array('9', '16');
}
// To overcome invalid module names.
if (empty($tabid)) {
return array();
}
// Let us pick up all the fields first so that we can cache information
$sql = "SELECT tabid, fieldname, fieldid, fieldlabel, columnname, tablename, uitype, typeofdata, presence\n\t\tFROM vtiger_field WHERE tabid in (" . generateQuestionMarks($tabid) . ")";
$result = $adb->pquery($sql, array($tabid));
$noofrows = $adb->num_rows($result);
if ($noofrows) {
while ($resultrow = $adb->fetch_array($result)) {
// Update information to cache for re-use
VTCacheUtils::updateFieldInfo($resultrow['tabid'], $resultrow['fieldname'], $resultrow['fieldid'], $resultrow['fieldlabel'], $resultrow['columnname'], $resultrow['tablename'], $resultrow['uitype'], $resultrow['typeofdata'], $resultrow['presence']);
}
}
// For consistency get information from cache
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
}
if ($module == 'Calendar') {
$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
if ($cachedEventsFields) {
if (empty($cachedModuleFields)) {
$cachedModuleFields = $cachedEventsFields;
} else {
$cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
}
}
}
$column_fld = array();
if ($cachedModuleFields) {
foreach ($cachedModuleFields as $fieldinfo) {
$column_fld[$fieldinfo['fieldname']] = '';
}
}
$log->debug("Exiting getColumnFields method ...");
return $column_fld;
}
示例5: buildSearchQueryForFieldTypes
/** END * */
function buildSearchQueryForFieldTypes($uitypes, $value = false)
{
global $adb;
if (!is_array($uitypes)) {
$uitypes = array($uitypes);
}
$module = get_class($this);
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if ($cachedModuleFields === false) {
getColumnFields($module);
// This API will initialize the cache as well
// We will succeed now due to above function call
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
}
$lookuptables = array();
$lookupcolumns = array();
foreach ($cachedModuleFields as $fieldinfo) {
if (in_array($fieldinfo['uitype'], $uitypes)) {
$lookuptables[] = $fieldinfo['tablename'];
$lookupcolumns[] = $fieldinfo['columnname'];
}
}
$entityfields = getEntityField($module);
$querycolumnnames = implode(',', $lookupcolumns);
$entitycolumnnames = $entityfields['fieldname'];
$query = "select crmid as id, {$querycolumnnames}, {$entitycolumnnames} as name ";
$query .= " FROM {$this->table_name} ";
$query .= " INNER JOIN vtiger_crmentity ON {$this->table_name}.{$this->table_index} = vtiger_crmentity.crmid AND deleted = 0 ";
//remove the base table
$LookupTable = array_unique($lookuptables);
$indexes = array_keys($LookupTable, $this->table_name);
if (!empty($indexes)) {
foreach ($indexes as $index) {
unset($LookupTable[$index]);
}
}
foreach ($LookupTable as $tablename) {
$query .= " INNER JOIN {$tablename}\n\t\t\t\t\t\ton {$this->table_name}.{$this->table_index} = {$tablename}." . $this->tab_name_index[$tablename];
}
if (!empty($lookupcolumns) && $value !== false) {
$query .= " WHERE ";
$i = 0;
$columnCount = count($lookupcolumns);
foreach ($lookupcolumns as $columnname) {
if (!empty($columnname)) {
if ($i == 0 || $i == $columnCount) {
$query .= sprintf("%s = '%s'", $columnname, $value);
} else {
$query .= sprintf(" OR %s = '%s'", $columnname, $value);
}
$i++;
}
}
}
return $query;
}
示例6: buildSearchQueryWithUIType
public function buildSearchQueryWithUIType($uitype, $value, $module)
{
if (empty($value)) {
return false;
}
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if ($cachedModuleFields === false) {
getColumnFields($module);
// This API will initialize the cache as well
// We will succeed now due to above function call
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
}
$lookuptables = array();
$lookupcolumns = array();
foreach ($cachedModuleFields as $fieldinfo) {
if (in_array($fieldinfo['uitype'], array($uitype))) {
$lookuptables[] = $fieldinfo['tablename'];
$lookupcolumns[] = $fieldinfo['columnname'];
}
}
$entityfields = getEntityField($module);
$querycolumnnames = implode(',', $lookupcolumns);
$entitycolumnnames = $entityfields['fieldname'];
$query = "select id as id, {$querycolumnnames}, {$entitycolumnnames} as name ";
$query .= " FROM vtiger_users";
if (!empty($lookupcolumns)) {
$query .= " WHERE deleted=0 AND ";
$i = 0;
$columnCount = count($lookupcolumns);
foreach ($lookupcolumns as $columnname) {
if (!empty($columnname)) {
if ($i == 0 || $i == $columnCount) {
$query .= sprintf("%s = '%s'", $columnname, $value);
} else {
$query .= sprintf(" OR %s = '%s'", $columnname, $value);
}
$i++;
}
}
}
return $query;
}
示例7: getModuleSequenceField
function getModuleSequenceField($module)
{
global $adb, $log;
$log->debug("Entering function getModuleSequenceFieldName ({$module})...");
$field = null;
if (!empty($module)) {
// First look at the cached information
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if ($cachedModuleFields === false) {
//uitype 4 points to Module Numbering Field
$seqColRes = $adb->pquery("SELECT fieldname, fieldlabel, columnname FROM vtiger_field WHERE uitype=? AND tabid=? and vtiger_field.presence in (0,2)", array('4', getTabid($module)));
if ($adb->num_rows($seqColRes) > 0) {
$fieldname = $adb->query_result($seqColRes, 0, 'fieldname');
$columnname = $adb->query_result($seqColRes, 0, 'columnname');
$fieldlabel = $adb->query_result($seqColRes, 0, 'fieldlabel');
$field = array();
$field['name'] = $fieldname;
$field['column'] = $columnname;
$field['label'] = $fieldlabel;
}
} else {
foreach ($cachedModuleFields as $fieldinfo) {
if ($fieldinfo['uitype'] == '4') {
$field = array();
$field['name'] = $fieldinfo['fieldname'];
$field['column'] = $fieldinfo['columnname'];
$field['label'] = $fieldinfo['fieldlabel'];
break;
}
}
}
}
$log->debug("Exiting getModuleSequenceFieldName...");
return $field;
}
示例8: getFieldByPDFMakerLabel
function getFieldByPDFMakerLabel($module, $label)
{
$cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
if ($cacheLabel) {
return $cacheLabel;
}
// this is required so the internal cache is populated or reused.
getColumnFields($module);
//lookup all the accessible fields
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if (empty($cachedModuleFields)) {
return null;
}
foreach ($cachedModuleFields as $fieldInfo) {
$fieldName = str_replace(' ', '_', $fieldInfo['fieldname']);
if ($label == $fieldName) {
VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
return $fieldInfo;
}
}
return null;
}
示例9: generateEntityModel
protected function generateEntityModel($entity, $module, $prefix, $model)
{
// Get only active field information
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
if (isset($this->focus->column_fields['currency_id'])) {
$currencyInfo = getCurrencyInfo($this->focus->column_fields['currency_id']);
$currency = $currencyInfo['code'];
} else {
$currency = 'RUB';
}
if ($cachedModuleFields) {
foreach ($cachedModuleFields as $fieldname => $fieldinfo) {
$fieldname = $fieldinfo['fieldname'];
$type = explode('~', $fieldinfo['typeofdata']);
$uitype = $fieldinfo['uitype'];
if ($uitype == 10 && !empty($entity->column_fields[$fieldname])) {
$entityid = $entity->column_fields[$fieldname];
$entityType = getSalesEntityType($entityid);
$recordName = array_values(getEntityName($entityType, $entityid));
$recordName = $recordName[0];
$model->set($prefix . $fieldname, $recordName);
} else {
if ($uitype == 117) {
$currencyInfo = getCurrencyInfo($entity->column_fields[$fieldname]);
$model->set($prefix . $fieldname, getTranslatedString($currencyInfo['name'], $module));
} else {
switch ($type[0]) {
case 'N':
case 'NN':
$model->set($prefix . $fieldname, $this->formatPrice($entity->column_fields[$fieldname]));
$model->set($prefix . $fieldname . '_literal', $this->num2str($entity->column_fields[$fieldname], false, $currency));
$model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])) . '_LITERAL', $model->get($prefix . $fieldname . '_literal'));
$model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)) . getTranslatedString('_literal'), $model->get($prefix . $fieldname . '_literal'));
break;
case 'D':
$model->set($prefix . $fieldname, $this->literalDate($entity->column_fields[$fieldname]));
$model->set($prefix . $fieldname . '_short', $this->shortDate($entity->column_fields[$fieldname]));
$model->set($prefix . $fieldname . '_mmyyyy', $this->mmyyyyDate($entity->column_fields[$fieldname]));
$model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])) . '_SHORT', $model->get($prefix . $fieldname . '_short'));
$model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)) . getTranslatedString('_short'), $model->get($prefix . $fieldname . '_short'));
break;
case 'C':
if ($entity->column_fields[$fieldname] == 0) {
$model->set($prefix . $fieldname, 'Нет');
} else {
$model->set($prefix . $fieldname, 'Да');
}
break;
case 'V':
$model->set($prefix . $fieldname, nl2br($entity->column_fields[$fieldname]));
$model->set($prefix . $fieldname . '_translated', nl2br(getTranslatedString($entity->column_fields[$fieldname], $module)));
break;
default:
$model->set($prefix . $fieldname, $entity->column_fields[$fieldname]);
break;
}
}
}
// Add human-readable variables
$model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])), $model->get($prefix . $fieldname));
$model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)), $model->get($prefix . $fieldname));
}
}
}
示例10: filterInactiveFields
/**
* Filter in-active fields based on type
*
* @param String $module
*/
function filterInactiveFields($module)
{
if ($this->__inactive_fields_filtered) {
return;
}
global $adb, $mod_strings;
// Look for fields that has presence value NOT IN (0,2)
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module, array('1'));
if ($cachedModuleFields === false) {
// Initialize the fields calling suitable API
getColumnFields($module);
$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module, array('1'));
}
$hiddenFields = array();
if ($cachedModuleFields) {
foreach ($cachedModuleFields as $fieldinfo) {
$fieldLabel = $fieldinfo['fieldlabel'];
// NOTE: We should not translate the label to enable field diff based on it down
$fieldName = $fieldinfo['fieldname'];
$tableName = str_replace("vtiger_", "", $fieldinfo['tablename']);
$hiddenFields[$fieldLabel] = array($tableName => $fieldName);
}
}
if (isset($this->list_fields)) {
$this->list_fields = array_diff_assoc($this->list_fields, $hiddenFields);
}
if (isset($this->search_fields)) {
$this->search_fields = array_diff_assoc($this->search_fields, $hiddenFields);
}
// To avoid re-initializing everytime.
$this->__inactive_fields_filtered = true;
}