Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F823441
visits_list.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 9, 7:24 PM
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Mar 11, 7:24 PM (1 d, 1 h)
Engine
blob
Format
Raw Data
Handle
585695
Attached To
rINP In-Portal
visits_list.php
View Options
<?php
/**
* @version $Id: visits_list.php 12734 2009-10-20 19:28:11Z alex $
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
class
VisitsList
extends
kDBList
{
/**
* Counts the total number of records base on the query resulted from {@link kDBList::GetSelectSQL()}
*
* The method modifies the query to substitude SELECT part (fields listing) with COUNT(*).
* Special care should be applied when working with lists based on grouped queries, all aggregate function fields
* like SUM(), AVERAGE() etc. should be added to CountedSQL by using {@link kDBList::SetCountedSQL()}
*
* @access public
* @param string
* @return void
*/
function
CountRecs
()
{
$system_sql
=
$this
->
GetSelectSQL
(
true
,
true
);
$sql
=
$this
->
getCountSQL
(
$system_sql
);
if
(
$this
->
GetGroupClause
()
)
{
if
(!
isset
(
$this
->
OriginalParams
[
'types'
])
&&
$this
->
Special
==
'incommerce'
)
{
//$sql = preg_replace('/GROUP BY.*/', '', $sql);
$sql
=
'SELECT COUNT(*) FROM '
.
$this
->
TableName
;
$this
->
NoFilterCount
=
(
int
)
$this
->
Conn
->
GetOne
(
$sql
);
}
else
{
$this
->
NoFilterCount
=
count
(
$this
->
Conn
->
GetCol
(
$sql
)
);
}
}
else
{
$this
->
NoFilterCount
=
(
int
)
$this
->
Conn
->
GetOne
(
$sql
);
}
$all_sql
=
$this
->
GetSelectSQL
(
true
,
false
);
if
(
$system_sql
==
$all_sql
)
{
//no need to query the same again
$this
->
RecordsCount
=
$this
->
NoFilterCount
;
return
;
}
$sql
=
$this
->
getCountSQL
(
$all_sql
);
if
(
$this
->
GetGroupClause
()
)
{
$this
->
RecordsCount
=
count
(
$this
->
Conn
->
GetCol
(
$sql
)
);
}
else
{
$this
->
RecordsCount
=
(
int
)
$this
->
Conn
->
GetOne
(
$sql
);
}
$this
->
Counted
=
true
;
}
}
Event Timeline
Log In to Comment