function mx_fieldsetstr($form, $values, $cansubmit = true, $errors = null, $nofieldset = false, $fielddesc = true) { //if ($form[1]==1) $nofieldset=true; $str = $nofieldset ? '' : '<fieldset>'; $fieldset = 0; //die(print_r($form)); $cols = 0; foreach ($form[5] as $field => $fldinfo) { if (is_array($fldinfo) && $fldinfo[0] >= 0 && $fldinfo[2] != "hidden") { $cols++; } } $mandatory = 0; foreach ($form[5] as $field => $fldinfo) { if (!is_array($fldinfo)) { continue; } if ($fldinfo[0] == -1) { if (!$form[1]) { if ($fieldset) { if ($mandatory) { $str .= '<tr><td class="mandatoryhelp" colspan="' . $cols . '"><sup>*</sup>' . _('Information in <b>bold</b> is mandatory') . '</td></tr>'; $mandatory = 0; } $str .= '</table></fieldset><br/></td></tr>'; $str .= '<tr><td><fieldset>'; } $str .= '<a name="' . $field . '"></a>'; if (!$nofieldset) { $str .= '<legend>' . $fldinfo[1] . '</legend>'; } $fieldset = 1; $str .= '<table class="subform">'; if ($fldinfo[2]) { $str .= '<tr><td colspan=2 class="tabledesc">' . $fldinfo[2] . '</td></tr>'; } } continue; } if ($fldinfo[0] == -2) { $str .= '<tr><td colspan="2">' . mx_showtablestr($fldinfo[1], $fldinfo[2], $fldinfo[3], $fldinfo[4], $fldinfo[5]) . '</td></tr>'; continue; } if ($fldinfo[0] == -3) { //inside buttons $spacer = ''; $str .= '<tr><td class="buttons" colspan="' . $cols . '">'; $spacer = ''; foreach ($fldinfo[1] as $btnname => $btnlabel) { if (!is_array($btnlabel)) { $str .= $spacer . mx_formfield($btnname, $btnlabel, 'button', null, true); } else { $str .= $spacer . $btnlabel[0]; } $spacer = ' '; } //$str.=mx_formfield('submit',$form[4],'submit').' '; //$str.=mx_formfield('clear',$form[6],'reset'); $str .= '</td></tr>'; continue; } if ($fieldset == 0) { $str .= '<table class="subform">'; $fieldset = 1; } if ($fldinfo[2] == 'hidden') { $str .= '<tr><td colspan=2>' . mx_formfield($field, $values[$field] ? $values[$field] : $fldinfo[1], $fldinfo) . '</td></tr>'; continue; } $str .= '<tr class="row_' . $field . '">'; if ($fldinfo[0] >= 3) { $mandatory = 1; } if ($fielddesc) { $str .= '<td class="fieldname' . ($fldinfo[0] >= 3 ? ' mandatory' : '') . ($errors && array_key_exists($field, $errors) ? ' flderror' : '') . '">' . $fldinfo[1] . ($fldinfo[0] >= 3 ? '<sup>*</sup>' : '') . '</td>'; } if (!$fldinfo[0] || !$cansubmit) { $str .= '<td class="data"' . ($fielddesc ? '' : ' colspan=2') . '>' . mx_infofield($field, $values[$field], $fldinfo); $str .= '</td>'; } else { $str .= '<td class="input"' . ($fielddesc ? '' : ' colspan=2') . '>'; if ($errors && array_key_exists($field, $errors)) { $str .= '<div class="formerror"><table><tr><td class="errorarrow">↓</td><td>' . $errors[$field] . '</td></tr></table></div>'; } $str .= mx_formfield($field, $values[$field], $fldinfo); $str .= '</td>'; } $str .= '</tr>'; } if ($mandatory) { $str .= '<tr><td class="mandatoryhelp" colspan="' . $cols . '"><sup>*</sup>' . _('Information in <b>bold</b> is mandatory') . '</td></tr>'; } if ($cansubmit && is_array($form[4]) && false) { // inside buttons (disabled) $spacer = ''; $str .= '<tr><td style="border:red 1px solid;" class="buttons" colspan="' . $cols . '">'; $spacer = ''; foreach ($form[4] as $btnname => $btnlabel) { $str .= $spacer . mx_formfield($btnname, $btnlabel, 'button', null, true); $spacer = ' '; } //$str.=mx_formfield('submit',$form[4],'submit').' '; //$str.=mx_formfield('clear',$form[6],'reset'); $str .= '</td></tr>'; } $str .= '</table>'; $str .= $nofieldset ? '' : '</fieldset>'; return $str; }
function mx_mnacctype($page, $option, $action) { global $mxuser; if (!$mxuser->acctype) { switch ($action) { case 'submit': $acctype = mx_onlynumbers($_POST['acctype']); //if ($acctype>=0 && $acctype<=2) { $mxuser->setoption('acctype', $acctype); //} echo sprintf(_('Your account type is currently defined as: <i>%s Account</i>.'), mx_infofield('acctype', $acctype, $mxuser->fielddesc('acctype'))); mx_showhtmlpage('acctype'); break; default: $buttons = array('submit' => _('Submit'), 'clear' => _('Clear')); __('Your account type is currently <i>undefined</i>.'); $acctypeform = array('acctype', 0, _('Please define your Account Type'), _('<p><b>Fan Accounts</b> will give you access to free material' . ' and allow you to become an official fan and access all past stuff' . ' and new releases from artists you will become fan of.</p>' . '<p><b>Artist Accounts</b> allow you to' . ' upload your productions and maintain the contact with your fan' . ' base, but also to be a fan yourself.' . '</p>'), $buttons, array('help' => array(-1, _('Account Type Selection'), _('Who are you?')), 'acctype' => array(1, _('Type:'), 'acctype', 40), 'a' => array(1, 'submit', 'hidden'))); mx_showform($acctypeform, ''); } return; } echo sprintf(_('Your account type is currently defined as: <i>%s Account</i>.'), mx_infofield('acctype', $mxuser->acctype, $mxuser->fielddesc('acctype'))); mx_showhtmlpage('acctype'); }