Extended profile - fix some issues saving and displaying dates
This commit is contained in:
parent
974d0c48f6
commit
bb087a9650
@ -98,6 +98,15 @@ class ExtendedProfile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDateValue($name) {
|
||||||
|
$key = strtolower($name);
|
||||||
|
if (array_key_exists($key, $this->fields)) {
|
||||||
|
return $this->fields[$key][0]->date;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: getPhones, getIms, and getWebsites pretty much do the same thing,
|
// XXX: getPhones, getIms, and getWebsites pretty much do the same thing,
|
||||||
// so refactor.
|
// so refactor.
|
||||||
function getPhones()
|
function getPhones()
|
||||||
|
@ -493,11 +493,14 @@ class ExtendedProfileWidget extends Form
|
|||||||
$this->out->text($this->ext->getTextValue($name));
|
$this->out->text($this->ext->getTextValue($name));
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
$this->out->element(
|
$value = $this->ext->getDateValue($name);
|
||||||
'div',
|
if (!empty($value)) {
|
||||||
array('class' => 'field date'),
|
$this->out->element(
|
||||||
date('j M Y', strtotime($this->ext->getTextValue($name)))
|
'div',
|
||||||
);
|
array('class' => 'field date'),
|
||||||
|
date('j M Y', strtotime($value))
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'person':
|
case 'person':
|
||||||
$this->out->text($this->ext->getTextValue($name));
|
$this->out->text($this->ext->getTextValue($name));
|
||||||
@ -549,7 +552,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
$out->input(
|
$out->input(
|
||||||
$id,
|
$id,
|
||||||
null,
|
null,
|
||||||
date('j M Y', strtotime($this->ext->getTextValue($name)))
|
date('j M Y', strtotime($this->ext->getDateValue($name)))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'person':
|
case 'person':
|
||||||
|
@ -113,10 +113,14 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
|
|||||||
|
|
||||||
foreach ($dateFieldNames as $name) {
|
foreach ($dateFieldNames as $name) {
|
||||||
$value = $this->trimmed('extprofile-' . $name);
|
$value = $this->trimmed('extprofile-' . $name);
|
||||||
|
$dateVal = $this->parseDate($name, $value);
|
||||||
$this->saveField(
|
$this->saveField(
|
||||||
$user,
|
$user,
|
||||||
$name,
|
$name,
|
||||||
$this->parseDate($name, $value)
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
$dateVal
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user