/** * Retreives the admin interface of this object * * @return string The HTML fragment for this interface */ public function getAdminUI() { // Init values $html = ''; // All sections $profileSections = array(); // Metadata section $profileMetadataItems = array(); // is_visible $title = _("Should this profile be publicly visible?"); $name = "profile_" . $this->getId() . "_is_visible"; $data = InterfaceElements::generateInputCheckbox($name, "", _("Yes"), $this->isVisible(), "profile_is_visible_radio"); $profileMetadataItems[] = InterfaceElements::genSectionItem($data, $title); $profileSections[] = InterfaceElements::genSection($profileMetadataItems, _("Profile preferences")); // Fields section $profileFieldsUI = array(); $template = $this->getTemplate(); // Aggregate the fields UI $profileFields = $this->getFields(); //var_dump($profileFields); foreach ($template->getFields() as $templateField) { //var_dump($templateField); if (!empty($profileFields[$templateField->getId()])) { //We already have a real field instanciated $field = $profileFields[$templateField->getId()]; //var_dump($field); $profileFieldsUI[] = InterfaceElements::genSectionItem($field->getAdminUI()); } else { //show the template admin UI //$profileFieldsUI[] = InterfaceElements::genSectionItem($templateField->getUserUI()); // Init values $tmp_html = ''; $admin_label = $templateField->getAdminLabelContent(); if ($admin_label != null) { $title = $admin_label->__toString(); } else { $title = null; } $tmp_html .= "<fieldset class='admin_container " . get_class($this) . "'>\n"; if (!empty($title)) { $tmp_html .= "<legend>{$title}</legend>\n"; } $futureProfileFieldId = get_guid(); $name = "profile_template_field_{$templateField->getId()}_field_future_id"; $tmp_html .= '<input type="hidden" name="' . $name . '" value="' . $futureProfileFieldId . '">'; $userData['contentTypeFilter'] = $templateField->getContentTypeFilter(); //echo "Profile::getAdminUI: userData";pretty_print_r($userData); $tmp_html .= ProfileField::getNewUI($futureProfileFieldId, $userData); $tmp_html .= "</fieldset>\n"; $profileFieldsUI[] = $tmp_html; } } $profileSections[] = InterfaceElements::genSection($profileFieldsUI, _("Profile fields")); $html .= InterfaceElements::genSection($profileSections, _("Profile"), false, false, get_class($this)); return $html; }