* Vizsage Public License (the "License"). You may not use this file except in compliance with the * License. Roughly speaking, non-commercial users may share and modify this code, but must give credit * and share improvements. However, for proper details please read the full License, available at * http://vizsage.com/license/Vizsage-License-BY-NC-SA.html and the handy reference for understanding * the full license at http://vizsage.com/license/Vizsage-Deed-BY-NC-SA.html. Unless required by * applicable law or agreed to in writing, any software distributed under the License is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the * License terms of Creative Commons Attribution-NonCommercial-ShareAlike 3.0 (the License). ************************************************************************************************* * Module : cbMap * Version : 5.5.0 * Author : OpenCubed. *************************************************************************************************/ global $log; include_once 'modules/cbMap/cbMap.php'; global $mod_strings, $app_strings; $mapInstance = CRMEntity::getInstance("cbMap"); $modtype = $_REQUEST['modtype']; $module_list = json_decode($_REQUEST['module_list']); $related_modules = json_decode($_REQUEST['related_modules']); $rel_fields = json_decode($_REQUEST['rel_fields']); $pmodule = $_REQUEST['pmodule']; VTCacheUtils::updateMap_ListofModuleInfos($module_list, $related_modules, $rel_fields); if ($modtype == "target") { $mapInstance->getPriModuleFieldsList($pmodule, $modtype); echo $mapInstance->getPrimaryFieldHTML($pmodule, $modtype); } else { $mapInstance->getPriModuleFieldsList($pmodule, $modtype); echo $mapInstance->getPrimaryFieldHTML($pmodule, $modtype); }
function initListOfModules() { global $adb; $restricted_modules = array('Emails', 'Events', 'Webmails'); $restricted_blocks = array('LBL_IMAGE_INFORMATION', 'LBL_COMMENTS', 'LBL_COMMENT_INFORMATION'); //tabid and name of modules $this->module_id = array(); //name and blocks of modules $this->module_list = array(); $modulerows = vtlib_prefetchModuleActiveInfo(false); $cachedInfo = VTCacheUtils::lookupMap_ListofModuleInfos(); if ($cachedInfo !== false) { $this->module_list = $cachedInfo['module_list']; $this->related_modules = $cachedInfo['related_modules']; $this->rel_fields = $cachedInfo['rel_fields']; } else { if ($modulerows) { foreach ($modulerows as $resultrow) { if ($resultrow['presence'] == '1') { continue; } // skip disabled modules if ($resultrow['isentitytype'] != '1') { continue; } // skip extension modules if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules continue; } if ($resultrow['name'] != 'Calendar') { $this->module_id[$resultrow['tabid']] = $resultrow['name']; } else { $this->module_id[9] = $resultrow['name']; $this->module_id[16] = $resultrow['name']; } $this->module_list[$resultrow['name']] = array(); } //get tabId of all modules $moduleids = array_keys($this->module_id); $moduleblocks = $adb->pquery("SELECT blockid, blocklabel, tabid FROM vtiger_blocks WHERE tabid IN (" . generateQuestionMarks($moduleids) . ")", array($moduleids)); $prev_block_label = ''; if ($adb->num_rows($moduleblocks)) { while ($resultrow = $adb->fetch_array($moduleblocks)) { $blockid = $resultrow['blockid']; $blocklabel = $resultrow['blocklabel']; $module = $this->module_id[$resultrow['tabid']]; if (in_array($blocklabel, $restricted_blocks) || in_array($blockid, $this->module_list[$module]) || isset($this->module_list[$module][getTranslatedString($blocklabel, $module)])) { continue; } if (!empty($blocklabel)) { if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') { $this->module_list[$module][$blockid] = getTranslatedString($blocklabel, $module); } else { $this->module_list[$module][$blockid] = getTranslatedString($blocklabel, $module); } $prev_block_label = $blocklabel; } else { $this->module_list[$module][$blockid] = getTranslatedString($prev_block_label, $module); } } } // $relatedmodules = $adb->pquery( // "SELECT vtiger_tab.name, vtiger_relatedlists.tabid FROM $dbname.vtiger_tab // INNER JOIN $dbname.vtiger_relatedlists on vtiger_tab.tabid=vtiger_relatedlists.related_tabid // WHERE vtiger_tab.isentitytype=1 // AND vtiger_tab.name NOT IN(".generateQuestionMarks($restricted_modules).") // AND vtiger_tab.presence = 0 AND vtiger_relatedlists.label!='Activity History' // UNION // SELECT module, vtiger_tab.tabid FROM $dbname.vtiger_fieldmodulerel // INNER JOIN $dbname.vtiger_tab on vtiger_tab.name = vtiger_fieldmodulerel.relmodule // WHERE vtiger_tab.isentitytype = 1 // AND vtiger_tab.name NOT IN(".generateQuestionMarks($restricted_modules).") // AND vtiger_tab.presence = 0", // array($restricted_modules,$restricted_modules) // ); $relatedmodules = $adb->pquery("SELECT module as name, vtiger_tab.tabid,fieldid FROM vtiger_fieldmodulerel\n INNER JOIN vtiger_tab on vtiger_tab.name = vtiger_fieldmodulerel.relmodule\n WHERE vtiger_tab.isentitytype = 1\n AND vtiger_tab.name NOT IN(" . generateQuestionMarks($restricted_modules) . ")\n AND vtiger_tab.presence = 0\n\t\t\t\tUNION\n\t\t\t SELECT relmodule as name, vtiger_tab.tabid,fieldid FROM vtiger_fieldmodulerel\n INNER JOIN vtiger_tab on vtiger_tab.name = vtiger_fieldmodulerel.module\n WHERE vtiger_tab.isentitytype = 1\n AND vtiger_tab.name NOT IN(" . generateQuestionMarks($restricted_modules) . ")\n AND vtiger_tab.presence = 0", array($restricted_modules, $restricted_modules)); if ($adb->num_rows($relatedmodules)) { while ($resultrow = $adb->fetch_array($relatedmodules)) { $module = $this->module_id[$resultrow['tabid']]; if (!isset($this->related_modules[$module])) { $this->related_modules[$module] = array(); } if (!isset($this->related_modules[$module])) { $this->rel_fields[$module] = array(); } if ($module != $resultrow['name']) { $this->related_modules[$module][] = $resultrow['name']; $this->rel_fields[$module][$resultrow['name']] = $this->getFieldName($resultrow['fieldid']); } } } // Put the information in cache for re-use VTCacheUtils::updateMap_ListofModuleInfos($this->module_list, $this->related_modules, $this->rel_fields); } } }