public static function getNavigation($callerBadgerRoot) { global $badgerDb; NavigationFromDB::$callerBadgerRoot = $callerBadgerRoot; $settings = new UserSettings($badgerDb); $itemTypes = array('i' => 'item', 'm' => 'menu', 's' => 'separator'); $sql = 'SELECT navi_id, parent_id, menu_order, item_type, item_name, tooltip, icon_url, command FROM navi ORDER BY parent_id, menu_order'; $res =& $badgerDb->query($sql); $menus = array(); $row = array(); while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { $menuId = $row['parent_id']; //create containing menu if it does not exist if (!isset($menus[$menuId])) { $menus[$menuId] = array(); } //fill most of the fields $menus[$menuId][] = array('type' => $itemTypes[$row['item_type']], 'name' => getBadgerTranslation2("Navigation", $row['item_name']), 'tooltip' => $row['tooltip'], 'icon' => BADGER_ROOT . "/tpl/" . $settings->getProperty("badgerTemplate") . "/Navigation/" . $row['icon_url'], 'command' => NavigationFromDB::replaceBadgerRoot($row['command'])); //if current row is a menu if ($row['item_type'] == 'm') { //create sub-menu if it does not exist if (!isset($menus[$row['navi_id']])) { $menus[$row['navi_id']] = array(); } //add menu field to the previously created item and assign a reference to the proper //sub-menu to it $menus[$menuId][count($menus[$menuId]) - 1]['menu'] =& $menus[$row['navi_id']]; } } //All sub-menus are within element 0 as references return $menus[0]; }
/** * function called upon by global exception handler * * @param object $e exception thrown * @return void */ function handleBadgerException($e) { /** * Object containing global logging information * * @var object */ global $logger; echo "<b>"; echo getBadgerTranslation2('badgerException', 'Error'); echo "</b><br />"; echo getBadgerTranslation2($e->getBadgerErrorPage(), $e->getBadgerErrorId()); /** * Compiled error message * * @var string */ $loggedError = "ERROR: - ERROR Module: " . $e->getBadgerErrorPage() . ", ERROR Code: " . $e->getBadgerErrorId() . ", Error Description: " . getBadgerTranslation2($e->getBadgerErrorPage(), $e->getBadgerErrorId(), 'en') . " ON LINE " . $e->getLine() . " IN FILE " . $e->getFile() . " ADDITIONAL INFO " . $e->getAdditionalInfo(); // compile error message to be logged $logger->log($loggedError); //write to log file }
$dataGrid->initialSort = "valutaDate"; $dataGrid->initialSortDirection = "asc"; $dataGrid->height = "350px"; $dataGrid->headerSize = array(120, 210, 39, 80, 120, 200); $dataGrid->cellAlign = array("left", "left", "center", "right", "right", "left"); $dataGrid->deleteRefreshType = "refreshDataGrid"; $dataGrid->deleteAction = "Transaction.php?action=delete&accountID={$accountID}&ID="; $dataGrid->editAction = "Transaction.php?action=edit&accountID={$accountID}&ID="; $dataGrid->newAction = "Transaction.php?action=new&accountID={$accountID}"; $dataGrid->initDataGridJS(); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo "<h1>{$pageTitle}</h1>"; echo $widgets->createButton("btnNewFinished", getBadgerTranslation2('accountTransaction', 'newFinishedTrans'), "dgNew('type=finished')", "Account/finished_transaction_new.gif"); echo ' '; echo $widgets->createButton("btnNewPlanned", getBadgerTranslation2('accountTransaction', 'newPlannedTrans'), "dgNew('type=planned')", "Account/planned_transaction_new.gif"); echo ' '; echo $widgets->createButton("btnEdit", getBadgerTranslation2('dataGrid', 'edit'), "dgEdit()", "Widgets/table_edit.gif"); echo ' '; echo $widgets->createButton("btnDelete", getBadgerTranslation2('dataGrid', 'delete'), "dgDelete()", "Widgets/table_delete.gif"); echo ' '; echo $widgets->createButton("btnShowPlannedTransactions", getBadgerTranslation2('accountOverview', 'showPlannedTrans'), "location.href = location.href.replace(/AccountOverview\\.php/, 'AccountOverviewPlanned.php');", "Account/planned_transaction.png"); echo $dataGrid->writeDataGrid(); $legend = getBadgerTranslation2('dataGrid', 'legend'); $finishedTransactionText = getBadgerTranslation2('Account', 'finishedTransaction'); $finishedTransactionImage = $widgets->addImage('Account/finished_transaction.png', 'title="' . $finishedTransactionText . '"'); $plannedTransactionText = getBadgerTranslation2('Account', 'plannedTransaction'); $plannedTransactionImage = $widgets->addImage('Account/planned_transaction.png', 'title="' . $plannedTransactionText . '"'); eval('echo "' . $tpl->getTemplate('Account/AccountOverview') . '";'); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php";
$total->add($other); foreach ($amounts as $currentAmount) { $total->add($currentAmount); } foreach ($amounts as $currentId => $currentAmount) { $percentage = new Amount($currentAmount); $percentage->div($total); if ($percentage->compare(MIN_PERCENTAGE) < 0) { $other->add($currentAmount); unset($amounts[$currentId]); unset($labels[$currentId]); } } if ($other->compare(0) != 0) { $amounts['other'] = $other; $labels['other'] = getBadgerTranslation2('statistics2', 'miscCategories'); } $data = array(); $dataNames = array(); foreach ($amounts as $currentAmount) { $data[] = $currentAmount->mul($type == 'i' ? 1 : -1)->get(); $dataNames[] = $currentAmount->getFormatted(); } $legends = array(); foreach ($labels as $currentKey => $currentLabel) { $legends[] = $currentLabel . ' - ' . $amounts[$currentKey]->getFormatted(); } $targets = array(); foreach ($labels as $currentId => $currentLabel) { if ($currentId != 'none' && $currentId != 'other') { $targets[] = 'javascript:reachThroughCategory(\'' . substr($currentId, 1) . '\');';
} } } } $submitTitle = getBadgerTranslation2('importCsv', 'submitTitle'); echo "<h1>{$submitTitle}</h1>\n"; if ($selectedTransactionNumber > 0) { // echo success message & number of written transactions echo $selectedTransactionNumber . ' ' . getBadgerTranslation2("importCsv", "successfullyWritten") . '<ul>'; foreach ($targetAccounts as $currentAccount) { echo '<li><a href="' . BADGER_ROOT . '/modules/account/AccountOverview.php?accountID=' . $currentAccount->getId() . '">' . htmlentities($currentAccount->getTitle()) . '</a></li>'; } echo '</ul>'; } else { //echo no transactions selected echo getBadgerTranslation2("importCsv", "noTransactionSelected"); } } eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php"; function importMatching($importedTransaction, $accountId) { global $us; global $badgerDb; static $dateDelta = null; static $amountDelta = null; static $textSimilarity = null; static $categories = null; if (is_null($dateDelta)) { try { $dateDelta = $us->getProperty('matchingDateDelta');
$autoExpandPlannedTransactionsField = $widgets->createField('autoExpandPlannedTransactionsField', 0, 1, getBadgerTranslation2('UserSettingsAdmin', 'autoExpandPlannedTransactionsDescription'), true, 'checkbox', $us->getProperty('autoExpandPlannedTransactions') ? 'checked="checked"' : ''); // Print Form for change of password $PWFormLabel = getBadgerTranslation2('UserSettingsAdmin', 'change_password_heading'); $OldPwLabel = $widgets->createLabel("OldPassword", getBadgerTranslation2('UserSettingsAdmin', 'old_password_name'), false); $OldPwField = $widgets->createField("OldPassword", 20, "", getBadgerTranslation2('UserSettingsAdmin', 'old_password_description'), false, 'password'); $NewPwLabel = $widgets->createLabel("NewPassword", getBadgerTranslation2('UserSettingsAdmin', 'new_password_name'), false); $NewPwField = $widgets->createField("NewPassword", 20, "", getBadgerTranslation2('UserSettingsAdmin', 'new_password_description'), false, 'password'); $ConfPwLabel = $widgets->createLabel("NewPasswordConfirm", getBadgerTranslation2('UserSettingsAdmin', 'new_password_confirm_name'), false); $ConfPwField = $widgets->createField("NewPasswordConfirm", 20, "", getBadgerTranslation2('UserSettingsAdmin', 'new_password_confirm_description'), false, 'password'); $btnSubmit = $widgets->createButton("SubmitUserSettings", getBadgerTranslation2('UserSettingsAdmin', 'submit_button'), "submit", "Widgets/accept.gif", "accesskey='s'"); // Begin of Feedback $Feedback = "<br/>"; if (isset($validation_user_settings) && $validation_user_settings == true && $change_password == true && isset($validation_change_password) && $validation_change_password == true || isset($validation_user_settings) && $validation_user_settings == true && $change_password == false) { if ($change_password == true) { $Feedback .= getBadgerTranslation2('UserSettingsAdmin', 'password_change_commited') . "<br/>"; } $Feedback .= getBadgerTranslation2('UserSettingsAdmin', 'user_settings_change_commited') . "<br/><br/>"; } if ($change_password == true && isset($validation_change_password) && $validation_change_password != true) { $Feedback .= $validation_change_password_errors; } // If Validation for User Settings had returned // a bad result, print the error messages if (isset($validation_user_settings) && $validation_user_settings != true) { $Feedback .= "<div class=\"USAError\">" . $validation_user_settings_errors . "</div><br/><br/>"; } // End of Feedback eval("echo \"" . $tpl->getTemplate("UserSettingsAdmin/UserSettingsAdmin") . "\";"); //-- //-- eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";");
function addJSValMessages() { $this->tpl->addHeaderTag("<script type=\"text/javascript\">"); $this->tpl->addHeaderTag("function _jsVal_Language() {"); $this->tpl->addHeaderTag("\tthis.err_form = '" . getBadgerTranslation2('jsVal', 'err_form') . "';"); $this->tpl->addHeaderTag("\tthis.err_select = '" . getBadgerTranslation2('jsVal', 'err_select') . "';"); $this->tpl->addHeaderTag("\tthis.err_enter = '" . getBadgerTranslation2('jsVal', 'err_enter') . "';"); $this->tpl->addHeaderTag("}"); $this->tpl->addHeaderTag("</script>"); }
/** * Returns all fields in an array. * * The result has the following form: * array ( * array ( * 'field name 0' => 'value of field 0', * 'field name 1' => 'value of field 1' * ) * ); * * The inner array is repeated for each row. * The fields need to be in the order returned by @link getFieldNames(). * * @return array A list of all fields. */ public function getAll() { global $us; while ($this->fetchNextCategory()) { } $this->sortCategories(); $result = array(); $currResultIndex = 0; $currentLanguage = $us->getProperty('badgerLanguage'); foreach ($this->categories as $currentCategory) { $parent = $currentCategory->getParent(); if (is_null($parent)) { $title = ''; $parentId = ''; $parentTitle = $currentCategory->getTitle(); } else { $title = $currentCategory->getTitle(); $parentId = $parent->getId(); $parentTitle = $parent->getTitle(); } if ($currentCategory->getOutsideCapital()) { $image = "Account/{$currentLanguage}/outside_capital.png"; $tooltip = getBadgerTranslation2('CategoryManager', 'outsideCapital'); } else { $image = "Account/{$currentLanguage}/own_capital.png"; $tooltip = getBadgerTranslation2('CategoryManager', 'ownCapital'); } $result[$currResultIndex] = array(); $result[$currResultIndex]['categoryId'] = $currentCategory->getId(); foreach ($this->selectedFields as $selectedField) { switch ($selectedField) { case 'title': $result[$currResultIndex]['title'] = $title; break; case 'description': $result[$currResultIndex]['description'] = $currentCategory->getDescription(); break; case 'outsideCapital': $result[$currResultIndex]['outsideCapital'] = array('img' => getRelativeTplPath($image), 'title' => $tooltip); break; case 'parentId': $result[$currResultIndex]['parentId'] = $parentId; break; case 'parentTitle': $result[$currResultIndex]['parentTitle'] = $parentTitle; break; case 'keywords': $result[$currResultIndex]['keywords'] = $currentCategory->getKeywords(); break; case 'expense': $result[$currResultIndex]['expense'] = $currentCategory->getExpense(); break; } //switch } //foreach selectedFields $currResultIndex++; } //foreach categories return $result; }
$account = $am->getAccountById($accountID); $pageTitle = getBadgerTranslation2('accountOverviewPlanned', 'pageTitle'); $pageTitle .= ": " . $account->getTitle(); $widgets = new WidgetEngine($tpl); $dataGrid = new DataGrid($tpl, "Account" . $accountID . "planned"); $dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=Account&qp={$accountID};planned"; $dataGrid->headerName = array(getBadgerTranslation2('accountOverview', 'colTitle'), getBadgerTranslation2('accountOverviewPlanned', 'colBeginDate'), getBadgerTranslation2('accountOverviewPlanned', 'colEndDate'), getBadgerTranslation2('accountOverviewPlanned', 'colRepeatText'), getBadgerTranslation2('accountOverview', 'colAmount'), getBadgerTranslation2('accountOverview', 'colCategoryTitle')); //$dataGrid->columnOrder = array("title","beginDate", "endDate", "repeatUnit", "repeatFrequency", "amount", "categoryTitle"); $dataGrid->columnOrder = array("title", "beginDate", "endDate", "repeatText", "amount", "categoryTitle"); $dataGrid->height = "350px"; //$dataGrid->headerSize = array(210, 95, 85, 70, 75, 120, 200); $dataGrid->headerSize = array(210, 95, 85, 85, 120, 200); //$dataGrid->cellAlign = array("left", "right", "right", "left", "right", "right", "left"); $dataGrid->cellAlign = array("left", "right", "right", "left", "right", "left"); $dataGrid->deleteAction = "Transaction.php?action=delete&backTo=planned&accountID={$accountID}&ID="; $dataGrid->editAction = "Transaction.php?action=edit&backTo=planned&accountID={$accountID}&ID="; $dataGrid->newAction = "Transaction.php?action=new&backTo=planned&accountID={$accountID}"; $dataGrid->initDataGridJS(); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo "<h1>{$pageTitle}</h1>"; echo $widgets->createButton("btnNewPlanned", getBadgerTranslation2('accountTransaction', 'newPlannedTrans'), "dataGridAccount" . $accountID . "planned.callNewEvent('type=planned')", "Widgets/table_add.gif"); echo ' '; echo $widgets->createButton("btnEdit", getBadgerTranslation2('dataGrid', 'edit'), "dataGridAccount" . $accountID . "planned.callEditEvent()", "Widgets/table_edit.gif"); echo ' '; echo $widgets->createButton("btnDelete", getBadgerTranslation2('dataGrid', 'delete'), "dataGridAccount" . $accountID . "planned.callDeleteEvent()", "Widgets/table_delete.gif"); echo ' '; echo $widgets->createButton("btnShowTransactions", getBadgerTranslation2('accountOverviewPlanned', 'showTrans'), "location.href = location.href.replace(/AccountOverviewPlanned\\.php/, 'AccountOverview.php');", "Account/finished_transaction.png"); echo $dataGrid->writeDataGrid(); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php";
function getUpdateTranslation($pageId, $id) { global $us; static $transTbl = array('updateProcedure' => array('en' => array('pageTitle' => 'Update BADGER finance', 'legend' => 'Steps to Update', 'updateInformation' => 'BADGER finance detected an update of its files. This page updates the database. All your data will be preserved.', 'dbVersionText' => 'Database version:', 'fileVersionText' => 'File version:', 'stepDescription' => 'The update consists of two simple steps. First, a backup of the database is saved to your computer. This preserves your data in the rare case anything goes wrong. Second, the database is updated.', 'step1PreLink' => 'Please click the following link and save the file to your computer.', 'step1LinkText' => 'Save backup', 'step1PostLink' => '', 'step2PreLink' => 'Please click the following link to start the database update.', 'step2LinkText' => 'Update database', 'step2PostLink' => ''), 'de' => array('pageTitle' => 'BADGER finance aktualisieren', 'legend' => 'Schritte zur Aktualisierung', 'updateInformation' => 'BADGER finance hat eine Aktualisierung seiner Dateien festgestellt. Diese Seite aktualisiert die Datenbank. Ihre Daten bleiben vollständig erhalten.', 'dbVersionText' => 'Datenbank-Version:', 'fileVersionText' => 'Datei-Version:', 'stepDescription' => 'Die Aktualisierung besteht aus zwei einfachen Schritten. Zuerst wird eine Sicherheitskopie der Datenbank auf Ihrem Computer gespeichert. Dadurch bleiben Ihre Daten auch im unwahrscheinlichen Fall eines Fehlschlags erhalten. Anschließend wird die Datenbank aktualisiert.', 'step1PreLink' => 'Bitte klicken Sie auf folgenden Link und speichern Sie die Datei auf Ihrem Computer.', 'step1LinkText' => 'Sicherungskopie speichern', 'step1PostLink' => '', 'step2PreLink' => 'Bitte klicken Sie auf folgenden Link, um die Datenbank-Aktualisierung zu beginnen.', 'step2LinkText' => 'Datenbank aktualisieren', 'step2PostLink' => '')), 'updateUpdate' => array('en' => array('pageTitle' => 'Updating BADGER finance', 'betweenVersionsText' => 'Versions in between:', 'preCurrentText' => 'Update from', 'postCurrentText' => 'to', 'postNextText' => '', 'logEntryHeader' => 'Information from the update:', 'updateInformation' => 'BADGER finance is now performing the update. It is performed step-by-step, one step for each version.', 'errorInformation' => 'Please read the output of the process. If it encounters any severe errors they are written in red. In this case, please send the whole output to the BADGER development team (see help for contact info).', 'updateFinished' => 'The update has finished.', 'severeError' => 'The update encountered a severe error. Please send the whole output to the BADGER finance development team.', 'goToStartPagePreLink' => 'Please ', 'goToStartPageLinkText' => 'go to start page', 'goToStartPagePostLink' => ' to continue.'), 'de' => array('pageTitle' => 'BADGER finance wird aktualisiert', 'betweenVersionsText' => 'Dazwischenliegende Versionen:', 'preCurrentText' => 'Aktualisierung von', 'postCurrentText' => 'auf', 'postNextText' => '', 'logEntryHeader' => 'Informationen der Aktualisierung:', 'updateInformation' => 'Die Aktualisierung wird nun durchgeführt. Dies findet Schritt für Schritt statt, einen Schritt für jede Version.', 'errorInformation' => 'Bitte lesen sie die Ausgabe dieses Prozesses. Die einfachen Informationen sind auf Englisch gehalten. Falls der Prozess irgend welche schweren Fehler meldet, sind diese rot eingefärbt. Bitte schicken Sie in diesem Fall die gesamte Ausgabe an das BADGER Entwicklungsteam (siehe Hilfe für Kontaktinformationen).', 'updateFinished' => 'Die Aktualisierung ist beendet.', 'severeError' => 'Die Aktualisierung stieß auf einen schweren Fehler. Bitte schicken Sie die gesamte Ausgabe an das BADGER finance development team.', 'goToStartPagePreLink' => 'Bitte ', 'goToStartPageLinkText' => 'zur Startseite gehen', 'goToStartPagePostLink' => ' um fortzusetzen.'))); $trans = getBadgerTranslation2($pageId, $id); if (PEAR::isError($trans) || $trans === '') { $trans = $transTbl[$pageId][$us->getProperty('badgerLanguage')][$id]; } return $trans; }
$dataGrid = new DataGrid($tpl, "CategoryManager"); $dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=CategoryManager"; $dataGrid->headerName = array(getBadgerTranslation2('accountCategory', 'colparentTitle'), getBadgerTranslation2('accountCategory', 'colTitle'), getBadgerTranslation2('accountCategory', 'colDescription'), getBadgerTranslation2('accountCategory', 'colOutsideCapital')); $dataGrid->columnOrder = array("parentTitle", "title", "description", "outsideCapital"); $dataGrid->deleteMsg = getBadgerTranslation2('accountCategory', 'deleteMsg'); $dataGrid->headerSize = array(200, 200, 300, 100); $dataGrid->cellAlign = array("left", "left", "left", "center"); $dataGrid->height = "350px"; $dataGrid->deleteAction = "CategoryManager.php?action=delete&ID="; $dataGrid->editAction = "CategoryManager.php?action=edit&ID="; $dataGrid->newAction = "CategoryManager.php?action=new"; $dataGrid->deleteRefreshType = 'refreshDataGrid'; $dataGrid->initDataGridJS(); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo "<h1>{$pageTitle}</h1>"; echo $widgets->createButton("btnNew", getBadgerTranslation2('dataGrid', 'new'), "dataGridCategoryManager.callNewEvent()", "Widgets/table_add.gif"); echo ' '; echo $widgets->createButton("btnEdit", getBadgerTranslation2('dataGrid', 'edit'), "dataGridCategoryManager.callEditEvent()", "Widgets/table_edit.gif"); echo ' '; echo $widgets->createButton("btnDelete", getBadgerTranslation2('dataGrid', 'delete'), "dataGridCategoryManager.callDeleteEvent()", "Widgets/table_delete.gif"); echo $dataGrid->writeDataGrid(); $legend = getBadgerTranslation2('dataGrid', 'legend'); $currentLanguage = $us->getProperty('badgerLanguage'); $ownCapitalText = getBadgerTranslation2('CategoryManager', 'ownCapital'); $ownCapitalImage = $widgets->addImage("Account/{$currentLanguage}/own_capital.png", 'title="' . $ownCapitalText . '"'); $outsideCapitalText = getBadgerTranslation2('CategoryManager', 'outsideCapital'); $outsideCapitalImage = $widgets->addImage("Account/{$currentLanguage}/outside_capital.png", 'title="' . $outsideCapitalText . '"'); eval('echo "' . $tpl->getTemplate('Account/CategoryManagerOverview') . '";'); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php";
function printFrontend() { global $tpl; global $cm; global $order; global $redirectPageAfterSave; if (isset($_GET['ID'])) { //edit: load values for this ID $ID = getGPC($_GET, 'ID', 'integer'); $pageTitle = getBadgerTranslation2('accountCategory', 'pageTitleEdit'); $category = $cm->getCategoryById($ID); $titleValue = $category->getTitle(); $descriptionValue = $category->getDescription(); if ($category->getOutsideCapital() == "1") { $outsideCapitalValue = "checked"; } else { $outsideCapitalValue = ""; } $keywordsValue = $category->getKeywords(); if ($category->getParent()) { $parentValue = $category->getParent()->getTitle(); $parentId = $category->getParent()->getId(); } else { $parentValue = ""; $parentId = ""; } $expenseValue = $category->getExpense(); } else { //new: empty values $pageTitle = getBadgerTranslation2('accountCategory', 'pageTitleNew'); $ID = "new"; $titleValue = ""; $descriptionValue = ""; $outsideCapitalValue = ""; $keywordsValue = ""; $parentValue = ""; $parentId = ""; $expenseValue = null; } $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addJSValMessages(); $tpl->addJavaScript("js/prototype.js"); $tpl->addOnLoadEvent("Form.focusFirstElement('mainform')"); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo $widgets->addToolTipLayer(); //set vars with values $FormAction = $_SERVER['PHP_SELF']; $legend = getBadgerTranslation2('accountCategory', 'legend'); $hiddenID = $widgets->createField("hiddenID", 20, $ID, "", false, "hidden"); $pageHeading = $pageTitle; //Fields & Labels $titleLabel = $widgets->createLabel("title", getBadgerTranslation2('accountCategory', 'title'), true); $titleField = $widgets->createField("title", 30, $titleValue, "", true, "text", "style='width: 30ex;'"); $descriptionLabel = $widgets->createLabel("description", getBadgerTranslation2('accountCategory', 'description'), false); $descriptionField = $widgets->createTextarea("description", $descriptionValue, "", false, "style='width: 30ex; height: 5em;'"); $parentLabel = $widgets->createLabel("parent", getBadgerTranslation2('accountCategory', 'parent'), false); $parentCats = array("" => getBadgerTranslation2('CategoryManager', 'no_parent')); while ($cat = $cm->getNextCategory()) { $cat->getParent(); } $cm->resetCategories(); while ($cat = $cm->getNextCategory()) { if (is_null($cat->getParent())) { $parentCats[$cat->getId()] = $cat->getTitle(); } } $parentField = $widgets->createSelectField("parent", $parentCats, $parentId, '', false, "style='width: 31ex;'"); $outsideCapitalLabel = $widgets->createLabel("outsideCapital", getBadgerTranslation2('accountCategory', 'outsideCapital'), false); $outsideCapitalField = $widgets->createField("outsideCapital", 30, "on", "", false, "checkbox", $outsideCapitalValue); $keywordsLabel = $widgets->createLabel('keywords', getBadgerTranslation2('accountCategory', 'keywordsLabel'), false); $keywordsField = $widgets->createTextarea('keywords', $keywordsValue, getBadgerTranslation2('accountCategory', 'keywordsDescription'), false, "style='width: 30ex; height: 5em;'"); $expenseRowLabel = getBadgerTranslation2('accountCategory', 'expenseRowLabel'); $incomeField = $widgets->createField('expense', 0, 'income', '', false, 'radio', $expenseValue === false ? 'checked="checked"' : ''); $incomeLabel = $widgets->createLabel('expense', getBadgerTranslation2('accountCategory', 'expenseIncome'), false); $expenseField = $widgets->createField('expense', 0, 'expense', '', false, 'radio', $expenseValue === true ? 'checked="checked"' : ''); $expenseLabel = $widgets->createLabel('expense', getBadgerTranslation2('accountCategory', 'expenseExpense'), false); //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/Category") . "\";"); }
$pocketMoney2EndValue = $val3->sub($PocketMoney2Loop->mul($day))->get(); } $day++; } //foreach($totals as $key => $val) { echo '<forecastData>'; $insertChart = urlencode($insertChart); echo "<insertChart>{$insertChart}</insertChart>"; if ($showSavingTarget == 1) { $dailyPocketMoneyValue = $dailyPocketMoney->getFormatted(); echo "<dailyPocketMoneyValue>{$dailyPocketMoneyValue}</dailyPocketMoneyValue>"; } if ($pocketMoney1EndValue) { $printedPocketMoney1EndValue = new Amount($pocketMoney1EndValue); $balancedEndDate1 = $printedPocketMoney1EndValue->getFormatted(); echo "<balancedEndDate1>{$balancedEndDate1}</balancedEndDate1>"; } if ($pocketMoney2EndValue) { $printedPocketMoney2EndValue = new Amount($pocketMoney2EndValue); $balancedEndDate2 = $printedPocketMoney2EndValue->getFormatted(); echo "<balancedEndDate2>{$balancedEndDate2}</balancedEndDate2>"; } echo "<accountCurrency>{$accountCurrency}</accountCurrency>"; echo '</forecastData>'; } } else { //if ($today->compare($today, $selectedDate)!=1){ $noFutureDates = getBadgerTranslation2("forecast", "onlyFutureDates"); echo "<errors><error>{$noFutureDates}</error></errors>"; } require_once BADGER_ROOT . "/includes/fileFooter.php";
} if ($showPlannedTransactions == 1) { $chart['chart_data'][$numberOfGraph1][0] = getBadgerTranslation2("forecast", "plannedTransactions"); //account balance for every day between today & end date, if no other expenses / income than in the finished transactions $numberOfGraph1++; } if ($showSavingTarget == 1) { $chart['chart_data'][$numberOfGraph1][0] = getBadgerTranslation2("forecast", "savingTarget"); $numberOfGraph1++; } if ($showPocketMoney1 == 1) { $chart['chart_data'][$numberOfGraph1][0] = getBadgerTranslation2("forecast", "pocketMoney1"); $numberOfGraph1++; } if ($showPocketMoney2 == 1) { $chart['chart_data'][$numberOfGraph1][0] = getBadgerTranslation2("forecast", "pocketMoney2"); $numberOfGraph1++; } $day = 0; foreach ($totals as $key => $val) { $tmp = new Date($key); $chart['chart_data'][0][] = $tmp->getFormatted(); $numberOfGraph = 1; if ($showLowerLimit == 1) { $chart['chart_data'][$numberOfGraph][] = $lowerLimit->get(); $numberOfGraph++; } if ($showUpperLimit == 1) { $chart['chart_data'][$numberOfGraph][] = $upperLimit->get(); $numberOfGraph++; }
$lowerLimitToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "lowerLimitToolTip")); //checkbox for upper limit graph $upperLimitLabel = getBadgerTranslation2("forecast", "upperLimitLabel") . ":"; $upperLimitBox = "<input type=\"checkbox\" id=\"upperLimitBox\" name=\"upperLimitBox\" value=\"select\" checked=\"checked\"/>"; $upperLimitToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "upperLimitToolTip")); //checkbox for planned transactions graph $plannedTransactionsLabel = getBadgerTranslation2("forecast", "plannedTransactionsLabel") . ":"; $plannedTransactionsBox = "<input type=\"checkbox\" id=\"plannedTransactionsBox\" name=\"plannedTransactionsBox\" value=\"select\" checked=\"checked\"/>"; $plannedTransactionsToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "plannedTransactionsToolTip")); //checkbox for saving target graph $savingTargetLabel1 = getBadgerTranslation2("forecast", "savingTargetLabel") . ":"; $savingTargetBox = "<input type=\"checkbox\" id=\"savingTargetBox\" name=\"savingTargetBox\" value=\"select\" checked=\"checked\"/>"; $savingTargetToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "showSavingTargetToolTip")); //checkbox for pocket money1 graph $pocketMoney1Label1 = getBadgerTranslation2("forecast", "pocketMoney1Label") . ":"; $pocketMoney1Box = "<input type=\"checkbox\" id=\"pocketMoney1Box\" name=\"pocketMoney1Box\" value=\"select\" checked=\"checked\"/>"; $pocketMoney1ToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "showPocketMoney1ToolTip")); //checkbox for pocket money1 graph $pocketMoney2Label1 = getBadgerTranslation2("forecast", "pocketMoney2Label") . ":"; $pocketMoney2Box = "<input type=\"checkbox\" id=\"pocketMoney2Box\" name=\"pocketMoney2Box\" value=\"select\" checked=\"checked\"/>"; $pocketMoneyTool2Tip = $widgets->addToolTip(getBadgerTranslation2("forecast", "showPocketMoney2ToolTip")); //Create Chart Button $tooLongTimeSpanWarning = getBadgerTranslation2("forecast", "performanceWarning"); $sendButton = $widgets->createButton("sendData", getBadgerTranslation2("forecast", "sendData"), 'submitForecast();', "Widgets/accept.gif"); $dailyPocketMoneyLabel = getBadgerTranslation2("forecast", "dailyPocketMoneyLabel") . ":"; $dailyPocketMoneyToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "dailyPocketMoneyToolTip")) . "<br />"; $balancedEndDateLabel1 = getBadgerTranslation2("forecast", "printedPocketMoney1Label") . ": "; $balancedEndDateLabel2 = getBadgerTranslation2("forecast", "printedPocketMoney2Label") . ": "; eval("echo \"" . $tpl->getTemplate("forecast/forecast") . "\";"); //show chart eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";");
function getIntervalUnitsArray() { $units = array('day' => getBadgerTranslation2('intervalUnits', 'day'), 'week' => getBadgerTranslation2('intervalUnits', 'week'), 'month' => getBadgerTranslation2('intervalUnits', 'month'), 'year' => getBadgerTranslation2('intervalUnits', 'year')); return $units; }
$filters['transactionPartner'] = getBadgerTranslation2('statistics2', 'transactionPartnerFilter') . $widgets->createSelectField("transactionPartnerOperator{$FILTER_ID_MARKER}", $dataGridStringFilterArray, "", "", false, "style='width: 95px;'") . ' ' . $widgets->createField("transactionPartner{$FILTER_ID_MARKER}", 30, "", "", false, "text", ""); $filters['category'] = getBadgerTranslation2('statistics2', 'categoryFilter') . $widgets->createField("categoryOp{$FILTER_ID_MARKER}", null, 'eq', '', false, 'radio') . $widgets->createLabel("categoryOp{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'categoryFilterIs')) . ' ' . $widgets->createField("categoryOp{$FILTER_ID_MARKER}", null, 'ne', '', false, 'radio') . $widgets->createLabel("categoryOp{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'categoryFilterIsNot')) . ' ' . $widgets->createSelectField("categoryId{$FILTER_ID_MARKER}", getCategorySelectArray(true), "", "", false, "style='width: 210px;'"); $filters['exceptional'] = getBadgerTranslation2('statistics2', 'exceptionalFilter') . $widgets->createField("exceptional{$FILTER_ID_MARKER}", null, '1', '', false, 'radio') . $widgets->createLabel("exceptional{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'exceptionalFilterExceptional')) . ' ' . $widgets->createField("exceptional{$FILTER_ID_MARKER}", null, '0', '', false, 'radio') . $widgets->createLabel("exceptional{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'exceptionalFilterNotExceptional')); $filters['periodical'] = getBadgerTranslation2('statistics2', 'periodicalFilter') . $widgets->createField("periodical{$FILTER_ID_MARKER}", null, '1', '', false, 'radio') . $widgets->createLabel("periodical{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'periodicalFilterPeriodical')) . ' ' . $widgets->createField("periodical{$FILTER_ID_MARKER}", null, '0', '', false, 'radio') . $widgets->createLabel("periodical{$FILTER_ID_MARKER}", getBadgerTranslation2('statistics2', 'periodicalFilterNotPeriodical')); $availableFilters = array('unselected' => getBadgerTranslation2('statistics2', 'availableFiltersUnselected'), 'title' => getBadgerTranslation2('statistics2', 'availableFiltersTitle'), 'description' => getBadgerTranslation2('statistics2', 'availableFiltersDescription'), 'valutaDate' => getBadgerTranslation2('statistics2', 'availableFiltersValutaDate'), 'valutaDateBetween' => getBadgerTranslation2('statistics2', 'availableFiltersValutaDateBetween'), 'valutaDateAgo' => getBadgerTranslation2('statistics2', 'availableFiltersValutaDateAgo'), 'amount' => getBadgerTranslation2('statistics2', 'availableFiltersAmount'), 'outsideCapital' => getBadgerTranslation2('statistics2', 'availableFiltersOutsideCapital'), 'transactionPartner' => getBadgerTranslation2('statistics2', 'availableFiltersTransactionPartner'), 'category' => getBadgerTranslation2('statistics2', 'availableFiltersCategory'), 'exceptional' => getBadgerTranslation2('statistics2', 'availableFiltersExceptional'), 'periodical' => getBadgerTranslation2('statistics2', 'availableFiltersPeriodical'), 'delete' => getBadgerTranslation2('statistics2', 'availableFiltersDelete')); $dateFormat = $widgets->createField('dateFormat', null, $us->getProperty('badgerDateFormat'), null, false, 'hidden'); $content = "<div style=\"float: left;\">"; $content .= $widgets->createSelectField("filterSelect{$FILTER_ID_MARKER}", $availableFilters, "", "", false, "onchange=\"setFilterContent('{$FILTER_ID_MARKER}');\""); $content .= "</div><div id=\"filterContent{$FILTER_ID_MARKER}\"></div>"; $filterLineEmpty = "<div id='filterLineEmpty' style='display:none;'>{$content}</div>"; $filtersEmpty = ''; foreach ($filters as $currentName => $currentFilter) { $filtersEmpty .= "<div id='{$currentName}Empty' style='display:none;'>{$currentFilter}</div>"; } $dataGridAccounts = $dgAccounts->writeDataGrid(); $filterCaption = getBadgerTranslation2('statistics2', 'filterCaption'); $addFilterButton = $widgets->createButton('addFilter', getBadgerTranslation2('statistics2', 'addFilterButton'), 'addFilterLineX();'); eval('$filterBoxContent = "' . $tpl->getTemplate('statistics2/filterBox') . '";'); $filterBox = $widgets->addTwistieSection(getBadgerTranslation2('statistics2', 'twistieCaptionInput'), $filterBoxContent, null, true); $ACTIVE_OS_MARKER = '__ACTIVE_OS__'; $outputSelectionTrend = '<div id="outputSelectionTrend" style="display: inline; vertical-align: top;">' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionTrendStartValue') . '</legend>' . '<p>' . $widgets->createField("outputSelectionTrendStart{$ACTIVE_OS_MARKER}", null, 'b', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionTrendStart{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTrendStartValueBalance')) . '</p><p>' . $widgets->createField("outputSelectionTrendStart{$ACTIVE_OS_MARKER}", null, '0', '', false, 'radio') . $widgets->createLabel("outputSelectionTrendStart{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTrendStartValueZero')) . '</p>' . '</fieldset>' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionTrendTickLabels') . '</legend>' . '<p>' . $widgets->createField("outputSelectionTrendTicks{$ACTIVE_OS_MARKER}", null, 's', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionTrendTicks{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTrendTickLabelsShow')) . '</p><p>' . $widgets->createField("outputSelectionTrendTicks{$ACTIVE_OS_MARKER}", null, 'h', '', false, 'radio') . $widgets->createLabel("outputSelectionTrendTicks{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTrendTickLabelsHide')) . '</p>' . '</fieldset>' . '</div>'; $outputSelectionCategory = '<div id="outputSelectionCategory">' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionCategoryType') . '</legend>' . '<p>' . $widgets->createField("outputSelectionCategoryType{$ACTIVE_OS_MARKER}", null, 'i', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionCategoryType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategoryTypeInput')) . '</p><p>' . $widgets->createField("outputSelectionCategoryType{$ACTIVE_OS_MARKER}", null, 'o', '', false, 'radio') . $widgets->createLabel("outputSelectionCategoryType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategoryTypeOutput')) . '</p>' . '</fieldset>' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategories') . '</legend>' . '<p>' . $widgets->createField("outputSelectionCategorySummarize{$ACTIVE_OS_MARKER}", null, 't', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionCategorySummarize{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategoriesSummarize')) . '</p><p>' . $widgets->createField("outputSelectionCategorySummarize{$ACTIVE_OS_MARKER}", null, 'f', '', false, 'radio') . $widgets->createLabel("outputSelectionCategorySummarize{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategoriesNoSummarize')) . '</p>' . '</fieldset>' . '</div>'; $outputSelectionTimespan = '<div id="outputSelectionTimespan">' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionTimespanType') . '</legend>' . '<p>' . $widgets->createField("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", null, 'w', '', false, 'radio') . $widgets->createLabel("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTimespanTypeWeek')) . '</p><p>' . $widgets->createField("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", null, 'm', '', false, 'radio') . $widgets->createLabel("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTimespanTypeMonth')) . '</p><p>' . $widgets->createField("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", null, 'q', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTimespanTypeQuarter')) . '</p><p>' . $widgets->createField("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", null, 'y', '', false, 'radio') . $widgets->createLabel("outputSelectionTimespanType{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionTimespanTypeYear')) . '</p>' . '</fieldset>' . '<fieldset style="display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategories') . '</legend>' . '<p>' . $widgets->createField("outputSelectionTimespanSummarize{$ACTIVE_OS_MARKER}", null, 't', '', false, 'radio', 'checked="checked"') . $widgets->createLabel("outputSelectionTimespanSummarize{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategoriesSummarize')) . '</p><p>' . $widgets->createField("outputSelectionTimespanSummarize{$ACTIVE_OS_MARKER}", null, 'f', '', false, 'radio') . $widgets->createLabel("outputSelectionTimespanSummarize{$ACTIVE_OS_MARKER}", getBadgerTranslation2('statistics2', 'outputSelectionCategorySubCategoriesNoSummarize')) . '</p>' . '</fieldset>' . '</div>'; $outputSelection = "<div id='outputSelections' style='display:none;'>\r\n\t{$outputSelectionTrend}\r\n\t{$outputSelectionCategory}\r\n\t{$outputSelectionTimespan}\r\n</div>"; $outputSelectionContent = '<fieldset style="width: 8em; display: inline; vertical-align: top;">' . '<legend>' . getBadgerTranslation2('statistics2', 'outputSelectionGraphType') . '</legend>' . '<p>' . $widgets->createField("outputSelectionType", null, 'Trend', '', false, 'radio', 'checked="checked" onchange="updateOutputSelection();" onclick="updateOutputSelection();"') . $widgets->createLabel("outputSelectionType", getBadgerTranslation2('statistics2', 'outputSelectionGraphTypeTrend')) . '</p><p>' . $widgets->createField("outputSelectionType", null, 'Category', '', false, 'radio', 'onchange="updateOutputSelection();" onclick="updateOutputSelection();"') . $widgets->createLabel("outputSelectionType", getBadgerTranslation2('statistics2', 'outputSelectionGraphTypeCategory')) . '</p><p>' . $widgets->createField("outputSelectionType", null, 'Timespan', '', false, 'radio', 'onchange="updateOutputSelection();" onclick="updateOutputSelection();"') . $widgets->createLabel("outputSelectionType", getBadgerTranslation2('statistics2', 'outputSelectionGraphTypeTimespan')) . '</p>' . '</fieldset>' . "<div id='outputSelectionContent' style='display: inline; vertical-align: top;'>" . str_replace($ACTIVE_OS_MARKER, '', $outputSelectionTrend) . '</div>'; $outputSelectionTwistie = $widgets->addTwistieSection(getBadgerTranslation2('statistics2', 'twistieCaptionOutputSelection'), $outputSelectionContent, null, true); $analyzeButton = $widgets->createButton('applyFilter', getBadgerTranslation2('statistics2', 'analyzeButton'), 'applyFilterX();'); $graphTwistie = $widgets->addTwistieSection(getBadgerTranslation2('statistics2', 'twistieCaptionGraph'), '<div id="graphContent"></div>', null, true); $outputTwistie = $widgets->addTwistieSection(getBadgerTranslation2('statistics2', 'twistieCaptionOutput'), '<div id="resultGridContainer" style="display:none;">' . $dgResult->writeDataGrid() . '</div>', null, true); eval('echo "' . $tpl->getTemplate('statistics2/statistics2') . '";'); eval('echo "' . $tpl->getTemplate('badgerFooter') . '";');
var monthName = <?php echo str_replace("\\", "", getBadgerTranslation2("Calendar", "monthName")); ?> ; var monthName2 = <?php echo str_replace("\\", "", getBadgerTranslation2("Calendar", "monthName2")); ?> ; if (startAt==0) { dayName = <?php echo str_replace("\\", "", getBadgerTranslation2("Calendar", "dayNameStartsWithSunday")); ?> ; } else { dayName = <?php echo str_replace("\\", "", getBadgerTranslation2("Calendar", "dayNameStartsWithMonday")); ?> ; } var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear, selDayAction, isPast; var visYear = 0; var visMonth = 0; var bPageLoaded = false; var ie = document.all; var dom = document.getElementById; var ns4 = document.layers; var op = window.opera var today = new Date(); var dateNow = today.getDate(); var monthNow = today.getMonth();
<?php /* * ____ _____ _____ ______ _____ *| _ \ /\ | __ \ / ____| ____| __ \ *| |_) | / \ | | | | | __| |__ | |__) | *| _ < / /\ \ | | | | | |_ | __| | _ / *| |_) / ____ \| |__| | |__| | |____| | \ \ *|____/_/ \_\_____/ \_____|______|_| \_\ * Open Source Finance Management * Visit http://www.badger-finance.org * **/ //Retrieve md5´ed password from user settings $readoutpassword = $us->getProperty('badgerPassword'); $passwordcorrect = false; if (isset($_session['password']) && $readoutpassword == $_session['password']) { $passwordcorrect = true; } elseif (isset($_POST['password']) && md5(getGPC($_POST, 'password')) == $readoutpassword) { $passwordcorrect = true; //create session variable set_session_var('password', md5(getGPC($_POST, 'password'))); } if ($passwordcorrect != true) { die(getBadgerTranslation2('badger_login', 'backend_not_login')); }
function printFrontend() { global $pageTitle; global $tpl; global $cm; global $redirectPageAfterSave; $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addJSValMessages(); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo $widgets->addToolTipLayer(); if (isset($_GET['ID'])) { //edit: load values for this ID $ID = $_GET['ID']; $currency = $cm->getCurrencyById($ID); $symbolValue = $currency->getSymbol(); $langnameValue = $currency->getLongName(); } else { //new: empty values $ID = "new"; $symbolValue = ""; $langnameValue = ""; } //set vars with values $FormAction = $_SERVER['PHP_SELF']; $legend = getBadgerTranslation2('accountCurrency', 'legend'); $hiddenID = $widgets->createField("hiddenID", 20, $ID, "", false, "hidden"); $pageHeading = $pageTitle; //Fields & Labels $symbolLabel = $widgets->createLabel("symbol", getBadgerTranslation2('accountCurrency', 'symbol'), true); $symbolField = $widgets->createField("symbol", 20, $symbolValue, "", true, "text", "maxlength='3'"); $longnameLabel = $widgets->createLabel("longname", getBadgerTranslation2('accountCurrency', 'longname'), false); $longnameField = $widgets->createField("longname", 20, $langnameValue, "", false, "text", ""); //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/Currency") . "\";"); }
**/ define("BADGER_ROOT", "../../.."); require_once BADGER_ROOT . "/includes/fileHeaderFrontEnd.inc.php"; require_once BADGER_ROOT . "/core/widgets/DataGrid.class.php"; $widgets = new WidgetEngine($tpl); $tpl->addCss("Widgets/dataGrid.css"); $tpl->addJavaScript("js/behaviour.js"); $tpl->addJavaScript("js/prototype.js"); $dataGrid = new DataGrid($tpl); $dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=CurrencyManager"; $dataGrid->headerName = array("Symbol", "LongName"); $dataGrid->columnOrder = array("symbol", "longName"); $dataGrid->initialSort = "symbol"; //$dataGrid->width = "410px"; $dataGrid->headerSize = array(200, 200); $dataGrid->cellAlign = array("left", "left"); $dataGrid->deleteMsg = getBadgerTranslation2('dataGrid', 'deleteMsg'); $dataGrid->rowCounterName = getBadgerTranslation2('dataGrid', 'rowCounterName'); $dataGrid->deleteAction = "CurrencyManager.php?action=delete&ID="; $dataGrid->editAction = "CurrencyManager.php?action=edit&ID="; $dataGrid->newAction = "CurrencyManager.php?action=new"; $dataGrid->initDataGridJS(); $widgets->addNavigationHead(); echo $tpl->getHeader("Currency Manager"); echo $widgets->createButton("btnNew", getBadgerTranslation2('dataGrid', 'new'), "dgNew()", "Widgets/table_add.gif"); echo $widgets->createButton("btnDelete", getBadgerTranslation2('dataGrid', 'delete'), "dgDelete()", "Widgets/table_delete.gif"); echo $widgets->createButton("btnTest", "test", "alert(dgGetAllIds())", ""); echo $dataGrid->writeDataGrid(); ?> </body> </html>
function printFrontend() { global $pageTitle; global $tpl; global $cm; global $redirectPageAfterSave; $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addJSValMessages(); $widgets->addNavigationHead(); echo $tpl->getHeader($pageTitle); echo $widgets->addToolTipLayer(); if (isset($_GET['ID'])) { //edit: load values for this ID $ID = $_GET['ID']; $category = $cm->getCategoryById($ID); $titleValue = $category->getTitle(); $descriptionValue = $category->getDescription(); if ($category->getOutsideCapital() == "1") { $outsideCapitalValue = "checked"; } else { $outsideCapitalValue = ""; } if ($category->getParent()) { $parentValue = $category->getParent()->getTitle(); $parentId = $category->getParent()->getId(); } else { $parentValue = ""; $parentId = ""; } } else { //new: empty values $ID = "new"; $titleValue = ""; $descriptionValue = ""; $outsideCapitalValue = ""; $parentValue = ""; $parentId = ""; } //set vars with values $FormAction = $_SERVER['PHP_SELF']; $legend = getBadgerTranslation2('accountCategory', 'legend'); $hiddenID = $widgets->createField("hiddenID", 20, $ID, "", false, "hidden"); $pageHeading = $pageTitle; //Fields & Labels $titleLabel = $widgets->createLabel("title", getBadgerTranslation2('accountCategory', 'title'), true); $titleField = $widgets->createField("title", 30, $titleValue, "", true, "text", ""); $descriptionLabel = $widgets->createLabel("description", getBadgerTranslation2('accountCategory', 'description'), false); $descriptionField = $widgets->createField("description", 30, $descriptionValue, "", false, "text", ""); $parentLabel = $widgets->createLabel("parent", getBadgerTranslation2('accountCategory', 'parent'), false); $parentCats = array("" => getBadgerTranslation2('CategoryManager', 'no_parent')); while ($cat = $cm->getNextCategory()) { $cat->getParent(); } $cm->resetCategories(); while ($cat = $cm->getNextCategory()) { if (is_null($cat->getParent())) { $parentCats[$cat->getId()] = $cat->getTitle(); } } $parentField = $widgets->createSelectField("parent", $parentCats, $default = $parentId); $outsideCapitalLabel = $widgets->createLabel("outsideCapital", getBadgerTranslation2('accountCategory', 'outsideCapital'), false); $outsideCapitalField = $widgets->createField("outsideCapital", 30, "on", "", false, "checkbox", $outsideCapitalValue); //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/Category") . "\";"); }
//print(getBadgerTranslation2('badger_login', 'wrong_password')."<br /><br />"); $Feedback .= getBadgerTranslation2('badger_login', 'wrong_password') . "<br /><br />"; } if (isset($_GET['send_password']) && $_GET['send_password'] == "true") { //print(getBadgerTranslation2('badger_login', 'ask_really_send')."<br/>"); $Feedback .= getBadgerTranslation2('badger_login', 'ask_really_send') . "<br/>"; //print("<a href=\"".$_SERVER['PHP_SELF'].$signature."send_password=truetrue\">".getBadgerTranslation2('badger_login', 'ask_really_send_link')."</a><br/>"); $Feedback .= "<a href=\"" . $_SERVER['PHP_SELF'] . $signature . "send_password=truetrue\">" . getBadgerTranslation2('badger_login', 'ask_really_send_link') . "</a><br/>"; } if (isset($_GET['send_password']) && $_GET['send_password'] == "truetrue") { //send an E-Mail with a new password to the email adress read from the user settings object $newpassword = rand(0, 16000); $newpassword = md5($newpassword); $newpassword = substr($newpassword, 0, 12); if (mail($us->getProperty('badgerPassword'), getBadgerTranslation2('badger_login', 'password_sent_mail_subject'), getBadgerTranslation2('badger_login', 'password_sent_mail_part_1') . $newpassword . getBadgerTranslation2('badger_login', 'password_sent_mail_part_2'), 'From: forgottenpassword@donotreply.com')) { //print(getBadgerTranslation2('badger_login', 'sent_password')."<br /><br />"); $Feedback .= getBadgerTranslation2('badger_login', 'sent_password') . "<br /><br />"; } else { //print(getBadgerTranslation2('badger_login', 'sent_password_failed')."<br/>"); $Feedback .= getBadgerTranslation2('badger_login', 'sent_password_failed') . "<br/>"; } } if (isset($_GET['logout']) && $_GET['logout'] == true) { //echo getBadgerTranslation2('badger_login', 'you_are_logout'); $Feedback .= getBadgerTranslation2('badger_login', 'you_are_logout'); } eval("echo \"" . $tpl->getTemplate("Login/login2") . "\";"); exit; } else { set_session_var('number_of_login_attempts', 0); }
* Visit http://www.badger-finance.org * **/ define("BADGER_ROOT", ".."); require_once BADGER_ROOT . "/includes/fileHeaderFrontEnd.inc.php"; require_once BADGER_ROOT . "/core/widgets/DataGrid.class.php"; require_once BADGER_ROOT . '/modules/account/AccountManager.class.php'; require_once BADGER_ROOT . '/modules/account/accountCommon.php'; updateBalances(); $widgets = new WidgetEngine($tpl); $dataGrid = new DataGrid($tpl, "AccountManagerWelcomePage"); //$dataGrid->noRowSelectedMsg = "test"; $dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=AccountManager"; $dataGrid->headerName = array(getBadgerTranslation2('accountAccount', 'colTitle'), getBadgerTranslation2('accountAccount', 'colBalance'), getBadgerTranslation2('accountAccount', 'colCurrency')); $dataGrid->columnOrder = array("title", "balance", "currency"); $dataGrid->headerSize = array(200, 150, 100); $dataGrid->cellAlign = array("left", "right", "left"); $dataGrid->height = "180px"; $dataGrid->width = "520px"; $dataGrid->discardSelectedRows = "true"; $dataGrid->editAction = "account/AccountOverview.php?accountID="; $dataGrid->initDataGridJS(); $widgets->addNavigationHead(); echo $tpl->getHeader("Badger"); $accountOverviewHeader = getBadgerTranslation2('welcome', 'pageTitle'); $accountOverviewGrid = $dataGrid->writeDataGrid(); $btnOpen = $widgets->createButton("btnNew", getBadgerTranslation2('dataGrid', 'open'), "dataGridAccountManagerWelcomePage.callEditEvent()", "Widgets/table_go.gif"); eval("echo \"" . $tpl->getTemplate("badgerOverview") . "\";"); /*echo $dataGridTest->writeDataGrid();*/ eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php";
$categoryField = $widgets->createSelectField("categoryId", getCategorySelectArray(true), "", "", false, "style='width: 210px;'"); //$btnFilterOkay = $widgets->createButton("btnFilterOkay", getBadgerTranslation2('dataGrid', 'setFilter'), "dataGridAccount$accountID.filter.setFilterFields(['title','amount','valutaDate','categoryId'])", "Widgets/dataGrid/filter.gif"); $btnFilterOkay = $widgets->createButton("btnFilterOkay", getBadgerTranslation2('dataGrid', 'setFilter'), "submit", "Widgets/dataGrid/filter.gif"); $btnFilterReset = $widgets->createButton("btnFilterReset", getBadgerTranslation2('dataGrid', 'resetFilter'), "dataGridAccount{$accountID}.filter.resetFilterFields(['title','amount','valutaDate','categoryId'])", "Widgets/cancel.gif"); $formAction = "javascript:dataGridAccount{$accountID}.filter.setFilterFields(['title','amount','valutaDate','categoryId'])"; eval('$filterContent = "' . $tpl->getTemplate('Account/StandardFilter') . '";'); $standardFilter = $widgets->addTwistieSection("Filter", $filterContent); // DataGrid $btnNewFinished = $widgets->createButton("btnNewFinished", getBadgerTranslation2('accountTransaction', 'newFinishedTrans'), "dataGridAccount{$accountID}.callNewEvent('type=finished')", "Account/finished_transaction_new.gif"); $btnNewPlanned = $widgets->createButton("btnNewPlanned", getBadgerTranslation2('accountTransaction', 'newPlannedTrans'), "dataGridAccount{$accountID}.callNewEvent('type=planned')", "Account/planned_transaction_new.gif"); $btnEdit = $widgets->createButton("btnEdit", getBadgerTranslation2('dataGrid', 'edit'), "dataGridAccount{$accountID}.callEditEvent()", "Widgets/table_edit.gif"); $btnDelete = $widgets->createButton("btnDelete", getBadgerTranslation2('dataGrid', 'delete'), "dataGridAccount{$accountID}.callDeleteEvent()", "Widgets/table_delete.gif"); $btnShowPlannedTransactions = $widgets->createButton("btnShowPlannedTransactions", getBadgerTranslation2('accountOverview', 'showPlannedTrans'), "location.href = location.href.replace(/AccountOverview\\.php/, 'AccountOverviewPlanned.php');", "Account/planned_transaction.png"); $btnGotoToday = $widgets->createButton("btnGotoToday", getBadgerTranslation2('dataGrid', 'gotoToday'), "dataGridAccount{$accountID}.gotoToday()", "Widgets/dataGrid/goto.gif"); $dgHtml = $dataGrid->writeDataGrid(); $legend = getBadgerTranslation2('dataGrid', 'legend'); $finishedTransactionText = getBadgerTranslation2('Account', 'finishedTransaction'); $finishedTransactionImage = $widgets->addImage('Account/finished_transaction.png', 'title="' . $finishedTransactionText . '"'); $finishedTransferalSourceTransactionText = getBadgerTranslation2('Account', 'FinishedTransferalSourceTransaction'); $finishedTransferalSourceTransactionImage = $widgets->addImage('Account/finished_transferal_source_transaction.png', 'title="' . $finishedTransferalSourceTransactionText . '"'); $finishedTransferalTargetTransactionText = getBadgerTranslation2('Account', 'FinishedTransferalTargetTransaction'); $finishedTransferalTargetTransactionImage = $widgets->addImage('Account/finished_transferal_target_transaction.png', 'title="' . $finishedTransferalTargetTransactionText . '"'); $plannedTransactionText = getBadgerTranslation2('Account', 'plannedTransaction'); $plannedTransactionImage = $widgets->addImage('Account/planned_transaction.png', 'title="' . $plannedTransactionText . '"'); $plannedTransferalSourceTransactionText = getBadgerTranslation2('Account', 'PlannedTransferalSourceTransaction'); $plannedTransferalSourceTransactionImage = $widgets->addImage('Account/planned_transferal_source_transaction.png', 'title="' . $plannedTransferalSourceTransactionText . '"'); $plannedTransferalTargetTransactionText = getBadgerTranslation2('Account', 'PlannedTransferalTargetTransaction'); $plannedTransferalTargetTransactionImage = $widgets->addImage('Account/planned_transferal_target_transaction.png', 'title="' . $plannedTransferalTargetTransactionText . '"'); eval('echo "' . $tpl->getTemplate('Account/AccountOverview') . '";'); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";"); require_once BADGER_ROOT . "/includes/fileFooter.php";
/* * ____ _____ _____ ______ _____ *| _ \ /\ | __ \ / ____| ____| __ \ *| |_) | / \ | | | | | __| |__ | |__) | *| _ < / /\ \ | | | | | |_ | __| | _ / *| |_) / ____ \| |__| | |__| | |____| | \ \ *|____/_/ \_\_____/ \_____|______|_| \_\ * Open Source Financial Management * Visit http://www.badger-finance.org * **/ define("BADGER_ROOT", ".."); require_once BADGER_ROOT . "/includes/fileHeaderFrontEnd.inc.php"; $tpl->addCSS("style.css"); $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $accountOverview = getBadgerTranslation2('accountAccount', 'pageTitleOverview'); $categoryOverview = getBadgerTranslation2('accountCategory', 'pageTitleOverview'); $statistics = getBadgerTranslation2('statistics', 'pageTitle'); $backup = getBadgerTranslation2('importExport', 'askTitle'); $userPrefrences = getBadgerTranslation2('UserSettingsAdmin', 'title'); $widgets->addNavigationHead(); echo $tpl->getHeader("Badger"); $Modul1 = "<a href='" . BADGER_ROOT . "/modules/account/AccountManagerOverview.php'>{$accountOverview}</a>"; $Modul2 = "<a href='" . BADGER_ROOT . "/modules/account/CategoryManagerOverview.php'>{$categoryOverview}</a>"; $Modul3 = "<a href='" . BADGER_ROOT . "/modules/statistics/statistics.php'>{$statistics}</a>"; $Modul4 = "<a href='" . BADGER_ROOT . "/modules/importExport/importExport.php?mode=export'>{$backup}</a>"; $Modul5 = "<a href='" . BADGER_ROOT . "/core/UserSettingsAdmin/UserSettingsAdmin.php'>{$userPrefrences}</a>"; eval("echo \"" . $tpl->getTemplate("badgerOverview") . "\";"); eval("echo \"" . $tpl->getTemplate("badgerFooter") . "\";");
function printInsert() { global $tpl, $us, $badgerDb; $widgets = new WidgetEngine($tpl); $widgets->addNavigationHead(); $insertTitle = getBadgerTranslation2('importExport', 'insertTitle'); $updateInfo = ''; echo $tpl->getHeader($insertTitle); $goToStartPagePreLink = getBadgerTranslation2('importExport', 'goToStartPagePreLink'); $goToStartPageLinkText = getBadgerTranslation2('importExport', 'goToStartPageLinkText'); $goToStartPagePostLink = getBadgerTranslation2('importExport', 'goToStartPagePostLink'); if (!isset($_POST['confirmUpload']) || $_POST['confirmUpload'] !== 'yes') { $insertMsg = getBadgerTranslation2('importExport', 'insertNoInsert'); } else { if (!isset($_FILES['sqlDump']) || !is_uploaded_file($_FILES['sqlDump']['tmp_name'])) { $insertMsg = getBadgerTranslation2('importExport', 'insertNoFile'); } else { $insertMsg = getBadgerTranslation2('importExport', 'insertSuccessful'); $newerVersionMsg = getBadgerTranslation2('importExport', 'newerVersion'); if (applySqlDump() === 'newerVersion') { eval(' $updateInfo = "' . $tpl->getTemplate('importExport/newerVersion') . '";'); } } } $us = new UserSettings($badgerDb); $startPageURL = getAbsoluteStartPage(); eval('echo "' . $tpl->getTemplate('importExport/insert') . '";'); eval('echo "' . $tpl->getTemplate('badgerFooter') . '";'); }
private function getTypeFilter() { foreach ($this->filter as $currentFilter) { if ($currentFilter['key'] == 'type') { return getBadgerTranslation2('Account', $currentFilter['val']); } } return false; }
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 gatherCategories($accountIds, $startDate, $endDate, $type, $summarize) { global $badgerDb; $accountManager = new AccountManager($badgerDb); $categories = array('none' => array('title' => getBadgerTranslation2('statistics', 'noCategoryAssigned'), 'count' => 0, 'amount' => new Amount(0))); foreach ($accountIds as $currentAccountId) { $currentAccount = $accountManager->getAccountById($currentAccountId); //echo 'Account: ' . $currentAccount->getTitle() . '<br />'; $currentAccount->setFilter(array(array('key' => 'valutaDate', 'op' => 'ge', 'val' => $startDate), array('key' => 'valutaDate', 'op' => 'le', 'val' => $endDate))); while ($currentTransaction = $currentAccount->getNextFinishedTransaction()) { if ($type == 'i') { if ($currentTransaction->getAmount()->compare(0) < 0) { continue; } } else { if ($currentTransaction->getAmount()->compare(0) > 0) { continue; } } if (!is_null($category = $currentTransaction->getCategory())) { if ($summarize && $category->getParent()) { $category = $category->getParent(); } if (isset($categories[$category->getId()])) { $categories[$category->getId()]['count']++; $categories[$category->getId()]['amount']->add($currentTransaction->getAmount()); } else { $categories[$category->getId()] = array('title' => $category->getTitle(), 'count' => 1, 'amount' => $currentTransaction->getAmount()); } } else { $categories['none']['count']++; $categories['none']['amount']->add($currentTransaction->getAmount()); } } } //uasort($categories, 'compareCategories'); if ($categories['none']['count'] == 0) { unset($categories['none']); } return $categories; }