Guest User

Untitled

a guest
Jul 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. class ViewableDataExtensions extends Extension {
  4. function ColumnedPos($cols=3, $startIndex = 1) {
  5. return $this->owner->Pos(0) % $cols + $startIndex;
  6. }
  7.  
  8. function setIterator($iterator) {
  9. $this->iterator = $iterator;
  10. }
  11.  
  12. function Prev() {
  13. $pos = $this->owner->Pos(0);
  14. if ($pos <= 0) return null;
  15.  
  16. return $this->iterator->getOffset(-1);
  17. }
  18.  
  19. function Next() {
  20. $pos = $this->owner->Pos(0);
  21. if ($pos+1 >= $this->owner->TotalItems()) return null;
  22.  
  23. return $this->iterator->getOffset(1);
  24. }
  25.  
  26. /* Some ViewableData subclasses are DataObjects, which need this function when extended. Just return null */
  27. function extraStatics() {
  28. return null;
  29. }
  30. }
Add Comment
Please, Sign In to add comment