function list_censuses($name, $val) { global $tblprefix; global $err_list_census; $search = new CensusDetail(); $dao = getCensusDAO(); $cresult = $dao->getCensusYears(''); $dates = ''; $date[0] = ''; $i = 0; // do the output echo "<select name=" . $name . " onChange=\"changeCensusDate(this.selectedIndex)\">\n"; echo "<option value=\"0\"></option>"; foreach ($cresult as $crow) { echo "<option value=\"" . $crow->census_id . "\""; if ($val == $crow->census_id) { echo " selected=\"selected\" "; } echo ">" . $crow->year . " / " . $crow->country . "</option>\n"; $dates .= "censusDates[{$i}+1] = '" . $crow->census_date . "';\n"; $i++; } echo "</select>\n"; ?> <script language="javascript"> var censusDates = new Array(); <?php echo $dates; ?> function changeCensusDate(fieldValue) { var newDate = null; newDate = censusDates[fieldValue]; if( newDate == null ) return; //TODO // change the display example document.getElementById('date1').value = newDate; } changeCensusDate(<?php echo $val; ?> ); </script> <?php }
<?php $dao = getCensusDAO(); $filter = 0; if (isset($_REQUEST["filter"])) { $filter = $_REQUEST["filter"]; } $countries = $dao->getCensusCountries($filter); echo "<h1>" . $strMissing . " " . $strCensusRecs . "</h1>"; foreach ($countries as $c) { echo "<h2>" . $c . "</h2>"; $years = $dao->getCensusYears($c); $cen = new CensusDetail(); foreach ($years as $y) { echo '<h3>' . $y->year . "</h3>\n"; $peeps = $dao->getMissingRecords($y); echo "<ul>"; foreach ($peeps as $p) { echo "<li>" . $p->getLink() . "</li>"; } echo "</ul>"; } echo "<hr/>"; }
function show_census($per) { global $strNoInfo, $restrictmsg; $search = new CensusDetail(); $search->setFromRequest(); if (!$per->isViewable()) { echo $restrictmsg . "\n"; return 0; } else { $dao = getCensusDAO(); $dao->getCensusDetails($search); if (count($search->results) < 1) { echo $strNoInfo . "\n"; } else { ?> <table width="100%"> <tr> <?php printCensusHeader(LIST_CENSUS, $per->isEditable()); ?> </tr> <?php for ($i = 0; $i < $search->numResults; $i++) { if ($i == 0 || fmod($i, 2) == 0) { $class = "tbl_odd"; } else { $class = "tbl_even"; } $cen = $search->results[$i]; ?> <tr> <?php foreach ($cen->event->attendees as $attendee) { printCensusRow($cen, $attendee, LIST_CENSUS, $per, $class); } ?> </tr> <?php } echo "</table>"; } } return $search->numResults; }
function deletePerson($per) { global $tblprefix, $err_child_update, $err_person_delete; // there's a lot to do here $this->startTrans(); $dao = getEventDAO(); $dao->deletePersonEvents($per, BIRTH_EVENT); // delete transcripts $trans = new Transcript(); $trans->person = $per; $tdao = getTranscriptDAO(); $tdao->getTranscripts($trans); for ($i = 0; $i < $trans->numResults; $i++) { $tdao->deleteTranscript($trans->results[$i]); } // delete censuses $cdao = getCensusDAO(); $cdao->deletePersonCensusRecord($per); // delete images $img = new Image(); $img->person = $per; $idao = getImageDAO(); $idao->getImages($img); for ($i = 0; $i < $img->numResults; $i++) { $idao->deleteImage($img->results[$i]); } // delete marriages $rdao = getRelationsDAO(); $rdao->deletePersonRelationshipDetails($per); // delete tracking $dtquery = "DELETE FROM " . $tblprefix . "tracking WHERE person_id = '" . $per->person_id . "'"; $dtresult = $this->runQuery($dtquery, $err_person_delete); // update children to point to the right person $ucquery = "UPDATE " . $tblprefix . "people SET mother_id = '0' WHERE mother_id = '" . $per->person_id . "'"; $ucresult = $this->runQuery($ucquery, $err_child_update); $ucquery = "UPDATE " . $tblprefix . "people SET father_id = '0' WHERE father_id = '" . $per->person_id . "'"; $ucresult = $this->runQuery($ucquery, $err_child_update); // names $dpquery = "DELETE FROM " . $tblprefix . "names WHERE person_id = '" . $per->person_id . "'"; $dpresult = $this->runQuery($dpquery, $err_person_delete); // finally, the person $dpquery = "DELETE FROM " . $tblprefix . "people WHERE person_id = '" . $per->person_id . "'"; $dpresult = $this->runQuery($dpquery, $err_person_delete); $this->commitTrans(); }