$item = $h_oledrion_discounts->create(true); $label_submit = _AM_OLEDRION_ADD; $edit = false; } include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $xoopsTpl->assign('formTitle', $title); $xoopsTpl->assign('action', 'edit'); $xoopsTpl->assign('baseurl', $baseurl); $xoopsTpl->assign('label_submit', $label_submit); $discountForTemplate = $item->toArray(); $discountForTemplate['disc_pediod_checked'] = $item->getVar('disc_date_from') > 0 && $item->getVar('disc_date_to') > 0 ? "checked='checked'" : ''; $disc_date_from = new XoopsFormTextDateSelect(_AM_OLEDRION_DISCOUNT_PERFROM, 'disc_date_from', 15, $item->getVar('disc_date_from')); $discountForTemplate['disc_date_from'] = $disc_date_from->render(); $disc_date_to = new XoopsFormTextDateSelect(_AM_OLEDRION_DISCOUNT_PERTO, 'disc_date_to', 15, $item->getVar('disc_date_to')); $discountForTemplate['disc_date_to'] = $disc_date_to->render(); $reductionType0 = $reductionType1 = $reductionType2 = ''; $checked = "checked='checked'"; switch ($item->getVar('disc_price_type')) { case OLEDRION_DISCOUNT_PRICE_TYPE0: $reductionType0 = $checked; break; case OLEDRION_DISCOUNT_PRICE_TYPE1: $reductionType1 = $checked; break; case OLEDRION_DISCOUNT_PRICE_TYPE2: $reductionType2 = $checked; break; } $discountForTemplate['disc_price_type_checked0'] = $reductionType0; $discountForTemplate['disc_price_type_checked1'] = $reductionType1;
function formulize_buildDateRangeFilter($handle, $search_text) { $elementMetaData = formulize_getElementMetaData($handle, true); // true means this is a handle if ($elementMetaData['ele_type'] == "date") { // split any search_text into start and end values if (strstr($search_text, "//")) { $startEnd = explode("//", $search_text); $startText = isset($startEnd[0]) ? parseUserAndToday(substr(htmlspecialchars_decode($startEnd[0]), 2)) : _formulize_QSdateRange_startText; $endText = isset($startEnd[1]) ? parseUserAndToday(substr(htmlspecialchars_decode($startEnd[1]), 2)) : _formulize_QSdateRange_endText; } else { $startText = ""; $endText = ""; } include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $startDateElement = new XoopsFormTextDateSelect('', 'formulize_daterange_sta_' . $handle, 15, strtotime($startText)); $startDateElement->setExtra("class='formulize_daterange'"); $endDateElement = new XoopsFormTextDateSelect('', 'formulize_daterange_end_' . $handle, 15, strtotime($endText)); $endDateElement->setExtra("class='formulize_daterange' target='{$handle}'"); static $js; if ($js) { // only need to include this code once! $js = ""; } else { $js = "<script type='text/javascript'>\n\t\tif (typeof jQuery == 'undefined') { \n\t\t\t\tvar head = document.getElementsByTagName('head')[0];\n\t\t\t\tscript = document.createElement('script');\n\t\t\t\tscript.id = 'jQuery';\n\t\t\t\tscript.type = 'text/javascript';\n\t\t\t\tscript.src = '" . XOOPS_URL . "/modules/formulize/libraries/jquery/jquery-1.4.2.min.js';\n\t\t\t\thead.appendChild(script);\n\t\t}\n\t\t\$().click(function() {\n\t\t\t\$('.formulize_daterange').change();\t\n\t\t});\n\t\t\$('.formulize_daterange').change(function() {\n\t\t\tvar id = new String(\$(this).attr('id'));\n\t\t\tvar handle = id.substr(24);\n\t\t\tvar start = \$('#formulize_daterange_sta_'+handle).val();\n\t\t\tvar end = \$('#formulize_daterange_end_'+handle).val();\n\t\t\t\$('#formulize_hidden_daterange_'+handle).val('>='+start+'//'+'<='+end);\n\t\t});\n\t\t</script>"; } return $startDateElement->render() . " " . _formulize_QDR_to . " " . $endDateElement->render() . " <input type=button name=qdrGoButton value='" . _formulize_QDR_go . "' onclick=\"javascript:showLoading();\"></input>\n<input type='hidden' id='formulize_hidden_daterange_" . $handle . "' name='search_" . $handle . "' value='" . $search_text . "' ></input>\n{$js}"; } else { return ""; } }