Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     // Extract the request parameters
     $this->show_thumbs = WT_Filter::getBool('show_thumbs');
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Compact tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Compact tree'));
     }
     $this->treeid = ancestry_array($this->rootid, 5);
 }
Exemple #2
0
 public function __construct()
 {
     parent::__construct();
     $this->surname = WT_Filter::get('surname');
     $this->soundex_std = WT_Filter::getBool('soundex_std');
     $this->soundex_dm = WT_Filter::getBool('soundex_dm');
     if ($this->surname) {
         $this->setPageTitle(WT_I18N::translate('Branches of the %s family', WT_Filter::escapeHtml($this->surname)));
         $this->loadIndividuals();
         $self = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
         if ($self) {
             $this->loadAncestors(WT_Individual::getInstance(WT_USER_GEDCOM_ID), 1);
         }
     } else {
         $this->setPageTitle(WT_I18N::translate('Branches'));
     }
 }
Exemple #3
0
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'find.php');
require './includes/session.php';
require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
$controller = new WT_Controller_Simple();
$type = WT_Filter::get('type');
$filter = WT_Filter::get('filter');
$action = WT_Filter::get('action');
$callback = WT_Filter::get('callback', '[a-zA-Z0-9_]+', 'paste_id');
$media = WT_Filter::get('media');
$all = WT_Filter::getBool('all');
$subclick = WT_Filter::get('subclick');
$choose = WT_Filter::get('choose', '[a-zA-Z0-9_]+', '0all');
$qs = WT_Filter::get('tags');
// Retrives the currently selected tags in the opener window (reading curTags value of the query string)
// $preselDefault will be set to the array of DEFAULT preselected tags
// $preselCustom will be set to the array of CUSTOM preselected tags
function getPreselectedTags(&$preselDefault, &$preselCustom)
{
    global $qs;
    $all = strlen($qs) ? explode(',', strtoupper($qs)) : array();
    $preselDefault = array();
    $preselCustom = array();
    foreach ($all as $one) {
        if (WT_Gedcom_Tag::isTag($one)) {
            $preselDefault[] = $one;
Exemple #4
0
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
define('WT_SCRIPT_NAME', 'fanchart.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Fanchart();
if (WT_Filter::getBool('img')) {
    Zend_Session::writeClose();
    $controller->generate_fan_chart('png', $fanChart);
    // $fanChart comes from the theme
    exit;
}
$controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('
		autocomplete();
		var WT_FANCHART = (function() {
			jQuery("area")
				.click(function (e) {
					e.stopPropagation();
					e.preventDefault();
					var target = jQuery(this.hash);
					target
						// position the menu centered immediately above the mouse click position and
Exemple #5
0
    public function getBlock($block_id, $template = true, $cfg = null)
    {
        global $ctype, $foundlist;
        $filter = get_block_setting($block_id, 'filter', 'all');
        $controls = get_block_setting($block_id, 'controls', true);
        $start = get_block_setting($block_id, 'start', false) || WT_Filter::getBool('start');
        $block = get_block_setting($block_id, 'block', true);
        // We can apply the filters using SQL
        // Do not use "ORDER BY RAND()" - it is very slow on large tables.  Use PHP::array_rand() instead.
        $all_media = WT_DB::prepare("SELECT m_id FROM `##media`" . " WHERE m_file = ?" . " AND m_ext  IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')")->execute(array(WT_GED_ID, get_block_setting($block_id, 'filter_avi', false) ? 'avi' : NULL, get_block_setting($block_id, 'filter_bmp', true) ? 'bmp' : NULL, get_block_setting($block_id, 'filter_gif', true) ? 'gif' : NULL, get_block_setting($block_id, 'filter_jpeg', true) ? 'jpg' : NULL, get_block_setting($block_id, 'filter_jpeg', true) ? 'jpeg' : NULL, get_block_setting($block_id, 'filter_mp3', false) ? 'mp3' : NULL, get_block_setting($block_id, 'filter_ole', true) ? 'ole' : NULL, get_block_setting($block_id, 'filter_pcx', true) ? 'pcx' : NULL, get_block_setting($block_id, 'filter_pdf', false) ? 'pdf' : NULL, get_block_setting($block_id, 'filter_png', true) ? 'png' : NULL, get_block_setting($block_id, 'filter_tiff', true) ? 'tiff' : NULL, get_block_setting($block_id, 'filter_wav', false) ? 'wav' : NULL, get_block_setting($block_id, 'filter_audio', false) ? 'audio' : NULL, get_block_setting($block_id, 'filter_book', true) ? 'book' : NULL, get_block_setting($block_id, 'filter_card', true) ? 'card' : NULL, get_block_setting($block_id, 'filter_certificate', true) ? 'certificate' : NULL, get_block_setting($block_id, 'filter_coat', true) ? 'coat' : NULL, get_block_setting($block_id, 'filter_document', true) ? 'document' : NULL, get_block_setting($block_id, 'filter_electronic', true) ? 'electronic' : NULL, get_block_setting($block_id, 'filter_fiche', true) ? 'fiche' : NULL, get_block_setting($block_id, 'filter_film', true) ? 'film' : NULL, get_block_setting($block_id, 'filter_magazine', true) ? 'magazine' : NULL, get_block_setting($block_id, 'filter_manuscript', true) ? 'manuscript' : NULL, get_block_setting($block_id, 'filter_map', true) ? 'map' : NULL, get_block_setting($block_id, 'filter_newspaper', true) ? 'newspaper' : NULL, get_block_setting($block_id, 'filter_other', true) ? 'other' : NULL, get_block_setting($block_id, 'filter_painting', true) ? 'painting' : NULL, get_block_setting($block_id, 'filter_photo', true) ? 'photo' : NULL, get_block_setting($block_id, 'filter_tombstone', true) ? 'tombstone' : NULL, get_block_setting($block_id, 'filter_video', false) ? 'video' : NULL))->fetchOneColumn();
        // Keep looking through the media until a suitable one is found.
        $random_media = null;
        while ($all_media) {
            $n = array_rand($all_media);
            $media = WT_Media::getInstance($all_media[$n]);
            if ($media->canShow() && !$media->isExternal()) {
                // Check if it is linked to a suitable individual
                foreach ($media->linkedIndividuals('OBJE') as $indi) {
                    if ($filter == 'all' || $filter == 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || $filter == 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false) {
                        // Found one :-)
                        $random_media = $media;
                        break 2;
                    }
                }
            }
            unset($all_media[$n]);
        }
        $id = $this->getName() . $block_id;
        $class = $this->getName() . '_block';
        if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
            $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
        } else {
            $title = '';
        }
        $title .= $this->getTitle();
        if ($random_media) {
            $content = "<div id=\"random_picture_container{$block_id}\">";
            if ($controls) {
                if ($start) {
                    $icon_class = 'icon-media-stop';
                } else {
                    $icon_class = 'icon-media-play';
                }
                $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>';
                $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . WT_I18N::translate('Play') . "/" . WT_I18N::translate('Stop') . '"></a>';
                $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&amp;action=ajax&amp;block_id=' . $block_id . '\');return false;" title="' . WT_I18N::translate('Next image') . '" class="icon-media-next"></a>';
                $content .= '</div><script>
					var play = false;
						function togglePlay() {
							if (play) {
								play = false;
								jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play");
							}
							else {
								play = true;
								playSlideShow();
								jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop");
							}
						}

						function playSlideShow() {
							if (play) {
								window.setTimeout("reload_image()", 6000);
							}
						}
						function reload_image() {
							if (play) {
								jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1");
							}
						}
					</script>';
            }
            if ($start) {
                $content .= '<script>togglePlay();</script>';
            }
            $content .= '<div class="center" id="random_picture_content' . $block_id . '">';
            $content .= '<table id="random_picture_box"><tr><td';
            if ($block) {
                $content .= ' class="details1"';
            } else {
                $content .= ' class="details2"';
            }
            $content .= ' >';
            $content .= $random_media->displayImage();
            if ($block) {
                $content .= '<br>';
            } else {
                $content .= '</td><td class="details2">';
            }
            $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
            foreach ($random_media->linkedIndividuals('OBJE') as $individual) {
                $content .= '<a href="' . $individual->getHtmlUrl() . '">' . WT_I18N::translate('View person') . ' — ' . $individual->getFullname() . '</a><br>';
            }
            foreach ($random_media->linkedFamilies('OBJE') as $family) {
                $content .= '<a href="' . $family->getHtmlUrl() . '">' . WT_I18N::translate('View family') . ' — ' . $family->getFullname() . '</a><br>';
            }
            foreach ($random_media->linkedSources('OBJE') as $source) {
                $content .= '<a href="' . $source->getHtmlUrl() . '">' . WT_I18N::translate('View source') . ' — ' . $source->getFullname() . '</a><br>';
            }
            $content .= '<br><div class="indent">';
            $content .= print_fact_notes($random_media->getGedcom(), "1", false, true);
            $content .= '</div>';
            $content .= '</td></tr></table>';
            $content .= '</div>';
            // random_picture_content
            $content .= '</div>';
            // random_picture_container
        } else {
            $content = WT_I18N::translate('This family tree has no images to display.');
        }
        if ($template) {
            require WT_THEME_DIR . 'templates/block_main_temp.php';
        } else {
            return $content;
        }
    }
Exemple #6
0
    WT_DB::exec("COMMIT");
    $controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").toggle();' . 'jQuery("#actions' . $gedcom_id . '").toggle();');
    exit;
}
// Calculate progress so far
$percent = 100 * ($row->import_offset / $row->import_total);
$status = WT_I18N::translate('Loading data from GEDCOM: %.1f%%', $percent);
echo '<div id="progressbar', $gedcom_id, '"><div style="position:absolute;">', $status, '</div></div>';
$controller->addInlineJavascript('jQuery("#progressbar' . $gedcom_id . '").progressbar({value: ' . round($percent, 1) . '});');
$first_time = $row->import_offset == 0;
// Run for one second.  This keeps the resource requirements low.
for ($end_time = microtime(true) + 1.0; microtime(true) < $end_time;) {
    $data = WT_DB::prepare("SELECT gedcom_chunk_id, REPLACE(chunk_data, '\r', '\n') AS chunk_data" . " FROM `##gedcom_chunk`" . " WHERE gedcom_id=? AND NOT imported" . " ORDER BY gedcom_chunk_id" . " LIMIT 1")->execute(array($gedcom_id))->fetchOneRow();
    // If we are at the start position, do some tidying up
    if ($first_time) {
        $keep_media = WT_Filter::getBool('keep_media' . $gedcom_id);
        // Delete any existing genealogical data
        empty_database($gedcom_id, $keep_media);
        set_gedcom_setting($gedcom_id, 'imported', false);
        // Remove any byte-order-mark
        WT_DB::prepare("UPDATE `##gedcom_chunk`" . " SET chunk_data=TRIM(LEADING ? FROM chunk_data)" . " WHERE gedcom_chunk_id=?")->execute(array(WT_UTF8_BOM, $data->gedcom_chunk_id));
        // Re-fetch the data, now that we have removed the BOM
        $data = WT_DB::prepare("SELECT gedcom_chunk_id, REPLACE(chunk_data, '\r', '\n') AS chunk_data" . " FROM `##gedcom_chunk`" . " WHERE gedcom_chunk_id=?")->execute(array($data->gedcom_chunk_id))->fetchOneRow();
        if (substr($data->chunk_data, 0, 6) != '0 HEAD') {
            WT_DB::exec("ROLLBACK");
            echo WT_I18N::translate('Invalid GEDCOM file - no header record found.');
            $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").toggle();');
            exit;
        }
        // What character set is this?  Need to convert it to UTF8
        if (preg_match('/\\n[ \\t]*1 CHAR(?:ACTER)? (.+)/', $data->chunk_data, $match)) {
Exemple #7
0
// (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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Log;
define('WT_SCRIPT_NAME', 'mediafirewall.php');
require './includes/session.php';
Zend_Session::writeClose();
$mid = WT_Filter::get('mid', WT_REGEX_XREF);
$thumb = WT_Filter::getBool('thumb');
$media = WT_Media::getInstance($mid);
// Send a “Not found” error as an image
function send404AndExit()
{
    $error = WT_I18N::translate('The media file was not found in this family tree');
    $width = mb_strlen($error) * 6.5 + 50;
    $height = 60;
    $im = imagecreatetruecolor($width, $height);
    /* Create a black image */
    $bgc = imagecolorallocate($im, 255, 255, 255);
    /* set background color */
    imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc);
    /* create a rectangle, leaving 2 px border */
    embedText($im, $error, 100, "255, 0, 0", "", "top", "left");
    header('HTTP/1.0 404 Not Found');
Exemple #8
0
    private function adminPlaces()
    {
        require WT_ROOT . 'includes/functions/functions_edit.php';
        $action = WT_Filter::get('action');
        $parent = WT_Filter::get('parent');
        $inactive = WT_Filter::getBool('inactive');
        $deleteRecord = WT_Filter::get('deleteRecord');
        if (!isset($parent)) {
            $parent = 0;
        }
        $controller = new WT_Controller_Page();
        $controller->restrictAccess(Auth::isAdmin());
        if ($action == 'ExportFile' && Auth::isAdmin()) {
            Zend_Session::writeClose();
            $tmp = $this->placeIdToHierarchy($parent);
            $maxLevel = $this->getHighestLevel();
            if ($maxLevel > 8) {
                $maxLevel = 8;
            }
            $tmp[0] = 'places';
            $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
            echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
            if ($maxLevel > 0) {
                echo '"', WT_I18N::translate('State'), '";';
            }
            if ($maxLevel > 1) {
                echo '"', WT_I18N::translate('County'), '";';
            }
            if ($maxLevel > 2) {
                echo '"', WT_I18N::translate('City'), '";';
            }
            if ($maxLevel > 3) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 4) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 5) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 6) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 7) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
            echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
            $this->outputLevel($parent);
            exit;
        }
        $controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<table id="gm_config">
			<tr>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_config">
						<?php 
        echo WT_I18N::translate('Google Maps™ preferences');
        ?>
					</a>
				</th>
				<th>
					<a class="current" href="module.php?mod=googlemap&amp;mod_action=admin_places">
						<?php 
        echo WT_I18N::translate('Geographic data');
        ?>
					</a>
				</th>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">
						<?php 
        echo WT_I18N::translate('Place check');
        ?>
					</a>
				</th>
			</tr>
		</table>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
                while (!empty($placerec)) {
                    if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
                        $placelist[$j] = array();
                        $placelist[$j]['place'] = trim($match[1]);
                        if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
                            $placelist[$j]['lati'] = trim($match[1]);
                            if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
                                if ($placelist[$j]['lati'] < 0) {
                                    $placelist[$j]['lati'][0] = 'S';
                                } else {
                                    $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
                                }
                            }
                        } else {
                            $placelist[$j]['lati'] = NULL;
                        }
                        if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
                            $placelist[$j]['long'] = trim($match[1]);
                            if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') {
                                if ($placelist[$j]['long'] < 0) {
                                    $placelist[$j]['long'][0] = 'W';
                                } else {
                                    $placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
                                }
                            }
                        } else {
                            $placelist[$j]['long'] = NULL;
                        }
                        $j = $j + 1;
                    }
                    $i = $i + 1;
                    $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
                }
            }
            asort($placelist);
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $highestIndex = $this->getHighestIndex();
            $default_zoom_level = array(4, 7, 10, 12);
            foreach ($placelistUniq as $k => $place) {
                $parent = preg_split('/ *, */', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    if (!isset($default_zoom_level[$i])) {
                        $default_zoom_level[$i] = $default_zoom_level[$i - 1];
                    }
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if ($i < count($parent) - 1) {
                        // Create higher-level places, if necessary
                        if (empty($row)) {
                            $highestIndex++;
                            WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i]));
                            echo WT_Filter::escapeHtml($escparent), '<br>';
                            $parent_id = $highestIndex;
                        } else {
                            $parent_id = $row->pl_id;
                        }
                    } else {
                        // Create lowest-level place, if necessary
                        if (empty($row->pl_id)) {
                            $highestIndex++;
                            WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i]));
                            echo WT_Filter::escapeHtml($escparent), '<br>';
                        } else {
                            if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id));
                                echo WT_Filter::escapeHtml($escparent), '<br>';
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'ImportFile') {
            $placefiles = array();
            $this->findFiles(WT_MODULES_DIR . 'googlemap/extra');
            sort($placefiles);
            ?>
		<form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&amp;mod_action=admin_places&amp;action=ImportFile2">
			<table class="gm_plac_edit">
				<tr>
					<th><?php 
            echo WT_I18N::translate('File containing places (CSV)');
            ?>
</th>
					<td><input type="file" name="placesfile" size="50"></td>
				</tr>
				<?php 
            if (count($placefiles) > 0) {
                ?>
				<tr>
					<th><?php 
                echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE', 'googlemap');
                ?>
</th>
					<td>
						<select name="localfile">
							<option></option>
							<?php 
                foreach ($placefiles as $p => $placefile) {
                    ?>
							<option value="<?php 
                    echo WT_Filter::escapeHtml($placefile);
                    ?>
"><?php 
                    if (substr($placefile, 0, 1) == "/") {
                        echo substr($placefile, 1);
                    } else {
                        echo $placefile;
                    }
                    ?>
</option>
							<?php 
                }
                ?>
						</select>
					</td>
				</tr>
				<?php 
            }
            ?>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Delete all existing geographic data before importing the file.');
            ?>
</th>
					<td><input type="checkbox" name="cleardatabase"></td>
				</tr>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Do not create new locations, just import coordinates for existing locations.');
            ?>
</th>
					<td><input type="checkbox" name="updateonly"></td>
				</tr>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Overwrite existing coordinates.');
            ?>
</th>
					<td><input type="checkbox" name="overwritedata"></td>
				</tr>
			</table>
			<input id="savebutton" type="submit" value="<?php 
            echo WT_I18N::translate('Continue adding');
            ?>
"><br>
		</form>
		<?php 
            exit;
        }
        if ($action == 'ImportFile2') {
            $country_names = array();
            foreach (WT_Stats::iso3166() as $key => $value) {
                $country_names[$key] = WT_I18N::translate($key);
            }
            if (isset($_POST['cleardatabase'])) {
                WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1");
            }
            if (!empty($_FILES['placesfile']['tmp_name'])) {
                $lines = file($_FILES['placesfile']['tmp_name']);
            } elseif (!empty($_REQUEST['localfile'])) {
                $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']);
            }
            // Strip BYTE-ORDER-MARK, if present
            if (!empty($lines[0]) && substr($lines[0], 0, 3) == WT_UTF8_BOM) {
                $lines[0] = substr($lines[0], 3);
            }
            asort($lines);
            $highestIndex = $this->getHighestIndex();
            $placelist = array();
            $j = 0;
            $maxLevel = 0;
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if ($fieldrec[0] > $maxLevel) {
                    $maxLevel = $fieldrec[0];
                }
            }
            $fields = count($fieldrec);
            $set_icon = true;
            if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) {
                $set_icon = false;
            }
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) {
                    $placelist[$j] = array();
                    $placelist[$j]['place'] = '';
                    for ($ii = $fields - 4; $ii > 1; $ii--) {
                        if ($fieldrec[0] > $ii - 2) {
                            $placelist[$j]['place'] .= $fieldrec[$ii] . ',';
                        }
                    }
                    foreach ($country_names as $countrycode => $countryname) {
                        if ($countrycode == strtoupper($fieldrec[1])) {
                            $fieldrec[1] = $countryname;
                            break;
                        }
                    }
                    $placelist[$j]['place'] .= $fieldrec[1];
                    $placelist[$j]['long'] = $fieldrec[$fields - 4];
                    $placelist[$j]['lati'] = $fieldrec[$fields - 3];
                    $placelist[$j]['zoom'] = $fieldrec[$fields - 2];
                    if ($set_icon) {
                        $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]);
                    } else {
                        $placelist[$j]['icon'] = '';
                    }
                    $j = $j + 1;
                }
            }
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $placelistUniq[$j]['zoom'] = $place['zoom'];
                    $placelistUniq[$j]['icon'] = $place['icon'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                        $placelistUniq[$j - 1]['zoom'] = $place['zoom'];
                        $placelistUniq[$j - 1]['icon'] = $place['icon'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $default_zoom_level = array();
            $default_zoom_level[0] = 4;
            $default_zoom_level[1] = 7;
            $default_zoom_level[2] = 10;
            $default_zoom_level[3] = 12;
            foreach ($placelistUniq as $k => $place) {
                $parent = explode(',', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if (empty($row)) {
                        // this name does not yet exist: create entry
                        if (!isset($_POST['updateonly'])) {
                            $highestIndex = $highestIndex + 1;
                            if ($i + 1 == count($parent)) {
                                $zoomlevel = $place['zoom'];
                            } elseif (isset($default_zoom_level[$i])) {
                                $zoomlevel = $default_zoom_level[$i];
                            } else {
                                $zoomlevel = $this->getSetting('GM_MAX_ZOOM');
                            }
                            if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) {
                                WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon']));
                            } else {
                                //delete leading zero
                                $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']);
                                $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']);
                                if ($pl_lati >= 0) {
                                    $place['lati'] = 'N' . abs($pl_lati);
                                } elseif ($pl_lati < 0) {
                                    $place['lati'] = 'S' . abs($pl_lati);
                                }
                                if ($pl_long >= 0) {
                                    $place['long'] = 'E' . abs($pl_long);
                                } elseif ($pl_long < 0) {
                                    $place['long'] = 'W' . abs($pl_long);
                                }
                                WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon']));
                            }
                            $parent_id = $highestIndex;
                        }
                    } else {
                        $parent_id = $row->pl_id;
                        if (isset($_POST['overwritedata']) && $i + 1 == count($parent)) {
                            WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id));
                        } else {
                            if (($row->pl_long == '0' || $row->pl_long == null) && ($row->pl_lati == '0' || $row->pl_lati == null)) {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $parent_id));
                            }
                            if (empty($row->pl_icon) && !empty($place['icon'])) {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?")->execute(array($place['icon'], $parent_id));
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'DeleteRecord') {
            $exists = WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne();
            if (!$exists) {
                WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord));
            } else {
                echo '<table class="facts_table"><tr><td>', WT_I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>';
            }
        }
        ?>
		<script>
		function updateList(inactive) {
			window.location.href='<?php 
        if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) {
            $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true);
        } else {
            $uri = $_SERVER['REQUEST_URI'];
        }
        echo $uri, '&inactive=';
        ?>
