function getBarangayDetails($barangayID) { $barangay = new Barangay(); $barangay->selectRecord($barangayID); if (!($domDoc = $barangay->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } }
function Main() { switch ($this->formArray["formAction"]) { // ajax method case "confirmAjax": // buildup odID list and print in template as hidden variables $this->tpl->set_block("rptsTemplate", "Run", "RunBlock"); $this->tpl->set_var("RunBlock", ""); $this->tpl->set_block("rptsTemplate", "Done", "DoneBlock"); $this->tpl->set_var("DoneBlock", ""); $this->tpl->set_block("rptsTemplate", "BarangayForm", "BarangayFormBlock"); $this->tpl->set_var("BarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxBarangayForm", "AjaxBarangayFormBlock"); $this->tpl->set_var("AjaxBarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "ConventionalConfirm", "ConventionalConfirmBlock"); $this->tpl->set_var("ConventionalConfirmBlock", ""); $barangay = new Barangay(); $barangay->selectRecord($this->formArray["barangayID"]); $this->tpl->set_var("barangayID", $this->formArray["barangayID"]); $this->tpl->set_var("barangay", $barangay->getDescription()); $message = "Run General Revision for this barangay?"; $this->tpl->set_var("message", $message); // get latestActiveRPUs for the barangay $latestActiveRPUs = $this->getLatestActiveRPUsByBarangay($this->formArray["barangayID"]); $this->tpl->set_var("latestActiveRPUs", number_format($latestActiveRPUs)); $this->tpl->set_var("countBackDays", $this->formArray["countBackDays"]); $this->tpl->set_var("countBackDaysTimeStr", $this->formArray["countBackDaysTimeStr"]); $this->tpl->set_var("userID", $this->userID); break; // old-school method // old-school method case "run": $this->tpl->set_block("rptsTemplate", "Page", "PageBlock"); $this->tpl->set_var("PageBlock", ""); $this->formArray["timerStart"] = date("F d, Y h:i:s A", strtotime("now")); $this->run($this->formArray["barangayID"]); if ($this->formArray["totalCreated"] == 0) { $this->formArray["message"] = "There were no RPUs generated through General Revision for this barangay."; } else { $this->formArray["message"] = "General Revision successfully generated for this barangay!"; } $this->tpl->set_var("barangayID", $this->formArray["barangayID"]); $this->tpl->set_var("message", $this->formArray["message"]); $this->tpl->set_var("totalArchived", $this->formArray["totalArchived"]); $this->tpl->set_var("totalCreated", $this->formArray["totalCreated"]); $this->tpl->set_var("timerStart", $this->formArray["timerStart"]); $this->tpl->set_var("timerEnd", $this->formArray["timerEnd"]); $this->tpl->set_var("progressLog", $this->formArray["progressLog"]); break; case "done": $this->tpl->set_block("rptsTemplate", "Run", "RunBlock"); $this->tpl->set_var("RunBlock", ""); $this->tpl->set_block("rptsTemplate", "Confirm", "ConfirmBlock"); $this->tpl->set_var("ConfirmBlock", ""); $this->tpl->set_block("rptsTemplate", "BarangayForm", "BarangayFormBlock"); $this->tpl->set_var("BarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxBarangayForm", "AjaxBarangayFormBlock"); $this->tpl->set_var("AjaxBarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxConfirm", "AjaxConfirmBlock"); $this->tpl->set_var("AjaxConfirmBlock", ""); $this->tpl->set_var("progressLog", $this->formArray["progressLog"]); if ($this->formArray["timerEnd"] == "") { $this->formArray["timerEnd"] = date("F d, Y h:i:s A", strtotime("now")); } $duration = strtotime($this->formArray["timerEnd"]) - strtotime($this->formArray["timerStart"]); $duration_minutes = floor($duration / 60); $duration_seconds = $duration % 60; $this->tpl->set_var("duration", $duration_minutes . "mins " . $duration_seconds . "s"); $this->tpl->set_var("timerStart", date("g:i:s a", strtotime($this->formArray["timerStart"]))); $this->tpl->set_var("timerEnd", date("g:i:s a", strtotime($this->formArray["timerEnd"]))); $barangay = new Barangay(); $barangay->selectRecord($this->formArray["barangayID"]); $this->tpl->set_var("barangayID", $this->formArray["barangayID"]); $this->tpl->set_var("barangay", $barangay->getDescription()); $this->tpl->set_var("totalArchived", $this->formArray["totalArchived"]); $this->tpl->set_var("totalCreated", $this->formArray["totalCreated"]); $this->tpl->set_var("message", $this->formArray["message"]); break; case "confirm": $this->tpl->set_block("rptsTemplate", "Run", "RunBlock"); $this->tpl->set_var("RunBlock", ""); $this->tpl->set_block("rptsTemplate", "Done", "DoneBlock"); $this->tpl->set_var("DoneBlock", ""); $this->tpl->set_block("rptsTemplate", "BarangayForm", "BarangayFormBlock"); $this->tpl->set_var("BarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxBarangayForm", "AjaxBarangayFormBlock"); $this->tpl->set_var("AjaxBarangayFormBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxConfirm", "AjaxConfirmBlock"); $this->tpl->set_var("AjaxConfirmBlock", ""); $barangay = new Barangay(); $barangay->selectRecord($this->formArray["barangayID"]); $this->tpl->set_var("barangayID", $this->formArray["barangayID"]); $this->tpl->set_var("barangay", $barangay->getDescription()); $message = "Run General Revision for this barangay?"; $this->tpl->set_var("message", $message); // get latestActiveRPUs for the barangay $latestActiveRPUs = $this->getLatestActiveRPUsByBarangay($this->formArray["barangayID"]); $this->tpl->set_var("latestActiveRPUs", number_format($latestActiveRPUs)); $this->tpl->set_var("countBackDays", $this->formArray["countBackDays"]); $this->tpl->set_var("countBackDaysTimeStr", $this->formArray["countBackDaysTimeStr"]); break; default: $this->tpl->set_block("rptsTemplate", "Run", "RunBlock"); $this->tpl->set_var("RunBlock", ""); $this->tpl->set_block("rptsTemplate", "Confirm", "ConfirmBlock"); $this->tpl->set_var("ConfirmBlock", ""); $this->tpl->set_block("rptsTemplate", "AjaxConfirm", "AjaxConfirmBlock"); $this->tpl->set_var("AjaxConfirmBlock", ""); $this->tpl->set_block("rptsTemplate", "Done", "DoneBlock"); $this->tpl->set_var("DoneBlock", ""); // display barangay list $this->initBarangayList(); $message = "Select a Barangay"; $this->tpl->set_var("message", $message); $this->tpl->set_var("countBackDays", $this->countBackDays); $this->tpl->set_var("countBackDaysTimeStr", $this->countBackDaysTimeStr); break; } $this->tpl->set_var("Session", $this->sess->url("")); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y")); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
function getBarangay() { $barangay = new Barangay(); $barangay->selectRecord($this->formArray["barangayID"]); $this->formArray["barangay"] = $barangay->getDescription(); }