/** * Display a form with list of available databases */ function DatabaseSelectionListForm() { global $page; global $dbase; global $newdb; global $login; global $successInstall; $page->FormStart(array('step' => GetNextStep(STEP_DBSELECT))); $page->StartTable(2, array('class' => 'dblist')); $dblist = $dbase->GetDatabaseList(); foreach ($dblist as $idx => $db) { // $optional : Additional attributes to the <input> tag // $divClass : Added class value to the <div> that contains the <input> $optional = array(); $divClass = ''; // If a database has been selected, make this radiobox checked if ($db['name'] == $login['database']) { $optional[0] = 'checked'; } # numeric keys are ignored in HtmlMaker // If however, the $newdb is in the list - it was just inserted, // then highlight that database as newly created database if ($newdb && $newdb == $db['name']) { $divClass = 'newdb'; } // If this database has successful installation, highlight it // as successful or approved database if (in_array($db['name'], $successInstall)) { // if this IF-statement validates to true, then the database was // JUST created but still marked as "successful installation". That // can ONLY happen if the user installs tables on a database, then // drops it using another tool and creates it again here if (strlen($divClass) > 0) { $divClass .= ' installdone'; } else { $divClass = 'installdone'; } // The current database is removed from $successInstall, which // indicates that at the end of this foreach, $successInstall // should be empty - meaning all successfully installed databases // do in fact exist. If $successInstall has any elements left when // this foreach is done - then remove those databases from sessions! $key = array_search($db['name'], $successInstall); unset($successInstall[$key]); } // The name caption of the database is formed in html $caption = $db['name'] . ' ' . $page->Discrete('(' . $db['tbcount'] . ')'); // Add a radio box for this database $page->FormRadiobox($db['name'], 'database', $caption, $optional, $divClass); // Get the data from HTML queue back, and add the HTML 'values' // from the returned queue item array into a table $html = $page->PopQueue(); $page->AddTableData($html); } $page->EndTable(); // If there are some elements left in $successInstall, then those databases // do not exist and there cannot be a successfull installation on a database // that does not exist - sessions need to be updated if (count($successInstall) > 0) { foreach ($successInstall as $database) { RemoveDatabaseInstallStatus($database); } } $page->FormButton('Back', array('step' => GetPrevStep(STEP_DBSELECT))); $page->FormSubmit('Next'); $page->FormClose(); }
$page->FormRadiobox($db['name'], 'database', $caption, $optional, $divClass); // Get the data from HTML queue back, and add the HTML 'values' // from the returned queue item array into a table $html = $page->PopQueue(); $page->AddTableData($html); } $page->EndTable(); // If there are some elements left in $successInstall, then those databases // do not exist and there cannot be a successfull installation on a database // that does not exist - sessions need to be updated if(count($successInstall) > 0) { foreach($successInstall as $database) RemoveDatabaseInstallStatus($database); } $page->FormButton('Back', array('step'=>GetPrevStep(STEP_DBSELECT))); $page->FormSubmit('Next'); $page->FormClose(); } // There are no detected databases - getting the list of databases might // be denied so offer the user to type in the name of the database directly else { $page->Label('Database list:'); // If database error messages should be displayed $error = $dbase->GetDatabaseError();