function AddEditMarqueeForm($marqueeid, $Action, $FormTitle, $contentvalue, $bgcolorvalue, $widthvalue, $heightvalue, $scrollamountvalue, $hspacevalue, $vspacevalue, $scrolldelayvalue, $directionvalue, $behaviourvalue, $alignvalue, $loopvalue, $stopvalue, $LabelSubmitButton, $sourcevalue = 'fixed')
{
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    global $xoopsModule, $xoopsModuleConfig;
    $sform = new XoopsThemeForm($FormTitle, 'marqueeform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/marquee.php');
    $source = new XoopsFormSelect(_AM_MARQUEE_SOURCE, 'source', $sourcevalue);
    $source->addOption('fixed', _AM_MARQUEE_SOURCE_FIXED);
    $fileslst = myglob(XOOPS_ROOT_PATH . '/modules/marquee/plugins/', 'php');
    foreach ($fileslst as $onefile) {
        $onefile = basename($onefile, '.php');
        $source->addOption($onefile, $onefile);
    }
    $sform->addElement($source);
    $editor = marquee_utils::getWysiwygForm(_AM_MARQUEE_CONTENT, 'content', $contentvalue, 15, 60, 'content_text_hidden');
    if ($editor) {
        $sform->addElement($editor, false);
    }
    if (marquee_getmoduleoption('methodtouse') != 'DHTML') {
        $sform->addElement(new XoopsFormText(_AM_MARQUEE_BGCOLOR, 'bgcolor', 7, 7, $bgcolorvalue), false);
    }
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_WIDTH, 'width', 4, 4, $widthvalue), false);
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_HEIGHT, 'height', 4, 4, $heightvalue), false);
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRAMOUNT, 'scrollamount', 4, 4, $scrollamountvalue), false);
    if (marquee_getmoduleoption('methodtouse') != 'DHTML') {
        $sform->addElement(new XoopsFormText(_AM_MARQUEE_HSPACE, 'hspace', 4, 4, $hspacevalue), false);
        $sform->addElement(new XoopsFormText(_AM_MARQUEE_VSPACE, 'vspace', 4, 4, $vspacevalue), false);
    }
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRDELAY, 'scrolldelay', 6, 6, $scrolldelayvalue), false);
    $direction = new XoopsFormSelect(_AM_MARQUEE_DIRECTION, 'direction', $directionvalue);
    $direction->addOption('0', _AM_MARQUEE_DIRECTION1);
    $direction->addOption('1', _AM_MARQUEE_DIRECTION2);
    $direction->addOption('2', _AM_MARQUEE_DIRECTION3);
    $direction->addOption('3', _AM_MARQUEE_DIRECTION4);
    $sform->addElement($direction, true);
    $behaviour = new XoopsFormSelect(_AM_MARQUEE_BEHAVIOUR, 'behaviour', $behaviourvalue);
    $behaviour->addOption('0', _AM_MARQUEE_BEHAVIOUR1);
    if (marquee_getmoduleoption('methodtouse') != 'DHTML') {
        $behaviour->addOption('1', _AM_MARQUEE_BEHAVIOUR2);
    }
    $behaviour->addOption('2', _AM_MARQUEE_BEHAVIOUR3);
    $sform->addElement($behaviour, true);
    if (marquee_getmoduleoption('methodtouse') != 'DHTML') {
        $align = new XoopsFormSelect(_AM_MARQUEE_ALIGN, 'align', $alignvalue);
        $align->addOption('0', _AM_MARQUEE_ALIGN1);
        $align->addOption('1', _AM_MARQUEE_ALIGN2);
        $align->addOption('2', _AM_MARQUEE_ALIGN3);
        $sform->addElement($align, true);
    }
    $loop = new XoopsFormSelect(_AM_MARQUEE_LOOP, 'loop', $loopvalue);
    $loop->addOption('0', _AM_MARQUEE_INFINITELOOP);
    for ($i = 1; $i <= 100; $i++) {
        $loop->addOption($i, $i);
    }
    if (marquee_getmoduleoption('methodtouse') != 'DHTML') {
        $sform->addElement($loop, true);
        $sform->addElement(new XoopsFormRadioYN(_AM_MARQUEE_STOP, 'stoponmouseover', $stopvalue, _YES, _NO));
    }
    $sform->addElement(new XoopsFormHidden('op', $Action), false);
    if (!empty($marqueeid)) {
        $sform->addElement(new XoopsFormHidden('marqueeid', $marqueeid), false);
    }
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit');
    $button_tray->addElement($submit_btn);
    $cancel_btn = new XoopsFormButton('', 'reset', _AM_MARQUEE_RESETBUTTON, 'reset');
    $button_tray->addElement($cancel_btn);
    $sform->addElement($button_tray);
    $sform->display();
}
Exemple #2
0
/**
 * upgrade the database
 * 
 */
function databaseUpgrade($fromDir)
{
    $version = databaseGetVersion();
    $list = myglob($fromDir . "/*.sql");
    natsort($list);
    foreach ($list as $f) {
        $nextVersion = false;
        if (preg_match("~^(\\d+)~", basename($f, ".sql"), $nn)) {
            if (count($nn) > 1) {
                $nextVersion = $nn[1];
            } else {
                echo "\n  Invalid {$f}";
                continue;
            }
        } else {
            echo "\n  Invalid parsed {$f}";
            continue;
        }
        if ($nextVersion == $version || strnatcmp($version, $nextVersion) > 0) {
            echo "\n- Skipping {$f} [{$nextVersion}]";
            continue;
        }
        echo "\n* Treating {$f} [{$nextVersion}]: ";
        databaseExecuteFile($f, true);
        if ($nextVersion) {
            databaseSetVersion($nextVersion);
        }
    }
}