Exemple #1
0
 public function view()
 {
     $l = new LogList();
     $pagination = $l->getPagination();
     $pagination->setMaxPerPage(10);
     $entries = $pagination->getCurrentPageResults();
     $this->set('list', $l);
     $this->set('entries', $entries);
     $this->set('total', Logger::getTotalLogged());
     $this->set('pagination', $pagination);
 }
 public function csv()
 {
     if (!Loader::helper('validation/token')->validate('csv')) {
         $this->redirect('/dashboard/system/optimization/query_log');
     } else {
         $l = new LogList();
         $entries = $l->get(0);
         $fileName = "Database Query Log Results";
         header("Content-Type: text/csv");
         header("Cache-control: private");
         header("Pragma: public");
         $date = date('Ymd');
         header("Content-Disposition: attachment; filename=" . $fileName . "_form_data_{$date}.csv");
         $fp = fopen('php://output', 'w');
         // write the columns
         $row = array(t('Times Run'), t('Query'));
         fputcsv($fp, $row);
         foreach ($entries as $ent) {
             fputcsv($fp, array($ent['queryTotal'], $ent['query']));
         }
         fclose($fp);
         die;
     }
 }