123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ProfileList extends Widget
- {
-
- var $profile = null;
-
- var $action = null;
- function __construct($profile, HTMLOutputter $action = null)
- {
- parent::__construct($action);
- $this->profile = $profile;
- $this->action = $action;
- }
- function show()
- {
- $cnt = 0;
- if (Event::handle('StartProfileList', array($this))) {
- $this->startList();
- $cnt = $this->showProfiles();
- $this->endList();
- Event::handle('EndProfileList', array($this));
- }
- return $cnt;
- }
- function startList()
- {
- $this->out->elementStart('ul', 'profile_list xoxo');
- }
- function endList()
- {
- $this->out->elementEnd('ul');
- }
- function showProfiles()
- {
- $cnt = $this->profile->N;
- $profiles = $this->profile->fetchAll();
- $max = min($cnt, $this->maxProfiles());
- for ($i = 0; $i < $max; $i++) {
- $pli = $this->newListItem($profiles[$i]);
- $pli->show();
- }
- return $cnt;
- }
- function newListItem(Profile $target)
- {
- return new ProfileListItem($target, $this->action);
- }
- function maxProfiles()
- {
- return PROFILES_PER_PAGE;
- }
- }
|