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;
}
}
// 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);
}
/** 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())
{
}
}
- 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;
{
$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;
}
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;
}
}
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;
}
}
$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);
}
}
{
$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);
}
}
}
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);
}
}
$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);
}
}
$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);
}
}
}
$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