本文整理汇总了PHP中PearDatabase::pquery方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::pquery方法的具体用法?PHP PearDatabase::pquery怎么用?PHP PearDatabase::pquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PearDatabase
的用法示例。
在下文中一共展示了PearDatabase::pquery方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPickListOptions
function getPickListOptions($fieldName)
{
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = html_entity_decode($picklistValue, ENT_QUOTES, $default_charset);
$elem["label"] = getTranslatedString($picklistValue, $this->getMeta()->getTabName());
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$details = getPickListValues($fieldName, $this->user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = html_entity_decode($details[$i], ENT_QUOTES, $default_charset);
$elem["label"] = getTranslatedString($picklistValue, $this->getMeta()->getTabName());
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
return $options;
}
示例2: getPickListOptions
function getPickListOptions()
{
global $app_strings, $mod_strings, $log, $current_language;
static $purified_plcache = array();
$fieldName = $this->getFieldName();
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$temp_mod_strings = $moduleName != '' ? return_module_language($current_language, $moduleName) : $mod_strings;
if (array_key_exists($moduleName . $fieldName, $purified_plcache)) {
return $purified_plcache[$moduleName . $fieldName];
}
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = decode_html($picklistValue);
$trans_str = $temp_mod_strings[$picklistValue] != '' ? $temp_mod_strings[$picklistValue] : ($app_strings[$picklistValue] != '' ? $app_strings[$picklistValue] : $picklistValue);
while ($trans_str != preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str)) {
$trans_str = preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str);
}
$elem["label"] = $trans_str;
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$user = VTWS_PreserveGlobal::getGlobal('current_user');
$details = getPickListValues($fieldName, $user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = decode_html($details[$i]);
$trans_str = $temp_mod_strings[$picklistValue] != '' ? $temp_mod_strings[$picklistValue] : ($app_strings[$picklistValue] != '' ? $app_strings[$picklistValue] : $picklistValue);
while ($trans_str != preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str)) {
$trans_str = preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str);
}
$elem["label"] = $trans_str;
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
$purified_plcache[$moduleName . $fieldName] = $options;
return $options;
}
示例3: getTreeDetails
function getTreeDetails()
{
if (count(self::$treeDetails) > 0) {
return self::$treeDetails;
}
$result = $this->pearDB->pquery('SELECT module FROM vtiger_trees_templates WHERE templateid = ?', [$this->getFieldParams()]);
$module = $this->pearDB->getSingleValue($result);
$moduleName = getTabModuleName($module);
$result = $this->pearDB->pquery('SELECT tree,label FROM vtiger_trees_templates_data WHERE templateid = ?', [$this->getFieldParams()]);
while ($row = $this->pearDB->fetch_array($result)) {
self::$treeDetails[$row['tree']] = getTranslatedString($row['label'], $moduleName);
}
return self::$treeDetails;
}
示例4: deleteImage
function deleteImage()
{
$sql1 = 'SELECT attachmentsid FROM vtiger_salesmanattachmentsrel WHERE smid = ?';
$res1 = $this->db->pquery($sql1, array($this->id));
if ($this->db->num_rows($res1) > 0) {
$attachmentId = $this->db->query_result($res1, 0, 'attachmentsid');
$sql2 = "DELETE FROM vtiger_crmentity WHERE crmid=? AND setype='Users Attachments'";
$this->db->pquery($sql2, array($attachmentId));
$sql3 = 'DELETE FROM vtiger_salesmanattachmentsrel WHERE smid=? AND attachmentsid=?';
$this->db->pquery($sql3, array($this->id, $attachmentId));
$sql2 = "UPDATE vtiger_users SET imagename='' WHERE id=?";
$this->db->pquery($sql2, array($this->id));
$sql4 = 'DELETE FROM vtiger_attachments WHERE attachmentsid=?';
$this->db->pquery($sql4, array($attachmentId));
}
}
示例5: getFieldTypeFromUIType
private function getFieldTypeFromUIType()
{
// Cache all the information for futher re-use
if (empty(self::$fieldTypeMapping)) {
$result = $this->pearDB->pquery("select * from vtiger_ws_fieldtype", array());
while ($resultrow = $this->pearDB->fetch_array($result)) {
self::$fieldTypeMapping[$resultrow['uitype']] = $resultrow;
}
}
if (isset(WebserviceField::$fieldTypeMapping[$this->getUIType()])) {
if (WebserviceField::$fieldTypeMapping[$this->getUIType()] === false) {
return null;
}
$row = WebserviceField::$fieldTypeMapping[$this->getUIType()];
return $row['fieldtype'];
} else {
WebserviceField::$fieldTypeMapping[$this->getUIType()] = false;
return null;
}
}
示例6: getPickListOptions
function getPickListOptions()
{
$fieldName = $this->getFieldName();
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = decode_html($picklistValue);
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$elem["label"] = getTranslatedString($picklistValue, $moduleName);
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$user = VTWS_PreserveGlobal::getGlobal('current_user');
$details = getPickListValues($fieldName, $user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = decode_html($details[$i]);
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$elem["label"] = getTranslatedString($picklistValue, $moduleName);
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
return $options;
}
示例7: 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';
//.........这里部分代码省略.........
示例8: getListViewEntries
//.........这里部分代码省略.........
if ($module == 'Documents' && $fieldName == 'filename') {
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
if ($downloadtype == 'I') {
$ext = substr($value, strrpos($value, ".") + 1);
$ext = strtolower($ext);
if ($value != '') {
if ($ext == 'bin' || $ext == 'exe' || $ext == 'rpm') {
$fileicon = "<img src='" . vtiger_imageurl('fExeBin.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'jpg' || $ext == 'gif' || $ext == 'bmp') {
$fileicon = "<img src='" . vtiger_imageurl('fbImageFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'txt' || $ext == 'doc' || $ext == 'xls') {
$fileicon = "<img src='" . vtiger_imageurl('fbTextFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'zip' || $ext == 'gz' || $ext == 'rar') {
$fileicon = "<img src='" . vtiger_imageurl('fbZipFile.gif', $theme) . "' hspace='3' align='absmiddle'\tborder='0'>";
} else {
$fileicon = "<img src='" . vtiger_imageurl('fbUnknownFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
}
}
} elseif ($downloadtype == 'E') {
if (trim($value) != '') {
$fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' title='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' hspace='3' align='absmiddle' border='0'>";
} else {
$value = '--';
$fileicon = '';
}
} else {
$value = ' --';
$fileicon = '';
}
$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 href='index.php?module=uploads&action=downloadfile&" . "entityid={$recordId}&fileid={$fileId}' title='" . getTranslatedString("LBL_DOWNLOAD_FILE", $module) . "' onclick='javascript:dldCntIncrease({$recordId});'>" . textlength_check($value) . "</a>";
} elseif ($downloadType == 'E') {
$value = "<a target='_blank' href='{$fileName}' onclick='javascript:" . "dldCntIncrease({$recordId});' 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';
}
}
} else {
$value = ' --';
}
} elseif ($module == 'Documents' && $fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
$value = getTranslatedString('no', $module);
示例9: selectCityStateAndRegion
/**
* Add state and region to city container.
*
* @param array $currentCity - description of city name, socr and code
* @param PearDatabase $db
*/
private function selectCityStateAndRegion(&$currentCity, $db)
{
/* Get lelvel 1 location for current entity of level 3-4 */
$firstLevelLocationCode = substr($currentCity["cityCode"], 0, 2) . "00000000000";
$firstLevelLocationResult = $db->pquery("select name, socr FROM sp_kladr WHERE code=?", array($firstLevelLocationCode));
if ($firstLevelLocationRow = $db->fetch_row($firstLevelLocationResult)) {
$currentCity["stateName"] = $firstLevelLocationRow["name"];
$currentCity["stateSocr"] = $firstLevelLocationRow["socr"];
}
/* Get lelvel 2 location for current entity of level 3-4 */
$currentCity["regionName"] = "";
$currentCity["regionSocr"] = "";
$secondLevelLocationCode = substr($currentCity["cityCode"], 0, 5) . "00000000";
$secondLevelLocationResult = $db->pquery("select name, socr FROM sp_kladr WHERE code=? " . "AND socr IN (select scname FROM sp_kladr_socrbase WHERE level=2)", array($secondLevelLocationCode));
if ($secondLevelLocationRow = $db->fetch_row($secondLevelLocationResult)) {
$currentCity["regionName"] = $secondLevelLocationRow["name"];
$currentCity["regionSocr"] = $secondLevelLocationRow["socr"];
}
}
示例10: 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';
//.........这里部分代码省略.........
示例11: getListViewEntries
//.........这里部分代码省略.........
} else {
$field = $this->queryGenerator->getReferenceField($fieldName, false);
if (is_null($field)) {
continue;
}
}
$uitype = $field->getUIType();
if ($fieldName != 'assigned_user_id' && strstr($fieldName, ".assigned_user_id")) {
$modrel = getTabModuleName($field->getTabId());
$rawValue = $this->db->query_result($result, $i, "smowner" . strtolower($modrel));
} else {
if (getTabid($currentModule) != $field->getTabId()) {
$modrel = getTabModuleName($field->getTabId());
$relfieldname = strtolower($modrel) . $field->getColumnName();
if (in_array($relfieldname, $listviewcolumns)) {
$rawValue = $this->db->query_result($result, $i, $relfieldname);
} else {
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
}
} else {
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
}
}
if ($module == 'Calendar') {
$activityType = $this->db->query_result($result, $i, 'activitytype');
}
if ($uitype != 8) {
$value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
} else {
$value = $rawValue;
}
if ($module == 'Documents' && $fieldName == 'filename' or $fieldName == 'Documents.filename') {
if ($fieldName == 'Documents.filename') {
$docrs = $db->pquery('select filename,filelocationtype,filestatus,notesid from vtiger_notes where note_no=?', array($db->query_result($result, $i, 'documentsnote_no')));
$downloadtype = $db->query_result($docrs, 0, 'filelocationtype');
$fileName = $db->query_result($docrs, 0, 'filename');
$status = $db->query_result($docrs, 0, 'filestatus');
$docid = $db->query_result($docrs, 0, 'notesid');
} else {
$docid = $recordId;
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
$fileName = $db->query_result($result, $i, 'filename');
$status = $db->query_result($result, $i, 'filestatus');
}
$fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
$fileIdRes = $db->pquery($fileIdQuery, array($docid));
$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
if ($downloadtype == 'I') {
$ext = substr($value, strrpos($value, ".") + 1);
$ext = strtolower($ext);
if ($value != '') {
if ($ext == 'bin' || $ext == 'exe' || $ext == 'rpm') {
$fileicon = "<img src='" . vtiger_imageurl('fExeBin.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'jpg' || $ext == 'gif' || $ext == 'bmp') {
$fileicon = "<img src='" . vtiger_imageurl('fbImageFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'txt' || $ext == 'doc' || $ext == 'xls') {
$fileicon = "<img src='" . vtiger_imageurl('fbTextFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
} elseif ($ext == 'zip' || $ext == 'gz' || $ext == 'rar') {
$fileicon = "<img src='" . vtiger_imageurl('fbZipFile.gif', $theme) . "' hspace='3' align='absmiddle'\tborder='0'>";
} else {
$fileicon = "<img src='" . vtiger_imageurl('fbUnknownFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
}
}
} elseif ($downloadtype == 'E') {
if (trim($value) != '') {
$fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' title='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' hspace='3' align='absmiddle' border='0'>";