Beispiel #1
0
 /**
  * Get CSV data
  * @param  [type] $data_type [description]
  * @return [type] [description]
  */
 public function getCsvData($data_type)
 {
     $app = \Cobalt\Container::fetch('app');
     $data = array();
     $export_ids = $app->input->get('ids');
     switch ($data_type) {
         case "deals":
             $model = new Deal();
             $data = $model->getDeals($export_ids);
             break;
         case "companies":
             $model = new Company();
             $data = $model->getCompanies($export_ids);
             break;
         case "people":
             $model = new People();
             $data = $model->getPeople($export_ids);
             break;
         case "sales_pipeline":
             $model = new Deal();
             $data = $model->getReportDeals($export_ids);
             break;
         case "source_report":
             $model = new Deal();
             $data = $model->getDeals($export_ids);
             break;
         case "roi_report":
             $model = new Source();
             $data = $model->getRoiSources($export_ids);
             break;
         case "notes":
             $model = new Note();
             $data = $model->getNotes(NULL, NULL, FALSE);
             break;
         case "custom_report":
             $model = new Report();
             $data = $model->getCustomReportData($app->input->get('report_id'));
             break;
     }
     if (count($data)) {
         $header = array_keys((array) $data[0]);
     }
     return array('header' => $header, 'rows' => $data);
 }
Beispiel #2
0
 public function _display_custom_report_filter()
 {
     //get report
     $reportModel = new ReportModel();
     $this->report = $reportModel->getCustomReports($app->input->get('id'));
     $this->report_data = $reportModel->getCustomReportData($app->input->get('id'));
     $this->state = $reportModel->getState();
 }
Beispiel #3
0
 public function _display_custom_report()
 {
     //get model
     $reportModel = new ReportModel();
     //get report
     $this->report = $reportModel->getCustomReports($this->app->input->get('id'));
     $this->report_data = $reportModel->getCustomReportData($this->app->input->get('id'));
     $state = $reportModel->getState();
     //info for dropdowns
     $deal_amounts = DealHelper::getAmounts();
     $deal_sources = DealHelper::getSources();
     $deal_stages = DealHelper::getSourceStages();
     $deal_statuses = DealHelper::getStatuses();
     $deal_close_dates = DealHelper::getClosing();
     $modified_dates = DealHelper::getModified();
     $custom_report_header = ViewHelper::getView('reports', 'custom_report_header', 'phtml', array('report_data' => $this->report_data, 'report' => $this->report, 'state' => $state));
     $custom_report_list = ViewHelper::getView('reports', 'custom_report_filter', 'phtml', array('report_data' => $this->report_data, 'report' => $this->report, 'state' => $state));
     $custom_report_footer = ViewHelper::getView('reports', 'custom_report_footer', 'phtml');
     $custom_report_header->deal_amounts = $deal_amounts;
     $custom_report_header->deal_sources = $deal_sources;
     $custom_report_header->deal_stages = $deal_stages;
     $custom_report_header->deal_statuses = $deal_statuses;
     $custom_report_header->deal_close_dates = $deal_close_dates;
     $custom_report_header->modified_dates = $modified_dates;
     $custom_report_header->created_dates = DateHelper::getCreatedDates();
     $custom_report_header->team_names = DropdownHelper::getTeamNames();
     $custom_report_header->user_names = DropdownHelper::getUserNames();
     $custom_report_header->state = $state;
     //assign refs to view
     $this->custom_report_header = $custom_report_header;
     $this->custom_report_list = $custom_report_list;
     $this->custom_report_footer = $custom_report_footer;
     $this->state = $state;
 }