function setup_edit() { $dao = getEventDAO(); $e = new Event(); $e->setFromRequest(); $dao->getEvents($e, Q_ALL, true); if ($e->numResults > 0) { $per = $e->results[0]->person; } else { $per = new PersonDetail(); $per->setFromRequest(); $e->results = array(new Event()); $e->results[0]->type = -1; } $per->queryType = Q_IND; $dao = getPeopleDAO(); $dao->getPersonDetails($per); if ($per->numResults > 0) { $ret = $per->results[0]; } else { $ret = $per; } $ret->events = $e->results; return $ret; }
function setup_edit() { $per = new PersonDetail(); $per->father = new PersonDetail(); $per->mother = new PersonDetail(); $per->birth_place = new Location(); $per->setFromRequest(); $per->queryType = Q_IND; $dao = getPeopleDAO(); $dao->getPersonDetails($per); if ($per->numResults > 0) { $ret = $per->results[0]; } else { $ret = $per; } $dao = getEventDAO(); $e = new Event(); $e->person->person_id = $per->person_id; $dao->getEvents($e, Q_BD, true); $ret->events = $e->results; return $ret; }
function a2p($a) { global $base, $gridsize; $r = $a + $base; if ($r < 0) { return 20; } return $r * $gridsize + 20; } // -------------------------------------------------------------------- // --------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Get the details of the first person // check we have a person $peep = new PersonDetail(); $peep->setFromRequest(); $peep->queryType = Q_IND; $dao = getPeopleDAO(); $dao->getPersonDetails($peep); if ($peep->numResults != 1) { die("Could not find person"); } $per = $peep->results[0]; // the query for the database // Security ------------------ // set security for living people (born after 01/01/1910) if (!$per->isViewable()) { // ATTENTION: Correct path to the inc directory // die(include $our_path."inc/forbidden.inc.php"); die(include "inc/forbidden.inc.php"); }
<?php include_once "modules/db/DAOFactory.php"; $peep = new PersonDetail(); $peep->queryType = Q_IND; $config = Config::getInstance(); $per = new PersonDetail(); $dao = getPeopleDAO(); $loc = "index.php"; if (isset($_REQUEST["func"]) && $_REQUEST["func"] == "delete") { $per->setFromRequest(); $peep->setFromRequest(); $dao->getPersonDetails($peep); $peep = $peep->results[0]; if (!$peep->isEditable()) { die(include "inc/forbidden.inc.php"); } // If Big Brother is watching // We need to call it here while we can! stamppeeps($per); $dao->deletePerson($per); // have to go to index, cos don't know where else to go $loc = "index.php"; } else { $peep->setFromPost(); if (isset($peep->person_id)) { $peep->name = new Name(); unset($peep->date_of_birth); unset($peep->gender); $peep->queryType = Q_IND; $dao->getPersonDetails($peep);