[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/uitypes/ -> DocumentsFileUpload.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  class Vtiger_DocumentsFileUpload_UIType extends Vtiger_Base_UIType {
  11      /**
  12       * Function to get the Template name for the current UI Type Object
  13       * @return <String> - Template Name
  14       */
  15  	public function getTemplateName() {
  16          return 'uitypes/DocumentsFileUpload.tpl';
  17      }
  18  
  19      /**
  20       * Function to get the Display Value, for the current field type with given DB Insert Value
  21       * @param <String> $value
  22       * @param <Integer> $recordId
  23       * @param <Vtiger_Record_Model>
  24       * @return <String>
  25       */
  26  	public function getDisplayValue($value, $recordId=false, $recordModel=false) {
  27          if($recordModel) {
  28              $fileLocationType = $recordModel->get('filelocationtype');
  29              $fileStatus = $recordModel->get('filestatus');
  30              if(!empty($value) && $fileStatus) {
  31                  if($fileLocationType == 'I') {
  32                      $db = PearDatabase::getInstance();
  33                      $fileIdRes = $db->pquery('SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid = ?', array($recordId));
  34                      $fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
  35                      if($fileId){
  36                          $value = '<a href="index.php?module=Documents&action=DownloadFile&record='.$recordId.'&fileid='.$fileId.'"'.
  37                                      ' title="'.    vtranslate('LBL_DOWNLOAD_FILE', 'Documents').'" >'.$value.'</a>';
  38                      }
  39                  } else {
  40                      $value = '<a href="'.$value.'" target="_blank" title="'. vtranslate('LBL_DOWNLOAD_FILE', 'Documents').'" >'.$value.'</a>';
  41                  }
  42              }
  43          }
  44          return $value;
  45      }
  46  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1