phpOpenTracker/phpOpenTracker/API Plugin.php,1.28,1.29 Result.php,1.4,1.5 ResultIterator.php,1.1,1.2
Sebastian Bergmann <[email protected]>
| Newsgroups | gmane.comp.web.phpopentracker.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API
In directory sc8-pr-cvs1:/tmp/cvs-serv27090/phpOpenTracker/API
Modified Files:
Plugin.php Result.php ResultIterator.php
Log Message:
Flush.
Index: Result.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API/Result.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Result.php 24 Nov 2003 20:28:34 -0000 1.4
--- Result.php 16 Dec 2003 13:38:06 -0000 1.5
***************
*** 18,44 ****
protected $result;
protected $parameters;
! protected $supportedFormats = array(
! 'array' => true,
! 'csv' => true,
! 'xml' => true
! );
public function __construct($result, $parameters, $supportedFormats = array()) {
! $this->result = $result;
! $this->parameters = $parameters;
!
! if (!empty($supportedFormats)) {
! $this->supportedFormats = $supportedFormats;
! }
! }
!
! public function __toString() {
! $string = '';
!
! foreach ($this->parameters as $parameter => $value) {
! $string .= $parameter . ': ' . $value . "\n";
! }
!
! return $string;
}
--- 18,27 ----
protected $result;
protected $parameters;
! protected $supportedFormats;
public function __construct($result, $parameters, $supportedFormats = array()) {
! $this->result = $result;
! $this->parameters = $parameters;
! $this->supportedFormats = $supportedFormats;
}
Index: Plugin.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API/Plugin.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** Plugin.php 22 Nov 2003 11:53:55 -0000 1.28
--- Plugin.php 16 Dec 2003 13:38:06 -0000 1.29
***************
*** 19,22 ****
--- 19,27 ----
protected $container;
protected $database;
+ protected $supportedResultFormats = array(
+ 'array' => true,
+ 'csv' => true,
+ 'xml' => true
+ );
public function __construct() {
***************
*** 26,33 ****
}
! protected function getConstraintClause() {
}
! protected function getWhereTimerange() {
}
--- 31,156 ----
}
! protected function getConstraintClause($constraints, $selfJoinPossiblyRequired = false) {
! $constraint = '';
! $selfJoinRequired = false;
!
! foreach ($constraints as $field => $value) {
! switch ($field) {
! case 'document': {
! $constraint .= sprintf(
! " AND accesslog%s.document_id = %d",
!
! ($selfJoinPossiblyRequired) ? '2' : '',
! $value,
! ($selfJoinPossiblyRequired) ? '2' : ''
! );
!
! if ($selfJoinPossiblyRequired) {
! $selfJoinRequired = true;
! }
! }
! break;
!
! case 'entry_document': {
! $constraint .= sprintf(
! " AND accesslog%s.document_id = %d AND accesslog%s.entry_document = 1",
!
! ($selfJoinPossiblyRequired) ? '2' : '',
! $value,
! ($selfJoinPossiblyRequired) ? '2' : ''
! );
!
! if ($selfJoinPossiblyRequired) {
! $selfJoinRequired = true;
! }
! }
! break;
!
! case 'exit_document': {
! $constraint .= sprintf(
! ' AND accesslog%s.document_id = %d AND accesslog%s.exit_target_id <> 0',
!
! ($selfJoinPossiblyRequired) ? '2' : '',
! $value,
! ($selfJoinPossiblyRequired) ? '2' : ''
! );
!
! if ($selfJoinPossiblyRequired) {
! $selfJoinRequired = true;
! }
! }
! break;
!
! case 'exit_target': {
! $constraint .= sprintf(
! ' AND accesslog%s.exit_target_id = %d',
!
! ($selfJoinPossiblyRequired) ? '2' : '',
! $value
! );
!
! if ($selfJoinPossiblyRequired) {
! $selfJoinRequired = true;
! }
! }
! break;
!
! case 'host':
! case 'operating_system':
! case 'referer':
! case 'user_agent': {
! $constraint .= sprintf(
! ' AND visitors.%s_id = %d',
!
! $field,
! $value
! );
! }
! break;
!
! case 'hour':
! case 'weekday': {
! $constraint .= sprintf(
! ' AND accesslog.%s = %d',
!
! $field,
! $value
! );
! }
! break;
! }
! }
!
! if ($selfJoinPossiblyRequired) {
! return array(
! $constraint,
! $selfJoinRequired
! );
! } else {
! return $constraint;
! }
}
! protected function getTimerangeClause($start, $end, $table = 'visitors') {
! $table .= '.';
! $timerange = ' AND ';
!
! if ($start && $end) {
! $timerange .= $table . "timestamp BETWEEN $start AND $end";
! }
!
! elseif ($start && !$end) {
! $timerange .= $table . "timestamp >= $start";
! }
!
! elseif (!$start && $end) {
! $timerange .= $table . "timestamp <= $end";
! }
!
! elseif (!$start && !$end) {
! return '';
! }
!
! return $timerange;
}
Index: ResultIterator.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API/ResultIterator.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ResultIterator.php 22 Nov 2003 08:47:43 -0000 1.1
--- ResultIterator.php 16 Dec 2003 13:38:06 -0000 1.2
***************
*** 23,43 ****
}
! function rewind() {
$this->cursor = 0;
}
! function hasMore() {
return $this->cursor < sizeof($this->result);
}
! function key() {
return $this->cursor;
}
! function current() {
return $this->result[$this->cursor];
}
! function next() {
$this->cursor++;
}
--- 23,43 ----
}
! public function rewind() {
$this->cursor = 0;
}
! public function hasMore() {
return $this->cursor < sizeof($this->result);
}
! public function key() {
return $this->cursor;
}
! public function current() {
return $this->result[$this->cursor];
}
! public function next() {
$this->cursor++;
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/