Beispiel #1
0
 /**
  * @param ProfileRegstep|XoopsObject $obj
  */
 public function __construct(ProfileRegstep &$obj)
 {
     parent::__construct(_PROFILE_AM_STEP, 'stepform', 'step.php', 'post', true);
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('step_id')));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Text(_PROFILE_AM_STEPNAME, 'step_name', 5, 255, $obj->getVar('step_name', 'e')), true);
     $this->addElement(new Xoops\Form\Text(_PROFILE_AM_STEPINTRO, 'step_desc', 5, 255, $obj->getVar('step_desc', 'e')));
     $order = new Xoops\Form\Text(_PROFILE_AM_STEPORDER, 'step_order', 1, 10, $obj->getVar('step_order', 'e'), '');
     $order->setPattern('^\\d+$', _PROFILE_AM_ERROR_WEIGHT);
     $this->addElement($order, true);
     $this->addElement(new Xoops\Form\RadioYesNo(_PROFILE_AM_STEPSAVE, 'step_save', $obj->getVar('step_save', 'e')));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #2
0
/**
 * Get {@link XoopsThemeForm} for editing a step
 *
 * @param ProfileRegstep|null $step {@link ProfileRegstep} to edit
 * @param bool                $action
 *
 * @return object
 */
function profile_getStepForm(ProfileRegstep $step = null, $action = false)
{
    if ($action === false) {
        $action = $_SERVER['REQUEST_URI'];
    }
    if (empty($GLOBALS['xoopsConfigUser'])) {
        $config_handler = xoops_getHandler('config');
        $GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
    }
    include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
    $form = new XoopsThemeForm(_PROFILE_AM_STEP, 'stepform', 'step.php', 'post', true);
    if (!$step->isNew()) {
        $form->addElement(new XoopsFormHidden('id', $step->getVar('step_id')));
    }
    $form->addElement(new XoopsFormHidden('op', 'save'));
    $form->addElement(new XoopsFormText(_PROFILE_AM_STEPNAME, 'step_name', 25, 255, $step->getVar('step_name', 'e')));
    $form->addElement(new XoopsFormText(_PROFILE_AM_STEPINTRO, 'step_desc', 25, 255, $step->getVar('step_desc', 'e')));
    $form->addElement(new XoopsFormText(_PROFILE_AM_STEPORDER, 'step_order', 10, 10, $step->getVar('step_order', 'e')));
    $form->addElement(new XoopsFormRadioYN(_PROFILE_AM_STEPSAVE, 'step_save', $step->getVar('step_save', 'e')));
    $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    return $form;
}