'+inactive;
		}

		function edit_place_location(placeid) {
			window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs);
			return false;
		}

		function add_place_location(placeid) {
			window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs);
			return false;
		}

		function delete_place(placeid) {
			var answer=confirm('<?php 
        echo WT_I18N::translate('Remove this location?');
        ?>
');
			if (answer == true) {
				window.location = '<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
&action=DeleteRecord&deleteRecord=' + placeid;
			}
		}
		</script>
		<?php 
        echo '<div id="gm_breadcrumb">';
        $where_am_i = $this->placeIdToHierarchy($parent);
        foreach (array_reverse($where_am_i, true) as $id => $place) {
            if ($id == $parent) {
                if ($place != 'Unknown') {
                    echo WT_Filter::escapeHtml($place);
                } else {
                    echo WT_I18N::translate('unknown');
                }
            } else {
                echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">';
                if ($place != 'Unknown') {
                    echo WT_Filter::escapeHtml($place), '</a>';
                } else {
                    echo WT_I18N::translate('unknown'), '</a>';
                }
            }
            echo ' - ';
        }
        echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top level'), '</a></div>';
        echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">';
        echo '<label for="inactive">', WT_I18N::translate('Show inactive places'), '</label>';
        echo '<input type="checkbox" name="inactive" id="inactive"';
        if ($inactive) {
            echo ' checked="checked"';
        }
        echo ' onclick="updateList(this.checked)"';
        echo '>', help_link('PLE_ACTIVE', 'googlemap'), '</div></form>';
        $placelist = $this->getPlaceListLocation($parent, $inactive);
        echo '<div class="gm_plac_edit">';
        echo '<table class="gm_plac_edit"><tr>';
        echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>';
        echo '<th>', WT_Gedcom_Tag::getLabel('LATI'), '</th>';
        echo '<th>', WT_Gedcom_Tag::getLabel('LONG'), '</th>';
        echo '<th>', WT_I18N::translate('Zoom level'), '</th>';
        echo '<th>', WT_I18N::translate('Icon'), '</th>';
        echo '<th>';
        echo WT_I18N::translate('Edit'), '</th><th>', WT_I18N::translate('Delete'), '</th></tr>';
        if (count($placelist) == 0) {
            echo '<tr><td colspan="7" class="accepted">', WT_I18N::translate('No places found'), '</td></tr>';
        }
        foreach ($placelist as $place) {
            echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
            if ($place['place'] != 'Unknown') {
                echo WT_Filter::escapeHtml($place['place']), '</a></td>';
            } else {
                echo WT_I18N::translate('unknown'), '</a></td>';
            }
            echo '<td>', $place['lati'], '</td>';
            echo '<td>', $place['long'], '</td>';
            echo '<td>', $place['zoom'], '</td>';
            echo '<td>';
            if ($place['icon'] == NULL || $place['icon'] == '') {
                if ($place['lati'] == NULL || $place['long'] == NULL || $place['lati'] == '0' && $place['long'] == '0') {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">';
                } else {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">';
                }
            } else {
                echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">';
            }
            echo '</td>';
            echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>';
            $noRows = WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne();
            if ($noRows == 0) {
                ?>
				<td><a href="#" onclick="delete_place(<?php 
                echo $place['place_id'];
                ?>
);return false;" class="icon-delete" title="<?php 
                echo WT_I18N::translate('Remove');
                ?>
"></a></td>
		<?php 
            } else {
                ?>
				<td><i class="icon-delete-grey"></i></td>
		<?php 
            }
            ?>
			</tr>
			<?php 
        }
        ?>
		</table>
		</div>

		<table id="gm_manage">
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Add  a new geographic location');
        ?>
				</td>
				<td>
					<form action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;">
						<?php 
        echo select_edit_control('parent_id', $where_am_i, WT_I18N::translate('Top level'), $parent);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Add');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Import all places from a family tree');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ImportGedcom">
						<?php 
        echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Import');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Upload geographic data');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ImportFile">
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Upload');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Download geographic data');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ExportFile">
						<?php 
        echo select_edit_control('parent', $where_am_i, WT_I18N::translate('All'), WT_GED_ID);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Download');
        ?>
