function getFieldHTML($field, $required) { $html = ''; $pID = $field->value; $class = $required == 1 ? ' required' : ''; $disabled = ''; if ($this->_view === 'register') { // get pType from registration session OR defaultPType $pID = XiptFactory::getPluginHandler()->getRegistrationPType(); $html = '<input type="hidden" id="field' . $field->id . '" name="field' . $field->id . '" value="' . $pID . '" />'; $pName = XiptLibProfiletypes::getProfiletypeName($pID); $html .= $pName; return $html; } // it might be some other user (in case of admin is editing profile) $user = JFactory::getUser(); $userid = $user->id; if (!(int) $pID) { $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); XiptError::assert($pID, XiptText::_("USERID {$pID} DOES_NOT_EXIST"), XiptError::ERROR); } $visiblePT = XiptLibProfiletypes::getProfiletypeArray(array('visible' => 1)); $allowToChangePType = $this->_params->get('allow_user_to_change_ptype_after_reg', 0); $allowToChangePType = $allowToChangePType && array_key_exists($pID, $visiblePT) || XiptHelperUtils::isAdmin($user->id); //if not allowed then show disabled view of ptype if ($allowToChangePType == false) { $pName = XiptLibProfiletypes::getProfileTypeName($pID); $pName = $pName; $html = '<input type="hidden" id="field' . $field->id . '" name="field' . $field->id . '" value="' . $pID . '" />'; return $html . $pName; } $mainframe = JFactory::getApplication(); if ($mainframe->isAdmin() == true || XiptHelperUtils::isAdmin($user->id)) { $filter = array('published' => 1); } else { $filter = array('published' => 1, 'visible' => 1); } // user can change profiletype, add information $pTypes = XiptLibProfiletypes::getProfiletypeArray($filter); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '" ' . $disabled . ' class="hasTip select' . $class . ' inputbox" title="' . $field->name . '::' . htmlentities($field->tips) . '">'; $selectedElement = 0; if (!empty($pTypes)) { foreach ($pTypes as $pType) { $selected = $pType->id == $pID ? ' selected="selected"' : ''; if (!empty($selected)) { $selectedElement++; } $html .= '<option value="' . $pType->id . '"' . $selected . '>' . $pType->name . '</option>'; } } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }