diff options
Diffstat (limited to 'forum/utils/contacts.php')
-rw-r--r-- | forum/utils/contacts.php | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/forum/utils/contacts.php b/forum/utils/contacts.php index 7458108..7c67f92 100644 --- a/forum/utils/contacts.php +++ b/forum/utils/contacts.php @@ -39,27 +39,36 @@ class Contact { public function show() { - echo "<p>\n"; - // echo "\tcid: " . $this->cid . "<br/>\n"; - echo "\tName: " . $this->name . "<br/>\n"; - if($this->co) echo "\tc/o: " . $this->co . "<br/>\n"; - if($this->address) echo "\tAddress: " . $this->address . "<br/>\n"; - if($this->city) echo "\tCity: " . $this->city . "<br/>\n"; - if($this->country) echo "\tCountry: " . $this->country . "<br/>\n"; - if($this->phone) echo "\tPhone: " . $this->phone . "<br/>\n"; - if($this->phone2) echo "\tPhone2: " . $this->phone2 . "<br/>\n"; - if($this->email) echo "\tEmail: <a href=\"mailto:" . $this->email . "\">" . $this->email . "</a><br/>\n"; - if($this->email2) echo "\tEmail2: <a href=\"mailto:" . $this->email2 . "\">" . $this->email2 . "</a><br/>\n"; - if($this->url) echo "\tURL: <a href=\"" . $this->url . "\">" . $this->url . "</a><br/>\n"; - if($this->url2) echo "\tURL2: <a href=\"" . $this->url2 . "\">" . $this->url2 . "</a><br/>\n"; - if($this->notes) echo "\tNotes: <br/>\n" . parse($this->notes) . "<br/>\n"; - echo "\t<a href=\"?mode=addressbook&action=editcontact&cid=" . $this->cid . "\">Edit</a>\n"; - echo "</p>\n"; + $str = ""; + + $str .= "<p>\n"; + // $str .= "\tcid: " . $this->cid . "<br/>\n"; + $str .= "\tName: " . $this->name . "<br/>\n"; + if($this->co) $str .= "\tc/o: " . $this->co . "<br/>\n"; + if($this->address) $str .= "\tAddress: " . $this->address . "<br/>\n"; + if($this->city) $str .= "\tCity: " . $this->city . "<br/>\n"; + if($this->country) $str .= "\tCountry: " . $this->country . "<br/>\n"; + if($this->phone) $str .= "\tPhone: " . $this->phone . "<br/>\n"; + if($this->phone2) $str .= "\tPhone2: " . $this->phone2 . "<br/>\n"; + if($this->email) $str .= "\tEmail: <a href=\"mailto:" . $this->email . "\">" . $this->email . "</a><br/>\n"; + if($this->email2) $str .= "\tEmail2: <a href=\"mailto:" . $this->email2 . "\">" . $this->email2 . "</a><br/>\n"; + if($this->url) $str .= "\tURL: <a href=\"" . $this->url . "\">" . $this->url . "</a><br/>\n"; + if($this->url2) $str .= "\tURL2: <a href=\"" . $this->url2 . "\">" . $this->url2 . "</a><br/>\n"; + if($this->notes) $str .= "\tNotes: <br/>\n" . parse($this->notes) . "<br/>\n"; + $str .= "\t<a href=\"?mode=addressbook&action=editcontact&cid=" . $this->cid . "\">Edit</a>\n"; + $str .= "</p>\n"; + + return $str; } public function showshort() { - echo "<div class=\"contact\"><a href=\"?mode=addressbook&cid=" . $this->cid . "\">" . $this->name . "</a></div>"; + $str = ""; + + $str .= "<div class=\"contact\"><a href=\"?mode=addressbook&cid=" . + $this->cid . "\">" . $this->name . "</a></div>"; + + return $str; } function Contact($cid, $name, $co, $address, $city, $country, $phone, $phone2, $email, $email2, $url, $url2, $essential, $notes) @@ -118,35 +127,44 @@ class ContactGroup { public function show() { - echo " <div class=\"contactgroup\">\n"; - echo " <div class=\"title\">" . $this->name . "</div>\n"; - echo " <div class=\"contacts\">\n"; + $str = ""; + + $str .= " <div class=\"contactgroup\">\n"; + $str .= " <div class=\"title\">" . $this->name . "</div>\n"; + $str .= " <div class=\"contacts\">\n"; foreach($this->contacts as $contact) { - $contact->showshort(); + $str .= $contact->showshort(); } - echo " </div>\n"; - echo " </div>\n"; + $str .= " </div>\n"; + $str .= " </div>\n"; + + return $str; } public function showshort() { global $client_is_mobile_device; + + $str = ""; + $ness = 0; foreach($this->contacts as $contact) { if($contact->essential) $ness += 1; } - echo " <div class=\"contactgroup\">\n"; - echo " <div class=\"title\"><a href=\"?mode=addressbook&gid=" . $this->gid . "\">" . $this->name . "</a>"; + $str .= " <div class=\"contactgroup\">\n"; + $str .= " <div class=\"title\"><a href=\"?mode=addressbook&gid=" . $this->gid . "\">" . $this->name . "</a>"; if(!$client_is_mobile_device) - echo " - ".sizeof($this->contacts)." contacts (". sprintf("%d", sizeof($this->contacts) - $ness)." hidden)"; - echo "</div>\n"; - echo " <div class=\"contacts\">\n"; + $str .= " - ".sizeof($this->contacts)." contacts (". sprintf("%d", sizeof($this->contacts) - $ness)." hidden)"; + $str .= "</div>\n"; + $str .= " <div class=\"contacts\">\n"; foreach($this->contacts as $contact) { - if($contact->essential) $contact->showshort(); + if($contact->essential) $str .= $contact->showshort(); } - echo " </div>\n"; - echo " </div>\n"; + $str .= " </div>\n"; + $str .= " </div>\n"; + + return $str; } function ContactGroup($gid, @@ -164,11 +182,15 @@ class Contacts { public function show() { - echo "<div class=\"contactlist\">\n"; + $str = ""; + + $str .= "<div class=\"contactlist\">\n"; foreach($this->contactgroups as $contactgroup) { - $contactgroup->showshort(); + $str .= $contactgroup->showshort(); } - echo "</div>\n"; + $str .= "</div>\n"; + + return $str; } public function getNextCID() |