Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -35,13 +35,13 @@ class _Purchase extends \IPS\Node\Model
|
||||
* @return \IPS\Helpers\Tree
|
||||
*/
|
||||
public static function tree( \IPS\Http\Url $url, array $where, $ref = 'c', \IPS\nexus\Purchase $root = NULL, $includeRoot = TRUE )
|
||||
{
|
||||
{
|
||||
$where[] = array( 'ps_show=1' );
|
||||
|
||||
return new \IPS\Helpers\Tree\Tree(
|
||||
$url,
|
||||
'Purchases',
|
||||
function() use ( $url, $where, $ref, $root, $includeRoot )
|
||||
function( $limit ) use ( $url, $where, $ref, $root, $includeRoot )
|
||||
{
|
||||
if ( $root )
|
||||
{
|
||||
@@ -60,7 +60,7 @@ class _Purchase extends \IPS\Node\Model
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where ), 'IPS\nexus\Purchase' ) as $purchase )
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where, 'ps_start DESC', $limit ), 'IPS\nexus\Purchase' ) as $purchase )
|
||||
{
|
||||
$rows[ $purchase->id ] = $purchase->treeRow( $url, $ref );
|
||||
}
|
||||
@@ -82,6 +82,16 @@ class _Purchase extends \IPS\Node\Model
|
||||
$rows[ $child->id ] = $child->treeRow( $url, $ref );
|
||||
}
|
||||
return $rows;
|
||||
},
|
||||
NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
function()
|
||||
{
|
||||
$where[] = array( 'ps_parent=0' );
|
||||
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user