public function execute() { $model = new ReportModel(); //store data $link = 'index.php?view=reports&layout=custom_reports'; if ($model->store()) { $msg = TextHelper::_('COBALT_CUSTOM_REPORT_SUCCESSFULLY_ADDED'); $this->getApplication()->redirect($link, $msg); } else { $msg = TextHelper::_('COBALT_PROBLEM_CREATING_CUSTOM_REPORT'); $this->getApplication()->redirect($link, $msg); } }
public function execute() { //gen return info $return = array(); $return['error'] = true; //get model $model = new ReportModel(); if ($model->deleteReport($this->getInput()->get('id'))) { $return['error'] = false; } //return json info echo json_encode($return); }
/** * 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); }
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(); }
public function _display_custom_reports() { //load javascripts $this->document->addScript(JURI::base() . 'src/Cobalt/media/js/custom_reports.js'); //get info from model $reportModel = new ReportModel(); $reports = $reportModel->getCustomReports(); $state = $reportModel->getState(); //list view $custom_reports_list = ViewHelper::getView('reports', 'custom_reports_filter', 'phtml', array('reports' => $reports)); //assign references $this->custom_reports_list = $custom_reports_list; $this->reports = $reports; $this->state = $state; }