function showSummary($query) { global $db_conn; print '<table align="center" border="1">'; // print table column headers $tableHeaders = array("id", "Name", "Phone #", "Email", "Points", "Details"); writeTableHeader($tableHeaders); // retrieve all data from the database to be displayed $result = $db_conn->query($query); if ($result == true) { $result->data_seek(0); while ($row = $result->fetch_assoc()) { $id = $row[tcCustomer::$custIdStr]; $fname = $row[tcCustomer::$fnameStr]; $lname = $row[tcCustomer::$lnameStr]; $phone = $row[tcCustomer::$phoneStr]; $email = $row[tcCustomer::$emailStr]; $totalPtrs = tcVisits::getTotalPointsById($db_conn, $id); writeTRBegin(); writeTD('<a href="' . 'editcustomer.php?custId=' . $id . '">' . $id . '</a>'); writeTDArray(array("{$fname} {$lname}", $phone, $email)); writeTD($totalPtrs, "right"); writeTD('<a href="' . 'showdetails.php?custId=' . $id . '">Details</a>'); writeTREnd(); } $result->free(); } else { exit("Unable to access the database."); } print "</table>"; }
public function showDetailTable() { print '<table align="center" border="1">'; // write the table header information writeTableHeader(array("Name", "Phone", "Email", "Date", "Points")); // write the table row to the web page writeTRBegin(); writeTDArray(array("{$this->fname} {$this->lname}", $this->phone, $this->email)); print '<td colspan=2></td>'; writeTREnd(); $visits = new tcVisits($this->custId, $this->db_conn); $visits->initVisits(); $numVisits = count($visits->visits); // NOTE: rowspan number has to plus 2 for unknown reason print '<td colspan=3 rowspan=' . ($numVisits + 2) . '></td>'; for ($i = 0; $i < $numVisits; ++$i) { writeTRBegin(); writeTD($visits->visits[$i]->dtime); writeTD($visits->visits[$i]->point, "right"); writeTREnd(); } $totalPtrs = tcVisits::getTotalPointsById($this->db_conn, $this->custId); writeTRBegin(); writeTD("Balance:"); writeTD($totalPtrs, "right"); writeTREnd(); print '</table>'; }
function wikiToHtml(&$session, $wiki_text) { $lines = explode("\n", $wiki_text); $session->trace(TC_Util1, 'wikiToHtml: ' . (0 + count($lines)) . ' Zeilen' . "({$lines['0']})"); $status = new LayoutStatus($session); foreach ($lines as $ii => $line) { if (($line_trimmed = trim($line)) == '') { writeParagraphEnd($status); } else { #$session->trace (TC_X, "Neue Zeile: '$line_trimmed' $line]"); if ($line_trimmed == '[code]') { $session->startCode(); } elseif ($line_trimmed == '[/code]') { $session->finishCode(); } elseif ($session->fPreformated) { echo htmlentities($line); } else { switch (substr($line, 0, 1)) { case '!': if (substr($line, 1, 1) == '|') { writeTableHeader($line, $status); } else { writeHeader($line, $status); } break; case ' ': writeLine($line, $status); break; # writeIndent ($line, $status); break; # writeIndent ($line, $status); break; case '*': writeUList($line, $status); break; case '#': writeOrderedList($line, $status); break; case '|': writeTable($line, $status); break; case '-': writeHoricontalLine($line, $status); break; default: writeLine($line, $status); break; } } } } // foreach $session->trace(TC_Util1, 'wikiToHtml-Ende'); }
function wikiToHtml(&$session, $wiki_text) { $lines = explode("\n", $wiki_text); $session->trace(TC_Util1, 'wikiToHtml: ' . (0 + count($lines)) . ' Zeilen' . "({$lines['0']})"); $status = new LayoutStatus($session); $last_linetype = ''; foreach ($lines as $ii => $line) { $start_code = false; if (!$status->fPreformatted && ($line_trimmed = trim($line)) == '') { $last_linetype = ''; $status->changeOfLineType($last_linetype, ''); } else { $linetype = $status->fPreformatted ? '[' : substr($line, 0, 1); switch ($linetype) { case '-': $count = countRepeats($line, '-'); if ($count < 4) { $linetype = 'x'; } break; case '[': if (strpos($line, 'code]') == 1) { $start_code = true; } elseif (strpos($line, '/code]') == 1) { $status->finishCode(); $last_linetype = 'x'; $line = $line_trimmed = substr($line, 7); $session->trace(TC_Util2, 'wikiToHtml: /code-Restzeile: ' . $line); } else { $linetype = 'x'; } break; case '!': case ';': case '*': case '#': case '|': break; default: $linetype = 'x'; break; } $last_linetype = $status->testChangeOfLineType($last_linetype, $linetype); switch ($linetype) { case '!': if (strpos($line, '|') != 1) { writeHeader($line, $status); } else { writeTableHeader($line, $status); $last_linetype = '|'; } break; case '[': if ($start_code) { $status->startCode(); } $line = substr($line_trimmed, 6); if (!empty($line)) { writeLine($line, $status); } break; case ';': writeIndent($line, $status); break; case '*': writeUList($line, $status); break; case '#': writeOrderedList($line, $status); break; case '|': writeTable($line, $status); break; case '-': guiLine($status->fSession, $count - 3); break; default: writeLine($line, $status); break; } } } // foreach if ($status->fPreformatted) { $session->trace(TC_Warning, PREFIX_Warning . '[/code] fehlt'); } $session->trace(TC_Util1, 'wikiToHtml-Ende'); }