/
VersionList.php
39 lines (35 loc) · 987 Bytes
/
VersionList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace Concrete\Core\Page\Collection\Version;
use Concrete\Core\Legacy\DatabaseItemList;
/**
* An object that holds a list of versions for a particular collection.
*
* \@package Pages
*
* @author Andrew Embler <andrew@concrete5.org>
*
* @category Concrete
*
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
class VersionList extends DatabaseItemList
{
public function __construct($c)
{
$this->c = $c;
$this->setQuery('select cvID from CollectionVersions');
$this->filter('cID', $c->getCollectionID());
$this->sortBy('cvID', 'desc');
}
public function get($itemsToGet = 0, $offset = 0)
{
$r = parent::get($itemsToGet, $offset);
$items = array();
foreach ($r as $row) {
$cv = Version::get($this->c, $row['cvID']);
$items[] = $cv;
}
return $items;
}
}