- $this->id = S::i('uid');
- }
- $this->tel = new ProfileTel();
- $this->pub = new ProfilePub();
- $this->link_type = $type;
- $this->link_id = $link_id;
- }
-
- public function value(ProfilePage &$page, $field, $value, &$success)
- {
- $success = true;
- if (is_null($value) || !is_array($value)) {
- $value = array();
- $res = XDB::iterator("SELECT t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment
- FROM profile_phones AS t
- WHERE t.uid = {?} AND t.link_type = {?}
- ORDER BY t.tel_id",
- $this->id, $this->link_type);
- $value = $res->fetchAllAssoc();
- }
- foreach ($value as $key=>&$phone) {
- if (@$phone['removed']) {
- unset($value[$key]);
- } else {
- unset($phone['removed']);
- $phone['pub'] = $this->pub->value($page, 'pub', $phone['pub'], $s);
- $phone['tel'] = $this->tel->value($page, 'tel', $phone['tel'], $s);
- if(!isset($phone['type']) || ($phone['type'] != 'fixed' && $phone['type'] != 'mobile' && $phone['type'] != 'fax')) {
- $phone['type'] = 'fixed';
- $s = false;
- }
- if (!$s) {
- $phone['error'] = true;
- $success = false;
- }
- if (!isset($phone['comment'])) {
- $phone['comment'] = '';
- }