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 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']) || getGPC($_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 = BADGER_ROOT . '/' . $us->getProperty('badgerStartPage'); eval('echo "' . $tpl->getTemplate('importExport/insert') . '";'); eval('echo "' . $tpl->getTemplate('badgerFooter') . '";'); }
/** * 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 $badgerDb; $us = new UserSettings($badgerDb); $tpl = new TemplateEngine($us, BADGER_ROOT); $widgets = new WidgetEngine($tpl); $currentLanguage = $us->getProperty('badgerLanguage'); $result = array(); switch ($this->type) { case 'transaction': $this->fetchTransactions(); $sum = new Amount(); foreach ($this->finishedTransactions as $currentTransaction) { $sum->add($currentTransaction->getAmount()); $result[] = array('transactionId' => $currentTransaction->getId(), 'type' => $widgets->addImage($currentTransaction->getType() == 'FinishedTransaction' ? 'Account/finished_transaction.png' : 'Account/planned_transaction.png', 'title="' . getBadgerTranslation2('Account', $currentTransaction->getType()) . '"'), 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'valutaDate' => ($tmp = $currentTransaction->getValutaDate()) ? $tmp->getFormatted() : '', 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : '', 'sum' => $sum->getFormatted()); } break; case 'finished': while ($this->fetchNextFinishedTransaction()) { } foreach ($this->finishedTransactions as $currentTransaction) { $result[] = array('finishedTransactionId' => $currentTransaction->getId(), 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'valutaDate' => ($tmp = $currentTransaction->getValutaDate()) ? $tmp->getFormatted() : '', 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : '', 'exceptional' => is_null($tmp = $currentTransaction->getExceptional()) ? '' : $tmp, 'periodical' => is_null($tmp = $currentTransaction->getPeriodical()) ? '' : $tmp); } break; case 'planned': while ($this->fetchNextPlannedTransaction()) { } foreach ($this->plannedTransactions as $currentTransaction) { $result[] = array('plannedTransactionId' => 'p' . $currentTransaction->getId() . '_X', 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'beginDate' => $currentTransaction->getBeginDate()->getFormatted(), 'endDate' => ($tmp = $currentTransaction->getEndDate()) ? $tmp->getFormatted() : '', 'repeatUnit' => getBadgerTranslation2('Account', $currentTransaction->getRepeatUnit()), 'repeatFrequency' => $currentTransaction->getRepeatFrequency(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : ''); } break; } return $result; }
*| |_) | / \ | | | | | __| |__ | |__) | *| _ < / /\ \ | | | | | |_ | __| | _ / *| |_) / ____ \| |__| | |__| | |____| | \ \ *|____/_/ \_\_____/ \_____|______|_| \_\ * Open Source Financial Management * Visit http://www.badger-finance.org * **/ define("BADGER_ROOT", ".."); require_once BADGER_ROOT . "/includes/fileHeaderBackEnd.inc.php"; //require_once(BADGER_ROOT . "/core/UserSettings.class.php"); // sollte das nicht auch in die Includes?? header('Content-Type: text/javascript'); $badgerRoot = $_GET['badgerRoot']; //we need this bagerRoot for images path $settings = new UserSettings($badgerDb); $badgerTemplate = $settings->getProperty("badgerTemplate"); //We do our best to get this cached //header('Cache-Control: public'); //header('Expires: ' . date('r', time() + 24 * 60 * 60)); ?> // written by Tan Ling Wee // last updated 28 July 2003 // email : info@sparrowscripts.com // modified by ALQUANTO 30 July 2003 - german language included. // - modified languageLogic with the ISO-2letter-strings // - changes in in showCalendar: defaultLanguage is already set... // - js and html corrected... more xhtml-compliant... simplier css // email: popcalendar@alquanto.de // // modified by PinoToy 25 July 2003 - new logic for multiple languages (English, Spanish and ready for more).
* ____ _____ _____ ______ _____ *| _ \ /\ | __ \ / ____| ____| __ \ *| |_) | / \ | | | | | __| |__ | |__) | *| _ < / /\ \ | | | | | |_ | __| | _ / *| |_) / ____ \| |__| | |__| | |____| | \ \ *|____/_/ \_\_____/ \_____|______|_| \_\ * Open Source Financial Management * Visit http://www.badger-finance.org * **/ define("BADGER_ROOT", "../.."); require_once BADGER_ROOT . "/includes/fileHeaderFrontEnd.inc.php"; require_once BADGER_ROOT . '/core/UserSettings.class.php'; $us = new UserSettings($badgerDb); try { echo $us->getProperty('password') . "<br />\n"; } catch (BadgerException $ex) { echo "Exception!" . "<br />\n"; } // set test 2 $us->setProperty('password', 'Hans'); echo $us->getProperty('password') . "<br />\n"; $us->setProperty('password', 'Paul'); echo $us->getProperty('password') . "<br />\n"; // set $us->setProperty('123', 'Haus'); echo $us->getProperty('123') . "<br />\n"; // del $us->delProperty('123'); try { echo $us->getProperty('123') . "<br />\n";
/** * 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 $badgerDb; $us = new UserSettings($badgerDb); $tpl = new TemplateEngine($us, BADGER_ROOT); $widgets = new WidgetEngine($tpl); $currentLanguage = $us->getProperty('badgerLanguage'); while ($this->fetchNextCategory()) { } $this->sortCategories(); $result = array(); 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 = 'title="' . getBadgerTranslation2('CategoryManager', 'outsideCapital') . '"'; } else { $image = "Account/{$currentLanguage}/own_capital.png"; $tooltip = 'title="' . getBadgerTranslation2('CategoryManager', 'ownCapital') . '"'; } $result[] = array('categoryId' => $currentCategory->getId(), 'title' => $title, 'description' => $currentCategory->getDescription(), 'outsideCapital' => $widgets->addImage($image, $tooltip), 'parentId' => $parentId, 'parentTitle' => $parentTitle); } return $result; }
/** * function initDataGridJS () */ public function initDataGridJS() { global $badgerDb; global $tpl; $us = new UserSettings($badgerDb); if ($this->discardSelectedRows == true) { $this->discardSelectedRows = "true"; } else { $this->discardSelectedRows = "false"; } $this->tpl->addJavaScript('js/dataGrid.js'); //add global variable dataGrid'.$this->UniqueId.' $this->tpl->addHeaderTag('<script>dataGrid' . $this->UniqueId . ' = new Object()</script>'); $this->tpl->addOnLoadEvent('badgerRoot = "' . $tpl->getBadgerRoot() . '";'); $this->tpl->addOnLoadEvent('dataGrid' . $this->UniqueId . ' = new DataGrid( {'); $this->tpl->addOnLoadEvent(' uniqueId: "' . $this->UniqueId . '",'); $this->tpl->addOnLoadEvent(' sourceXML: "' . $this->sourceXML . '",'); $this->tpl->addOnLoadEvent(' headerName: new Array("' . implode('","', $this->headerName) . '"),'); $this->tpl->addOnLoadEvent(' columnOrder: new Array("' . implode('","', $this->columnOrder) . '"),'); $this->tpl->addOnLoadEvent(' headerSize: new Array(' . implode(',', $this->headerSize) . '),'); $this->tpl->addOnLoadEvent(' cellAlign: new Array("' . implode('","', $this->cellAlign) . '"),'); $this->tpl->addOnLoadEvent(' noRowSelectedMsg: "' . $this->noRowSelectedMsg . '",'); $this->tpl->addOnLoadEvent(' deleteMsg: "' . $this->deleteMsg . '",'); $this->tpl->addOnLoadEvent(' deleteRefreshType: "' . $this->deleteRefreshType . '",'); $this->tpl->addOnLoadEvent(' deleteAction: "' . $this->deleteAction . '",'); $this->tpl->addOnLoadEvent(' editAction: "' . $this->editAction . '",'); $this->tpl->addOnLoadEvent(' newAction: "' . $this->newAction . '",'); $this->tpl->addOnLoadEvent(' discardSelectedRows: ' . $this->discardSelectedRows . ','); $this->tpl->addOnLoadEvent(' loadingMessage: "' . $this->LoadingMessage . '",'); try { $dgParameter = $us->getProperty('dgParameter' . $this->UniqueId); } catch (BadgerException $e) { } if (isset($dgParameter)) { $this->tpl->addOnLoadEvent(' parameter: "' . $dgParameter . '",'); } $this->tpl->addOnLoadEvent(' tplPath: "' . BADGER_ROOT . '/tpl/' . $this->tpl->getThemeName() . '/Widgets/dataGrid/"'); $this->tpl->addOnLoadEvent('});'); $this->tpl->addOnLoadEvent('$("dataGrid' . $this->UniqueId . '").obj = dataGrid' . $this->UniqueId . ';'); //$this->tpl->addOnLoadEvent('dataGrid'.$this->UniqueId.'.htmlDiv = $("dataGrid'.$this->UniqueId.'");'); $this->tpl->addOnLoadEvent('Behaviour.register(dataGrid' . $this->UniqueId . '.behaviour);'); $this->tpl->addOnLoadEvent('Behaviour.apply();'); $this->tpl->addOnLoadEvent('Event.observe($("dataGrid' . $this->UniqueId . '"), \'keypress\', dataGrid' . $this->UniqueId . '.KeyEvents, false);'); //TODO: find a solution that's working with multiple datagrids //$this->tpl->addOnLoadEvent('Event.observe(window, \'unload\', dataGrid'.$this->UniqueId.'.saveSelectedRows, false);'); //$this->tpl->addOnLoadEvent('window.addEventListener(\'unload\', dataGrid'.$this->UniqueId.'.saveSelectedRows, false);'); }