[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Potentials/dashboards/ -> Forecast.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 Potentials_Forecast_Dashboard extends Vtiger_IndexAjax_View {
  12  
  13      /**

  14       * Function to get the list of Script models to be included

  15       * @param Vtiger_Request $request

  16       * @return <Array> - List of Vtiger_JsScript_Model instances

  17       */
  18  	function getHeaderScripts(Vtiger_Request $request) {
  19  
  20          $jsFileNames = array(
  21              '~/libraries/jquery/jqplot/plugins/jqplot.cursor.min.js',
  22              '~/libraries/jquery/jqplot/plugins/jqplot.dateAxisRenderer.min.js',
  23              '~/libraries/jquery/jqplot/plugins/jqplot.logAxisRenderer.min.js',
  24              '~/libraries/jquery/jqplot/plugins/jqplot.canvasTextRenderer.min.js',
  25              '~/libraries/jquery/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js'
  26          );
  27  
  28          $headerScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
  29          return $headerScriptInstances;
  30      }
  31  
  32  	public function process(Vtiger_Request $request) {
  33          $currentUser = Users_Record_Model::getCurrentUserModel();
  34          $viewer = $this->getViewer($request);
  35          $moduleName = $request->getModule();
  36  
  37          $linkId = $request->get('linkid');
  38          
  39          $expectedclosedate = $request->get('expectedclosedate');
  40          
  41          //Date conversion from user to database format

  42          if(!empty($expectedclosedate)) {
  43              $closingdates['start'] = Vtiger_Date_UIType::getDBInsertedValue($expectedclosedate['start']);
  44              $closingdates['end'] = Vtiger_Date_UIType::getDBInsertedValue($expectedclosedate['end']);
  45          }
  46          
  47          $createdTime = $request->get('createdtime');
  48          
  49          //Date conversion from user to database format

  50          if(!empty($createdTime)) {
  51              $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
  52              $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
  53          }
  54          
  55          $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
  56          $data = $moduleModel->getForecast($closingdates,$dates);
  57  
  58          $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
  59  
  60          //Include special script and css needed for this widget

  61          $viewer->assign('SCRIPTS',$this->getHeaderScripts($request));
  62          
  63          $viewer->assign('WIDGET', $widget);
  64          $viewer->assign('MODULE_NAME', $moduleName);
  65          $viewer->assign('DATA', $data);
  66  
  67          $content = $request->get('content');
  68          if(!empty($content)) {
  69              $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
  70          } else {
  71              $viewer->view('dashboards/Forecast.tpl', $moduleName);
  72          }
  73      }
  74  }


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