public static function makeParam($reportID, $reportParameterID) { $parm = null; $db = new DBService(); $result = $db->query("SELECT rp.*, rpm.parentReportParameterID\n FROM ReportParameter rp, ReportParameterMap rpm\n WHERE rp.reportParameterID = '{$reportParameterID}' LIMIT 1")->fetchRow(MYSQLI_ASSOC); if ($result['parameterDisplayPrompt'] === 'Provider / Publisher') { $parm = new ProviderPublisherParameter($reportID, $db, $result); } else { if ($result['parameterDisplayPrompt'] === 'Provider') { $parm = new ProviderParameter($reportID, $db, $result); } else { if ($result['parameterDisplayPrompt'] === 'Publisher') { $parm = new PublisherParameter($reportID, $db, $result); } else { if ($result['parameterTypeCode'] === 'chk') { if ($result['parameterDisplayPrompt'] === "Do not adjust numbers for use violations") { $parm = new CheckUnadjustedParameter($reportID, $db, $result); } else { $parm = new CheckboxParameter($reportID, $db, $result); } } else { if ($result['parameterTypeCode'] === 'dd') { if ($result['parameterAddWhereClause'] === 'limit') { $parm = new LimitParameter($reportID, $db, $result); } else { if ($result['parameterDisplayPrompt'] === 'Year') { $parm = new YearParameter($reportID, $db, $result); } else { if ($result['parameterDisplayPrompt'] === 'Date Range') { $parm = new DateRangeParameter($reportID, $db, $result); } else { $parm = new DropdownParameter($reportID, $db, $result); } } } } else { if ($result['parameterTypeCode'] === 'ms') { if ($result['parameterDisplayPrompt'] === 'Provider / Publisher' || $result['parameterDisplayPrompt'] === 'Provider' || $result['parameterDisplayPrompt'] === 'Publisher') { $parm = new ProviderPublisherDropdownParameter($reportID, $db, $result); } else { $parm = new MultiselectParameter($reportID, $db, $result); } } else { if ($result['parameterTypeCode'] === 'txt') { $parm = new TextParameter($reportID, $db, $result); } else { $parm = new Parameter($reportID, $db, $result); } } } } } } } return $parm; }
public function run($archiveInd, $ADD_WHERE1, $ADD_WHERE2, $orderBy) { if (stripos($this->sql, 'mus')) { $ch = 'm'; } else { $ch = 'y'; } $sql = str_replace('ADD_WHERE', "{$ADD_WHERE1} AND {$ch}" . "us.archiveInd = {$archiveInd}", str_replace('ADD_WHERE2', $ADD_WHERE2, $this->sql)) . $orderBy; $db = new DBService(Config::$database->{$this->getDBName()}); return $db->query($sql); }
</td> </tr> <tr> <td class="fullborder"><br /> <br /> <div id='div_report'> <label for="reportID"> <?php echo _("Select Report"); ?> </label> <select name='reportID' id='reportID' class='opt'> <option value=''></option> <?php // get all reports for output in drop down $db = new DBService(); foreach ($db->query("SELECT reportID, reportName FROM Report ORDER BY 2, 1")->fetchRows(MYSQLI_ASSOC) as $report) { echo "<option value='" . $report['reportID'] . "' "; if (isset($report['reportID']) && isset($_GET['reportID']) && $report['reportID'] === $_GET['reportID']) { echo 'selected'; } echo ">" . $report['reportName'] . "</option>"; } unset($db); ?> </select> </div> <div id='div_parm'> <?php if (isset($_GET['reportID'])) { $reportID = $_GET['reportID']; } else {
public function publisherNotes() { $db = new DBService(Config::$database->{$this->dbname}); return $db->query("SELECT startYear, endYear, noteText, reportDisplayName\n\t\t\t\tFROM PublisherPlatformNote pn, PublisherPlatform pp\n\t\t\t\tWHERE pp.publisherPlatformID = pn.publisherPlatformID\n\t\t\t\tAND pp.publisherPlatformID in (" . $db->sanitize(join(',', array_keys($this->pubIDs))) . ");")->fetchRows(MYSQLI_ASSOC); }
public function reportIdProvider() { $db = new DBService(); $ids = array(); foreach ($db->query("SELECT reportID FROM Report")->fetchRows(MYSQLI_ASSOC) as $report) { $ids[] = array($report['reportID']); } return $ids; }
$test_sql_file = "test_create.sql"; $sql_file = "create_tables_data.sql"; if (!file_exists($test_sql_file)) { $errorMessage[] = "Could not open sql file: " . $test_sql_file . ". If this file does not exist you must download new install files."; } else { //run the file - checking for errors at each SQL execution $f = fopen($test_sql_file, "r"); $sqlFile = fread($f, filesize($test_sql_file)); $sqlArray = explode(";", $sqlFile); //Process the sql file by statements foreach ($sqlArray as $stmt) { if (strlen(trim($stmt)) > 3) { //replace the DATABASE_NAME parameter with what was actually input $stmt = str_replace("_DATABASE_NAME_", Config::$database->name, $stmt); try { $result = $dbservice->query($stmt); } catch (RuntimeException $exception) { $errorMessage[] = $dbservice->error() . "<br /><br />For statement: " . $stmt; break; } } } } //once this check has passed we can run the entire ddl/dml script if (count($errorMessage) == 0) { if (!file_exists($sql_file)) { $errorMessage[] = "Could not open sql file: " . $sql_file . ". If this file does not exist you must download new install files."; } else { //run the file - checking for errors at each SQL execution $f = fopen($sql_file, "r"); $sqlFile = fread($f, filesize($sql_file));