function getAttendeePlaces(&$locations, $person = null) { global $tblprefix, $strEvent, $datefmt; global $strBirthPlace, $strAddress; $query = "SELECT " . Attendee::getFields('a') . "," . PersonDetail::getFields('p') . ", " . Event::getFields("e") . "," . Location::getFields("l") . "," . Location::getFields("el") . " FROM " . $tblprefix . "attendee a" . " JOIN " . $tblprefix . "people p ON a.person_id = p.person_id" . " JOIN " . $tblprefix . "event e ON a.event_id = e.event_id" . " LEFT JOIN " . $tblprefix . "locations el ON el.location_id = e.location_id" . " LEFT JOIN " . $tblprefix . "locations l ON l.location_id = a.location_id" . PersonDetail::getJoins() . " WHERE (a.location_id is not null OR e.location_id is not null)" . " AND (NOT (e.etype = " . BANNS_EVENT . " OR e.etype=" . MARRIAGE_EVENT . "))"; $query .= $this->addPersonRestriction(" AND "); if ($locations->location_id > 0) { $query .= " AND (a.location_id = " . $locations->location_id . " OR e.location_id = " . $locations->location_id . ")"; } $presult = $this->runQuery($query, ""); while ($prow = $this->getNextRow($presult)) { $per = new PersonDetail(); $per->loadFields($prow, L_HEADER, 'p_'); $per->name->loadFields($prow, 'n_'); $per->setPermissions(); $e = new Event(); $e->loadFields($prow, "e_"); $loc = new Location(); $loc->loadFields($prow, "l_"); $loc->setPermissions(); if ($per->isViewable() && $loc->hasData()) { $text = $per->getLink() . ' '; switch ($e->type) { case CENSUS_EVENT: $text .= $strEvent[$e->type] . " " . $strBirthPlace; break; default: $text .= $strAddress; break; } $text .= ' ' . $e->getDate1(); if ($locations->location_id > 0 && $loc->location_id == $locations->location_id || $locations->location_id <= 0) { $p = $this->createPlace($locations, $loc, $text); } } $e->location->loadFields($prow, "el_"); $e->location->setPermissions(); if ($per->isViewable() && $e->location->hasData()) { $text = $per->getLink() . ' ' . $strEvent[$e->type] . ' ' . $e->getDate1(); if ($locations->location_id > 0 && $e->location->location_id == $locations->location_id || $locations->location_id <= 0) { $p = $this->createPlace($locations, $e->location, $text); } } } $this->freeResultSet($presult); }