[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Webservices/ -> WebserviceEntityOperation.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  
  11  abstract class WebserviceEntityOperation{
  12      protected $user;
  13      protected $log;
  14      protected $webserviceObject;
  15      protected $meta;
  16      /**
  17       *
  18       * @var PearDatabase
  19       */
  20      protected $pearDB;
  21      
  22      protected static $metaCache = array();
  23      
  24  	protected function WebserviceEntityOperation($webserviceObject,$user,$adb,$log){
  25          $this->user = $user;
  26          $this->log = $log;
  27          $this->webserviceObject = $webserviceObject;
  28          $this->pearDB = $adb;
  29      }
  30      
  31  	public function create($elementType,$element){
  32          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  33          "Operation Create is not supported for this entity");
  34      }
  35      
  36  	public function retrieve($id){
  37          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  38          "Operation Retrieve is not supported for this entity");
  39      }
  40      
  41  	public function update($element){
  42          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  43          "Operation Update is not supported for this entity");
  44      }
  45      
  46  	public function revise($element){
  47          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  48          "Operation Update is not supported for this entity");
  49      }
  50  
  51  	public function delete($id){
  52          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  53          "Operation delete is not supported for this entity");
  54      }
  55      
  56  	public function query($q){
  57          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  58          "Operation query is not supported for this entity");
  59      }
  60      
  61  	public function describe($elementType){
  62          throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED,
  63          "Operation describe is not supported for this entity");
  64      }
  65      
  66  	function getFieldTypeDetails($webserviceField){
  67          global $upload_maxsize;
  68          $typeDetails = array();
  69          switch($webserviceField->getFieldDataType()){
  70              case 'reference': $typeDetails['refersTo'] = $webserviceField->getReferenceList();
  71                  break;
  72              case 'multipicklist':
  73              case 'picklist': $typeDetails["picklistValues"] = $webserviceField->getPicklistDetails($webserviceField);
  74                  $typeDetails['defaultValue'] = $typeDetails["picklistValues"][0]['value'];
  75                  break;
  76              case 'file': $maxUploadSize = 0;
  77                  $maxUploadSize = ini_get('upload_max_filesize');
  78                  $maxUploadSize = strtolower($maxUploadSize);
  79                  $maxUploadSize = explode('m',$maxUploadSize);
  80                  $maxUploadSize = $maxUploadSize[0];
  81                  if(!is_numeric($maxUploadSize)){
  82                      $maxUploadSize = 0;
  83                  }
  84                  $maxUploadSize = $maxUploadSize * 1000000;
  85                  if($upload_maxsize > $maxUploadSize){
  86                      $maxUploadSize = $upload_maxsize;
  87                  }
  88                  $typeDetails['maxUploadFileSize'] = $maxUploadSize;
  89                  break;
  90              case 'date': $typeDetails['format'] = $this->user->date_format;
  91          }
  92          return $typeDetails;
  93      }
  94      
  95  	function isEditable($webserviceField){
  96          if(((int)$webserviceField->getDisplayType()) === 2 || strcasecmp($webserviceField->getFieldDataType(),"autogenerated")
  97              ===0 || strcasecmp($webserviceField->getFieldDataType(),"id")===0 || $webserviceField->isReadOnly() == true){
  98              return false;
  99          }
 100          //uitype 70 is vtiger generated fields, such as (of vtiger_crmentity table) createdtime
 101          //and modified time fields.
 102          if($webserviceField->getUIType() ==  70 || $webserviceField->getUIType() ==  4){
 103              return false;
 104          }
 105          return true;
 106      }
 107      
 108  	function getIdField($label){
 109          return array('name'=>'id','label'=>$label,'mandatory'=>false,'type'=>'id','editable'=>false,'type'=>
 110                          array('name'=>'autogenerated'),'nullable'=>false,'default'=>"");
 111      }
 112      
 113      /**
 114       * @return Intance of EntityMeta class.
 115       *
 116       */
 117      abstract public function getMeta();
 118      abstract protected  function getMetaInstance();
 119      
 120  }
 121  
 122  ?>


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