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


PHP Vtiger_Cache::cacheEnable方法代码示例

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


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

示例1: transformForImport

 public function transformForImport($fieldData, $moduleMeta, $fillDefault = true, $checkMandatoryFieldValues = true)
 {
     $moduleFields = $moduleMeta->getModuleFields();
     $defaultFieldValues = $this->getDefaultFieldValues($moduleMeta);
     foreach ($fieldData as $fieldName => $fieldValue) {
         $fieldInstance = $moduleFields[$fieldName];
         if ($fieldInstance->getFieldDataType() == 'owner') {
             $ownerId = getUserId_Ol(trim($fieldValue));
             if (empty($ownerId)) {
                 $ownerId = getGrpId($fieldValue);
             }
             if (empty($ownerId) && isset($defaultFieldValues[$fieldName])) {
                 $ownerId = $defaultFieldValues[$fieldName];
             }
             if (empty($ownerId) || !Import_Utils_Helper::hasAssignPrivilege($moduleMeta->getEntityName(), $ownerId)) {
                 $ownerId = $this->user->id;
             }
             $fieldData[$fieldName] = $ownerId;
         } elseif ($fieldInstance->getFieldDataType() == 'multipicklist') {
             $trimmedValue = trim($fieldValue);
             if (!$trimmedValue && isset($defaultFieldValues[$fieldName])) {
                 $explodedValue = explode(',', $defaultFieldValues[$fieldName]);
             } else {
                 $explodedValue = explode(' |##| ', $trimmedValue);
             }
             foreach ($explodedValue as $key => $value) {
                 $explodedValue[$key] = trim($value);
             }
             $implodeValue = implode(' |##| ', $explodedValue);
             $fieldData[$fieldName] = $implodeValue;
         } elseif ($fieldInstance->getFieldDataType() == 'reference') {
             $entityId = false;
             if (!empty($fieldValue)) {
                 if (strpos($fieldValue, '::::') > 0) {
                     $fieldValueDetails = explode('::::', $fieldValue);
                 } else {
                     if (strpos($fieldValue, ':::') > 0) {
                         $fieldValueDetails = explode(':::', $fieldValue);
                     } else {
                         $fieldValueDetails = $fieldValue;
                     }
                 }
                 if (count($fieldValueDetails) > 1) {
                     $referenceModuleName = trim($fieldValueDetails[0]);
                     $entityLabel = trim($fieldValueDetails[1]);
                     $entityId = getEntityId($referenceModuleName, $entityLabel);
                 } else {
                     $referencedModules = $fieldInstance->getReferenceList();
                     $entityLabel = $fieldValue;
                     foreach ($referencedModules as $referenceModule) {
                         $referenceModuleName = $referenceModule;
                         if ($referenceModule == 'Users') {
                             $referenceEntityId = getUserId_Ol($entityLabel);
                             if (empty($referenceEntityId) || !Import_Utils_Helper::hasAssignPrivilege($moduleMeta->getEntityName(), $referenceEntityId)) {
                                 $referenceEntityId = $this->user->id;
                             }
                         } elseif ($referenceModule == 'Currency') {
                             $referenceEntityId = getCurrencyId($entityLabel);
                         } else {
                             $referenceEntityId = getEntityId($referenceModule, $entityLabel);
                         }
                         if ($referenceEntityId != 0) {
                             $entityId = $referenceEntityId;
                             break;
                         }
                     }
                 }
                 if ((empty($entityId) || $entityId == 0) && !empty($referenceModuleName)) {
                     if (isPermitted($referenceModuleName, 'EditView') == 'yes') {
                         try {
                             $wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel);
                             $wsEntityId = $wsEntityIdInfo['id'];
                             $entityIdComponents = vtws_getIdComponents($wsEntityId);
                             $entityId = $entityIdComponents[1];
                         } catch (Exception $e) {
                             $entityId = false;
                         }
                     }
                 }
                 $fieldData[$fieldName] = $entityId;
             } else {
                 $referencedModules = $fieldInstance->getReferenceList();
                 if ($referencedModules[0] == 'Users') {
                     if (isset($defaultFieldValues[$fieldName])) {
                         $fieldData[$fieldName] = $defaultFieldValues[$fieldName];
                     }
                     if (empty($fieldData[$fieldName]) || !Import_Utils_Helper::hasAssignPrivilege($moduleMeta->getEntityName(), $fieldData[$fieldName])) {
                         $fieldData[$fieldName] = $this->user->id;
                     }
                 } else {
                     $fieldData[$fieldName] = '';
                 }
             }
         } elseif ($fieldInstance->getFieldDataType() == 'picklist') {
             $fieldValue = trim($fieldValue);
             global $default_charset;
             if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
                 $fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
             }
             $olderCacheEnable = Vtiger_Cache::$cacheEnable;
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:Data.php

示例2: getFieldsWithBlocksForModule

 public static function getFieldsWithBlocksForModule($module_name, $references = false, $refTemplate = "([source]: ([module]) [destination])")
 {
     global $current_language, $adb, $app_strings;
     \Vtiger_Cache::$cacheEnable = false;
     $start = microtime(true);
     if (empty($refTemplate) && $references == true) {
         $refTemplate = "([source]: ([module]) [destination])";
     }
     //////echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>';
     // Fields in this module
     include_once "vtlib/Vtiger/Module.php";
     #$alle = glob(dirname(__FILE__).'/functions/*.inc.php');
     #foreach($alle as $datei) { include $datei;		 }
     $module = $module_name;
     $instance = Vtiger_Module::getInstance($module);
     $blocks = Vtiger_Block::getAllForModule($instance);
     ////echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>';
     if ($module != "Events") {
         $langModule = $module;
     } else {
         $langModule = "Calendar";
     }
     $modLang = return_module_language($current_language, $langModule);
     //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>';
     $moduleFields = array();
     $addReferences = array();
     if (is_array($blocks)) {
         foreach ($blocks as $block) {
             $fields = Vtiger_Field::getAllForBlock($block, $instance);
             //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>';
             if (empty($fields) || !is_array($fields)) {
                 continue;
             }
             foreach ($fields as $field) {
                 $field->label = getTranslatedString($field->label, $langModule);
                 $field->type = new StdClass();
                 $field->type->name = self::getFieldTypeName($field->uitype);
                 if ($field->type->name == 'picklist') {
                     $language = \Vtiger_Language_Handler::getModuleStringsFromFile($current_language, $field->block->module->name);
                     if (empty($language)) {
                         $language = \Vtiger_Language_Handler::getModuleStringsFromFile('en_us', $field->block->module->name);
                     }
                     switch ($field->name) {
                         case 'hdnTaxType':
                             $field->type->picklistValues = array('group' => 'Group', 'individual' => 'Individual');
                             break;
                         case 'email_flag':
                             $field->type->picklistValues = array('SAVED' => 'SAVED', 'SENT' => 'SENT', 'MAILSCANNER' => 'MAILSCANNER');
                             break;
                         case 'currency_id':
                             $field->type->picklistValues = array();
                             $currencies = getAllCurrencies();
                             foreach ($currencies as $currencies) {
                                 $field->type->picklistValues[$currencies['currency_id']] = $currencies['currencylabel'];
                             }
                             break;
                         default:
                             $field->type->picklistValues = getAllPickListValues($field->name, $language['languageStrings']);
                             break;
                     }
                 }
                 if (in_array($field->uitype, self::$referenceUitypes)) {
                     $modules = self::getModuleForReference($field->block->module->id, $field->name, $field->uitype);
                     $field->type->refersTo = $modules;
                 }
                 if ($references !== false) {
                     switch ($field->uitype) {
                         case "51":
                             $addReferences[] = array($field, "Accounts");
                             break;
                         case "52":
                             $addReferences[] = array($field, "Users");
                             break;
                         case "53":
                             $addReferences[] = array($field, "Users");
                             break;
                         case "57":
                             $addReferences[] = array($field, "Contacts");
                             break;
                         case "58":
                             $addReferences[] = array($field, "Campaigns");
                             break;
                         case "59":
                             $addReferences[] = array($field, "Products");
                             break;
                         case "73":
                             $addReferences[] = array($field, "Accounts");
                             break;
                         case "75":
                             $addReferences[] = array($field, "Vendors");
                             break;
                         case "81":
                             $addReferences[] = array($field, "Vendors");
                             break;
                         case "76":
                             $addReferences[] = array($field, "Potentials");
                             break;
                         case "78":
                             $addReferences[] = array($field, "Quotes");
                             break;
//.........这里部分代码省略.........
开发者ID:Neodracir,项目名称:VtigerCRM-Tools,代码行数:101,代码来源:VtUtils.php


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