refactored history views to use the new Collection object

This commit is contained in:
tmont 2008-10-24 05:39:22 +00:00
parent 59bbfccef9
commit cb39cca4fb
2 changed files with 11 additions and 9 deletions

View File

@ -31,11 +31,11 @@
* @uses WikiRevisionHistoryView * @uses WikiRevisionHistoryView
* *
* @param WikiPageObject $page The wiki page to display * @param WikiPageObject $page The wiki page to display
* @param array $revisions The revisions to display * @param Collection $revisions The revisions to display
* @param string $action The action to take * @param string $action The action to take
* @param int $priority The priority of the view * @param int $priority The priority of the view
*/ */
public function __construct(WikiPageObject $page, array $revisions, $action = null, $priority = 0) { public function __construct(WikiPageObject $page, Collection $revisions, $action = null, $priority = 0) {
parent::__construct($page, $action, $priority); parent::__construct($page, $action, $priority);
$this->addView(new WikiRevisionHistoryView($revisions, 1)); $this->addView(new WikiRevisionHistoryView($revisions, 1));

View File

@ -23,9 +23,7 @@
class WikiRevisionHistoryView extends PanaceaView { class WikiRevisionHistoryView extends PanaceaView {
/** /**
* Array of {@link WikiHistory}s * @var WikiHistoryCollection
*
* @var array
*/ */
protected $revisions; protected $revisions;
@ -35,12 +33,16 @@
* @author Tommy Montgomery * @author Tommy Montgomery
* @since 2008-10-21 * @since 2008-10-21
* *
* @param array $revisions The revisions to display * @param Collection $revisions The revisions to display
* @param int $priority The priority of the view * @param int $priority The priority of the view
*/ */
public function __construct(array $revisions, $priority = 0) { public function __construct(Collection $revisions, $priority = 0) {
parent::__construct($priority); parent::__construct($priority);
if ($revisions->type !== 'WikiHistory') {
throw new InvalidTypeException(1, 'Collection with type "WikiHistory"', $revisions);
}
$this->revisions = $revisions; $this->revisions = $revisions;
} }
@ -66,7 +68,7 @@
foreach ($this->revisions as $revision => $history) { ?> foreach ($this->revisions as $revision => $history) { ?>
<tr> <tr>
<td><?php echo $revision; ?></td> <td><?php echo $history->revision; ?></td>
<td><?php echo $history->created; ?></td> <td><?php echo $history->created; ?></td>
<td>Not implemented yet</td> <td>Not implemented yet</td>
<td><?php echo $history->created_user_id; ?></td> <td><?php echo $history->created_user_id; ?></td>