本文整理汇总了PHP中QueryGenerator::getMeta方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::getMeta方法的具体用法?PHP QueryGenerator::getMeta怎么用?PHP QueryGenerator::getMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryGenerator
的用法示例。
在下文中一共展示了QueryGenerator::getMeta方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdvancedSearchOptionString
public function getAdvancedSearchOptionString()
{
$module = $this->queryGenerator->getModule();
$meta = $this->queryGenerator->getMeta($module);
$moduleFields = $meta->getModuleFields();
$i = 0;
foreach ($moduleFields as $fieldName => $field) {
if ($field->getFieldDataType() == 'reference') {
$typeOfData = 'V';
} else {
if ($field->getFieldDataType() == 'boolean') {
$typeOfData = 'C';
} else {
$typeOfData = $field->getTypeOfData();
$typeOfData = explode("~", $typeOfData);
$typeOfData = $typeOfData[0];
}
}
$label = getTranslatedString($field->getFieldLabelKey(), $module);
if (empty($label)) {
$label = $field->getFieldLabelKey();
}
if ($label == "Start Date & Time") {
$fieldlabel = "Start Date";
}
$selected = '';
if ($i++ == 0) {
$selected = "selected";
}
$OPTION_SET .= "<option value=\\'{$fieldName}::::{$typeOfData}\\' {$selected}>{$label}</option>";
}
return $OPTION_SET;
}
示例2: getAdvancedSearchOptionString
public function getAdvancedSearchOptionString()
{
$module = $this->queryGenerator->getModule();
$meta = $this->queryGenerator->getMeta($module);
$moduleFields = $meta->getModuleFields();
$i = 0;
foreach ($moduleFields as $fieldName => $field) {
if ($field->getFieldDataType() == 'reference') {
$typeOfData = 'V';
} else {
if ($field->getFieldDataType() == 'boolean') {
$typeOfData = 'C';
} else {
$typeOfData = $field->getTypeOfData();
$typeOfData = explode("~", $typeOfData);
$typeOfData = $typeOfData[0];
}
}
$label = getTranslatedString($field->getFieldLabelKey(), $module);
$label = str_replace(array("\n", "\r"), '', $label);
if (empty($label)) {
$label = $field->getFieldLabelKey();
}
if ($label == "Start Date & Time") {
$fieldlabel = "Start Date";
}
$selected = '';
if ($i++ == 0) {
$selected = "selected";
}
// place option in array for sorting later
//$blockName = getTranslatedString(getBlockName($field->getBlockId()), $module);
$blockName = getTranslatedString($field->getBlockName(), $module);
$fieldLabelEscaped = str_replace(" ", "_", $field->getFieldLabelKey());
$optionvalue = $field->getTableName() . ":" . $field->getColumnName() . ":" . $fieldName . ":" . $module . "_" . $fieldLabelEscaped . ":" . $typeOfData;
$OPTION_SET[$blockName][$label] = "<option value=\\'{$optionvalue}\\' {$selected}>{$label}</option>";
}
// sort array on block label
ksort($OPTION_SET, SORT_STRING);
$shtml = '';
foreach ($OPTION_SET as $key => $value) {
$shtml .= "<optgroup label='{$key}' class='select' style='border:none'>";
// sort array on field labels
ksort($value, SORT_STRING);
$shtml .= implode('', $value);
}
return $shtml;
}
示例3: getListViewRecords
function getListViewRecords($focus, $module, $result)
{
global $listview_max_textlength, $theme, $default_charset;
require 'user_privileges/user_privileges_' . $this->user->id . '.php';
$fields = $this->queryGenerator->getFields();
$meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
$moduleFields = $this->queryGenerator->getModuleFields();
$accessibleFieldList = array_keys($moduleFields);
$listViewFields = array_intersect($fields, $accessibleFieldList);
$referenceFieldList = $this->queryGenerator->getReferenceFieldList();
foreach ($referenceFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$this->fetchNameList($field, $result);
}
}
$db = PearDatabase::getInstance();
$rowCount = $db->num_rows($result);
$ownerFieldList = $this->queryGenerator->getOwnerFieldList();
foreach ($ownerFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$idList = array();
for ($i = 0; $i < $rowCount; $i++) {
$id = $this->db->query_result($result, $i, $field->getColumnName());
if (!isset($this->ownerNameList[$fieldName][$id])) {
$idList[] = $id;
}
}
if (count($idList) > 0) {
if (!is_array($this->ownerNameList[$fieldName])) {
$this->ownerNameList[$fieldName] = getOwnerNameList($idList);
} else {
//array_merge API loses key information so need to merge the arrays
// manually.
$newOwnerList = getOwnerNameList($idList);
foreach ($newOwnerList as $id => $name) {
$this->ownerNameList[$fieldName][$id] = $name;
}
}
}
}
}
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
$this->setupAccessiblePicklistValueList($fieldName);
}
}
$useAsterisk = get_use_asterisk($this->user->id);
$data = array();
for ($i = 0; $i < $rowCount; ++$i) {
//Getting the recordId
if ($module != 'Users') {
$baseTable = $meta->getEntityBaseTable();
$moduleTableIndexList = $meta->getEntityTableIndexList();
$baseTableIndex = $moduleTableIndexList[$baseTable];
$recordId = $db->query_result($result, $i, $baseTableIndex);
} else {
$recordId = $db->query_result($result, $i, "id");
}
$row = array();
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
$uitype = $field->getUIType();
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
if (in_array($uitype, array(15, 33, 16))) {
$value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
} else {
$value = $rawValue;
}
if ($module == 'Documents' && $fieldName == 'filename') {
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
$fileName = $db->query_result($result, $i, 'filename');
$downloadType = $db->query_result($result, $i, 'filelocationtype');
$status = $db->query_result($result, $i, 'filestatus');
$fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
$fileIdRes = $db->pquery($fileIdQuery, array($recordId));
$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
if ($fileName != '' && $status == 1) {
if ($downloadType == 'I') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} elseif ($downloadType == 'E') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} else {
$value = ' --';
}
}
$value = $fileicon . $value;
} elseif ($module == 'Documents' && $fieldName == 'filesize') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'I') {
$filesize = $value;
if ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
//.........这里部分代码省略.........
示例4: getTopQuotes
/** function used to get the top 5 quotes from the ListView query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getTopQuotes($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Quotes/Quotes.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
global $app_strings, $current_language, $current_user;
$current_module_strings = return_module_language($current_language, 'Quotes');
global $list_max_entries_per_page, $adb, $theme, $mod_strings;
$log = LoggerManager::getLogger('quote_list');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Quotes");
$customviewcombo_html = $oCustomView->getCustomViewCombo();
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'Quotes';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('subject', 'potential_id', 'account_id', 'total');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if (count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getTopQuotesSearch($_REQUEST, array('assigned_user_id' => $current_user->column_fields['user_name'], 'validtill' => $date_var, 'quotestage.Rejected' => $current_module_strings['Rejected'], 'quotestage.Accepted' => $current_module_strings['Accepted']));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1) {
if ($noofrows != 0) {
$start_rec = $navigation_array['start'];
} else {
$start_rec = 0;
}
if ($noofrows > $list_max_entries_per_page) {
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
} else {
$end_rec = $noofrows;
}
} else {
if ($navigation_array['next'] > $list_max_entries_per_page) {
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
} else {
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
$focus = new Quotes();
$title = array('TopOpenQuotes.gif', $current_module_strings['LBL_MY_TOP_QUOTE'], 'home_mytopquote');
//Retreive the List View Table Header
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
$entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
//.........这里部分代码省略.........
示例5: getMyFaq
/** function used to get the top 5 recent FAQs from Listview query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getMyFaq($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Faq/Faq.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
global $current_language, $current_user, $list_max_entries_per_page, $adb;
$current_module_strings = return_module_language($current_language, 'Faq');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Faq");
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$focus = new Faq();
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$currentModule = 'Faq';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('question', 'product_id');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if (count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getMyFaqSearch($_REQUEST);
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1) {
if ($noofrows != 0) {
$start_rec = $navigation_array['start'];
} else {
$start_rec = 0;
}
if ($noofrows > $list_max_entries_per_page) {
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
} else {
$end_rec = $noofrows;
}
} else {
if ($navigation_array['next'] > $list_max_entries_per_page) {
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
} else {
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
//Retreive the List View Table Header
$title = array('myFaqs.gif', $current_module_strings['LBL_MY_FAQ'], 'home_myfaq');
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
$entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
$values = array('ModuleName' => 'Faq', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
if ($noofrows == 0 || $noofrows > 0) {
return $values;
}
}
示例6: getSearchViewList
public function getSearchViewList($module, $view)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$queryGenerator = new QueryGenerator($module, $currentUser);
$meta = $queryGenerator->getMeta($module);
$baseTable = $meta->getEntityBaseTable();
$tableIndexList = $meta->getEntityTableIndexList();
$baseTableIndex = $tableIndexList[$baseTable];
$queryGenerator->initForCustomViewById($view);
$queryGenerator->setFields([]);
$queryGenerator->addCustomColumn('userid');
$queryGenerator->addCustomFrom(['joinType' => 'INNER', 'relatedTable' => 'u_yf_crmentity_showners', 'relatedIndex' => 'crmid', 'baseTable' => $baseTable, 'baseIndex' => $baseTableIndex]);
$listQuery = $queryGenerator->getQuery('SELECT DISTINCT');
$result = $db->query($listQuery);
$users = $group = [];
while ($id = $db->getSingleValue($result)) {
$name = self::getUserName($id);
if ($name !== false) {
$users[$id] = $name;
continue;
}
$name = self::getGroupName($id);
if ($name !== false) {
$group[$id] = $name;
continue;
}
}
asort($users);
asort($group);
return ['users' => $users, 'group' => $group];
}
示例7: getSearchURL
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
// Enabling Module Search
$url_string = '';
if ($_REQUEST['query'] == 'true') {
$queryGenerator->addUserSearchConditions($_REQUEST);
$ustring = getSearchURL($_REQUEST);
$url_string .= "&query=true{$ustring}";
$smarty->assign('SEARCH_URL', $url_string);
}
$list_query = $queryGenerator->getQuery();
// Sorting
if (!empty($order_by)) {
$meta = $queryGenerator->getMeta($currentModule);
$moduleFields = $meta->getModuleFields();
$found = false;
foreach ($moduleFields as $field) {
if ($field->getColumnName() == $order_by) {
$found = true;
break;
}
}
if ($found === false) {
$list_query .= " ORDER BY {$order_by} {$sorder}";
} else {
$list_query .= " ORDER BY " . $field->getTableName() . ".{$order_by} {$sorder}";
}
}
//Postgres 8 fixes
示例8: getListViewRecords
function getListViewRecords($focus, $module, $result)
{
global $listview_max_textlength, $theme, $default_charset;
require 'user_privileges/user_privileges_' . $this->user->id . '.php';
$fields = $this->queryGenerator->getFields();
$meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
$moduleFields = $meta->getModuleFields();
$accessibleFieldList = array_keys($moduleFields);
$listViewFields = array_intersect($fields, $accessibleFieldList);
$referenceFieldList = $this->queryGenerator->getReferenceFieldList();
foreach ($referenceFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$this->fetchNameList($field, $result);
}
}
$db = PearDatabase::getInstance();
$rowCount = $db->num_rows($result);
$ownerFieldList = $this->queryGenerator->getOwnerFieldList();
foreach ($ownerFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$idList = array();
for ($i = 0; $i < $rowCount; $i++) {
$id = $this->db->query_result($result, $i, $field->getColumnName());
if (!isset($this->ownerNameList[$fieldName][$id])) {
$idList[] = $id;
}
}
if (count($idList) > 0) {
if (!is_array($this->ownerNameList[$fieldName])) {
$this->ownerNameList[$fieldName] = getOwnerNameList($idList);
} else {
//array_merge API loses key information so need to merge the arrays
// manually.
$newOwnerList = getOwnerNameList($idList);
foreach ($newOwnerList as $id => $name) {
$this->ownerNameList[$fieldName][$id] = $name;
}
}
}
}
}
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
$this->setupAccessiblePicklistValueList($fieldName);
}
}
$useAsterisk = get_use_asterisk($this->user->id);
$data = array();
for ($i = 0; $i < $rowCount; ++$i) {
//Getting the recordId
if ($module != 'Users') {
$baseTable = $meta->getEntityBaseTable();
$moduleTableIndexList = $meta->getEntityTableIndexList();
$baseTableIndex = $moduleTableIndexList[$baseTable];
$recordId = $db->query_result($result, $i, $baseTableIndex);
} else {
$recordId = $db->query_result($result, $i, "id");
}
$row = array();
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
$uitype = $field->getUIType();
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
if ($uitype != 8) {
$value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
} else {
$value = $rawValue;
}
if ($module == 'Documents' && $fieldName == 'filename') {
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
$fileName = $db->query_result($result, $i, 'filename');
$downloadType = $db->query_result($result, $i, 'filelocationtype');
$status = $db->query_result($result, $i, 'filestatus');
$fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
$fileIdRes = $db->pquery($fileIdQuery, array($recordId));
$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
if ($fileName != '' && $status == 1) {
if ($downloadType == 'I') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} elseif ($downloadType == 'E') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} else {
$value = ' --';
}
}
$value = $fileicon . $value;
} elseif ($module == 'Documents' && $fieldName == 'filesize') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'I') {
$filesize = $value;
if ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
//.........这里部分代码省略.........