function delfield_form($fid) { global $xoopsDB, $all_types; $mediaschema = new MediaSchema(); $field = $mediaschema->getField($fid); if (empty($field)) { return; } $fname = $field['name']; $form = new XoopsThemeForm(_AM_FIELDS_DELETE, 'RemoveForm', 'fields.php'); $form->addElement(new XoopsFormLabel(_AM_FIELDS_LABEL, $field['label'])); $form->addElement(new XoopsFormLabel(_AM_FIELDS_NAME, $fname)); $type = preg_replace('/\\((\\d+)\\)/', '', $field['type']); $form->addElement(new XoopsFormLabel(_AM_FIELDS_TYPE, $all_types[$type])); if (preg_match('/^add/', $fname)) { $res = $xoopsDB->query("SELECT count(mid) FROM " . MAIN . " WHERE {$fname} IS NOT NULL AND {$fname}<>''"); list($count) = $xoopsDB->fetchRow($res); if ($count) { $count = "<div class='confirmMsg'>" . sprintf(_AM_FIELDS_COUNT_NOTICE, $count) . "</div>"; } $form->addElement(new XoopsFormLabel(_AM_FIELDS_COUNT, $count)); } $form->addElement(new XoopsFormHidden('fid', $field['fid'])); $form->addElement(new XoopsFormButton('', 'delfield', _DELETE, 'submit')); $form->display(); }
function getField($name = null) { global $mediaschema; if (empty($mediaschema)) { $mediaschema = new MediaSchema(); } return $mediaschema->getField($name); }