$calculations->addOptionArray($calcs); $subButton = new xoopsFormButton('', 'submitx', _formulize_DE_CALCSUB, 'submit'); $pickcalc->addElement($columns); $pickcalc->addElement($calculations); $pickcalc->addElement($subButton); //$pickcalc->addElement(new xoopsFormHidden("frid", $frid)); //$pickcalc->addElement(new xoopsFormHidden("fid", $fid)); //$doneTray = new xoopsFormElementTray(_formulize_DE_REQDCALCS, "<br>"); $doneButton = new xoopsFormButton('', 'done', _formulize_DE_CALCGO, 'button'); $doneButton->setExtra("onclick=\"javascript:sendCalcs(this.form);return false;\""); //$nolistdisplay = new xoopsFormCheckbox('', 'nolistdisplay', $_POST['nolistdisplay']); //$nolistdisplay->addOption("1", _formulize_DE_CALC_LISTDISPLAY); //$doneTray->addElement($doneButton); //$doneTray->addElement($nolistdisplay); if (count($returned['rc']) > 0) { $pickcalc->insertBreak("</td></tr></table><table class=outer><tr><th colspan=2>" . _formulize_DE_REQDCALCS . "</th></tr><tr><td class=even colspan=2><center>" . $doneButton->render() . "</center>", ""); // $pickcalc->addElement($doneButton); } foreach ($returned['rc'] as $hidden) { switch ($hidden['column']) { case "creation_uid": $colname = _formulize_DE_CALC_CREATOR; break; case "mod_uid": $colname = _formulize_DE_CALC_MODIFIER; break; case "creation_datetime": $colname = _formulize_DE_CALC_CREATEDATE; break; case "mod_datetime": $colname = _formulize_DE_CALC_MODDATE;
$notButton = new xoopsFormButton('', 'not', "NOT", 'submit'); $addOtherTray->addElement($andButton); $addOtherTray->addElement($orButton); $addOtherTray->addElement($notButton); $addOtherTray->addElement($openBracketButton); $addOtherTray->addElement($closeBracketButton); // add hidden items... foreach ($hidden as $oneHidden) { $advsearch->addElement($oneHidden); unset($oneHidden); } $advsearch->insertBreak("<div style=\"font-weight: normal;\">" . _formulize_DE_AS_DEPRECATED . "</div>", "head"); // advanced search officially deprecated with work on version 3.1 $advsearch->addElement($opterm); $advsearch->addElement($columns); // order change April 4 2007 $advsearch->addElement($addButton); $advsearch->addElement($addOtherTray); if ($items['as_0']) { $removeButton = new xoopsFormButton('', 'remove', _formulize_DE_AS_REMOVE, 'submit'); $doneButton = new xoopsFormButton('', 'done', _formulize_DE_SEARCHGO, 'button'); $doneButton->setExtra("onclick=\"javascript:sendSearch(this.form);return false;\""); $advsearch->insertBreak("</td></tr></table><table class=outer><tr><th colspan=2>" . _formulize_DE_AS_QUERYSOFAR . "</th></tr><tr><td class=even colspan=2><center>" . $doneButton->render() . "</center>", ""); $qstring = writableQuery($items, 1); // 1 flag indicates to not translate special terms $advsearch->insertBreak("<p>{$qstring}" . "<br />" . $removeButton->render() . "</p>", 'head'); } print $advsearch->render(); print "</td><td style=\"width: 5%;\"></td></tr></table>"; print "</center></body>"; print "</HTML>";
function drawPageUI($pageNumber, $pageTitle, $elements, $conditions, $form, $options, $ops) { // insert page here button $form->addElement(new xoopsFormButton('', 'insertpage' . $pageNumber, _AM_FORMULIZE_SCREEN_INSERTPAGE, 'submit')); // pageNumbers start at 0, since that's how the arrays are indexed, they start from zero // but whatever we show users must start at 1 (there is no page 0 as far as they are concerned), so we add one to make the visiblePageNumber $visiblePageNumber = $pageNumber + 1; // page title $pageTitleBox = new xoopsFormText(_AM_FORMULIZE_SCREEN_PAGETITLE . ' ' . $visiblePageNumber, 'pagetitle_' . $pageNumber, 50, 255, $pageTitle); $form->addElement($pageTitleBox, true); // elements $elementSelection = new xoopsFormSelect(_AM_FORMULIZE_SCREEN_A_PAGE . ' ' . $visiblePageNumber . '<br><br><input type=submit name=delete' . $pageNumber . ' value="' . _AM_FORMULIZE_DELETE_THIS_PAGE . '" onclick="javascript:return confirmDeletePage(\'' . $pageNumber . '\');">', 'page' . $pageNumber, $elements, 10, true); $elementSelection->addOptionArray($options); $form->addElement($elementSelection); // page conditions -- september 6 2007 if (!isset($conditions['pagecons'])) { $conditionsYesNo = 'none'; } else { $conditionsYesNo = $conditions['pagecons']; } $conditionsTray = new xoopsFormElementTray(_AM_FORMULIZE_SCREEN_CONS_PAGE . ' ' . $visiblePageNumber, '<br />'); $conditionsTray->setDescription(_AM_FORMULIZE_SCREEN_CONS_HELP); $nocons = new xoopsFormRadio('', 'pagecons' . $pageNumber, $conditionsYesNo); $nocons->addOption('none', _AM_FORMULIZE_SCREEN_CONS_NONE); $conditionlist = ""; foreach ($conditions['details']['elements'] as $conIndex => $elementValue) { $form->addElement(new xoopsFormHidden('pageelements' . $pageNumber . '[]', $elementValue)); $form->addElement(new xoopsFormHidden('pageops' . $pageNumber . '[]', $conditions['details']['ops'][$conIndex])); $form->addElement(new xoopsFormHidden('pageterms' . $pageNumber . '[]', $conditions['details']['terms'][$conIndex])); $conditionlist .= $options[$conditions['details']['elements'][$conIndex]] . " " . $conditions['details']['ops'][$conIndex] . " " . $conditions['details']['terms'][$conIndex] . "<br />"; } // setup the operator boxes... $opterm = new xoopsFormElementTray('', " "); $element = new xoopsFormSelect('', 'pageelements' . $pageNumber . '[]'); $element->setExtra("onfocus=\"javascript:window.document.editscreenform.pagecons" . $pageNumber . "[1].checked=true\""); $element->addOptionArray($options); $op = new xoopsFormSelect('', 'pageops' . $pageNumber . '[]'); $op->addOptionArray($ops); $op->setExtra("onfocus=\"javascript:window.document.editscreenform.pagecons" . $pageNumber . "[1].checked=true\""); $term = new xoopsFormText('', 'pageterms' . $pageNumber . '[]', 10, 255); $term->setExtra("onfocus=\"javascript:window.document.editscreenform.pagecons" . $pageNumber . "[1].checked=true\""); $opterm->addElement($element); $opterm->addElement($op); $opterm->addElement($term); $addcon = new xoopsFormButton('', 'addcon', _AM_FORMULIZE_SCREEN_CONS_ADDCON, 'submit'); $addcon->setExtra("onfocus=\"javascript:window.document.editscreenform.pagecons" . $pageNumber . "[1].checked=true\""); $conditionui = "<br />{$conditionlist}<nobr>" . $opterm->render() . "</nobr><br />" . $addcon->render(); $yescons = new xoopsFormRadio('', 'pagecons' . $pageNumber, $conditionsYesNo); $yescons->addOption('yes', _AM_FORMULIZE_SCREEN_CONS_YES . $conditionui); $conditionsTray->addElement($nocons); $conditionsTray->addElement($yescons); $form->addElement($conditionsTray); return $form; }
$ops['>'] = ">"; $ops['<'] = "<"; $ops['>='] = ">="; $ops['<='] = "<="; $ops['LIKE'] = "LIKE"; $ops['NOT LIKE'] = "NOT LIKE"; $op->addOptionArray($ops); $op->setExtra("onfocus=\"javascript:window.document.setnot.setfor[1].checked=true\""); $term = new xoopsFormText('', 'new_term', 10, 255); $term->setExtra("onfocus=\"javascript:window.document.setnot.setfor[1].checked=true\""); $opterm->addElement($element); $opterm->addElement($op); $opterm->addElement($term); $addcon = new xoopsFormButton('', 'addcon', _formulize_DE_SETNOT_ADDCON, 'submit'); $addcon->setExtra("onfocus=\"javascript:window.document.setnot.setfor[1].checked=true\""); $conditionui = "<br />{$conditionlist}" . $opterm->render() . "<br />" . $addcon->render(); $setfor_con = new xoopsFormRadio('', 'setfor', $_POST['setfor']); $setfor_con->addOption('con', _formulize_DE_SETNOT_FOR_CON . $conditionui); $setfor->addElement($setfor_all); $setfor->addElement($setfor_con); $setnot->addElement($setfor); if ($canSetNots) { $setnot_cust_template = new xoopsFormText(_formulize_DE_SETNOT_TEMP, 'template', 50, 255, $_POST['template']); $setnot_cust_template->setDescription(_formulize_DE_SETNOT_TEMP_DESC); $setnot->addElement($setnot_cust_template); $setnot->addElement(new xoopsFormText(_formulize_DE_SETNOT_SUBJ, 'subject', 50, 255, $_POST['subject'])); } $setnot->addElement(new xoopsFormButton('', 'save', _formulize_DE_SETNOT_SAVE, 'submit')); print $setnot->render(); // if there are notifications to show if (!$noNots) {
function formulize_createFilterUI($filterSettings, $filterName, $formWithSourceElements, $formName, $defaultTypeIfNoFilterTypeGiven = "all", $groups = false, $filterAllText = _formulize_GENERIC_FILTER_ALL, $filterConText = _formulize_GENERIC_FILTER_CON, $filterButtonText = _formulize_GENERIC_FILTER_ADDBUTTON) { if (!$filterName or !$formWithSourceElements or !$formName) { return false; } // set all the elements that we want to show the user $cols = ""; if ($groups) { $cols = getAllColList($formWithSourceElements, "", $groups); } else { $cols = getAllColList($formWithSourceElements); } $options = array('creation_uid' => _formulize_DE_CALC_CREATOR, 'creation_datetime' => _formulize_DE_CALC_CREATEDATE, 'mod_uid' => _formulize_DE_CALC_MODIFIER, 'mod_datetime' => _formulize_DE_CALC_MODDATE); if (is_array($cols)) { // setup the options array for form elements foreach ($cols as $f => $vs) { foreach ($vs as $row => $values) { if ($values['ele_colhead'] != "") { $options[$values['ele_handle']] = printSmart(trans($values['ele_colhead']), 40); } else { $options[$values['ele_handle']] = printSmart(trans(strip_tags($values['ele_caption'])), 40); } } } } // process existing conditions...setup needed variables $oldElementsName = $filterName . "_elements"; $oldOpsName = $filterName . "_ops"; $oldTermsName = $filterName . "_terms"; $oldTypesName = $filterName . "_types"; // unpack existing conditions if (is_array($filterSettings)) { ${$oldElementsName} = $filterSettings[0]; ${$oldOpsName} = $filterSettings[1]; ${$oldTermsName} = $filterSettings[2]; if (isset($filterSettings[3])) { ${$oldTypesName} = $filterSettings[3]; } else { if (is_array($filterSettings[0])) { foreach ($filterSettings[0] as $i => $thisFilterSettingsZero) { ${$oldTypesName}[$i] = $defaultTypeIfNoFilterTypeGiven; } } } } // setup needed variables for the all or oom ui // > match all of these $conditionlist = ""; $newElementName = "new_" . $filterName . "_element"; $newOpName = "new_" . $filterName . "_op"; $newTermName = "new_" . $filterName . "_term"; // > match one or more of these $conditionlistOOM = ""; $newElementNameOOM = "new_" . $filterName . "_oom_element"; $newOpNameOOM = "new_" . $filterName . "_oom_op"; $newTermNameOOM = "new_" . $filterName . "_oom_term"; // make hidden elements for all the old conditions we found if (is_array(${$oldElementsName})) { $i = 0; foreach (${$oldElementsName} as $x => $thisOldElementsName) { // need to add [$i] to the generation of the hidden values here, so the hidden condition keys equal the flag on the deletion X // $x will be the order based on the filter settings that were passed in, might not start at 0. $i will always start at 0, so this way we'll catch/correct any malformed arrays as people edit/save them $thisHiddenElement = new xoopsFormHidden($oldElementsName . "[{$i}]", strip_tags(htmlspecialchars(${$oldElementsName}[$x]))); ${$oldOpsName}[$x] = formulize_conditionsCleanOps(${$oldOpsName}[$x]); $thisHiddenOp = new xoopsFormHidden($oldOpsName . "[{$i}]", ${$oldOpsName}[$x]); $thisHiddenTerm = new xoopsFormHidden($oldTermsName . "[{$i}]", strip_tags(htmlspecialchars(${$oldTermsName}[$x]))); $thisHiddenType = new xoopsFormHidden($oldTypesName . "[{$i}]", strip_tags(htmlspecialchars(${$oldTypesName}[$x]))); if (${$oldTypesName}[$x] == "all") { $conditionlist .= $options[${$oldElementsName}[$x]] . " " . ${$oldOpsName}[$x] . " " . ${$oldTermsName}[$x] . " <a class='conditionsdelete' title='Delete' target='" . $filterName . "_" . $i . "' href=''>X</a>\n" . $thisHiddenElement->render() . "\n" . $thisHiddenOp->render() . "\n" . $thisHiddenTerm->render() . "\n" . $thisHiddenType->render() . "\n<br />\n"; } else { $conditionlistOOM .= $options[${$oldElementsName}[$x]] . " " . ${$oldOpsName}[$x] . " " . ${$oldTermsName}[$x] . " <a class='conditionsdelete' title='Delete' target='" . $filterName . "_" . $i . "' href=''>X</a>\n" . $thisHiddenElement->render() . "\n" . $thisHiddenOp->render() . "\n" . $thisHiddenTerm->render() . "\n" . $thisHiddenType->render() . "\n<br />\n"; } $i++; } } // setup the new element, operator, term boxes // > match all of these $conditionui = "<i>" . _formulize_GENERIC_FILTER_MATCH_ALL . "</i>"; $conditionui .= formulize_createFilterUIMatch($newElementName, $formName, $filterName, $options, $newOpName, $newTermName, $conditionlist); // > match one or more of these $conditionui .= "<br /><i>" . _formulize_GENERIC_FILTER_MATCH_ONEORMORE . "</i>"; $conditionui .= formulize_createFilterUIMatch($newElementNameOOM, $formName, $filterName, $options, $newOpNameOOM, $newTermNameOOM, $conditionlistOOM); $conditionui .= "<br />"; // build add another condition button $addcon = new xoopsFormButton('', 'addcon', $filterButtonText, 'button'); return $conditionui . $addcon->render(); }