From c2dae24701a22cd2362ebe1a96828cd7945c6b5a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 14:52:26 -0700 Subject: Break profilelist into a recipe Expanded the ProfileList class so it worked more like a recipe. This helps to get rid of a lot of special cases and simplifies the code. It also makes it possible to do things like group block. --- lib/profileminilist.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'lib/profileminilist.php') diff --git a/lib/profileminilist.php b/lib/profileminilist.php index 57496d0e9..f11cae8a5 100644 --- a/lib/profileminilist.php +++ b/lib/profileminilist.php @@ -47,26 +47,15 @@ define('PROFILES_PER_MINILIST', 27); class ProfileMiniList extends ProfileList { - function show() + function newListItem($profile) { - $this->out->elementStart('ul', 'entities users xoxo'); - - $cnt = 0; - - while ($this->profile->fetch()) { - $cnt++; - if($cnt > PROFILES_PER_MINILIST) { - break; - } - $this->showProfile(); - } - - $this->out->elementEnd('ul'); - - return $cnt; + return new ProfileMiniListItem($profile, $this->action); } +} - function showProfile() +class ProfileMiniListItem extends ProfileListItem +{ + function show() { $this->out->elementStart('li', 'vcard'); $this->out->elementStart('a', array('title' => $this->profile->getBestName(), -- cgit v1.2.3-54-g00ecf From ee8dd62038993c184b704df08a3ab1fbcf0c04ac Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 22:07:27 -0700 Subject: try to get the right class for profileminilist --- lib/profilelist.php | 17 +++++++++++++++-- lib/profileminilist.php | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'lib/profileminilist.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index e2faf10af..bd866bed7 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -61,9 +61,24 @@ class ProfileList extends Widget } function show() + { + $this->startList(); + $this->showProfiles(); + $this->endList(); + } + + function startList() { $this->out->elementStart('ul', 'profiles'); + } + function endList() + { + $this->out->elementEnd('ul'); + } + + function showProfiles() + { $cnt = 0; while ($this->profile->fetch()) { @@ -75,8 +90,6 @@ class ProfileList extends Widget $pli->show(); } - $this->out->elementEnd('ul'); - return $cnt; } diff --git a/lib/profileminilist.php b/lib/profileminilist.php index f11cae8a5..0c02e2735 100644 --- a/lib/profileminilist.php +++ b/lib/profileminilist.php @@ -47,6 +47,11 @@ define('PROFILES_PER_MINILIST', 27); class ProfileMiniList extends ProfileList { + function startList() + { + $this->out->elementStart('ul', 'entity users xoxo'); + } + function newListItem($profile) { return new ProfileMiniListItem($profile, $this->action); -- cgit v1.2.3-54-g00ecf From 7097804eeb0c648391544f55e32bd66bc35bcdb1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 22:09:17 -0700 Subject: typo in profileminilist class --- lib/profileminilist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/profileminilist.php') diff --git a/lib/profileminilist.php b/lib/profileminilist.php index 0c02e2735..09bef6f7c 100644 --- a/lib/profileminilist.php +++ b/lib/profileminilist.php @@ -49,7 +49,7 @@ class ProfileMiniList extends ProfileList { function startList() { - $this->out->elementStart('ul', 'entity users xoxo'); + $this->out->elementStart('ul', 'entities users xoxo'); } function newListItem($profile) -- cgit v1.2.3-54-g00ecf