public function findByTableId($tableId) { $select = $this->getDbTable()->select(); $select->from('ga_nr_report')->where('table_id = ?', $tableId)->where('id IN (SELECT `report_id` FROM `ga_nr_referrer`)')->order('id DESC'); $resultSet = $this->getDbTable()->fetchAll($select); $entries = array(); foreach ($resultSet as $row) { $entry = new Application_Model_GanalyticsNewreferrerReport(); $entry->setId($row->id)->setAccountName($row->account_name)->setProfileName($row->profile_name)->setTableId($row->table_id)->setMinTraffic($row->min_traffic)->setDownloadPeriod($row->download_period)->setComparePeriod($row->compare_period)->setCreatedDate($row->created_date); $entries[] = $entry; } return $entries; }
public function ajaxnrcreatereportAction() { // disable layout $this->_helper->layout->disableLayout(); // Create report $report = new Application_Model_GanalyticsNewreferrerReport(); $report->setAccountName($this->getRequest()->getParam('account_name')); $report->setProfileName($this->getRequest()->getParam('profile_name')); $report->setTableId($this->getRequest()->getParam('table_id')); $report->setMinTraffic($this->getRequest()->getParam('min_traffic')); $report->setDownloadPeriod($this->getRequest()->getParam('download_period')); $report->setComparePeriod($this->getRequest()->getParam('compare_period')); $reportMapper = new Application_Model_GanalyticsNewreferrerReportMapper(); $report_id = $reportMapper->save($report); $reportMapper->createTempTable('ga_nr_tmp_' . $report_id); // JSON DATA $this->view->jsonData = array('error' => '0', 'report_id' => $report_id); // set json view $this->render('json'); }