require_once BADGER_ROOT . '/modules/csvImport/csvImportCommon.php'; $pageHeading = getBadgerTranslation2('importCsv', 'pageHeading'); $legend = getBadgerTranslation2('importCsv', 'legend'); //include widget functionalaty $widgets = new WidgetEngine($tpl); $widgets->addToolTipJS(); $widgets->addCalendarJS(); $widgets->addJSValMessages(); $tpl->addJavaScript('/js/prototype.js'); $tpl->addJavaScript('/js/csvImport.js'); $widgets->addNavigationHead(); echo $tpl->getHeader($pageHeading); echo $widgets->addToolTipLayer(); //create account manger object $am = new AccountManager($badgerDb); $am->setOrder(array(array('key' => 'title', 'dir' => 'asc'))); //if no Upload yet, show form if (!isset($_POST['btnSubmit'])) { if (!isset($_POST['Upload'])) { $fileLabel = $widgets->createLabel("", getBadgerTranslation2("importCsv", "selectFile") . ":", true); # widget for browse field has to be developed //$fileField = $widgets->createField("file", 50, "", "description", true); $fileField = "<input name=\"file\" type=\"file\" size=\"50\" required=\"required\" />"; $accountSelectLabel = $widgets->createLabel("accountSelect", getBadgerTranslation2("importCsv", "targetAccount") . ":", true); //get accounts $account = array(); $accountParserJS = "var accountParsers = new Array();\n"; $accountParsers = array(); while ($currentAccount = $am->getNextAccount()) { $account[$currentAccount->getId()] = $currentAccount->getTitle(); $accountParsers[$currentAccount->getId()] = $currentAccount->getCsvParser();
function getAccountsSelectArray($except = null) { global $badgerDb; $am = new AccountManager($badgerDb); $order = array(array('key' => 'title', 'dir' => 'asc')); $am->setOrder($order); $Accounts = array(); while ($account = $am->getNextAccount()) { if ($account->getId() != $except) { $Accounts[$account->getId()] = $account->getTitle(); } } return $Accounts; }