refactored history views to use the new Collection object
This commit is contained in:
		
							parent
							
								
									59bbfccef9
								
							
						
					
					
						commit
						cb39cca4fb
					
				| @ -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)); | ||||||
|  | |||||||
| @ -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>
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user