[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Reports/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 Reports_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          $record = $request->get('record');
  33          $reportModel = Reports_Record_Model::getInstanceById($record);
  34          $reportModel->setModule('Reports');
  35          $reportModel->set('advancedFilter', $request->get('advanced_filter'));
  36          
  37          $advFilterSql = $reportModel->getAdvancedFilterSQL();
  38          $query = $reportModel->getReportSQL($advFilterSql, 'PDF');
  39          $countQuery = $reportModel->generateCountQuery($query);
  40  
  41          $count = $reportModel->getReportsCount($countQuery);
  42          $response = new Vtiger_Response();
  43          $response->setResult($count);
  44          $response->emit();
  45      }
  46      
  47  }


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