public function view() { $this->registry->template->form_heading = 'My Form'; $this->registry->template->form_content = 'This is the form title'; $codes = $this->registry->db->getDepartmentCodes(); $this->registry->template->set = $codes; $this->registry->template->footer = writeFooter(); $this->registry->template->show('form_view'); }
$quantity = $row['rQuantity']; echo "<tr>\n\t\t\t\t\t\t\t <td>{$date}</td>\n\t\t\t\t\t\t\t <td>{$id}</td>\n\t\t\t\t\t\t\t <td>{$item}</td>\n\t\t\t\t\t\t\t <td>{$quantity}</td>\n\t\t\t\t\t\t\t <td><a href=\"updateReceivedForm.php?rId={$id}\" >{$dateModified}</a></td>\n\t\t\t\t\t\t </tr>"; } echo "<tr><td colspan=\"5\"><a href=\"display.php?type=received&status=all\">Display All</a></td></tr>"; } if ($type == 'Issued') { echo "<div >\n\t\t\t\t\t\t<p> Refine your Search : </p>\n\t\t\t\t\t\t<form method=\"post\" action=\"refine.php?type=given\" class=\"Refine\">\n\t\t\t\t\t\t<table id=\"refine\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>From : </td>\n\t\t\t\t\t\t\t\t<td><input id=\"date\" name=\"date\" onMouseOver=\"init()\" /></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>To : </td>\n\t\t\t\t\t\t\t\t<td><input id=\"date1\" name=\"date1\" onMouseOver=\"init()\" /></td>\n\t\t\t\t\t\t\t</tr> \n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td colspan=\"2\"><input type=\"submit\" name=\"SUBMIT\" id=\"SUBMIT\" value=\"Search\"/></td>\n\t\t\t\t\t\t</table> \n\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>"; if ($_GET['status'] == 'lessStock') { echo "<p class=\"heading\">Not Enough Stock Available</p>"; } echo "<table class=\"addform\" cellpadding=\"2\" cellspacing=\"2\" width=\"650\" align=\"center\">\n\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t <td>Date</td>\n\t\t\t\t\t\t <td>Issued ID</td>\n\t\t\t\t\t\t <td>Item Name</td>\n\t\t\t\t\t\t <td>Quantity</td>\n\t\t\t\t\t\t <td>Given To</td>\n\t\t\t\t\t\t <td>Lab</td>\n\t\t\t\t\t\t <td>Date Last Modified</td>\n\t\t\t\t\t </tr>"; while ($row = mysql_fetch_array($result)) { $id = $row['gId']; $date = new DateTime($row['gDate']); $date = $date->format('d-m-Y'); $item = $row['iName']; $dateModified = $row['dateAdded']; $quantity = $row['gQuantity']; $gto = $row['gTo']; $glab = $row['gLab']; echo "<tr>\n\t\t\t\t\t\t\t <td>{$date}</td>\n\t\t\t\t\t\t\t <td>{$id}</td>\n\t\t\t\t\t\t\t <td>{$item}</td>\n\t\t\t\t\t\t\t <td>{$quantity}</td>\n\t\t\t\t\t\t\t <td>{$gto}</td>\n\t\t\t\t\t\t\t <td>{$glab}</td>\n\t\t\t\t\t\t\t <td><a href=\"updateGivenForm.php?gid={$id}\" >{$dateModified}</a></td>\n\t\t\t\t\t\t </tr>"; } echo "<tr><td colspan=\"7\"><a href=\"display.php?type=given&status=all\">Display All</a></td></tr>"; } ?> </table> <?php writeFooter(); ?>
} else { $sortDir = "ASC"; } $db = login(); $selfUrl = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"]; $msg = ""; writeHeader("Building session- build new session", "secure", $msg); wizardHeader(2); //echo "<p><font size=+1><a href=\"selectExistingSession.php?table=sessions&returnURL=".urlencode($selfUrl)."&returnIdName=sessionId\">Select existing session</a>\n"; //echo " or add a new session:\n</font></p>"; $idStr = '<a href="buildSession3.php?studyId=' . $studyId . '&sessionId=<ID>"><ID></a>'; $sortbyStr = '<a href="' . selfURL() . '?table=' . $table . '&studyId=' . $studyId . '&sortDir=<DIR2>&sortBy=<ID>"><ID><DIR></a>'; if ($sortBy == "") { // Default sort $sortBy = 'id'; } $displaySummary = 1; echo "<p><font size=+1><b>Select from the following existing sessions:</b></font></p>"; //tableText = displayTable($db, $table, $idStr, "WHERE primaryStudyID=".$studyId, 0, $displaySummary, "", $studyId, $subjectId, $sessionId, "", "", "", ""); $tableText = displayTable($db, $table, $idStr, "WHERE primaryStudyID=" . $studyId, 0, $displaySummary, "", $studyId, 0, $sessionId, $sortbyStr, $sortBy, $sortDir, ""); if ($tableText != "") { echo $tableText; } else { echo "<p class=error>No entries found for studyid=" . $studyId . ".</p>\n"; echo "<p><a href=buildSession2.php?studyId=" . $studyId . ">Back to previous page</a></p>\n"; } //echo "<p><a href=\"editTable.php?table=studies&returnURL=".urlencode($selfUrl); //echo "&returnIdName=studyId\">Select a study...</a>\n"; //echo "(Create a new one or select an existing study by clicking the id).</p>\n"; writeFooter('basic');
HEADER; require_once "XML_PullParser.inc"; $files = array(); $file = "synopsis.xml"; $xml_outfile = "XML_PullParser_contents.xml"; $html_outfile = "html_contents.html"; $handle = openOutputFile($xml_outfile); $html_handle = openOutputFile($html_outfile); writeHeader($handle); writeText($html_handle, $HTML_Header); echo "<A href = \"article2html.php?fn=synopsis.xml\">Synopsis</A><br>\n"; writeEntry($handle, "synopsis.xml", "Synopsis"); writeHTMLEntry($html_handle, "synopsis.xml", "Synopsis"); while ($file = toc($file)) { } writeFooter($handle, $xml_outfile); writeHTMLFooter($html_handle, $html_outfile); function toc($file) { global $handle, $html_handle; global $files; $tags = array("para"); $child_tags = array("ulink"); $parser = new XML_PullParser($file, $tags, $child_tags); $next_url = ""; $prev_url = ""; while ($token = $parser->XML_PullParser_getToken()) { if ($link = $parser->XML_PullParser_getElement('ulink')) { while ($link = $parser->XML_PullParser_nextElement()) { $url_array = $parser->XML_PullParser_getAttributes($link); $url = $parser->XML_PullParser_getAttrVal('url', $url_array);
$q2 = "SELECT subjects.lastName, subjects.firstName, subjects.dob, sessions.* FROM subjects, sessions WHERE sessions.subjectID = subjects.id "; if ($subjectName != "") { $subjectName = strtolower(trim($subjectName)); $subjectName = str_replace('*', '%', $subjectName); $q2 .= "AND (subjects.lastName LIKE ('%{$subjectName}%') OR subjects.firstName LIKE ('%{$subjectName}%')) "; } if (is_numeric($ageRangeLow)) { $q2 .= "AND (DATE_ADD(subjects.dob, INTERVAL " . $ageRangeLow . " YEAR) <= sessions.start) "; } if (is_numeric($ageRangeHigh)) { $q2 .= "AND (DATE_ADD(subjects.dob, INTERVAL " . $ageRangeHigh . " YEAR) >= sessions.start) "; } if ($subjectNotes != "") { $subjectNotes = strtolower(trim($subjectNotes)); $subjectNotes = str_replace('*', '%', $subjectNotes); $q2 .= "AND (subjects.notes LIKE ('%{$subjectNotes}%')) "; } $q2 .= "ORDER by sessions.id"; if (!($res = mysql_query($q2, $db))) { print "\n<p>ERROR " . mysql_error($db); exit; } $totalNumRows = mysql_num_rows($res); if ($totalNumRows > 0) { displaySearchResult($res, $int_cur_position); } else { echo "<center><h2>No result found. Try again.</h2></center>\n"; } } writeFooter("basic");
} writeText($handle, "</indexdiv>\n"); writeText($handle, "<formalpara><title></title><para><![CDATA[ <BR /> ]]></para></formalpara>"); writeText($handle, "\n<indexdiv><title>Index of Variables and Terms</title>\n"); ksort($glossary); foreach ($glossary as $term => $val) { $val = array_unique($val); $citation_str = ""; foreach ($val as $index) { $citation_str .= formatSectionCitations($file_names[$index]); } $citation_str = rtrim($citation_str, ','); writeEntry($handle, $term, $citation_str, "varname"); } writeText($handle, "</indexdiv>"); writeFooter($handle); // -------------------END MAIN ------------------------- function get_array() { XML_PullParser_excludeBlanks(true); XML_PullParser_trimCdata(true); global $doc, $fn_names; $tags = array("simplelist"); $child_tags = array('member'); $parser = new XML_PullParser_doc($doc, $tags, $child_tags); while ($token = $parser->XML_PullParser_getToken()) { $parser->XML_PullParser_getElement('member'); $which = 1; while ($member = $parser->XML_PullParser_getText('member', $which)) { if (preg_match('/XML_PullParser(_\\w+)\\W/', $member, $matches)) { $fn_names[$matches[1]] = array();
public static function getResponse($request) { require_once 'web/header.inc'; require_once 'web/page.inc'; require_once 'web/footer.inc'; require_once 'template/TemplateManager.php'; //inizio il conteggio delle query require_once 'session.php'; Session::initializeQueryCounter(); self::$user = Session::getUser(); $data = self::elaborateRequest($request); if (self::$requestedObject == "Login") { self::redirect(""); } else { if (self::$requestedObject == "Logout") { Session::destroy(); self::redirect(""); } } $default = TemplateManager::getDefaultTemplate(); $parser = null; $tentativi = 0; while (is_numeric($parser) || is_null($parser)) { $template = TemplateManager::getTemplateForRequest(self::$requestedObject, self::$currentID, self::$requestedAction); if (is_numeric($parser) || is_null($template) || $template === false) { $template = $default; } if ($tentativi == 1) { echo "<h3>ERRORE IN " . $template . "</h3>"; } if ($tentativi == 2) { echo "<h3>ERRORE NEL TEMPLATE DI DEFAULT</h3>"; return; } $tentativi++; $parser = TemplateParser::parseTemplate($template); //echo "<p>" . serialize(is_numeric($parser)) . "</p>"; //DEBUG } //echo "parser creato: " . serialize($parser) . "<br />"; //DEBUG $css = array(); $js = array(); $title = self::titleForRequest($request); $cols_stack = array(); $write_h = false; $write_f = false; $ad = false; // $i=0; //DEBUG while ($el = $parser->nextElement()) { // if($i==10) //DEBUG // return; //DEBUG // $i++; //DEBUG $id = null; $class = null; switch ($el["tag"]) { case "TEMPLATE": break; case "HEAD": if ($el["type"] != "close") { continue; } writeHeader($title, $css, $js); break; case "STYLESHEET": if (isset($el["attributes"]["CSS"])) { $c = $el["attributes"]["CSS"]; if ($c != "default/default") { $css[] = $c; } } break; case "JS": if (isset($el["attributes"]["SRC"])) { $js[] = $el["attributes"]["SRC"]; } break; case "HEADER": $write_h = true; if ($el["type"] == "close") { writePageHeader(self::$user, $ad); $write_h = false; } break; case "FOOTER": $write_f = true; if ($el["type"] == "close" || $el["type"] == "complete") { writePageFooter(null, $ad); $write_f = false; } break; case "AD": if ($write_h || $write_f) { $ad = true; } else { $style = "default"; if (isset($el["attributes"]["STYLE"])) { $style = $el["attributes"]["STYLE"]; } writeAD($style); } break; case "CONTENT": $id = "content"; case "COL": //echo "<p>element: " . serialize($el) . "</p>"; //DEBUG //echo "<p>element: " . serialize($el) . "</p>"; //DEBUG case "DIV": //echo "<p>element: " . serialize($el) . "</p>"; //DEBUG if ($el["type"] == "open" || $el["type"] == "complete") { if (isset($el["attributes"]["COLS"])) { $cols_stack[] = $el["attributes"]["COLS"]; } else { $cols_stack[] = 1; } if (isset($el["attributes"]["ID"])) { $id = $el["attributes"]["ID"]; } if (isset($el["attributes"]["CLASS"])) { $class = $el["attributes"]["CLASS"]; } opendiv($class, $id); } if (isset($el["value"]) && $el["value"] != "\n") { self::evaluateText($el["value"], $data); } if ($el["type"] == "close" || $el["type"] == "complete") { if ($el["type"] == "close") { unset($cols_stack[count($cols_stack) - 1]); } closediv(); } break; } //echo "<p style='color:red;'>element: " . $el["tag"] . "</p>"; //DEBUG } writeFooter(); }