">
					</form>
				</td>
			</tr>
		</table>
		<?php 
    }
Exemple #9
0
 function __construct()
 {
     global $WT_SESSION;
     parent::__construct();
     $this->setPageTitle(WT_I18N::translate('Lifespans'));
     $this->colorindex = 0;
     $this->Fcolorindex = 0;
     $this->Mcolorindex = 0;
     $this->zoomfactor = 10;
     $this->color = "#0000FF";
     $this->currentYear = date("Y");
     $this->deathMod = 0;
     $this->endDate = $this->currentYear;
     // Request parameters
     $newpid = WT_Filter::get('newpid', WT_REGEX_XREF);
     $remove = WT_Filter::get('remove', WT_REGEX_XREF);
     $pids = WT_Filter::getArray('pids', WT_REGEX_XREF);
     $clear = WT_Filter::getBool('clear');
     $addfam = WT_Filter::getBool('addFamily');
     $place = WT_Filter::get('place');
     $beginYear = WT_Filter::getInteger('beginYear', 0, date('Y') + 100, 0);
     $endYear = WT_Filter::getInteger('endYear', 0, date('Y') + 100, 0);
     if ($clear) {
         // Empty list
         $this->pids = array();
     } elseif ($pids) {
         // List of specified records
         $this->pids = $pids;
     } elseif ($place) {
         // All records found in a place
         $wt_place = new WT_Place($place, WT_GED_ID);
         $this->pids = WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($wt_place->getPlaceId(), WT_GED_ID))->fetchOneColumn();
         $this->place = $place;
     } else {
         // Modify an existing list of records
         if (is_array($WT_SESSION->timeline_pids)) {
             $this->pids = $WT_SESSION->timeline_pids;
         } else {
             $this->pids = array();
         }
         if ($remove) {
             foreach ($this->pids as $key => $value) {
                 if ($value == $remove) {
                     unset($this->pids[$key]);
                 }
             }
         } elseif ($newpid) {
             $person = WT_Individual::getInstance($newpid);
             $this->addFamily($person, $addfam);
         } elseif (!$this->pids) {
             $this->addFamily($this->getSignificantIndividual(), false);
         }
     }
     $WT_SESSION->timeline_pids = $this->pids;
     $this->beginYear = $beginYear;
     $this->endYear = $endYear;
     if ($beginYear == 0 || $endYear == 0) {
         //-- cleanup user input
         $this->pids = array_unique($this->pids);
         //removes duplicates
         foreach ($this->pids as $key => $value) {
             if ($value != $remove) {
                 $this->pids[$key] = $value;
                 $person = WT_Individual::getInstance($value);
                 // list of linked records includes families as well as individuals.
                 if ($person) {
                     $bdate = $person->getEstimatedBirthDate();
                     if ($bdate->isOK() && $person->canShow()) {
                         $this->people[] = $person;
                     }
                 }
             }
         }
     } else {
         //--Finds if the begin year and end year textboxes are not empty
         //-- reset the people array when doing a year range search
         $this->people = array();
         //Takes the begining year and end year passed by the postback and modifies them and uses them to populate
         //the time line
         //Variables to restrict the person boxes to the year searched.
         //--Searches for individuals who had an even between the year begin and end years
         $indis = self::search_indis_year_range($beginYear, $endYear);
         //--Populates an array of people that had an event within those years
         foreach ($indis as $person) {
             if (empty($searchplace) || in_array($person->getXref(), $this->pids)) {
                 $bdate = $person->getEstimatedBirthDate();
                 if ($bdate->isOK() && $person->canShow()) {
                     $this->people[] = $person;
                 }
             }
         }
         $WT_SESSION->timeline_pids = null;
     }
     // Sort the array in order of birth year
     uasort($this->people, function (WT_Individual $a, WT_Individual $b) {
         return WT_Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate());
     });
     //If there is people in the array posted back this if occurs
     if (isset($this->people[0])) {
         //Find the maximum Death year and mimimum Birth year for each individual returned in the array.
         $bdate = $this->people[0]->getEstimatedBirthDate();
         $ddate = $this->people[0]->getEstimatedDeathDate();
         $this->timelineMinYear = $bdate->gregorianYear();
         $this->timelineMaxYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y');
         foreach ($this->people as $value) {
             $bdate = $value->getEstimatedBirthDate();
             $ddate = $value->getEstimatedDeathDate();
             $this->timelineMinYear = min($this->timelineMinYear, $bdate->gregorianYear());
             $this->timelineMaxYear = max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y'));
         }
         if ($this->timelineMaxYear > $this->currentYear) {
             $this->timelineMaxYear = $this->currentYear;
         }
     } else {
         // Sets the default timeline length
         $this->timelineMinYear = date("Y") - 101;
         $this->timelineMaxYear = date("Y");
     }
 }
