if ($getNewItem == 0) { $defaultValue = $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'); } $form->addSelectBoxFromSql('inf-' . $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'), $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name'), $gDb, $sql, array('property' => $fieldProperty, 'showContextDependentFirstEntry' => true, 'defaultValue' => $defaultValue)); } else { $arrListValues = $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_value_list'); $defaultValue = $inventory->getValue($field->getValue('inf_name_intern'), 'database'); $form->addSelectBox('inf-' . $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'), $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name'), $arrListValues, $fieldProperty, $defaultValue, true, $helpId, null, $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_icon', 'database')); } } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'RADIO_BUTTON') { $arrListValues = $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_value_list'); $showDummyRadioButton = false; if ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_mandatory') == 0) { $showDummyRadioButton = true; } $form->addRadioButton('inf-' . $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'), $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name'), $arrListValues, $fieldProperty, $inventory->getValue($field->getValue('inf_name_intern'), 'database'), $showDummyRadioButton, $helpId, $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_icon', 'database')); } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'TEXT_BIG') { $form->addMultilineTextInput('inf-' . $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'), $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name'), $inventory->getValue($field->getValue('inf_name_intern')), 3, 4000, $fieldProperty, $helpId, $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_icon', 'database')); } else { $fieldType = 'text'; if ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'DATE') { $fieldType = 'date'; $maxlength = '10'; } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'EMAIL') { // email could not be longer than 254 characters $fieldType = 'email'; $maxlength = '254'; } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'URL') { // maximal browser compatible url length will be 2000 characters $maxlength = '2000'; } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'NUMBER') {
$defaultValue = $gPreferences['default_country']; } elseif ($user->getValue('usr_id') > 0 && strlen($user->getValue($field->getValue('usf_name_intern'))) > 0) { $defaultValue = $user->getValue($field->getValue('usf_name_intern'), 'database'); } } else { $arrListValues = $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_value_list'); $defaultValue = $user->getValue($field->getValue('usf_name_intern'), 'database'); } $form->addSelectBox('usf-' . $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_id'), $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_name'), $arrListValues, array('property' => $fieldProperty, 'defaultValue' => $defaultValue, 'helpTextIdLabel' => $helpId, 'icon' => $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_icon', 'database'))); } elseif ($gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_type') === 'RADIO_BUTTON') { $arrListValues = $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_value_list'); $showDummyRadioButton = false; if ($gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_mandatory') == 0) { $showDummyRadioButton = true; } $form->addRadioButton('usf-' . $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_id'), $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_name'), $arrListValues, array('property' => $fieldProperty, 'defaultValue' => $user->getValue($field->getValue('usf_name_intern'), 'database'), 'showNoValueButton' => $showDummyRadioButton, 'helpTextIdLabel' => $helpId, 'icon' => $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_icon', 'database'))); } elseif ($gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_type') === 'TEXT_BIG') { $form->addMultilineTextInput('usf-' . $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_id'), $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_name'), $user->getValue($field->getValue('usf_name_intern')), 3, array('maxLength' => 4000, 'property' => $fieldProperty, 'helpTextIdLabel' => $helpId, 'icon' => $gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_icon', 'database'))); } else { $fieldType = 'text'; if ($gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_type') === 'DATE') { if ($field->getValue('usf_name_intern') === 'BIRTHDAY') { $fieldType = 'birthday'; } else { $fieldType = 'date'; } $maxlength = '10'; } elseif ($gProfileFields->getProperty($field->getValue('usf_name_intern'), 'usf_type') === 'EMAIL') { // email could not be longer than 254 characters $fieldType = 'email'; $maxlength = '254';