Пример #1
0
 protected function action_run()
 {
     $stmt = $this->db->query('select * from query
   where query_id = :query_id', array('query_id' => $_POST['query_id']));
     if ($row = $stmt->fetch()) {
         if (stripos($row['query'], 'file ') === 0) {
             $this->transfer(substr($row['query'], 5), array('dest' => $_POST['dest']));
         } else {
             $stmt2 = $this->db->query($row['query']);
             $r = new Report();
             if ($_POST['dest'] == 'screen') {
                 $r->html($row['title'], $stmt2);
             } else {
                 if ($_POST['dest'] == 'pdf') {
                     $r->pdf($row['title'], $stmt2);
                 } else {
                     if ($_POST['dest'] == 'csv') {
                         $r->csv($stmt2);
                     }
                 }
             }
         }
     } else {
         $this->message('Query not found');
     }
 }
Пример #2
0
 protected function action_report()
 {
     $stmt = $this->db->query('select name,
   count(specialty_id) as count
   from member
   join specialty using (specialty_id)
   group by specialty_id order by name');
     if ($stmt->rowCount() == 0) {
         $this->message('No records found', true);
     } else {
         $r = new Report();
         if ($_POST['dest'] == 'screen') {
             $r->html('Speciaties', $stmt);
         } else {
             if ($_POST['dest'] == 'pdf') {
                 $r->pdf('Speciaties', $stmt);
             }
         }
     }
 }
Пример #3
0
 protected function action_report()
 {
     $hdgs = array('Number', 'Date', 'Start', 'Stop', 'Title');
     $ttl = "{$_POST['year']} Panels";
     $stmt = $this->db->query('select number, date_held,
   time_start, time_stop, title from panelcwa
   where year = :year order by number', array('year' => $_POST['year']));
     if ($stmt->rowCount() == 0) {
         $this->message('No records found', true);
     } else {
         $r = new Report();
         if ($_POST['dest'] == 'screen') {
             $r->html($ttl, $stmt, $hdgs);
         } else {
             if ($_POST['dest'] == 'pdf') {
                 $r->pdf($ttl, $stmt, array(50, 50, 50, 50), $hdgs);
             } else {
                 if ($_POST['dest'] == 'csv') {
                     $r->csv($stmt);
                 }
             }
         }
     }
 }
Пример #4
0
 protected function run($title, $sql)
 {
     echo '<div class=run>';
     $stmt = $this->db->query($sql);
     $r = new Report();
     $r->html($title, $stmt);
     echo '</div>';
 }