当前位置: 首页>>代码示例>>PHP>>正文


PHP PearDatabase::query_result方法代码示例

本文整理汇总了PHP中PearDatabase::query_result方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::query_result方法的具体用法?PHP PearDatabase::query_result怎么用?PHP PearDatabase::query_result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PearDatabase的用法示例。


在下文中一共展示了PearDatabase::query_result方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:WebserviceEntityOperation.php

示例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;
 }
开发者ID:jgjermeni,项目名称:corebos,代码行数:52,代码来源:WebserviceField.php

示例3: 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));
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:16,代码来源:Users.php

示例4: 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;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:41,代码来源:WebserviceField.php

示例5: getReferenceList

 public function getReferenceList()
 {
     static $referenceList = array();
     if ($this->referenceList === null) {
         if (isset($referenceList[$this->getFieldId()])) {
             $this->referenceList = $referenceList[$this->getFieldId()];
             return $referenceList[$this->getFieldId()];
         }
         if (!isset(WebserviceField::$fieldTypeMapping[$this->getUIType()])) {
             $this->getFieldTypeFromUIType();
         }
         $fieldTypeData = WebserviceField::$fieldTypeMapping[$this->getUIType()];
         $referenceTypes = array();
         if ($this->getUIType() != $this->genericUIType) {
             $sql = "select * from vtiger_ws_referencetype where fieldtypeid=?";
             $params = array($fieldTypeData['fieldtypeid']);
         } else {
             $sql = 'select relmodule as type from vtiger_fieldmodulerel where fieldid=?';
             $params = array($this->getFieldId());
         }
         $result = $this->pearDB->pquery($sql, $params);
         $numRows = $this->pearDB->num_rows($result);
         for ($i = 0; $i < $numRows; ++$i) {
             array_push($referenceTypes, $this->pearDB->query_result($result, $i, "type"));
         }
         //to handle hardcoding done for Calendar module todo activities.
         if ($this->tabid == 9 && $this->fieldName == 'parent_id') {
             $referenceTypes[] = 'Invoice';
             $referenceTypes[] = 'Quotes';
             $referenceTypes[] = 'PurchaseOrder';
             $referenceTypes[] = 'SalesOrder';
             $referenceTypes[] = 'Campaigns';
         }
         $referenceList[$this->getFieldId()] = $referenceTypes;
         $this->referenceList = $referenceTypes;
         return $referenceTypes;
     }
     return $this->referenceList;
 }
开发者ID:latechdirect,项目名称:vtiger,代码行数:39,代码来源:WebserviceField.php

示例6: 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';
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:ListViewController.php

示例7: getListViewEntries

 function getListViewEntries($focus, $module, $result, $navigationInfo, $skipActions = false)
 {
     require 'user_privileges/user_privileges_' . $this->user->id . '.php';
     global $listview_max_textlength, $theme, $default_charset;
     $fields = $this->queryGenerator->getFields();
     $whereFields = $this->queryGenerator->getWhereFields();
     $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);
             $ownerId = $db->query_result($result, $i, "smownerid");
         } 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 ($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') {
                 $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 = '';
//.........这里部分代码省略.........
开发者ID:mslokhat,项目名称:corebos,代码行数:101,代码来源:ListViewController.php

示例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';
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:101,代码来源:ListViewController.php

示例9: getListViewEntries

    function getListViewEntries($focus, $module, $result, $navigationInfo, $skipActions = false)
    {
        require 'user_privileges/user_privileges_' . $this->user->id . '.php';
        global $listview_max_textlength, $theme, $default_charset, $current_user, $currentModule, $adb;
        $fields = $this->queryGenerator->getFields();
        $whereFields = $this->queryGenerator->getWhereFields();
        $meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
        $moduleFields = $meta->getModuleFields();
        $accessibleFieldList = array_keys($moduleFields);
        if ($this->queryGenerator->getReferenceFieldInfoList()) {
            $accessibleFieldList = array_merge($this->queryGenerator->getReferenceFieldNameList(), $accessibleFieldList);
        }
        $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);
        $listviewcolumns = $db->getFieldsArray($result);
        $ownerFieldList = $this->queryGenerator->getOwnerFieldList();
        foreach ($ownerFieldList as $fieldName) {
            if (in_array($fieldName, $listViewFields)) {
                if (!empty($moduleFields[$fieldName])) {
                    $field = $moduleFields[$fieldName];
                } else {
                    $field = $this->queryGenerator->getReferenceField($fieldName, false);
                    if (is_null($field)) {
                        continue;
                    }
                }
                $fldcolname = $field->getColumnName();
                $idList = array();
                for ($i = 0; $i < $rowCount; $i++) {
                    $id = $this->db->query_result($result, $i, $fldcolname);
                    if (!isset($this->ownerNameList[$fieldName][$id])) {
                        $idList[] = $id;
                    }
                }
                if (count($idList) > 0) {
                    if (!isset($this->ownerNameList[$fieldName]) or !is_array($this->ownerNameList[$fieldName])) {
                        $this->ownerNameList[$fieldName] = getOwnerNameList($idList);
                    } else {
                        $newOwnerList = getOwnerNameList($idList);
                        $this->ownerNameList[$fieldName] = $this->ownerNameList[$fieldName] + $newOwnerList;
                    }
                }
            }
        }
        foreach ($listViewFields as $fieldName) {
            if (!empty($moduleFields[$fieldName])) {
                $field = $moduleFields[$fieldName];
            } else {
                $field = $this->queryGenerator->getReferenceField($fieldName, false);
                if (is_null($field)) {
                    continue;
                }
            }
            if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
                $this->setupAccessiblePicklistValueList($fieldName);
            }
            $idList = array();
            if ($fieldName != 'assigned_user_id' && strstr($fieldName, ".assigned_user_id")) {
                $modrel = getTabModuleName($field->getTabId());
                $fldcolname = 'smowner' . strtolower($modrel);
                $j = $rowCount * $k;
                $k++;
                for ($i = 0; $i < $rowCount; $i++) {
                    $id = $this->db->query_result($result, $i, $fldcolname);
                    if (!isset($this->ownerNameListrel[$fieldName][$id])) {
                        $idList[$j] = $id;
                        $j++;
                    }
                }
            } else {
                if (getTabid($currentModule) != $field->getTabId() && $field->getFieldDataType() == 'reference') {
                    $this->fetchNameList($field, $result, 1);
                }
            }
            if (count($idList) > 0) {
                if (!isset($this->ownerNameListrel[$fieldName]) or !is_array($this->ownerNameListrel[$fieldName])) {
                    $this->ownerNameListrel[$fieldName] = getOwnerNameList($idList);
                } else {
                    $newOwnerList = getOwnerNameList($idList);
                    $this->ownerNameListrel[$fieldName] = $this->ownerNameListrel[$fieldName] + $newOwnerList;
                }
            }
        }
        $useAsterisk = get_use_asterisk($this->user->id);
        $wfs = new VTWorkflowManager($adb);
        $data = array();
        for ($i = 0; $i < $rowCount; ++$i) {
            //Getting the recordId
            if ($module != 'Users') {
                $baseTable = $meta->getEntityBaseTable();
                $moduleTableIndexList = $meta->getEntityTableIndexList();
                $baseTableIndex = $moduleTableIndexList[$baseTable];
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:ListViewController.php


注:本文中的PearDatabase::query_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。