[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Campaigns/actions/ -> DetailAjax.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  class Campaigns_DetailAjax_Action extends Vtiger_BasicAjax_Action {
  12  
  13  	public function __construct() {
  14          parent::__construct();
  15          $this->exposeMethod('getRecordsCount');
  16      }
  17  
  18  	public function process(Vtiger_Request $request) {
  19          $mode = $request->get('mode');
  20          if(!empty($mode)) {
  21              $this->invokeExposedMethod($mode, $request);
  22              return;
  23          }
  24      }
  25  
  26      /**
  27       * Function to get related Records count from this relation
  28       * @param <Vtiger_Request> $request
  29       * @return <Number> Number of record from this relation
  30       */
  31  	public function getRecordsCount(Vtiger_Request $request) {
  32          $moduleName = $request->getModule();
  33          $relatedModuleName = $request->get('relatedModule');
  34          $parentId = $request->get('record');
  35          $label = $request->get('tab_label');
  36  
  37          $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
  38          $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
  39          $count =  $relationListView->getRelatedEntriesCount();
  40          $result = array();
  41          $result['module'] = $moduleName;
  42          $result['viewname'] = $cvId;
  43          $result['count'] = $count;
  44  
  45          $response = new Vtiger_Response();
  46          $response->setEmitType(Vtiger_Response::$EMIT_JSON);
  47          $response->setResult($result);
  48          $response->emit();
  49      }
  50  }


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