Beispiel #1
0
function show_transcript($per, $eid = -1, $sid = -1)
{
    $trans = new Transcript();
    $trans->setFromRequest();
    $dao = getTranscriptDAO();
    $dao->getTranscripts($trans, $eid, $sid);
    if ($trans->numResults > 0) {
        foreach ($trans->results as $t) {
            $t->person = $per;
        }
    }
    return show_transcript_details($trans);
}
Beispiel #2
0
function setup_edit()
{
    $trans = new Transcript();
    $trans->setFromRequest();
    if (!isset($trans->transcript_id)) {
        if (isset($_REQUEST["person"]) && $trans->person->person_id > 0) {
            $trans->person->queryType = Q_IND;
            $dao = getPeopleDAO();
            $dao->getPersonDetails($trans->person);
            if ($trans->person->numResults == 0) {
                $trans->person = $trans->person->results[0];
            } else {
                $trans->person = new PersonDetail();
                $trans->person->setFromRequest();
            }
        } else {
            $trans->person = new PersonDetail();
            $trans->person->setFromRequest();
        }
        $trans->source = new Source();
        $trans->source->setFromRequest();
        if ($trans->source->source_id > 0) {
            $sdao = getSourceDAO();
            $sdao->getSources($trans->source);
            if ($trans->source->numResults > 0) {
                $trans->source = $trans->source->results[0];
            }
        }
        $ret = $trans;
    } else {
        $dao = getTranscriptDAO();
        $dao->getTranscripts($trans);
        if ($trans->numResults == 0) {
            if (isset($_REQUEST["event"])) {
                $dao = getEventDAO();
                $event = new Event();
                $event->setFromRequest();
                $dao->getEvents($event, Q_ALL);
                $trans->event = $event->results[0];
                $trans->person = $trans->event->person;
            }
            if ($trans->person->person_id > 0) {
                $trans->person->queryType = Q_IND;
                $dao = getPeopleDAO();
                $dao->getPersonDetails($trans->person);
                $trans->person = $trans->person->results[0];
            } else {
                $trans->person = new PersonDetail();
            }
            $trans->source = new Source();
            $trans->source->setFromRequest();
            if ($trans->source->source_id > 0) {
                $sdao = getSourceDAO();
                $sdao->getSources($trans->source);
                if ($trans->source->numResults > 0) {
                    $trans->source = $trans->source->results[0];
                }
            }
            $ret = $trans;
        } else {
            $ret = $trans->results[0];
        }
    }
    return $ret;
}
Beispiel #3
0
function print_person($search, $per)
{
    global $famarray;
    // if trying to access a restriced person
    if (!$per->isExportable()) {
        return;
    }
    $config = Config::getInstance();
    //get surename right for gedcom NAME field
    //if there is just one name filled in name and surname
    $surname = "";
    if ($per->name->link != "") {
        $surname = $per->name->link;
    }
    $surname .= $per->name->surname;
    if ($per->name->suffix != "") {
        $surname .= $per->name->suffix;
    }
    if ($per->name->forenames != "") {
        $ged_name = $per->name->forenames . " /" . $surname . "/";
    } else {
        $ged_name = $surname;
    }
    //If this person was previously imported from a gedcom file then use that id
    $id = $per->person_id;
    $gdao = getGedcomDAO();
    $gedids = $gdao->getReferences($id);
    if (count($gedids) === 1) {
        $id = $gedids[0]["gedrefid"];
    }
    output_ged(0, "@", $id, "@ INDI");
    output_ged(1, "NAME ", $ged_name);
    output_ged(2, "GIVN ", $per->name->forenames);
    if ($per->name->link != "") {
        output_ged(2, "SPFX ", $per->name->link);
    }
    output_ged(2, "SURN ", $surname);
    if ($per->name->title != "") {
        output_ged(2, "NPFX ", $per->name->title);
    }
    if ($per->name->suffix != "") {
        output_ged(2, "NSFX ", $per->name->suffix);
    }
    if ($per->name->knownas != "") {
        output_ged(2, "NICK ", $per->name->knownas);
    }
    output_ged(1, "SEX ", $per->gender);
    $edao = getEventDAO();
    $e = new Event();
    $e->person->person_id = $per->person_id;
    $edao->getEvents($e, Q_BD, true);
    $sdao = getSourceDAO();
    $classes = array("1 BIRT", "1 BAPM", "1 DEAT", "1 BURI");
    foreach ($e->results as $e) {
        if ($e->hasData()) {
            echo $classes[$e->type] . "\n";
            $events[$e->type] = $e;
            #			$sdao->getEventSources($e);
            echo DateUtil::full_ged_date1($e);
            if ($e->location->place != "") {
                output_ged(2, "PLAC ", $e->location->place);
            }
            if ($e->type == DEATH_EVENT && $per->death_reason != "") {
                output_ged(2, "CAUS ", $per->death_reason);
            }
            if ($e->notes != "") {
                echo "2 NOTE\n";
                output_ged(3, "CONT ", $e->notes);
                if (isset($e->source) && $e->source != "") {
                    output_ged(2, "SOUR ", $e->source->title);
                } else {
                    output_ged(3, "SOUR ", "phpmyfamily");
                }
            }
        }
    }
    if ($per->mother->person_id != "00000" and $per->father->person_id != "00000") {
        $famc = $per->father->person_id . $per->mother->person_id;
        output_ged(1, "FAMC @", $famc . "@");
        if (!array_key_exists($famc, $famarray)) {
            $famarray[$famc] = array();
        }
        $famarray[$famc][] = $per;
    }
    if ($per->narrative != "") {
        //Textfield could have Returns, separate them in gedcom CONT lines
        $narrative = preg_replace("/\n/", "\n2 CONT ", $per->narrative);
        output_ged(1, "NOTE ", $narrative);
    }
    $exploded = explode(" ", $per->updated);
    $updated = DateUtil::ged_date($exploded[0]);
    echo "1 CHAN\n";
    output_ged(2, "DATE ", $updated);
    //find photos
    $eid = -1;
    $sid = -1;
    $images = new Image();
    $images->person = $per;
    $idao = getImageDAO();
    $idao->getImages($images);
    for ($current = 0; $current < $images->numResults; $current++) {
        $img = $images->results[$current];
        output_ged(1, "OBJE @img", $img->image_id, "@");
        output_ged(2, "FILE ", $config->absurl . $img->getImageFile());
        output_ged(2, "FORM ", "jpg");
        output_ged(2, "TITL ", $img->title);
    }
    $trans = new Transcript();
    $trans->person = $per;
    $tdao = getTranscriptDAO();
    $tdao->getTranscripts($trans);
    for ($i = 0; $i < $trans->numResults; $i++) {
        $doc = $trans->results[$i];
        output_ged(1, "SOUR @doc", $doc->transcript_id, "@");
        //TITL not allowed here
        output_ged(2, "TEXT ", $doc->description);
        //FILE not allowed here
    }
    echo "1 SUBM @phpmyfamily@\n";
}
Beispiel #4
0
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// include the configuration parameters and function
include_once "modules/db/DAOFactory.php";
$trans = new Transcript();
$trans->setFromRequest();
$dao = getTranscriptDAO();
$dao->getTranscripts($trans);
foreach ($trans->results as $doc) {
    if (!$doc->person->isViewable()) {
        continue;
    }
    // see if we have mime capabilities
    if (function_exists("mime_content_type")) {
        $type = mime_content_type($doc->getFileName());
    } else {
        $type = "application/unknown";
    }
    // fire off a few headers
    header("Content-Location: " . $doc->getFileName());
    header("Content-Type: " . $type);
    header("Content-Length: " . filesize($doc->getFileName()));
Beispiel #5
0
 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();
 }