function Calendar_getReferenceFieldColumnsList($module, $sort = true) { global $current_user; $handler = vtws_getModuleHandlerFromName($module, $current_user); $meta = $handler->getMeta(); $reffields = $meta->getReferenceFieldDetails(); $ret_module_list = array(); foreach ($reffields as $fld => $mods) { foreach ($mods as $mod) { if (!vtlib_isEntityModule($mod)) { continue; } // reference to a module without fields if (isset($ret_module_list[$mod])) { continue; } // we already have this one $Fields_Array = array(); $module_handler = vtws_getModuleHandlerFromName($mod, $current_user); $module_meta = $module_handler->getMeta(); $mflds = $module_meta->getModuleFields(); foreach ($mflds as $fname => $finfo) { $fieldid = $finfo->getFieldId(); $fieldlabel = getTranslatedString($finfo->getFieldLabelKey(), $mod); $field_data = array(); $field_data['fieldid'] = $fieldid; $field_data['fieldname'] = $finfo->getFieldName(); $field_data['fieldlabel'] = $fieldlabel; $field_data['module'] = $mod; $Fields_Array[$fieldid] = $field_data; unset($field_data); } if ($sort) { uasort($Fields_Array, function ($a, $b) { return strtolower($a['fieldlabel']) < strtolower($b['fieldlabel']) ? -1 : 1; }); } $ret_module_list[$mod] = $Fields_Array; unset($Fields_Array); } } if ($sort) { uksort($ret_module_list, function ($a, $b) { return strtolower(getTranslatedString($a, $a)) < strtolower(getTranslatedString($b, $b)) ? -1 : 1; }); } return $ret_module_list; }
/** to get the getModuleColumnsList for the given module * @param $module :: Type String * @returns $ret_module_list Array in the following format * $ret_module_list = Array ('module' => Array('BlockLabel1' => Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel, Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1, Array('BlockLabel2' => Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel, Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1, | Array('BlockLabeln' => Array('$fieldtablename:$fieldcolname:$fieldname:$module_$fieldlabel1:$fieldtypeofdata'=>$fieldlabel, Array('$fieldtablename1:$fieldcolname1:$fieldname1:$module_$fieldlabel11:$fieldtypeofdata1'=>$fieldlabel1, */ function getModuleColumnsList($module) { global $current_user; $module_info = $this->getCustomViewModuleInfo($module); foreach ($this->module_list[$module] as $key => $value) { $columnlist = $this->getColumnsListbyBlock($module, $value, true); if (isset($columnlist)) { $ret_module_list[$module][$key] = $columnlist; } } $handler = vtws_getModuleHandlerFromName($module, $current_user); $meta = $handler->getMeta(); $reffields = $meta->getReferenceFieldDetails(); foreach ($reffields as $fld => $mods) { foreach ($mods as $mod) { if (!vtlib_isEntityModule($mod)) { continue; } // reference to a module without fields if (isset($ret_module_list[$mod])) { continue; } // we already have this one $module_info = $this->getCustomViewModuleInfo($mod); foreach ($this->module_list[$mod] as $key => $value) { $columnlist = $this->getColumnsListbyBlock($mod, $value, false); if (isset($columnlist)) { $ret_module_list[$mod][$key] = $columnlist; } } } } return $ret_module_list; }
public function setReferenceFields() { global $current_user; $this->referenceFieldNameList = array(); $this->referenceFields = array(); if (isset($this->referenceModuleField)) { foreach ($this->referenceModuleField as $index => $conditionInfo) { $refmod = $conditionInfo['relatedModule']; if (!vtlib_isEntityModule($refmod)) { continue; } // reference to a module without fields $handler = vtws_getModuleHandlerFromName($refmod, $current_user); $meta = $handler->getMeta(); $fields = $meta->getModuleFields(); foreach ($fields as $fname => $finfo) { if ($fname == 'roleid') { continue; } $this->referenceFieldNameList[] = $fname; $this->referenceFieldNameList[] = $refmod . '.' . $fname; if ($fname == $conditionInfo['fieldName']) { $this->referenceFields[$conditionInfo['referenceField']][$refmod][$fname] = $finfo; } } } } if (count($this->referenceFieldInfoList) > 0 and count($this->fields) > 0) { foreach ($this->referenceFieldInfoList as $fld => $mods) { if ($fld == 'modifiedby') { $fld = 'assigned_user_id'; } foreach ($mods as $module) { if (!vtlib_isEntityModule($module)) { continue; } // reference to a module without fields $handler = vtws_getModuleHandlerFromName($module, $current_user); $meta = $handler->getMeta(); $fields = $meta->getModuleFields(); foreach ($fields as $fname => $finfo) { if ($fname == 'roleid') { continue; } $this->referenceFieldNameList[] = $fname; $this->referenceFieldNameList[] = $module . '.' . $fname; if (in_array($fname, $this->fields) or in_array($module . '.' . $fname, $this->fields)) { $this->referenceFields[$fld][$module][$fname] = $finfo; } } } } } }