/** Gets a list of units sorted by system */ function getAllUnits() { global $db_table_units, $alpha_sort_units, $DB_LINK, $LangUI; $localUnits = array(); $unitSystem = Units::getLocalSystem(); $localIDs = Units::getLocalUnitIDs($unitSystem); // Select all of the units from the database $sql = "SELECT unit_id,unit_desc FROM {$db_table_units} ORDER BY unit_order"; $rc = $DB_LINK->Execute($sql); DBUtils::checkResult($rc, NULL, $LangUI->_('There was an error selecting the unit_id'), $sql); while (!$rc->EOF) { $id = $rc->fields['unit_id']; $localUnits[$id] = $rc->fields['unit_desc']; $rc->MoveNext(); } // Returns an associative array with id->desc return $localUnits; }