From: Stéphane Jacob Date: Mon, 3 Jan 2011 23:55:18 +0000 (+0100) Subject: Removes useless getters from Phone class. X-Git-Tag: xorg/1.1.0~229 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0b53817f618e590864806947320868e11a355497;p=platal.git Removes useless getters from Phone class. Signed-off-by: Stéphane Jacob --- diff --git a/classes/address.php b/classes/address.php index fa10d6d..d271bb7 100644 --- a/classes/address.php +++ b/classes/address.php @@ -366,7 +366,7 @@ class Address public function addPhone(Phone &$phone) { - if ($phone->linkType() == Phone::LINK_ADDRESS && $phone->pid() == $this->pid) { + if ($phone->link_type == Phone::LINK_ADDRESS && $phone->pid == $this->pid) { $this->phones[$phone->uniqueId()] = $phone; } } @@ -897,7 +897,7 @@ class AddressIterator implements PlIterator // Adds phones to addresses. $it = Phone::iterate(array($data['pid']), array(Phone::LINK_ADDRESS), array($data['id'])); while ($phone = $it->next()) { - $data['phones'][$phone->id()] = $phone->toFormArray(); + $data['phones'][$phone->id] = $phone->toFormArray(); } return new Address($data); } diff --git a/classes/phone.php b/classes/phone.php index 9a9f1b0..8a63d66 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -59,17 +59,17 @@ class Phone /** The following fields, but $error, all correspond to the fields of the * database table profile_phones. */ - private $id = 0; - private $pid = 0; - private $search = ''; - private $link_type = 'user'; - private $link_id = 0; + public $id = 0; + public $pid = 0; + public $search = ''; + public $link_type = 'user'; + public $link_id = 0; // The following fields are the fields of the form in the profile edition. - private $type = 'fixed'; + public $type = 'fixed'; public $display = ''; public $pub = 'ax'; public $comment = ''; - private $error = false; + public $error = false; public function __construct(array $data = array()) { @@ -80,31 +80,6 @@ class Phone } } - public function linkType() - { - return $this->link_type; - } - - public function linkId() - { - return $this->link_id; - } - - public function id() - { - return $this->id; - } - - public function pid() - { - return $this->pid; - } - - public function search() - { - return $this->search; - } - public function setId($id) { $this->id = $id; diff --git a/classes/userfilter/conditions.inc.php b/classes/userfilter/conditions.inc.php index 817fa4d..c7d5bb3 100644 --- a/classes/userfilter/conditions.inc.php +++ b/classes/userfilter/conditions.inc.php @@ -1344,7 +1344,7 @@ class UFC_Phone extends UserFilterCondition { $phone = new Phone(array('display' => $number)); $phone->format(); - $this->number = $phone->search(); + $this->number = $phone->search; $this->num_type = $num_type; $this->phone_type = $phone_type; } diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index a3c26fd..f34e3b8 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -150,7 +150,7 @@ class Company public function setPhone(Phone &$phone) { - if ($phone->linkType() == Phone::LINK_COMPANY && $phone->linkId() == $this->id) { + if ($phone->link_type == Phone::LINK_COMPANY && $phone->link_id == $this->id) { $this->phone = $phone; } } @@ -223,7 +223,7 @@ class Job public function addPhone(Phone &$phone) { - if ($phone->linkType() == Phone::LINK_JOB && $phone->linkId() == $this->id && $phone->pid() == $this->pid) { + if ($phone->link_type == Phone::LINK_JOB && $phone->link_id == $this->id && $phone->pid == $this->pid) { $this->phones[$phone->uniqueId()] = $phone; } } @@ -544,10 +544,10 @@ class ProfileAddresses extends ProfileField $p = $phones->get(Profile::PHONE_LINK_ADDRESS | Profile::PHONE_TYPE_ANY); foreach ($p as $phone) { /* We must iterate on the addresses because id is not uniq thus, - * $this->addresse[$phone->linkId()] is invalid. + * $this->addresse[$phone->link_id] is invalid. */ foreach ($this->addresses as $address) { - if ($address->type == Address::LINK_PROFILE && $address->id == $phone->linkId()) { + if ($address->type == Address::LINK_PROFILE && $address->id == $phone->link_id) { $address->addPhone($phone); } } @@ -634,8 +634,8 @@ class ProfileJobs extends ProfileField { $p = $phones->get(Profile::PHONE_LINK_JOB | Profile::PHONE_TYPE_ANY); foreach ($p as $phone) { - if ($phone->linkType() == Phone::LINK_JOB && array_key_exists($phone->linkId(), $this->jobs)) { - $this->jobs[$phone->linkId()]->addPhone($phone); + if ($phone->link_type == Phone::LINK_JOB && array_key_exists($phone->link_id, $this->jobs)) { + $this->jobs[$phone->link_id]->addPhone($phone); } } } @@ -756,7 +756,7 @@ class CompanyList if (count($newcompanies)) { $it = Phone::iterate(array(), array(Phone::LINK_COMPANY), $newcompanies); while ($phone = $it->next()) { - self::$companies[$phone->linkId()]->setPhone($phone); + self::$companies[$phone->link_id]->setPhone($phone); } } diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 4db685c..6e29640 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -96,10 +96,10 @@ class VCard extends PlVCard $adr->hasFlag('current'), $adr->hasFlag('mail'), $adr->hasFlag('mail')); } foreach ($adr->phones() as $phone) { - if ($phone->linkType() == Phone::TYPE_FIXED) { + if ($phone->link_type == Phone::TYPE_FIXED) { $entry->addTel($group, $phone->display, false, true, true, false, false, $adr->hasFlag('current') && empty($pf->mobile)); - } else if ($phone->linkType() == Phone::TYPE_FAX) { + } else if ($phone->link_type == Phone::TYPE_FAX) { $entry->addTel($group, $phone->display, true, false, false, false, false, false); } } @@ -119,9 +119,9 @@ class VCard extends PlVCard $adr->locality, $adr->administrativeArea, $adr->country); } foreach ($adr->phones() as $phone) { - if ($phone->linkType() == Phone::TYPE_FIXED) { + if ($phone->link_type == Phone::TYPE_FIXED) { $entry->addTel($group, $phone->display); - } else if ($phone->linkType() == Phone::TYPE_FAX) { + } else if ($phone->link_type == Phone::TYPE_FAX) { $entry->addTel($group, $phone->display, true); } } diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index 2898004..8e2b35d 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -92,7 +92,7 @@ class ProfileSettingJob implements ProfileSetting } $it = Phone::iterate(array($page->pid()), array(Phone::LINK_JOB)); while ($phone = $it->next()) { - $jobs[$phone->linkId()]['w_phone'][$phone->id()] = $phone->toFormArray(); + $jobs[$phone->link_id]['w_phone'][$phone->id] = $phone->toFormArray(); } $res = XDB::iterator("SELECT e.jtid, e.full_name, j.jid FROM profile_job_term_enum AS e