Exemple #10
0
    private static function media_3_find()
    {
        $controller = new WT_Controller_Simple();
        $filter = WT_Filter::get('filter');
        $multiple = WT_Filter::getBool('multiple');
        $controller->setPageTitle(WT_I18N::translate('Find an individual'))->pageHeader();
        echo '<script>';
        ?>

			function pasterow(id, name, gend, yob, age, bpl) {
				window.opener.opener.insertRowToTable(id, name, '', gend, '', yob, age, 'Y', '', bpl);
			}

			function pasteid(id, name, thumb) {
				if (thumb) {
					window.opener.paste_id(id, name, thumb);
					<?php 
        if (!$multiple) {
            echo "window.close();";
        }
        ?>
				} else {
					// GEDFact_assistant ========================
					if (window.opener.document.getElementById('addlinkQueue')) {
						window.opener.insertRowToTable(id, name);
						// Check if Indi, Fam or source ===================
						/*
						if (id.match("I")=="I") {
							var win01 = window.opener.window.open('edit_interface.php?action=addmedia_links&noteid=newnote&pid='+id, 'win01', edit_window_specs);
							if (window.focus) {win01.focus();}
						} else if (id.match("F")=="F") {
							// TODO --- alert('Opening Navigator with family id entered will come later');
						}
						*/
					}
					window.opener.paste_id(id);
					if (window.opener.pastename) {
						window.opener.pastename(name);
					}
					<?php 
        if (!$multiple) {
            echo "window.close();";
        }
        ?>
				}
			}
			function checknames(frm) {
				if (document.forms[0].subclick) {
					button = document.forms[0].subclick.value;
				} else {
					button = "";
				}
				if (frm.filter.value.length<2&button!="all") {
					alert("<?php 
        echo WT_I18N::translate('Please enter more than one character');
        ?>
");
					frm.filter.focus();
					return false;
				}
				if (button=="all") {
					frm.filter.value = "";
				}
				return true;
			}
		<?php 
        echo '</script>';
        echo "<div align=\"center\">";
        echo "<table class=\"list_table width90\" border=\"0\">";
        echo "<tr><td style=\"padding: 10px;\" valign=\"top\" class=\"facts_label03 width90\">";
        // start column for find text header
        echo $controller->getPageTitle();
        echo "</td>";
        echo "</tr>";
        echo "</table>";
        echo "<br>";
        echo '<button onclick="window.close();">', WT_I18N::translate('close'), '</button>';
        echo "<br>";
        $filter = trim($filter);
        $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter));
        echo "<table class=\"tabs_table width90\"><tr>";
        $myindilist = search_indis_names($filter_array, array(WT_GED_ID), 'AND');
        if ($myindilist) {
            echo "<td class=\"list_value_wrap\"><ul>";
            usort($myindilist, array('WT_GedcomRecord', 'compare'));
            foreach ($myindilist as $indi) {
                $nam = WT_Filter::escapeHtml($indi->getFullName());
                echo "<li><a href=\"#\" onclick=\"pasterow(\n\t\t\t\t\t'" . $indi->getXref() . "' ,\n\t\t\t\t\t'" . $nam . "' ,\n\t\t\t\t\t'" . $indi->getSex() . "' ,\n\t\t\t\t\t'" . $indi->getbirthyear() . "' ,\n\t\t\t\t\t'" . (1901 - $indi->getbirthyear()) . "' ,\n\t\t\t\t\t'" . $indi->getbirthplace() . "'); return false;\">\n\t\t\t\t\t<b>" . $indi->getFullName() . "</b>&nbsp;&nbsp;&nbsp;";
                $born = WT_Gedcom_Tag::getLabel('BIRT');
                echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getbirthyear(), "&nbsp;&nbsp;&nbsp;", $indi->getbirthplace(), "</span></a></li>";
                echo "<hr>";
            }
            echo '</ul></td></tr><tr><td class="list_label">', WT_I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>';
        } else {
            echo "<td class=\"list_value_wrap\">";
            echo WT_I18N::translate('No results found.');
            echo "</td></tr>";
        }
        echo "</table>";
        echo '</div>';
    }
