Commit 7a129dad authored by Carsten  Rose's avatar Carsten Rose
Browse files

Report.php: previous report/Db.php class replaced by qfq/Db.php class....

Report.php: previous report/Db.php class replaced by qfq/Db.php class. Implemented some isset() checks for arrays. report() seems to run in easy setup.
parent 592b3325
......@@ -139,13 +139,15 @@ class Report {
// $this->log = new Log($this->variables->get('resultArray', 'global.'));
// Create DB Class. Take care to prepare a fr_log instance.
$this->db = new Db($this->log);
//TODO implement logging
// $this->db = new Db($this->log);
// Create sendmail Class. Take care to prepare a fr_log instance.
$this->sendmail = new Sendmail($this->log);
// Setter function to emulate global variables.
$this->db->set_fr_error($this->fr_error);
//TODO implement logging
// $this->db->set_fr_error($this->fr_error);
$this->log->set_fr_error($this->fr_error);
// Iteration over Bodytext
......@@ -325,15 +327,17 @@ class Report {
* The sublevel calls the method again for a following sublevel
*
* @param int $cur_level Which level it will call [10] = level 1, [10.10] = level 2 ...
* @param string $super_level_array The Value-Array of the indexarray [0=>10, 1=>50]* @param int $counter The outer numeric Arraykey of indexarray
* @param string $super_level_array The Value-Array of the indexarray [0=>10, 1=>50]
* @param int $counter The outer numeric Arraykey of indexarray
* @return string The content that is displayed on the website
* @throws codeException
* @throws SqlReportException
* @throws SyntaxReportException
* @throws UserReportException
*/
private function triggerReport($cur_level = 1, $super_level_array = "", $counter = 0) {
private function triggerReport($cur_level = 1, array $super_level_array = array(), $counter = 0) {
$keys = array();
if ($this->fr_error["debug_level"] >= DEBUG_EXTREME) {
// T3 function: debug()
// debug(array('function' => 'triggerReport'));
......@@ -344,9 +348,18 @@ class Report {
$rowTotal = 0;
// CurrentLevel "10.10.50"
$full_level = implode(".", $this->indexArray[$counter]);
if (isset($this->indexArray[$counter]) && is_array($this->indexArray[$counter])) {
$full_level = implode(".", $this->indexArray[$counter]);
} else {
$full_level = '';
}
// Superlevel "10.10"
$full_super_level = implode(".", $super_level_array);
if (isset($super_level_array) && is_array($super_level_array)) {
$full_super_level = implode(".", $super_level_array);
} else {
$full_super_level = '';
}
//condition1: indexArray
//condition2: full_level == Superlevel (but at the length of the Superlevel)
......@@ -354,12 +367,18 @@ class Report {
//True: The cur_level is a subquery -> continue
if ($cur_level != count($this->indexArray[$counter])) {
$full_level = implode(".", $this->indexArray[++$counter]);
++$counter;
if (isset($this->indexArray[$counter]) && is_array($this->indexArray[$counter])) {
$full_level = implode(".", $this->indexArray[$counter]);
} else {
$full_level = '';
}
continue;
}
// Set dbAlias if one is specified. Else keep the parent one.
$this->dbAlias = $this->getValueParentDefault("db", $full_super_level, $full_level, $cur_level, DB);
//TODO dbAlias
// $this->dbAlias = $this->getValueParentDefault("db", $full_super_level, $full_level, $cur_level, DB);
// Set debug, if one is specified else keep the parent one.
$lineDebug = $this->getValueParentDefault("debug", $full_super_level, $full_level, $cur_level, 0);
......@@ -370,7 +389,8 @@ class Report {
$this->fr_error["full_level"] = $full_level . ".sql";
// Setter function to emulate global variables
$this->db->set_fr_error($this->fr_error);
//TODO implement logging
// $this->db->set_fr_error($this->fr_error);
$this->log->set_fr_error($this->fr_error);
// Debug
......@@ -381,9 +401,6 @@ class Report {
// Do form ?
if (isset($this->frArray[$full_level . "." . "form"])) {
// Disable Typo3 Cache for this page to avoid problems with the session array / ajax
//TODO: Is this still necessary?
// $GLOBALS["TSFE"]->set_no_cache();
// Trigger 10.form, 20.form...
// Use the form passed by URL via hash
......@@ -437,7 +454,8 @@ class Report {
//Execute SQL. All errors have been already catched.
unset($result);
$this->db->doQueryKeys($this->dbAlias, $sql, $result, $keys, ROW_REGULAR, MERGE_NONE, MYSQL_NUM);
// $this->db->doQueryKeys($this->dbAlias, $sql, $result, $keys, ROW_REGULAR, MERGE_NONE, MYSQL_NUM);
$result = $this->db->sqlKeys($sql, $keys);
// If an array is returned, $sql was a query, otherwise an 'insert', 'update', 'delete', ...
// Query: total nummber of rows
......@@ -513,7 +531,12 @@ class Report {
$content .= $this->variables->doVariables($this->frArray[$full_level . "." . "althead"]);
}
$full_level = implode(".", $this->indexArray[++$counter]);
++$counter;
if (isset($this->indexArray[$counter]) && is_array($this->indexArray[$counter])) {
$full_level = implode(".", $this->indexArray[$counter]);
} else {
$full_level = '';
}
}
return $content;
......@@ -600,7 +623,8 @@ class Report {
$this->fr_error["columnIndex"] = $ii; // Debugging Information
// Setter Function to emulate global variables.
$this->db->set_fr_error($this->fr_error);
//TODO implement logging
// $this->db->set_fr_error($this->fr_error);
$this->log->set_fr_error($this->fr_error);
$tmp = $this->renderColumn($ii, $keys[$ii], $row[$ii], $full_level, $rowIndex, $show);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment