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


PHP Vtiger_Field_Model::initialize方法代碼示例

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


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

示例1: handleEvent

 function handleEvent($eventName, $entityData)
 {
     if (in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
         $fields = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($entityData['sourceModule'], $entityData['destinationModule']);
         foreach ($fields as $field) {
             $fieldModel = new Vtiger_Field_Model();
             $fieldModel->initialize($field);
             $UITypeModel = $fieldModel->getUITypeModel();
             if ($eventName == 'vtiger.entity.link.after') {
                 $UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
             } elseif ($eventName == 'vtiger.entity.unlink.after') {
                 $UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
             }
         }
     } else {
         if ($eventName == 'vtiger.entity.aftersave.final') {
             $db = PearDatabase::getInstance();
             $moduleName = $entityData->getModuleName();
             $modules = Vtiger_MultiReferenceValue_UIType::getRelatedModules($moduleName);
             foreach ($modules as $module) {
                 $db->insert('s_yf_multireference', ['source_module' => $module, 'dest_module' => $moduleName, 'lastid' => $entityData->getId(), 'type' => 1]);
             }
         }
     }
 }
開發者ID:Bergdahls,項目名稱:YetiForceCRM,代碼行數:25,代碼來源:MultiReferenceUpdater.php

示例2: handleEvent

 function handleEvent($eventName, $entityData)
 {
     if (!in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
         return;
     }
     $fields = Vtiger_MultiReferenceValue_UIType::getMultiReferenceValueFields($entityData['sourceModule'], $entityData['destinationModule']);
     foreach ($fields as $field) {
         $fieldModel = new Vtiger_Field_Model();
         $fieldModel->initialize($field);
         $UITypeModel = $fieldModel->getUITypeModel();
         if ($eventName == 'vtiger.entity.link.after') {
             $UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
         } elseif ($eventName == 'vtiger.entity.unlink.after') {
             $UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
         }
     }
 }
開發者ID:noclav,項目名稱:UpdatePackages,代碼行數:17,代碼來源:MultiReferenceUpdater.php


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