Exemple #11
0
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$controller = new WT_Controller_Simple();
$filter = WT_Filter::get('filter');
$action = WT_Filter::get('action');
$callback = WT_Filter::get('callback');
$multiple = WT_Filter::getBool('multiple');
$controller->setPageTitle(WT_I18N::translate('Find an individual'))->pageHeader();
?>
<script>
	function pasterow(id, nam, mnam, label, gend, cond, dom, dob, dod, occu, age, birthpl, fbirthpl, mbirthpl, chilBLD) {
		window.opener.insertRowToTable(id, nam, mnam, label, gend, cond, dom, dob, dod, occu, age, birthpl, fbirthpl, mbirthpl, chilBLD);
		<?php 
if (!$multiple) {
    echo "window.close();";
}
?>
	}

	function pasteid(id, name, thumb) {
		if (thumb) {
			window.opener.<?php 
 function getOptions()
 {
     $this->chan = WT_Filter::getBool('chan');
 }
Exemple #13
0
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
define('WT_SCRIPT_NAME', 'statistics.php');
require './includes/session.php';
// check for on demand content loading
$tab = WT_Filter::getInteger('tab', 0, 3);
$ajax = WT_Filter::getBool('ajax');
if (!$ajax) {
    $controller = new WT_Controller_Page();
    $controller->setPageTitle(WT_I18N::translate('Statistics'))->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('
			jQuery("#statistics_chart").css("visibility", "visible");
			jQuery("#statistics_chart").tabs({
				load: function() {
					jQuery("#loading-indicator").removeClass("loading-image");
				},
				beforeLoad: function(event, ui) {
					jQuery("#loading-indicator").addClass("loading-image");
					// Only load each tab once
					if (ui.tab.data("loaded")) {
						event.preventDefault();
						return;
					}
Exemple #14
0
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
define('WT_SCRIPT_NAME', 'relationship.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$pid1 = WT_Filter::get('pid1', WT_REGEX_XREF);
$pid2 = WT_Filter::get('pid2', WT_REGEX_XREF);
$show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
$path_to_find = WT_Filter::getInteger('path_to_find');
$followspouse = WT_Filter::getBool('followspouse');
$asc = WT_Filter::getBool('asc');
$asc = $asc ? -1 : 1;
$Dbwidth = $bwidth;
if (!$show_full) {
    $bwidth = $cbwidth;
    $bheight = $cbheight;
    $Dbwidth = $cbwidth;
}
$Dbheight = $bheight;
$Dbxspacing = 0;
$Dbyspacing = 0;
$Dbasexoffset = 0;
$Dbaseyoffset = 0;
$person1 = WT_Individual::getInstance($pid1);
$person2 = WT_Individual::getInstance($pid2);
$controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');