function printFrontend() { global $pageTitle; global $tpl; global $am; global $redirectPageAfterSave; $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addJSValMessages(); $tpl->addJavaScript("js/prototype.js"); $tpl->addOnLoadEvent("Form.focusFirstElement('mainform')"); $tpl->addJavaScript("js/account.js"); $widgets->addNavigationHead(); if (isset($_GET['ID'])) { $pageTitle = getBadgerTranslation2('accountAccount', 'pageTitleProp'); } else { $pageTitle = getBadgerTranslation2('accountAccount', 'pageTitlePropNew'); } echo $tpl->getHeader($pageTitle); echo $widgets->addToolTipLayer(); if (isset($_GET['ID'])) { //edit: load values for this ID $ID = getGPC($_GET, 'ID', 'integer'); $account = $am->getAccountById($ID); $titleValue = $account->getTitle(); $descriptionValue = $account->getDescription(); $lowerLimitValue = is_null($tmp = $account->getLowerLimit()) ? '' : $tmp->getFormatted(); $upperLimitValue = is_null($tmp = $account->getUpperLimit()) ? '' : $tmp->getFormatted(); $balanceValue = is_null($tmp = $account->getBalance()) ? '' : $tmp->getFormatted(); $currencyValue = $account->getCurrency()->getId(); $deleteOldPlannedTransactionsValue = $account->getDeleteOldPlannedTransactions() == false ? 'checked="checked"' : ''; $csvParserValue = $account->getCsvParser(); } else { //new: empty values $ID = "new"; $account = ""; $titleValue = ""; $descriptionValue = ""; $lowerLimitValue = ""; $upperLimitValue = ""; $balanceValue = ""; $currencyValue = ""; $deleteOldPlannedTransactionsValue = 'checked="checked"'; $csvParserValue = ''; } //set vars with values $FormAction = $_SERVER['PHP_SELF']; $legend = getBadgerTranslation2('accountAccount', 'legend'); $hiddenID = $widgets->createField("hiddenID", 20, $ID, "", false, "hidden"); $pageHeading = $pageTitle; //Fields & Labels $titleLabel = $widgets->createLabel("title", getBadgerTranslation2('accountAccount', 'title'), true); $titleField = $widgets->createField("title", 30, $titleValue, "", true, "text", "style='width: 30ex;'"); $descriptionLabel = $widgets->createLabel("description", getBadgerTranslation2('accountAccount', 'description'), false); $descriptionField = $widgets->createTextarea("description", $descriptionValue, "", false, "style='width: 30ex; height: 5em;'"); $lowerLimitLabel = $widgets->createLabel("lowerLimit", getBadgerTranslation2('accountAccount', 'lowerLimit'), false); $lowerLimitField = $widgets->createField("lowerLimit", 30, $lowerLimitValue, "", false, "text", "style='width: 30ex;' regexp='BADGER_NUMBER'"); $upperLimitLabel = $widgets->createLabel("upperLimit", getBadgerTranslation2('accountAccount', 'upperLimit'), false); $upperLimitField = $widgets->createField("upperLimit", 30, $upperLimitValue, "", true, "text", "style='width: 30ex;' regexp='BADGER_NUMBER'"); $currencyLabel = $widgets->createLabel("currency", getBadgerTranslation2('accountAccount', 'currency'), true); $currencies = getCurrencyArray('symbol'); $currencyField = $widgets->createSelectField("currency", $currencies, $default = $currencyValue, "", false, "style='width: 31ex;'"); $deleteOldPlannedTransactionsLabel = $widgets->createLabel('deleteOldPlannedTransactions', getBadgerTranslation2('accountAccount', 'deleteOldPlannedTransactions'), false); $deleteOldPlannedTransactionsField = $widgets->createField('deleteOldPlannedTransactions', 30, 'on', getBadgerTranslation2('accountAccount', 'deleteOldPlannedTransactionsDescription'), false, 'checkbox', $deleteOldPlannedTransactionsValue); $csvParserLabel = $widgets->createLabel('csvParser', getBadgerTranslation2('accountAccount', 'csvParser'), false); $csvParsers = getParsers(); $csvParsers = array_merge(array('NULL' => getBadgerTranslation2('accountAccount', 'csvNoParser')), $csvParsers); $csvParserField = $widgets->createSelectField('csvParser', $csvParsers, $csvParserValue, '', false, "style='width: 31ex;'"); //Buttons $submitBtn = $widgets->createButton("submitBtn", getBadgerTranslation2('dataGrid', 'save'), "submit", "Widgets/accept.gif", "accesskey='s'"); $backBtn = $widgets->createButton("backBtn", getBadgerTranslation2('dataGrid', 'back'), "location.href='{$redirectPageAfterSave}';return false;", "Widgets/back.gif"); //add vars to template, print site eval("echo \"" . $tpl->getTemplate("Account/Account") . "\";"); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); }
function printFrontend() { global $pageTitle; global $tpl; global $am; global $redirectPageAfterSave; $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addJSValMessages(); $widgets->addNavigationHead(); if (isset($_GET['ID'])) { $pageTitle = getBadgerTranslation2('accountAccount', 'pageTitleProp'); } else { $pageTitle = getBadgerTranslation2('accountAccount', 'pageTitlePropNew'); } echo $tpl->getHeader($pageTitle); echo $widgets->addToolTipLayer(); if (isset($_GET['ID'])) { //edit: load values for this ID $ID = $_GET['ID']; $account = $am->getAccountById($ID); $titleValue = $account->getTitle(); $descriptionValue = $account->getDescription(); $lowerLimitValue = is_null($tmp = $account->getLowerLimit()) ? '' : $tmp->getFormatted(); $upperLimitValue = is_null($tmp = $account->getUpperLimit()) ? '' : $tmp->getFormatted(); $balanceValue = is_null($tmp = $account->getBalance()) ? '' : $tmp->getFormatted(); $currencyValue = $account->getCurrency()->getId(); $targetFutureCalcDateValue = is_null($account->getTargetFutureCalcDate()) ? '' : $tmp->getFormatted(); } else { //new: empty values $ID = "new"; $account = ""; $titleValue = ""; $descriptionValue = ""; $lowerLimitValue = ""; $upperLimitValue = ""; $balanceValue = ""; $currencyValue = ""; $targetFutureCalcDateValue = ""; } //set vars with values $FormAction = $_SERVER['PHP_SELF']; $legend = getBadgerTranslation2('accountAccount', 'legend'); $hiddenID = $widgets->createField("hiddenID", 20, $ID, "", false, "hidden"); $pageHeading = $pageTitle; //Fields & Labels $titleLabel = $widgets->createLabel("title", getBadgerTranslation2('accountAccount', 'title'), true); $titleField = $widgets->createField("title", 30, $titleValue, "", true, "text", ""); $descriptionLabel = $widgets->createLabel("description", getBadgerTranslation2('accountAccount', 'description'), false); $descriptionField = $widgets->createField("description", 30, $descriptionValue, "", false, "text", ""); $lowerLimitLabel = $widgets->createLabel("lowerLimit", getBadgerTranslation2('accountAccount', 'lowerLimit'), false); $lowerLimitField = $widgets->createField("lowerLimit", 30, $lowerLimitValue, "", false, "text", "class='inputNumber'"); $upperLimitLabel = $widgets->createLabel("upperLimit", getBadgerTranslation2('accountAccount', 'upperLimit'), false); $upperLimitField = $widgets->createField("upperLimit", 30, $upperLimitValue, "", false, "text", "class='inputNumber'"); $currencyLabel = $widgets->createLabel("currency", getBadgerTranslation2('accountAccount', 'currency'), true); $currencies = getCurrencyArray('symbol'); $currencyField = $widgets->createSelectField("currency", $currencies, $default = $currencyValue, "", false, "style='width: 213px;'"); //Buttons $submitBtn = $widgets->createButton("submitBtn", getBadgerTranslation2('dataGrid', 'save'), "submit", "Widgets/accept.gif", "accesskey='s'"); $backBtn = $widgets->createButton("backBtn", getBadgerTranslation2('dataGrid', 'back'), "location.href='{$redirectPageAfterSave}';return false;", "Widgets/back.gif"); //add vars to template, print site eval("echo \"" . $tpl->getTemplate("Account/Account") . "\";"); }