+
+ private function saveTel($pid, $telid, array &$phone)
+ {
+ if ($phone['tel'] != '') {
+ XDB::execute("INSERT INTO profile_phones (uid, link_type, link_id, tel_id, tel_type,
+ search_tel, display_tel, pub, comment)
+ VALUES ({?}, {?}, {?}, {?}, {?},
+ {?}, {?}, {?}, {?})",
+ $pid, $this->link_type, $this->link_id, $telid, $phone['type'],
+ format_phone_number($phone['tel']), $phone['tel'], $phone['pub'], $phone['comment']);
+ }
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute("DELETE FROM profile_phones
+ WHERE uid = {?} AND link_type = {?} AND link_id = {?}",
+ $page->pid(), $this->link_type, $this->link_id);
+ $this->saveTels($page->pid(), $field, $value);
+ }
+
+ //Only saves phones without a delete operation
+ public function saveTels($pid, $field, $value)
+ {
+ foreach ($value as $telid=>&$phone) {
+ $this->saveTel($pid, $telid, $phone);
+ }
+ }