Extended profile - finished basic pattern for adding/removing/saving multiple complex fields

This commit is contained in:
Zach Copley
2011-03-14 01:49:46 -07:00
parent deb40602d2
commit 04c8bf2743
4 changed files with 107 additions and 74 deletions

View File

@@ -100,7 +100,7 @@ class ExtendedProfile
function getPhones()
{
$phones = $this->fields['phone'];
$phones = (isset($this->fields['phone'])) ? $this->fields['phone'] : null;
$pArrays = array();
if (empty($phones)) {
@@ -109,22 +109,20 @@ class ExtendedProfile
'index' => 0,
'type' => 'phone',
'vcard' => 'tel',
'multi' => true
'rel' => 'office',
'value' => null
);
} else {
for ($i = 0; $i < sizeof($phones); $i++) {
$pa = array(
'label' => _m('Phone'),
'type' => 'phone',
'index' => intva($phones[$i]->value_index),
'index' => intval($phones[$i]->value_index),
'rel' => $phones[$i]->rel,
'value' => $phones[$i]->field_value,
'vcard' => 'tel'
);
// Last phone record should allow adding more
if ($i == sizeof($phones) - 1) {
$pa['multi'] = true;
}
$pArrays[] = $pa;
}
}