function setup_edit() { // get the person to edit $search = new CensusDetail(); $search->setFromRequest(); $search->queryType = Q_FAMILY; $dao = getCensusDAO(); $dao->getCensusDetails($search); if ($search->numResults > 0) { $ret = $search->results[0]; $ret->person = $search->person; } else { $pdao = getPeopleDAO(); $ret = new CensusDetail(); $ret->person->setFromRequest(); $ret->person->queryType = Q_IND; $pdao->getPersonDetails($ret->person); $ret->event->person = $ret->person->results[0]; $ret->person = $ret->person->results[0]; } return $ret; }
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; }
<?php include_once "modules/db/DAOFactory.php"; $peep = new PersonDetail(); $peep->queryType = Q_IND; $pdao = getPeopleDAO(); $cen = new CensusDetail(); $dao = getCensusDAO(); if (isset($_REQUEST["func"]) && $_REQUEST["func"] == "delete") { $peep->setFromRequest(); $pdao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } $cen->setFromRequest(); $dao->deleteCensusRecord($cen); stamppeeps($peep); } else { $peep->setFromPost(); $pdao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } $cen->setFromPost(); $e = new Event(); $e->setFromPost(); $prefix = 'a'; $e->sources = array(); while (isset($_POST[$prefix . "_title"])) {