<?php
 class Actions2DB extends ADO { var $className = 'Actions2'; public function __construct( $app, $dburi, $debug=false, $tmode=true, $dformat='') { $this->owner = $app; if ( !empty($dburi)) $this->dburi = $dburi; return parent::__construct( $this->dburi, $debug, $tmode, $dformat); } public function get_records($lines_per_page, $page=0, $id='', $date='', $edate='', $callfrom='') { $ext = ''; $need_and = false; if ( $id != '') { $ext .= "UserName LIKE'%" . $id . "%' "; $need_and = true; } if ( $date != '' && $date != '1970-01-01' && $date != '0001-01-01') { if ( $need_and) $ext .= ' AND '; $ext .= 'Start_Time>=\'' . $date . '\''; $need_and = true; } if ( $edate != '' && $edate != '1970-01-01' && $edate != '0001-01-01') { if ( $need_and) $ext .= ' AND '; $ext .= 'Stop_Time<=\'' . $edate . '\''; $need_and = true; } if ( $callfrom != '') { if ( $need_and) $ext .= ' AND '; $ext .= 'Call_From LIKE \'%' . $callfrom . '%\''; } if ( !$need_and) $ext .= ' (TRUE)'; $res = $this->GetAll("SELECT count(*) FROM sk_actions WHERE ".$ext); $ext .= ' ORDER BY Start_Time DESC'; $limits = false; if ( $page >= 0) { $low = $page*$lines_per_page; $high = $lines_per_page; $limits = true; } $query = SQL_GET_ACT_DATA; if ( $limits) { $ext .= ' OFFSET '.$low.' LIMIT '.$high; } $allRecs = $this->GetAll($query.$ext); return array($res[0], $allRecs); } } ?>
