private function pageBody(PageController $controller)
    {
        ?>
		<!-- ADMIN PAGE CONTENT -->
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
		<form class="form-inline" method="post">
			<?php 
        echo Filter::getCsrf();
        ?>
			<input type="hidden" name="save" value="1">
			<!-- SHOW PDF -->
			<div class="form-group">
				<label class="control-label">
					<?php 
        echo I18N::translate('Access level');
        ?>
				</label>
				<?php 
        echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_PDF_ACCESS_LEVEL', $this->getSetting('FTV_PDF_ACCESS_LEVEL'), 'class="form-control"');
        ?>
			</div>
			<!-- BUTTONS -->
			<button class="btn btn-primary" type="submit">
				<i class="fa fa-check"></i>
				<?php 
        echo I18N::translate('save');
        ?>
			</button>
		</form>
		<?php 
    }
Ejemplo n.º 2
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
  */
 protected function renderContent()
 {
     return '
         <tr>
             <td class="descriptionbox wrap width33">' . I18N::translate('Enable Piwik Statistics') . '</td>
             <td class="optionbox">' . FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . '</td>
         </tr>' . '<tr>
             <td class="descriptionbox wrap width33">' . I18N::translate('Piwik URL') . '</td>
             <td class="optionbox">
                 <input type="text" name="piwik_url" size="45" value="' . $this->data->get('piwik_url', '') . '" />
             </td>
         </tr>' . '<tr>
             <td class="descriptionbox wrap width33">' . I18N::translate('Piwik Token') . '</td>
             <td class="optionbox">
                 <input type="text" name="piwik_token" size="45" value="' . $this->data->get('piwik_token', '') . '" />
             </td>
         </tr>' . '<tr>
             <td class="descriptionbox wrap width33">' . I18N::translate('Piwik Site ID') . '</td>
             <td class="optionbox">
                 <input type="text" name="piwik_siteid" size="4" value="' . $this->data->get('piwik_siteid', '') . '" />
             </td>
         </tr>';
 }
Ejemplo n.º 3
0
    }
    echo '>', I18N::number($i), '</option>';
}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="descriptionbox">
						<?php 
echo '<label>', I18N::translate('Show details'), '</label>';
?>
					</td>
					<td class="optionbox">
						<?php 
echo FunctionsEdit::twoStateCheckbox('show_full', $controller->showFull());
?>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
<?php 
if ($controller->error_message) {
    echo '<p class="ui-state-error">', $controller->error_message, '</p>';
    return;
}
switch ($controller->chart_style) {
    case 0:
        // List
        echo '<ul id="ancestry_chart" class="chart_common">';
Ejemplo n.º 4
0
    private function config()
    {
        global $WT_TREE;
        $controller = new webtrees\Controller\PageController();
        $controller->restrictAccess(webtrees\Auth::isManager($WT_TREE))->setPageTitle($this->getTitle())->pageHeader();
        $args = array();
        $args['module_name'] = $this->getName();
        $args['tree_id'] = $WT_TREE->getTreeId();
        $items = webtrees\Database::prepare("SELECT block_id, block_order, gedcom_id, bs1.setting_value AS menu_title, bs2.setting_value AS menu_address" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'menu_title'" . " AND bs2.setting_name = 'menu_address'" . " AND IFNULL(gedcom_id, :tree_id) = :tree_id" . " ORDER BY block_order")->execute($args)->fetchAll();
        unset($args['tree_id']);
        $min_block_order = webtrees\Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name = :module_name")->execute($args)->fetchOne();
        $max_block_order = webtrees\Database::prepare("SELECT MAX(block_order) FROM `##block` WHERE module_name = :module_name")->execute($args)->fetchOne();
        ?>
		
		<style>
			.text-left-not-xs, .text-left-not-sm, .text-left-not-md, .text-left-not-lg {
				text-align: left;
			}
			.text-center-not-xs, .text-center-not-sm, .text-center-not-md, .text-center-not-lg {
				text-align: center;
			}
			.text-right-not-xs, .text-right-not-sm, .text-right-not-md, .text-right-not-lg {
				text-align: right;
			}
			.text-justify-not-xs, .text-justify-not-sm, .text-justify-not-md, .text-justify-not-lg {
				text-align: justify;
			}

			@media (max-width: 767px) {
				.text-left-not-xs, .text-center-not-xs, .text-right-not-xs, .text-justify-not-xs {
					text-align: inherit;
				}
				.text-left-xs {
					text-align: left;
				}
				.text-center-xs {
					text-align: center;
				}
				.text-right-xs {
					text-align: right;
				}
				.text-justify-xs {
					text-align: justify;
				}
			}
			@media (min-width: 768px) and (max-width: 991px) {
				.text-left-not-sm, .text-center-not-sm, .text-right-not-sm, .text-justify-not-sm {
					text-align: inherit;
				}
				.text-left-sm {
					text-align: left;
				}
				.text-center-sm {
					text-align: center;
				}
				.text-right-sm {
					text-align: right;
				}
				.text-justify-sm {
					text-align: justify;
				}
			}
			@media (min-width: 992px) and (max-width: 1199px) {
				.text-left-not-md, .text-center-not-md, .text-right-not-md, .text-justify-not-md {
					text-align: inherit;
				}
				.text-left-md {
					text-align: left;
				}
				.text-center-md {
					text-align: center;
				}
				.text-right-md {
					text-align: right;
				}
				.text-justify-md {
					text-align: justify;
				}
			}
			@media (min-width: 1200px) {
				.text-left-not-lg, .text-center-not-lg, .text-right-not-lg, .text-justify-not-lg {
					text-align: inherit;
				}
				.text-left-lg {
					text-align: left;
				}
				.text-center-lg {
					text-align: center;
				}
				.text-right-lg {
					text-align: right;
				}
				.text-justify-lg {
					text-align: justify;
				}
			}
		</style>
		
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo webtrees\I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo webtrees\I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		
		<div class="row">
			<div class="col-sm-4 col-xs-12">
				<form class="form">
					<label for="ged" class="sr-only">
						<?php 
        echo webtrees\I18N::translate('Family tree');
        ?>
					</label>
					<input type="hidden" name="mod" value="<?php 
        echo $this->getName();
        ?>
">
					<input type="hidden" name="mod_action" value="admin_config">
					<div class="col-sm-9 col-xs-9" style="padding:0;">
						<?php 
        echo webtrees\Functions\FunctionsEdit::selectEditControl('ged', webtrees\Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"');
        ?>
					</div>
					<div class="col-sm-3" style="padding:0;">
						<input type="submit" class="btn btn-primary" value="<?php 
        echo webtrees\I18N::translate('show');
        ?>
">
					</div>
				</form>
			</div>
			<span class="visible-xs hidden-sm hidden-md hidden-lg" style="display:block;"></br></br></span>
			<div class="col-sm-4 text-center text-left-xs col-xs-12">
				<p>
					<a href="module.php?mod=<?php 
        echo $this->getName();
        ?>
&amp;mod_action=admin_edit" class="btn btn-primary">
						<i class="fa fa-plus"></i>
						<?php 
        echo webtrees\I18N::translate('Add Menu');
        ?>
					</a>
				</p>
			</div>
			<div class="col-sm-4 text-right text-left-xs col-xs-12">		
				<?php 
        // TODO: Move to internal item/page
        if (file_exists(WT_MODULES_DIR . $this->getName() . '/readme.html')) {
            ?>
					<a href="<?php 
            echo WT_MODULES_DIR . $this->getName();
            ?>
/readme.html" class="btn btn-info">
						<i class="fa fa-newspaper-o"></i>
						<?php 
            echo webtrees\I18N::translate('ReadMe');
            ?>
					</a>
				<?php 
        }
        ?>
			</div>
		</div>
		
		<table class="table table-bordered table-condensed">
			<thead>
				<tr>
					<th class="col-sm-2"><?php 
        echo webtrees\I18N::translate('Position');
        ?>
</th>
					<th class="col-sm-4"><?php 
        echo webtrees\I18N::translate('Menu title');
        ?>
</th>
					<th class="col-sm-4"><?php 
        echo webtrees\I18N::translate('Menu address');
        ?>
</th>
					<th class="col-sm-2" colspan=4><?php 
        echo webtrees\I18N::translate('Controls');
        ?>
</th>
				</tr>
			</thead>
			<tbody>
				<?php 
        foreach ($items as $item) {
            ?>
				<tr>
					<td>
						<?php 
            echo $item->block_order, ', ';
            if ($item->gedcom_id == null) {
                echo webtrees\I18N::translate('All');
            } else {
                echo webtrees\Tree::findById($item->gedcom_id)->getTitleHtml();
            }
            ?>
					</td>
					<td>
						<?php 
            echo webtrees\Filter::escapeHtml(webtrees\I18N::translate($item->menu_title));
            ?>
					</td>
					<td>
						<?php 
            echo webtrees\Filter::escapeHtml(substr(webtrees\I18N::translate($item->menu_address), 0, 1) == '<' ? webtrees\I18N::translate($item->menu_address) : nl2br(webtrees\I18N::translate($item->menu_address)));
            ?>
					</td>
					<td class="text-center">
						<a href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_edit&amp;block_id=<?php 
            echo $item->block_id;
            ?>
">
							<div class="icon-edit">&nbsp;</div>
						</a>
					</td>
					<td class="text-center">
						<a href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_moveup&amp;block_id=<?php 
            echo $item->block_id;
            ?>
">
							<?php 
            if ($item->block_order == $min_block_order) {
                echo '&nbsp;';
            } else {
                echo '<div class="icon-uarrow">&nbsp;</div>';
            }
            ?>
						</a>
					</td>
					<td class="text-center">
						<a href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_movedown&amp;block_id=<?php 
            echo $item->block_id;
            ?>
">
							<?php 
            if ($item->block_order == $max_block_order) {
                echo '&nbsp;';
            } else {
                echo '<div class="icon-darrow">&nbsp;</div>';
            }
            ?>
						</a>
					</td>
					<td class="text-center">
						<a href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_delete&amp;block_id=<?php 
            echo $item->block_id;
            ?>
"
							onclick="return confirm('<?php 
            echo webtrees\I18N::translate('Are you sure you want to delete this menu?');
            ?>
');">
							<div class="icon-delete">&nbsp;</div>
						</a>
					</td>
				</tr>
				<?php 
        }
        ?>
			</tbody>
		</table>
<?php 
    }
Ejemplo n.º 5
0
/**
 * Print a form to add an individual or edit an individual’s name
 *
 * @param string     $nextaction
 * @param Individual $person
 * @param Family     $family
 * @param Fact       $name_fact
 * @param string     $famtag
 * @param string     $gender
 */
function print_indi_form($nextaction, Individual $person = null, Family $family = null, Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U')
{
    global $WT_TREE, $bdm, $controller;
    if ($person) {
        $xref = $person->getXref();
    } elseif ($family) {
        $xref = $family->getXref();
    } else {
        $xref = 'new';
    }
    // Different cultures do surnames differently
    $surname_tradition = SurnameTradition::create($WT_TREE->getPreference('SURNAME_TRADITION'));
    $name_fields = array();
    if ($name_fact) {
        // Editing an existing name
        $name_fact_id = $name_fact->getFactId();
        $name_type = $name_fact->getAttribute('TYPE');
        $namerec = $name_fact->getGedcom();
        foreach (Config::standardNameFacts() as $tag) {
            if ($tag === 'NAME') {
                $name_fields[$tag] = $name_fact->getValue();
            } else {
                $name_fields[$tag] = $name_fact->getAttribute($tag);
            }
        }
        // Populate any missing 2 XXXX fields from the 1 NAME field
        $npfx_accept = implode('|', Config::namePrefixes());
        if (preg_match('/(((' . $npfx_accept . ')\\.? +)*)([^\\n\\/"]*)("(.*)")? *\\/(([a-z]{2,3} +)*)(.*)\\/ *(.*)/i', $name_fields['NAME'], $name_bits)) {
            if (empty($name_fields['NPFX'])) {
                $name_fields['NPFX'] = $name_bits[1];
            }
            if (empty($name_fields['SPFX']) && empty($name_fields['SURN'])) {
                $name_fields['SPFX'] = trim($name_bits[7]);
                // For names with two surnames, there will be four slashes.
                // Turn them into a list
                $name_fields['SURN'] = preg_replace('~/[^/]*/~', ',', $name_bits[9]);
            }
            if (empty($name_fields['GIVN'])) {
                $name_fields['GIVN'] = $name_bits[4];
            }
            if (empty($name_fields['NICK']) && !empty($name_bits[6]) && !preg_match('/^2 NICK/m', $namerec)) {
                $name_fields['NICK'] = $name_bits[6];
            }
        }
    } else {
        // Creating a new name
        $name_fact_id = null;
        $name_type = null;
        $namerec = null;
        // Populate the standard NAME field and subfields
        foreach (Config::standardNameFacts() as $tag) {
            $name_fields[$tag] = '';
        }
        // Inherit surname from parents, spouse or child
        if ($family) {
            $father = $family->getHusband();
            if ($father && $father->getFirstFact('NAME')) {
                $father_name = $father->getFirstFact('NAME')->getValue();
            } else {
                $father_name = '';
            }
            $mother = $family->getWife();
            if ($mother && $mother->getFirstFact('NAME')) {
                $mother_name = $mother->getFirstFact('NAME')->getValue();
            } else {
                $mother_name = '';
            }
        } else {
            $father = null;
            $mother = null;
            $father_name = '';
            $mother_name = '';
        }
        if ($person && $person->getFirstFact('NAME')) {
            $indi_name = $person->getFirstFact('NAME')->getValue();
        } else {
            $indi_name = '';
        }
        switch ($nextaction) {
            case 'add_child_to_family_action':
                $name_fields = $surname_tradition->newChildNames($father_name, $mother_name, $gender) + $name_fields;
                break;
            case 'add_child_to_individual_action':
                if ($person->getSex() === 'F') {
                    $name_fields = $surname_tradition->newChildNames('', $indi_name, $gender) + $name_fields;
                } else {
                    $name_fields = $surname_tradition->newChildNames($indi_name, '', $gender) + $name_fields;
                }
                break;
            case 'add_parent_to_individual_action':
                $name_fields = $surname_tradition->newParentNames($indi_name, $gender) + $name_fields;
                break;
            case 'add_spouse_to_family_action':
                if ($father) {
                    $name_fields = $surname_tradition->newSpouseNames($father_name, $gender) + $name_fields;
                } else {
                    $name_fields = $surname_tradition->newSpouseNames($mother_name, $gender) + $name_fields;
                }
                break;
            case 'add_spouse_to_individual_action':
                $name_fields = $surname_tradition->newSpouseNames($indi_name, $gender) + $name_fields;
                break;
            case 'add_unlinked_indi_action':
            case 'update':
                if ($surname_tradition->hasSurnames()) {
                    $name_fields['NAME'] = '//';
                }
                break;
        }
    }
    $bdm = '';
    // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR
    echo '<div id="edit_interface-page">';
    echo '<h4>', $controller->getPageTitle(), '</h4>';
    FunctionsPrint::initializeCalendarPopup();
    echo '<form method="post" name="addchildform" onsubmit="return checkform();">';
    echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">';
    echo '<input type="hidden" name="action" value="', $nextaction, '">';
    echo '<input type="hidden" name="fact_id" value="', $name_fact_id, '">';
    echo '<input type="hidden" name="xref" value="', $xref, '">';
    echo '<input type="hidden" name="famtag" value="', $famtag, '">';
    echo '<input type="hidden" name="gender" value="', $gender, '">';
    echo '<input type="hidden" name="goto" value="">';
    // set by javascript
    echo Filter::getCsrf();
    echo '<table class="facts_table">';
    switch ($nextaction) {
        case 'add_child_to_family_action':
        case 'add_child_to_individual_action':
            // When adding a new child, specify the pedigree
            FunctionsEdit::addSimpleTag('0 PEDI');
            break;
        case 'update':
            // When adding/editing a name, specify the type
            FunctionsEdit::addSimpleTag('0 TYPE ' . $name_type, '', '', null, $person);
            break;
    }
    // First - new/existing standard name fields
    foreach ($name_fields as $tag => $value) {
        if (substr_compare($tag, '_', 0, 1) !== 0) {
            FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value);
        }
    }
    // Second - new/existing advanced name fields
    if ($surname_tradition->hasMarriedNames() || preg_match('/\\n2 _MARNM /', $namerec)) {
        $adv_name_fields = array('_MARNM' => '');
    } else {
        $adv_name_fields = array();
    }
    if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_NAME_FACTS'), $match)) {
        foreach ($match[1] as $tag) {
            $adv_name_fields[$tag] = '';
        }
    }
    foreach (array_keys($adv_name_fields) as $tag) {
        // Edit existing tags, grouped together
        if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) {
            foreach ($match[1] as $value) {
                FunctionsEdit::addSimpleTag('2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $person));
                if ($tag === '_MARNM') {
                    preg_match_all('/\\/([^\\/]*)\\//', $value, $matches);
                    FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1]));
                }
            }
        }
        // Allow a new tag to be entered
        if (!array_key_exists($tag, $name_fields)) {
            FunctionsEdit::addSimpleTag('0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $person));
            if ($tag === '_MARNM') {
                FunctionsEdit::addSimpleTag('0 _MARNM_SURN');
            }
        }
    }
    // Third - new/existing custom name fields
    foreach ($name_fields as $tag => $value) {
        if (substr_compare($tag, '_', 0, 1) === 0) {
            FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value);
            if ($tag === '_MARNM') {
                preg_match_all('/\\/([^\\/]*)\\//', $value, $matches);
                FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1]));
            }
        }
    }
    // Fourth - SOUR, NOTE, _CUSTOM, etc.
    if ($namerec) {
        $gedlines = explode("\n", $namerec);
        // -- find the number of lines in the record
        $fields = explode(' ', $gedlines[0]);
        $glevel = $fields[0];
        $level = $glevel;
        $type = trim($fields[1]);
        $tags = array();
        $i = 0;
        do {
            if ($type !== 'TYPE' && !array_key_exists($type, $name_fields) && !array_key_exists($type, $adv_name_fields)) {
                $text = '';
                for ($j = 2; $j < count($fields); $j++) {
                    if ($j > 2) {
                        $text .= ' ';
                    }
                    $text .= $fields[$j];
                }
                while ($i + 1 < count($gedlines) && preg_match('/' . ($level + 1) . ' CONT ?(.*)/', $gedlines[$i + 1], $cmatch) > 0) {
                    $text .= "\n" . $cmatch[2];
                    $i++;
                }
                FunctionsEdit::addSimpleTag($level . ' ' . $type . ' ' . $text);
            }
            $tags[] = $type;
            $i++;
            if (isset($gedlines[$i])) {
                $fields = explode(' ', $gedlines[$i]);
                $level = $fields[0];
                if (isset($fields[1])) {
                    $type = $fields[1];
                }
            }
        } while ($level > $glevel && $i < count($gedlines));
    }
    // If we are adding a new individual, add the basic details
    if ($nextaction !== 'update') {
        echo '</table><br><table class="facts_table">';
        // 1 SEX
        if ($famtag === 'HUSB' || $gender === 'M') {
            FunctionsEdit::addSimpleTag("0 SEX M");
        } elseif ($famtag === 'WIFE' || $gender === 'F') {
            FunctionsEdit::addSimpleTag('0 SEX F');
        } else {
            FunctionsEdit::addSimpleTag('0 SEX');
        }
        $bdm = 'BD';
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) {
            foreach ($matches[1] as $match) {
                if (!in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    FunctionsEdit::addSimpleTags($match);
                }
            }
        }
        //-- if adding a spouse add the option to add a marriage fact to the new family
        if ($nextaction === 'add_spouse_to_individual_action' || $nextaction === 'add_spouse_to_family_action') {
            $bdm .= 'M';
            if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) {
                foreach ($matches[1] as $match) {
                    FunctionsEdit::addSimpleTags($match);
                }
            }
        }
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) {
            foreach ($matches[1] as $match) {
                if (in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    FunctionsEdit::addSimpleTags($match);
                }
            }
        }
    }
    echo keep_chan($person);
    echo '</table>';
    if ($nextaction === 'update') {
        // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE
        FunctionsEdit::printAddLayer('SOUR');
        FunctionsEdit::printAddLayer('NOTE');
        FunctionsEdit::printAddLayer('SHARED_NOTE');
        FunctionsEdit::printAddLayer('RESN');
    } else {
        FunctionsEdit::printAddLayer('SOUR', 1);
        FunctionsEdit::printAddLayer('NOTE', 1);
        FunctionsEdit::printAddLayer('SHARED_NOTE', 1);
        FunctionsEdit::printAddLayer('RESN', 1);
    }
    // If we are editing an existing name, allow raw GEDCOM editing
    if ($name_fact && (Auth::isAdmin() || $WT_TREE->getPreference('SHOW_GEDCOM_RECORD'))) {
        echo '<br><br><a href="edit_interface.php?action=editrawfact&amp;xref=', $xref, '&amp;fact_id=', $name_fact->getFactId(), '&amp;ged=', $WT_TREE->getNameUrl(), '">', I18N::translate('Edit raw GEDCOM'), '</a>';
    }
    echo '<p id="save-cancel">';
    echo '<input type="submit" class="save" value="', I18N::translate('save'), '">';
    if (preg_match('/^add_(child|spouse|parent|unlinked_indi)/', $nextaction)) {
        echo '<input type="submit" class="save" value="', I18N::translate('go to new individual'), '" onclick="document.addchildform.goto.value=\'new\';">';
    }
    echo '<input type="button" class="cancel" value="', I18N::translate('close'), '" onclick="window.close();">';
    echo '</p>';
    echo '</form>';
    $controller->addInlineJavascript('
	SURNAME_TRADITION="' . $WT_TREE->getPreference('SURNAME_TRADITION') . '";
	gender="' . $gender . '";
	famtag="' . $famtag . '";
	function trim(str) {
		str=str.replace(/\\s\\s+/g, " ");
		return str.replace(/(^\\s+)|(\\s+$)/g, "");
	}

	function lang_class(str) {
		if (str.match(/[\\u0370-\\u03FF]/)) return "greek";
		if (str.match(/[\\u0400-\\u04FF]/)) return "cyrillic";
		if (str.match(/[\\u0590-\\u05FF]/)) return "hebrew";
		if (str.match(/[\\u0600-\\u06FF]/)) return "arabic";
		return "latin"; // No matched text implies latin :-)
	}

	// Generate a full name from the name components
	function generate_name() {
		var npfx = jQuery("#NPFX").val();
		var givn = jQuery("#GIVN").val();
		var spfx = jQuery("#SPFX").val();
		var surn = jQuery("#SURN").val();
		var nsfx = jQuery("#NSFX").val();
		if (SURNAME_TRADITION === "polish" && (gender === "F" || famtag === "WIFE")) {
			surn = surn.replace(/ski$/, "ska");
			surn = surn.replace(/cki$/, "cka");
			surn = surn.replace(/dzki$/, "dzka");
			surn = surn.replace(/żki$/, "żka");
		}
		// Commas are used in the GIVN and SURN field to separate lists of surnames.
		// For example, to differentiate the two Spanish surnames from an English
		// double-barred name.
		// Commas *may* be used in other fields, and will form part of the NAME.
		if (WT_LOCALE=="vi" || WT_LOCALE=="hu") {
			// Default format: /SURN/ GIVN
			return trim(npfx+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/ "+givn.replace(/ *, */g, " ")+" "+nsfx);
		} else if (WT_LOCALE=="zh") {
			// Default format: /SURN/GIVN
			return trim(npfx+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/"+givn.replace(/ *, */g, " ")+" "+nsfx);
		} else {
			// Default format: GIVN /SURN/
			return trim(npfx+" "+givn.replace(/ *, */g, " ")+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/ "+nsfx);
		}
	}

	// Update the NAME and _MARNM fields from the name components
	// and also display the value in read-only "gedcom" format.
	function updatewholename() {
		// Don’t update the name if the user manually changed it
		if (manualChange) {
			return;
		}
		var npfx = jQuery("#NPFX").val();
		var givn = jQuery("#GIVN").val();
		var spfx = jQuery("#SPFX").val();
		var surn = jQuery("#SURN").val();
		var nsfx = jQuery("#NSFX").val();
		var name = generate_name();
		jQuery("#NAME").val(name);
		jQuery("#NAME_display").text(name);
		// Married names inherit some NSFX values, but not these
		nsfx = nsfx.replace(/^(I|II|III|IV|V|VI|Junior|Jr\\.?|Senior|Sr\\.?)$/i, "");
		// Update _MARNM field from _MARNM_SURN field and display it
		// Be careful of mixing latin/hebrew/etc. character sets.
		var ip = document.getElementsByTagName("input");
		var marnm_id = "";
		var romn = "";
		var heb = "";
		for (var i = 0; i < ip.length; i++) {
			var val = trim(ip[i].value);
			if (ip[i].id.indexOf("_HEB") === 0)
				heb = val;
			if (ip[i].id.indexOf("ROMN") === 0)
				romn = val;
			if (ip[i].id.indexOf("_MARNM") === 0) {
				if (ip[i].id.indexOf("_MARNM_SURN") === 0) {
					var msurn = "";
					if (val !== "") {
						var lc = lang_class(document.getElementById(ip[i].id).value);
						if (lang_class(name) === lc)
							msurn = trim(npfx + " " + givn + " /" + val + "/ " + nsfx);
						else if (lc === "hebrew")
							msurn = heb.replace(/\\/.*\\//, "/" + val + "/");
						else if (lang_class(romn) === lc)
							msurn = romn.replace(/\\/.*\\//, "/" + val + "/");
					}
					document.getElementById(marnm_id).value = msurn;
					document.getElementById(marnm_id+"_display").innerHTML = msurn;
				} else {
					marnm_id = ip[i].id;
				}
			}
		}
	}

	// Toggle the name editor fields between
	// <input type="hidden"> <span style="display:inline">
	// <input type="text">   <span style="display:hidden">
	var oldName = "";

	// Calls to generate_name() trigger an update - hence need to
	// set the manual change to true first.  We are probably
	// listening to the wrong events on the input fields...
	var manualChange = true;
	manualChange = generate_name() !== jQuery("#NAME").val();

	function convertHidden(eid) {
		var input1 = jQuery("#" + eid);
		var input2 = jQuery("#" + eid + "_display");
		// Note that IE does not allow us to change the type of an input, so we must create a new one.
		if (input1.attr("type")=="hidden") {
			input1.replaceWith(input1.clone().attr("type", "text"));
			input2.hide();
		} else {
			input1.replaceWith(input1.clone().attr("type", "hidden"));
			input2.show();
		}
	}

	/**
	 * if the user manually changed the NAME field, then update the textual
	 * HTML representation of it
	 * If the value changed set manualChange to true so that changing
	 * the other fields doesn’t change the NAME line
	 */
	function updateTextName(eid) {
		var element = document.getElementById(eid);
		if (element) {
			if (element.value!=oldName) manualChange = true;
			var delement = document.getElementById(eid+"_display");
			if (delement) {
				delement.innerHTML = element.value;
			}
		}
	}

	function checkform() {
		var ip=document.getElementsByTagName("input");
		for (var i=0; i<ip.length; i++) {
			// ADD slashes to _HEB and _AKA names
			if (ip[i].id.indexOf("_AKA")==0 || ip[i].id.indexOf("_HEB")==0 || ip[i].id.indexOf("ROMN")==0)
				if (ip[i].value.indexOf("/")<0 && ip[i].value!="")
					ip[i].value=ip[i].value.replace(/([^\\s]+)\\s*$/, "/$1/");
			// Blank out temporary _MARNM_SURN
			if (ip[i].id.indexOf("_MARNM_SURN")==0)
					ip[i].value="";
			// Convert "xxx yyy" and "xxx y yyy" surnames to "xxx,yyy"
			if ((SURNAME_TRADITION=="spanish" || "SURNAME_TRADITION"=="portuguese") && ip[i].id.indexOf("SURN")==0) {
				ip[i].value=document.forms[0].SURN.value.replace(/^\\s*([^\\s,]{2,})\\s+([iIyY] +)?([^\\s,]{2,})\\s*$/, "$1,$3");
			}
		}
		return true;
	}

	// If the name isn’t initially formed from the components in a standard way,
	// then don’t automatically update it.
	if (document.getElementById("NAME").value!=generate_name() && document.getElementById("NAME").value!="//") {
		convertHidden("NAME");
	}
	');
    echo '</div>';
}
Ejemplo n.º 6
0
					<?php 
echo I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.');
?>
				</p>
			</div>

			<div class="label">
				<label for="form_visible_online">
					<?php 
echo I18N::translate('Visible to other users when online');
?>
				</label>
			</div>
			<div class="value">
				<?php 
echo FunctionsEdit::checkbox('form_visible_online', Auth::user()->getPreference('visibleonline'));
?>
				<p class="small text-muted">
					<?php 
echo I18N::translate('This checkbox controls your visibility to other users while you’re online. It also controls your ability to see other online users who are configured to be visible.<br><br>When this box is unchecked, you will be completely invisible to others, and you will also not be able to see other online users. When this box is checked, exactly the opposite is true. You will be visible to others, and you will also be able to see others who are configured to be visible.');
?>
				</p>
			</div>
		</div>
		<div id="edituser_submit">
			<input type="submit" value="<?php 
echo I18N::translate('save');
?>
">
		</div>
		<?php 
Ejemplo n.º 7
0
echo I18N::translate('User');
?>
			</label>
			<?php 
echo FunctionsEdit::selectEditControl('user', $users_array, '', $user, 'class="form-control"');
?>
		</div>

		<div class="form-group col-xs-6 col-md-3">
			<label for="gedc">
				<?php 
echo I18N::translate('Family tree');
?>
			</label>
			<?php 
echo FunctionsEdit::selectEditControl('gedc', Tree::getNameList(), '', $gedc, Auth::isAdmin() ? 'class="form-control"' : 'disabled class="form-control"');
?>
		</div>
	</div>

	<div class="row text-center">
		<button type="submit" class="btn btn-primary">
			<?php 
echo I18N::translate('Filter');
?>
		</button>

		<button type="submit" class="btn btn-primary" onclick="document.logs.action.value='export';return true;" <?php 
echo $action === 'show' ? '' : 'disabled';
?>
>
Ejemplo n.º 8
0
        echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>', '<p>', I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which use the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p>', I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree1->getTitleHtml(), '</a>', '</p>', '<p>', '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->getNameUrl(), '">', I18N::translate('Renumber family tree'), ' — ', $tree2->getTitleHtml(), '</a>', '</p>';
    } else {
        Database::beginTransaction();
        Database::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        Database::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn)" . " SELECT ?, xref, tag_type, resn FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?")->execute(array($tree2_id, $tree1_id));
        Database::prepare("INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?")->execute(array($tree2_id, $tree1_id));
        // This table may contain old (deleted) references, which could clash. IGNORE these.
        Database::prepare("INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?")->execute(array($tree2_id, $tree1_id));
        // This table may contain old (deleted) references, which could clash. IGNORE these.
        Database::prepare("INSERT IGNORE INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count)" . " SELECT ?, page_name, page_parameter, page_count FROM `##hit_counter` AS hit_counter2 WHERE gedcom_id = ? AND page_name <> 'index.php'")->execute(array($tree2_id, $tree1_id));
        Database::exec("UNLOCK TABLES");
        Database::commit();
        echo '<p>', I18N::translate('The family trees have been merged successfully.'), '</p>';
    }
} else {
    echo '<form method="post">';
    echo '<input type="hidden" name="go" value="1">';
    echo '<p>', I18N::translate('Copy all the records from %1$s into %2$s.', FunctionsEdit::selectEditControl('tree1_id', Tree::getIdList(), '', null), FunctionsEdit::selectEditControl('tree2_id', Tree::getIdList(), '', null)), '</p>';
    echo '<button type="submit" class="btn btn-primary">';
    echo '<i class="fa fa-check"></i> ', I18N::translate('continue');
    echo '</button>';
    echo '</form>';
}
Ejemplo n.º 9
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if (Module::getModuleByName('ckeditor')) {
            CkeditorModule::enableEditor($this->ctrl);
        }
        /** @var AbstractModule $module  */
        $module = $this->data->get('module');
        ?>
        
        <ol class="breadcrumb small">
        	<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $this->data->get('title');
        ?>
</li>
		</ol>
		
		<h1><?php 
        echo $this->data->get('title');
        ?>
</h1>

		<form method="post" class="form-horizontal">
			<?php 
        echo Filter::getCsrf();
        ?>
			<input type="hidden" name="action" value="update">
			
			<h3><?php 
        echo I18N::translate('Titles');
        ?>
</h3>
			
			<!--  MAJ_TITLE_PREFIX -->        	
        	<div class="form-group">			
        		<label for="MAJ_TITLE_PREFIX" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Title prefixes');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_TITLE_PREFIX" name="MAJ_TITLE_PREFIX" value="<?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_TITLE_PREFIX'));
        ?>
" maxlength="255" placeholder="de |d'|du |of |von |vom |am |zur |van |del |della |t'|da |ten |ter |das |dos |af ">
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Set possible aristocratic particles to separate titles from the land they refer to (e.g. Earl <strong>of</strong> Essex). Variants must be separated by the character |.');
        ?>
<br />
        				<?php 
        echo I18N::translate('An example for this setting is : <strong>de |d\'|du |of |von |vom |am |zur |van |del |della |t\'|da |ten |ter |das |dos |af </strong> (covering some of French, English, German, Dutch, Italian, Spanish, Portuguese, Swedish common particles).');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php 
        echo I18N::translate('Header');
        ?>
</h3>
        	
        	<!-- MAJ_ADD_HTML_HEADER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_HEADER">
    				<?php 
        echo I18N::translate('Include additional HTML in header');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_HEADER', $module->getSetting('MAJ_ADD_HTML_HEADER', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to include raw additional HTML in the header of the page.');
        ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_HEADER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_HEADER">
        			<?php 
        echo I18N::translate('Hide additional header');
        ?>
        		</label>
        		<div class="col-sm-9">
        			<?php 
        echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_HEADER', $module->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE), 'class="form-control"');
        ?>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Select the access level until which the additional header should be displayed. The <em>Hide from everyone</em> should be used to show the header to everybody.');
        ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_HEADER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_HEADER" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Additional HTML in header');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_HEADER" name="MAJ_HTML_HEADER" ><?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_HTML_HEADER'));
        ?>
</textarea>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the header.');
        ?>
<br>
        				<?php 
        echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php 
        echo I18N::translate('Footer');
        ?>
</h3>
        	
        	<!-- MAJ_DISPLAY_CNIL -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_DISPLAY_CNIL">
    				<?php 
        echo I18N::translate('Display French <em>CNIL</em> disclaimer');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_DISPLAY_CNIL', $module->getSetting('MAJ_DISPLAY_CNIL', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to display an information disclaimer in the footer required by the French <em>CNIL</em> for detaining personal information on users.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<!--  MAJ_CNIL_REFERENCE -->        	
        	<div class="form-group">			
        		<label for="MAJ_CNIL_REFERENCE" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('<em>CNIL</em> reference');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_CNIL_REFERENCE" name="MAJ_CNIL_REFERENCE" value="<?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_CNIL_REFERENCE'));
        ?>
" maxlength="255">
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the website has been notified to the French <em>CNIL</em>, an authorisation number may have been delivered. Providing this reference will display a message in the footer visible to all users.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<!-- MAJ_ADD_HTML_FOOTER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_FOOTER">
    				<?php 
        echo I18N::translate('Include additional HTML in footer');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_FOOTER', $module->getSetting('MAJ_ADD_HTML_FOOTER', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to include raw additional HTML in the footer of the page.');
        ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_FOOTER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_FOOTER">
        			<?php 
        echo I18N::translate('Hide additional footer');
        ?>
        		</label>
        		<div class="col-sm-9">
        			<?php 
        echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_FOOTER', $module->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE), 'class="form-control"');
        ?>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Select the access level until which the additional footer should be displayed. The <em>Hide from everyone</em> should be used to show the footer to everybody.');
        ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_FOOTER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_FOOTER" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Additional HTML in footer');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_FOOTER" name="MAJ_HTML_FOOTER" ><?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_HTML_FOOTER'));
        ?>
</textarea>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the footer, before the logo.');
        ?>
<br>
        				<?php 
        echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<div class="form-group">
        		<div class="col-sm-offset-3 col-sm-9">
        			<button type="submit" class="btn btn-primary">
        				<i class="fa fa-check"></i>
        				<?php 
        echo I18N::translate('save');
        ?>
        			</button>
        		</div>
        	</div>
        	
        </form>
		
		<?php 
    }
Ejemplo n.º 10
0
    echo I18N::translate('When adding new close relatives, you can add source citations to the records (individual and family) or to the facts and events (birth, marriage, and death). This option controls whether records or facts will be selected by default.');
    ?>
			</p>
		</div>
	</fieldset>

	<!-- NO_UPDATE_CHAN -->
	<fieldset class="form-group">
		<legend class="control-label col-sm-3">
			<?php 
    echo I18N::translate('Keep the existing “last change” information');
    ?>
		</legend>
		<div class="col-sm-9">
			<?php 
    echo FunctionsEdit::radioButtons('NO_UPDATE_CHAN', $no_yes, $WT_TREE->getPreference('NO_UPDATE_CHAN'), 'class="radio-inline"');
    ?>
			<p class="small text-muted">
				<?php 
    echo I18N::translate('When a record is edited, the user and timestamp are recorded. Sometimes it is desirable to keep the existing “last change” information, for example when making minor corrections to someone else’s data. This option controls whether this feature is selected by default.');
    ?>
			</p>
		</div>
	</fieldset>

	<?php 
}
?>

	<div class="form-group">
		<div class="col-sm-offset-3 col-sm-9">
Ejemplo n.º 11
0
echo I18N::translate('Individual 1');
?>
				</td>
				<td class="optionbox">
					<input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="pid1" id="pid1" size="3" value="<?php 
echo $pid1;
?>
">
					<?php 
echo FunctionsPrint::printFindIndividualLink('pid1');
?>
				</td>
				<td class="optionbox">
					<label>
						<?php 
echo FunctionsEdit::twoStateCheckbox('show_full', $show_full);
?>
						<?php 
echo I18N::translate('Show details');
?>
					</label>
				</td>
				<td class="optionbox vmiddle" rowspan="2">
					<input type="submit" value="<?php 
echo I18N::translate('View');
?>
">
				</td>
			</tr>
			<tr>
				<td class="descriptionbox">
Ejemplo n.º 12
0
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
         $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '1');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only events of living individuals?');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('filter', $filter);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only births, deaths, and marriages?');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('alpha' => I18N::translate('sort by name'), 'anniv' => I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Ejemplo n.º 13
0
    /**
     * Main entry point
     *
     * @return string
     */
    private function main()
    {
        global $WT_TREE;
        $this->plugins = $this->getPluginList();
        // List of available plugins
        $this->plugin = Filter::get('plugin');
        // User parameters
        $this->xref = Filter::get('xref', WT_REGEX_XREF);
        $this->action = Filter::get('action');
        $this->data = Filter::get('data');
        // Don't do any processing until a plugin is chosen.
        if ($this->plugin && array_key_exists($this->plugin, $this->plugins)) {
            $this->PLUGIN = new $this->plugin();
            $this->PLUGIN->getOptions();
            $this->getAllXrefs();
            switch ($this->action) {
                case 'update':
                    $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]);
                    if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) {
                        $newrecord = $this->PLUGIN->updateRecord($this->xref, $record);
                        if ($newrecord != $record) {
                            if ($newrecord) {
                                GedcomRecord::getInstance($this->xref, $WT_TREE)->updateRecord($newrecord, $this->PLUGIN->chan);
                            } else {
                                GedcomRecord::getInstance($this->xref, $WT_TREE)->deleteRecord();
                            }
                        }
                    }
                    $this->xref = $this->findNextXref($this->xref);
                    break;
                case 'update_all':
                    foreach ($this->all_xrefs as $xref => $type) {
                        $record = self::getLatestRecord($xref, $type);
                        if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) {
                            $newrecord = $this->PLUGIN->updateRecord($xref, $record);
                            if ($newrecord != $record) {
                                if ($newrecord) {
                                    GedcomRecord::getInstance($xref, $WT_TREE)->updateRecord($newrecord, $this->PLUGIN->chan);
                                } else {
                                    GedcomRecord::getInstance($xref, $WT_TREE)->deleteRecord();
                                }
                            }
                        }
                    }
                    $this->xref = '';
                    break;
            }
            // Make sure that our requested record really does need updating.
            // It may have been updated in another session, or may not have
            // been specified at all.
            if (array_key_exists($this->xref, $this->all_xrefs) && $this->PLUGIN->doesRecordNeedUpdate($this->xref, self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]))) {
                $this->curr_xref = $this->xref;
            }
            // The requested record doesn't need updating - find one that does
            if (!$this->curr_xref) {
                $this->curr_xref = $this->findNextXref($this->xref);
            }
            if (!$this->curr_xref) {
                $this->curr_xref = $this->findPrevXref($this->xref);
            }
            // If we've found a record to update, get details and look for the next/prev
            if ($this->curr_xref) {
                $this->prev_xref = $this->findPrevXref($this->curr_xref);
                $this->next_xref = $this->findNextXref($this->curr_xref);
            }
        }
        // HTML common to all pages
        $controller = new PageController();
        $controller->setPageTitle(I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader();
        echo $this->getJavascript();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
		
		<form id="batch_update_form" class="form-horizontal" action="module.php" method="get">
			<input type="hidden" name="mod" value="batch_update">
			<input type="hidden" name="mod_action" value="admin_batch_update">
			<input type="hidden" name="xref"   value="' . $this->xref . '">
			<input type="hidden" name="action" value=""><?php 
        // will be set by javascript for next update
        ?>
			<input type="hidden" name="data"   value=""><?php 
        // will be set by javascript for next update
        ?>
			<div class="form-group">
				<label class="control-label col-sm-3"><?php 
        echo I18N::translate('Family tree');
        ?>
</label>
				<div class="col-sm-9">
		<?php 
        echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), '', $WT_TREE->getName(), 'class="form-control" onchange="reset_reload();"');
        ?>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-sm-3"><?php 
        echo I18N::translate('Batch update');
        ?>
</label>
				<div class="col-sm-9">
					<select class="form-control" name="plugin" onchange="reset_reload();">
						<?php 
        if (!$this->plugin) {
            ?>
							<option value="" selected></option>
						<?php 
        }
        ?>
						<?php 
        foreach ($this->plugins as $class => $plugin) {
            ?>
							<option value="<?php 
            echo $class;
            ?>
" <?php 
            echo $this->plugin == $class ? 'selected' : '';
            ?>
><?php 
            echo $plugin->getName();
            ?>
</option>
					<?php 
        }
        ?>
					</select>
					<?php 
        if ($this->PLUGIN) {
            ?>
						<p class="small text-muted"><?php 
            echo $this->PLUGIN->getDescription();
            ?>
</p>
		<?php 
        }
        ?>
				</div>
			</div>

				<?php 
        if (!Auth::user()->getPreference('auto_accept')) {
            ?>
				<div class="alert alert-danger">
				<?php 
            echo I18N::translate('Your user account does not have “automatically approve changes” enabled.  You will only be able to change one record at a time.');
            ?>
				</div>
			<?php 
        }
        ?>

			<?php 
        // If a plugin is selected, display the details
        ?>
			<?php 
        if ($this->PLUGIN) {
            ?>
				<?php 
            echo $this->PLUGIN->getOptionsForm();
            ?>
				<?php 
            if (substr($this->action, -4) == '_all') {
                ?>
					<?php 
                // Reset - otherwise we might "undo all changes", which refreshes the
                ?>
					<?php 
                // page, which makes them all again!
                ?>
					<script>reset_reload();</script>
			<?php 
            } else {
                ?>
					<hr>
					<div id="batch_update2" class="col-sm-12">
						<?php 
                if ($this->curr_xref) {
                    ?>
							<?php 
                    // Create an object, so we can get the latest version of the name.
                    ?>
								<?php 
                    $this->record = GedcomRecord::getInstance($this->curr_xref, $WT_TREE);
                    ?>
			
							<div class="form-group">
								<?php 
                    echo self::createSubmitButton(I18N::translate('previous'), $this->prev_xref);
                    ?>
					<?php 
                    echo self::createSubmitButton(I18N::translate('next'), $this->next_xref);
                    ?>
							</div>
							<div class="form-group">
								<a class="lead" href="<?php 
                    echo $this->record->getHtmlUrl();
                    ?>
"><?php 
                    echo $this->record->getFullName();
                    ?>
</a>
					<?php 
                    echo $this->PLUGIN->getActionPreview($this->record);
                    ?>
							</div>
							<div class="form-group">
							<?php 
                    echo implode(' ', $this->PLUGIN->getActionButtons($this->curr_xref, $this->record));
                    ?>
							</div>
						<?php 
                } else {
                    ?>
							<div class="alert alert-info"><?php 
                    echo I18N::translate('Nothing found.');
                    ?>
</div>
					<?php 
                }
                ?>
					</div>
				<?php 
            }
            ?>
		<?php 
        }
        ?>
		</form>
		<?php 
    }
Ejemplo n.º 14
0
    private function pageBody(PageController $controller)
    {
        $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
        ?>
		<!-- ADMIN PAGE CONTENT -->
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>

		<!-- *** FORM 1 *** -->
		<form class="form-horizontal" method="post" name="form1">
			<?php 
        echo Filter::getCsrf();
        ?>
			<!-- SELECT TREE -->
			<div class="form-group">
				<label class="control-label col-sm-2" for="tree">
					<?php 
        echo I18N::translate('Family tree');
        ?>
				</label>
				<div class="col-sm-4">
					<select id="tree" name="NEW_FIB_TREE" class="form-control">
						<?php 
        foreach (Tree::getAll() as $tree) {
            ?>
							<?php 
            if ($tree->getTreeId() == $this->tree_id) {
                ?>
								<option value="<?php 
                echo $tree->getTreeId();
                ?>
" data-ged="<?php 
                echo $tree->getNameHtml();
                ?>
" selected="selected">
									<?php 
                echo $tree->getTitleHtml();
                ?>
								</option>
							<?php 
            } else {
                ?>
								<option value="<?php 
                echo $tree->getTreeId();
                ?>
" data-ged="<?php 
                echo $tree->getNameHtml();
                ?>
">
									<?php 
                echo $tree->getTitleHtml();
                ?>
								</option>
							<?php 
            }
            ?>
						<?php 
        }
        ?>
					</select>
				</div>
			</div>
		</form>

		<!-- PANEL GROUP ACCORDION -->
		<div class="panel-group" id="accordion">
			<!-- PANEL 1 -->
			<div class="panel panel-default" id="panel1">
				<div class="panel-heading">
					<h4 class="panel-title">
						<a data-toggle="collapse" data-target="#collapseOne" href="#">
							<?php 
        echo I18N::translate('Pages');
        ?>
						</a>
					</h4>
				</div>
				<div id="collapseOne" class="panel-collapse collapse in">
					<div class="panel-body">
						<?php 
        if (empty($FTV_SETTINGS) || !empty($FTV_SETTINGS) && !$this->searchArray($FTV_SETTINGS, 'TREE', $this->tree_id)) {
            ?>
							<div class="alert alert-info alert-dismissible" role="alert">
								<button type="button" class="close" data-dismiss="alert" aria-label="' . I18N::translate('close') . '">
									<span aria-hidden="true">&times;</span>
								</button>
								<p class="small text-muted">
									<?php 
            echo I18N::translate('Use the search form below to search for a root person. After a successful search the Fancy Treeview page will be automatically created. You can add as many root persons as you want.');
            ?>
								</p>
							</div>
						<?php 
        }
        ?>
						<!-- *** FORM 2 *** -->
						<div id="ftv-search-form" class="form-group alert alert-info">
							<form class="form-inline" method="post" name="form2">
								<!-- SURNAME SEARCH FIELD -->
								<div class="form-group">
									<label class="control-label">
										<?php 
        echo I18N::translate('Search root person');
        ?>
									</label>
									<input
										class="form-control"
										data-autocomplete-type="SURN"
										id="surname-search"
										name="SURNAME"
										placeholder="<?php 
        echo I18N::translate('Surname');
        ?>
"
										type="text"
										>
									<label class="checkbox-inline">
										<?php 
        echo FunctionsEdit::checkbox('soundex_std') . I18N::translate('Russell');
        ?>
									</label>
									<label class="checkbox-inline">
										<?php 
        echo FunctionsEdit::checkbox('soudex_dm') . I18N::translate('Daitch-Mokotoff');
        ?>
									</label>
									<button name="search" class="btn btn-primary" type="submit">
										<i class="fa fa-search"></i>
										<?php 
        echo I18N::translate('search');
        ?>
									</button>
								</div>
								<!-- PID SEARCH FIELD -->
								<?php 
        $class = I18N::direction() === 'rtl' ? 'pull-left' : 'pull-right';
        ?>
								<div class="form-group <?php 
        echo $class;
        ?>
">
									<label class="control-label" for="pid-search">
										<?php 
        echo I18N::translate('Or enter an ID');
        ?>
									</label>
									<input
										class="form-control"
										data-autocomplete-type="INDI"
										id="pid-search"
										name="PID"
										placeholder="<?php 
        echo I18N::translate('Search ID by name');
        ?>
"
										type="text"
										value=""
										>
									<button name="Ok" class="btn btn-primary" type="submit">
										<i class="fa fa-check"></i>
										<?php 
        echo I18N::translate('ok');
        ?>
									</button>
								</div>
							</form>
							<!-- *** FORM 3 *** -->
							<form class="form-horizontal" method="post" name="form3">
								<!-- TABLE -->
								<table id="search-result-table" class="table" style="display: none">
									<thead>
										<tr>
											<th><?php 
        echo I18N::translate('Root person');
        ?>
</th>
											<?php 
        if (!$this->options('use_fullname')) {
            ?>
												<th><?php 
            echo I18N::translate('Surname in page title');
            ?>
</th>
											<?php 
        }
        ?>
											<th><?php 
        echo I18N::translate('Page title');
        ?>
</th>
											<th><?php 
        echo I18N::translate('Access level');
        ?>
</th>
											<th><?php 
        echo I18N::translate('Add');
        ?>
</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<!-- ROOT PERSONS FULL NAME -->
											<td id="root">
												<?php 
        if ($this->options('use_fullname')) {
            ?>
													<input
														name="surname"
														type="hidden"
														value=""
														>
													<?php 
        }
        ?>
												<input
													name="pid"
													type="hidden"
													value=""
													>
												<input
													name="sort"
													type="hidden"
													value=""
													>
												<span></span>
											</td>
											<?php 
        if (!$this->options('use_fullname')) {
            ?>
												<!-- SURNAME IN PAGE TITLE -->
												<td id="surn">
													<label class="showname"></label>
													<input
														class="form-control editname"
														name="surname"
														type="text"
														value=""
														>
												</td>
											<?php 
        }
        ?>
											<!-- PAGE TITLE -->
											<td id="title"></td>
											<!-- ACCESS LEVEL -->
											<td>
												<?php 
        echo FunctionsEdit::editFieldAccessLevel('access_level', 2, 'class="form-control"');
        ?>
											</td>
											<!-- ADD BUTTON -->
											<td>
												<button	type="submit" name="add" class="btn btn-success btn-sm" title="<?php 
        I18N::translate('Add');
        ?>
">
													<i class="fa fa-plus"></i>
												</button>
											</td>
										</tr>
									</tbody>
								</table>
							</form>
						</div>
						<?php 
        echo $this->addMessage("error", "danger", true);
        ?>
						<?php 
        echo $this->addMessage('update-settings', 'success', true, I18N::translate('The settings for this tree are succesfully updated'));
        ?>
						<div id="fancy-treeview-form" class="form-group">
							<?php 
        if (!empty($FTV_SETTINGS) && $this->searchArray($FTV_SETTINGS, 'TREE', $this->tree_id)) {
            ?>
								<form class="form-horizontal" method="post" name="form4">
									<!-- TABLE -->
									<table id="fancy-treeview-table" class="table table-hover">
										<thead>
											<tr>
												<th><?php 
            echo I18N::translate('Root person');
            ?>
</th>
												<?php 
            if (!$this->options('use_fullname')) {
                ?>
													<th><?php 
                echo I18N::translate('Surname in page title');
                ?>
</th>
												<?php 
            }
            ?>
												<th><?php 
            echo I18N::translate('Page title');
            ?>
</th>
												<th><?php 
            echo I18N::translate('Access level');
            ?>
</th>
												<th><?php 
            echo I18N::translate('Delete');
            ?>
</th>
											</tr>
										</thead>
										<tbody>
											<?php 
            foreach ($FTV_SETTINGS as $key => $this_ITEM) {
                ?>
												<?php 
                if ($this_ITEM['TREE'] == $this->tree_id) {
                    ?>
													<?php 
                    if (Individual::getInstance($this_ITEM['PID'], $this->tree)) {
                        ?>
														<tr class="sortme">
															<!-- ROOT PERSONS FULL NAME -->
															<td>
																<input
																	name="pid[<?php 
                        echo $key;
                        ?>
]"
																	type="hidden"
																	value="<?php 
                        echo $this_ITEM['PID'];
                        ?>
"
																	>
																<input
																	name="sort[<?php 
                        echo $key;
                        ?>
]"
																	type="hidden"
																	value="<?php 
                        echo $this_ITEM['SORT'];
                        ?>
"
																	>
																	<?php 
                        echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getFullName() . '';
                        ?>
																(<?php 
                        echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getLifeSpan();
                        ?>
)
															</td>
															<?php 
                        if (!$this->options('use_fullname')) {
                            ?>
																<!-- SURNAME IN PAGE TITLE -->
																<td>
																	<label class="showname">
																		<?php 
                            echo $this_ITEM['SURNAME'];
                            ?>
																	</label>
																	<input
																		class="form-control editname"
																		name="surname[<?php 
                            echo $key;
                            ?>
]"
																		type="text"
																		value="<?php 
                            echo $this_ITEM['SURNAME'];
                            ?>
"
																		>
																</td>
															<?php 
                        }
                        ?>
															<!-- PAGE TITLE -->
															<td>
																<a href="module.php?mod=<?php 
                        echo $this->getName();
                        ?>
&amp;mod_action=page&amp;ged=<?php 
                        echo $this->tree->getNameHtml();
                        ?>
&amp;rootid=<?php 
                        echo $this_ITEM['PID'];
                        ?>
" target="_blank">
																	<?php 
                        if ($this->options('use_fullname') == true) {
                            echo I18N::translate('Descendants of %s', Individual::getInstance($this_ITEM['PID'], $this->tree)->getFullName());
                        } else {
                            echo I18N::translate('Descendants of the %s family', $this_ITEM['SURNAME']);
                        }
                        ?>
																</a>
															</td>
															<!-- ACCESS LEVEL -->
															<td>
																<?php 
                        echo FunctionsEdit::editFieldAccessLevel('access_level[' . $key . ']', $this_ITEM['ACCESS_LEVEL'], 'class="form-control"');
                        ?>
															</td>
															<!-- DELETE BUTTON -->
															<td>
																<button	type="button" name="delete" class="btn btn-danger btn-sm" data-key="<?php 
                        echo $key;
                        ?>
" title="<?php 
                        I18N::translate('Delete');
                        ?>
">
																	<i class="fa fa-trash-o"></i>
																</button>
															</td>
														</tr>
													<?php 
                    } else {
                        ?>
														<tr>
															<!-- SURNAME -->
															<td class="error">
																<input
																	name="pid[<?php 
                        echo $key;
                        ?>
]"
																	type="hidden"
																	value="<?php 
                        echo $this_ITEM['PID'];
                        ?>
"
																	>
																	<?php 
                        echo $this_ITEM['SURNAME'];
                        ?>
															</td>
															<!-- ERROR MESSAGE -->
															<td colspan="4" class="error">
																<?php 
                        echo I18N::translate('The person with root id %s doesn’t exist anymore in this tree', $this_ITEM['PID']);
                        ?>
															</td>
															<!-- DELETE BUTTON -->
															<td>
																<button name="delete" type="button" class="btn btn-danger btn-sm" title="<?php 
                        I18N::translate('Delete');
                        ?>
">
																	<i class="fa fa-trash-o"></i>
																</button>
															</td>
														</tr>
													<?php 
                    }
                    ?>
												<?php 
                }
                ?>
											<?php 
            }
            ?>
										</tbody>
									</table>
									<!-- BUTTONS -->
									<button name="update" class="btn btn-primary" type="submit">
										<i class="fa fa-check"></i>
										<?php 
            echo I18N::translate('update');
            ?>
									</button>
								</form>
							<?php 
        }
        ?>
						</div>
					</div>
				</div>
			</div>

			<!-- PANEL 2 -->
			<div class="panel panel-default" id="panel2">
				<div class="panel-heading">
					<h4 class="panel-title">
						<a data-toggle="collapse" data-target="#collapseTwo" href="#" class="collapsed">
							<?php 
        echo I18N::translate('Options for %s', $this->tree->getTitleHtml());
        ?>
						</a>
					</h4>
				</div>
				<div id="collapseTwo" class="panel-collapse collapse">
					<div class="panel-body">
						<?php 
        echo $this->addMessage('save-options', 'success', true, I18N::translate('The options for this tree are succesfully saved'));
        ?>
						<?php 
        echo $this->addMessage('reset-options', 'success', true, I18N::translate('The options for this tree are succesfully reset to the default settings'));
        ?>
						<div id="ftv-options-form" class="form-group">
							<form class="form-horizontal" method="post" name="form5">
								<!-- USE FULLNAME IN MENU -->
								<div class="form-group fullname">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Use fullname in menu');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_FULLNAME]', $this->options('use_fullname'), 'class="radio-inline"');
        ?>
									</div>
								</div>
								<!-- GENERATION BLOCKS -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Number of generation blocks to show');
        ?>
									</label>
									<div class="col-sm-4">
										<?php 
        echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[NUMBLOCKS]', array(I18N::translate('All'), '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'), null, $this->options('numblocks'), 'class="form-control"');
        ?>
									</div>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('This option is especially usefull for large trees. When you notice a slow page load, here you can set the number of generation blocks to load at once to a lower level. Below the last generation block a button will appear to add the next set of generation blocks. The new blocks will be added to the blocks already loaded. Clicking on a “follow” link in the last visible generation block, will also load the next set of generation blocks.');
        ?>
									</p>
								</div>
								<!-- SHOW SINGLES -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show single persons');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_SINGLES]', $this->options('show_singles'), 'class="radio-inline"');
        ?>
									</div>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('Turn this option on if you want to show single persons in the generation blocks. Single persons are persons without partner and children. With this option turned on, every child of a family will be shown in a detailed way in the next generation block.');
        ?>
									</p>
								</div>
								<!-- CHECK RELATIONSHIP -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Check relationship between partners');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[CHECK_RELATIONSHIP]', $this->options('check_relationship'), 'class="radio-inline"');
        ?>
									</div>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('With this option turned on, the script checks if a (married) couple has the same ancestors. If a relationship between the partners is found, a text will appear between brackets after the spouses’ name to indicate the blood relationship.');
        ?>
</p>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('<strong>Note</strong>: this option can be time and/or memory consuming, especially on large trees. It can cause very slow page loading or an ’execution time out error’ on your server. If you notice such a behavior, reduce the number of generation blocks to load at once or don’t use it in combination with the option to show singles (see the previous options). If you still experience any problems, don’t use this option at all.');
        ?>
									</p>
								</div>
								<!-- SHOW PLACES -->
								<div id="places" class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show places?');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_PLACES]', $this->options('show_places'), 'class="radio-inline"');
        ?>
									</div>
								</div>
								<!-- USE GEDCOM PLACE SETTING -->
								<div id="gedcom_places" class="form-group<?php 
        if (!$this->options('show_places')) {
            echo ' collapse';
        }
        ?>
">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Use default GEDCOM settings to abbreviate place names?');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_GEDCOM_PLACES]', $this->options('use_gedcom_places'), 'class="radio-inline"');
        ?>
									</div>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('If you have ticked the “Show places” option, you can choose to use the default GEDCOM settings to abbreviate placenames. If you don’t set this option, full place names will be shown.');
        ?>
									</p>
								</div>
								<!-- GET COUNTRYLIST -->
								<?php 
        if ($this->getCountrylist()) {
            ?>
									<div id="country_list" class="form-group<?php 
            if (!$this->options('show_places') || $this->options('use_gedcom_places')) {
                echo ' collapse';
            }
            ?>
">
										<label class="control-label col-sm-4">
											<?php 
            echo I18N::translate('Select your country');
            ?>
										</label>
										<div class="col-sm-8">
											<?php 
            echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[COUNTRY]', $this->getCountryList(), '', $this->options('country'), 'class="form-control"');
            ?>
										</div>
										<p class="col-sm-8 col-sm-offset-4 small text-muted">
											<?php 
            echo I18N::translate('If you have ticked the “Show places” option but NOT the option to abbreviate placenames, you can set your own country here. Full places will be listed on the Fancy Treeview pages, but when a place includes the name of your own country, this name will be left out. If you don’t select a country then all countries will be shown, including your own.');
            ?>
										</p>
									</div>
								<?php 
        }
        ?>
								<!-- SHOW OCCUPATIONS -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show occupations');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_OCCU]', $this->options('show_occu'), 'class="radio-inline"');
        ?>
									</div>
								</div>
								<!-- RESIZE THUMBS -->
								<div id="resize_thumbs" class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Resize thumbnails');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[RESIZE_THUMBS]', $this->options('resize_thumbs'), 'class="radio-inline"');
        ?>
									</div>
									<p class="col-sm-8 col-sm-offset-4 small text-muted">
										<?php 
        echo I18N::translate('Here you can choose to resize the default webtrees thumbnails especially for the Fancy Treeview pages. You can set a custom size in percentage or in pixels. If you choose “no” the default webtrees thumbnails will be used with the formats you have set on the tree configuration page.');
        ?>
									</p>
								</div>
								<!-- THUMB SIZE -->
								<div id="thumb_size" class="form-group<?php 
        if (!$this->options('resize_thumbs')) {
            echo ' collapse';
        }
        ?>
">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Thumbnail size');
        ?>
									</label>
									<div class="row">
										<div class="col-sm-1">
											<input
												class="form-control"
												id="NEW_FTV_OPTIONS[THUMB_SIZE]"
												name="NEW_FTV_OPTIONS[THUMB_SIZE]"
												type="text"
												value="<?php 
        echo $this->options('thumb_size');
        ?>
"
												>
										</div>
										<div class="col-sm-2">
											<?php 
        echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[THUMB_RESIZE_FORMAT]', array('1' => I18N::translate('percent'), '2' => I18N::translate('pixels')), null, $this->options('thumb_resize_format'), 'class="form-control"');
        ?>
										</div>
									</div>
								</div>
								<!-- SQUARE THUMBS -->
								<div id="square_thumbs" class="form-group<?php 
        if (!$this->options('resize_thumbs')) {
            echo ' collapse';
        }
        ?>
">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Use square thumbnails');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_SQUARE_THUMBS]', $this->options('use_square_thumbs'), 'class="radio-inline"');
        ?>
									</div>
								</div>
								<!-- SHOW USERFORM -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show form to change start person');
        ?>
									</label>
									<div class="col-sm-4">
										<?php 
        echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_OPTIONS[SHOW_USERFORM]', $this->options('show_userform'), 'class="form-control"');
        ?>
									</div>
								</div>
								<!-- SHOW PDF -->
								<div class="form-group">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show PDF icon?');
        ?>
									</label>
									<div class="col-sm-4">
										<?php 
        echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_OPTIONS[SHOW_PDF_ICON]', $this->options('show_pdf_icon'), 'class="form-control"');
        ?>
									</div>
								</div>
								<!-- SHOW FANCY TREEVIEW ON INDI PAGE -->
								<div class="form-group fullname">
									<label class="control-label col-sm-4">
										<?php 
        echo I18N::translate('Show a Fancy Treeview tab on the individual page');
        ?>
									</label>
									<div class="col-sm-8">
										<?php 
        echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[FTV_TAB]', $this->options('ftv_tab'), 'class="radio-inline"');
        ?>
									</div>
								</div>
								<!-- BUTTONS -->
								<button name="save-options" class="btn btn-primary" type="submit">
									<i class="fa fa-check"></i>
									<?php 
        echo I18N::translate('save');
        ?>
								</button>
								<button name="reset-options" class="btn btn-primary" type="reset">
									<i class="fa fa-recycle"></i>
									<?php 
        echo I18N::translate('reset');
        ?>
								</button>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php 
    }
Ejemplo n.º 15
0
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
            $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls'));
            $this->setBlockSetting($block_id, 'start', Filter::postBool('start'));
            $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
            $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
            $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
            $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
            $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
            $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
            $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
            $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
            $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png'));
            $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
            $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
            $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
            $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book'));
            $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card'));
            $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
            $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
            $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document'));
            $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
            $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
            $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film'));
            $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
            $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
            $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map'));
            $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
            $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other'));
            $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
            $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
            $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
            $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video'));
        }
        $filter = $this->getBlockSetting($block_id, 'filter', 'all');
        $controls = $this->getBlockSetting($block_id, 'controls', '1');
        $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show only individuals, events, or all');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, '');
        echo '</td></tr>';
        $filters = array('avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'));
        ?>
	<tr>
	<td class="descriptionbox wrap width33">
		<?php 
        echo I18N::translate('Filter');
        ?>
	</td>
	<td class="optionbox">
		<center><b><?php 
        echo GedcomTag::getLabel('FORM');
        ?>
</b></center>
		<table class="width100">
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_avi" <?php 
        echo $filters['avi'] ? 'checked' : '';
        ?>
>
						avi
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_bmp" <?php 
        echo $filters['bmp'] ? 'checked' : '';
        ?>
>
						bmp
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_gif" <?php 
        echo $filters['gif'] ? 'checked' : '';
        ?>
>
						gif
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_jpeg" <?php 
        echo $filters['jpeg'] ? 'checked' : '';
        ?>
>
						jpeg
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_mp3" <?php 
        echo $filters['mp3'] ? 'checked' : '';
        ?>
>
						mp3
					</label>
				</td>
					<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_ole" <?php 
        echo $filters['ole'] ? 'checked' : '';
        ?>
>
						ole
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_pcx" <?php 
        echo $filters['pcx'] ? 'checked' : '';
        ?>
>
						pcx
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_pdf" <?php 
        echo $filters['pdf'] ? 'checked' : '';
        ?>
>
						pdf
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_png" <?php 
        echo $filters['png'] ? 'checked' : '';
        ?>
>
						png
					</label>
				</td>
			</tr>
			<tr>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_tiff" <?php 
        echo $filters['tiff'] ? 'checked' : '';
        ?>
>
						tiff
					</label>
				</td>
				<td class="width33">
					<label>
						<input type="checkbox" value="yes" name="filter_wav" <?php 
        echo $filters['wav'] ? 'checked' : '';
        ?>
>
						wav
					</label>
				</td>
				<td class="width33"></td>
				<td class="width33"></td>
			</tr>
		</table>
			<br>
			<center><b><?php 
        echo GedcomTag::getLabel('TYPE');
        ?>
</b></center>
				<table class="width100">
					<tr>
					<?php 
        //-- Build the list of checkboxes
        $i = 0;
        foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) {
            $i++;
            if ($i > 3) {
                $i = 1;
                echo '</tr><tr>';
            }
            echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" ';
            echo $filters[$typeName] ? 'checked' : '';
            echo '> ' . $typeValue . '</label></td>';
        }
        ?>
				</tr>
			</table>
		</td>
	</tr>

	<?php 
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show slide show controls');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('controls', $controls);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Start slide show on page load');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('start', $start);
        echo '</td></tr>';
    }
Ejemplo n.º 16
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag()
  */
 public function hAddSimpleTag($context, $level)
 {
     switch ($context) {
         case 'SOUR':
             FunctionsEdit::addSimpleTag($level . ' _ACT');
             break;
     }
 }
Ejemplo n.º 17
0
         $old_gedcom = $linker->getGedcom();
         $new_gedcom = FunctionsEdit::removeLinks($old_gedcom, $record->getXref());
         // FunctionsDb::fetch_all_links() does not take account of pending changes. The links (or even the
         // record itself) may have already been deleted.
         if ($old_gedcom !== $new_gedcom) {
             // If we have removed a link from a family to an individual, and it has only one member
             if (preg_match('/^0 @' . WT_REGEX_XREF . '@ FAM/', $new_gedcom) && preg_match_all('/\\n1 (HUSB|WIFE|CHIL) @(' . WT_REGEX_XREF . ')@/', $new_gedcom, $match) == 1) {
                 // Delete the family
                 $family = GedcomRecord::getInstance($xref, $WT_TREE);
                 FlashMessages::addMessage(I18N::translate('The family “%s” has been deleted because it only has one member.', $family->getFullName()));
                 $family->deleteRecord();
                 // Delete any remaining link to this family
                 if ($match) {
                     $relict = GedcomRecord::getInstance($match[2][0], $WT_TREE);
                     $new_gedcom = $relict->getGedcom();
                     $new_gedcom = FunctionsEdit::removeLinks($new_gedcom, $linker->getXref());
                     $relict->updateRecord($new_gedcom, false);
                     FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $relict->getFullName(), $family->getFullName()));
                 }
             } else {
                 // Remove links from $linker to $record
                 FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $linker->getFullName(), $record->getFullName()));
                 $linker->updateRecord($new_gedcom, false);
             }
         }
     }
     // Delete the record itself
     $record->deleteRecord();
 } else {
     http_response_code(406);
 }
Ejemplo n.º 18
0
 /** {@inheritdoc} */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
         $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
         $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
     $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
     $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
     $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('name' => I18N::translate('sort by name'), 'date_asc' => I18N::translate('sort by date, oldest first'), 'date_desc' => I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show the user who made the change');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Should this block be hidden when it is empty');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
Ejemplo n.º 19
0
    echo I18N::translate('An administrator must approve the new user account and select an access level before the user can log in.');
    ?>
			</p>
		</div>
	</fieldset>

	<!-- SHOW_REGISTER_CAUTION -->
	<fieldset class="form-group">
		<legend class="col-sm-3 control-label">
			<?php 
    echo I18N::translate('Show acceptable use agreement on “Request new user account” page');
    ?>
		</legend>
		<div class="col-sm-9">
			<?php 
    echo FunctionsEdit::editFieldYesNo('SHOW_REGISTER_CAUTION', Site::getPreference('SHOW_REGISTER_CAUTION'), 'class="radio-inline"');
    ?>
			<p class="small text-muted">
			</p>
		</div>
	</fieldset>

	<?php 
} elseif (Filter::get('action') === 'tracking') {
    ?>
	<input type="hidden" name="action" value="tracking">

		<p>
			<?php 
    echo I18N::translate('If you use one of the following tracking and analytics services, webtrees can add the tracking codes automatically.');
    ?>
Ejemplo n.º 20
0
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Ejemplo n.º 21
0
    /**
     * Places administration.
     */
    private function adminPlaces()
    {
        global $WT_TREE;
        $action = Filter::get('action');
        $parent = Filter::get('parent');
        $inactive = Filter::getBool('inactive');
        $deleteRecord = Filter::get('deleteRecord');
        if (!isset($parent)) {
            $parent = 0;
        }
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin());
        if ($action == 'ExportFile' && Auth::isAdmin()) {
            $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 '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";';
            if ($maxLevel > 0) {
                echo '"', I18N::translate('State'), '";';
            }
            if ($maxLevel > 1) {
                echo '"', I18N::translate('County'), '";';
            }
            if ($maxLevel > 2) {
                echo '"', I18N::translate('City'), '";';
            }
            if ($maxLevel > 3) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 4) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 5) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 6) {
                echo '"', I18N::translate('Place'), '";';
            }
            if ($maxLevel > 7) {
                echo '"', I18N::translate('Place'), '";';
            }
            echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";';
            echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL;
            $this->outputLevel($parent);
            exit;
        }
        $controller->setPageTitle(I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>

		<ul class="nav nav-tabs nav-justified" role="tablist">
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_config" role="tab">
					<?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
				</a>
			</li>
			<li role="presentation" class="active">
				<a href="#">
					<?php 
        echo I18N::translate('Geographic data');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_placecheck">
					<?php 
        echo I18N::translate('Place check');
        ?>
				</a>
			</li>
		</ul>

		<h2><?php 
        echo I18N::translate('Geographic data');
        ?>
</h2>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = Functions::getSubRecord(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 = Functions::getSubRecord(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 = Database::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++;
                            Database::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 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++;
                            Database::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 Filter::escapeHtml($escparent), '<br>';
                        } else {
                            if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') {
                                Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id));
                                echo Filter::escapeHtml($escparent), '<br>';
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action === 'ImportFile') {
            $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra');
            sort($placefiles);
            ?>
		<form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&amp;mod_action=admin_places&amp;action=ImportFile2">

			<!-- PLACES FILE -->
			<div class="form-group">
				<label class="control-label col-sm-4" for="placesfile">
					<?php 
            echo I18N::translate('File containing places (CSV)');
            ?>
				</label>
				<div class="col-sm-8">
					<div class="btn btn-default">
					<input id="placesfile" type="file" name="placesfile">
					</div>
				</div>
			</div>

			<!-- LOCAL FILE -->
			<?php 
            if (count($placefiles) > 0) {
                ?>
			<div class="form-group">
				<label class="control-label col-sm-4" for="localfile">
					<?php 
                echo I18N::translate('Server file containing places (CSV)');
                ?>
				</label>
				<div class="col-sm-8">
					<div class="input-group">
						<span class="input-group-addon">
							<?php 
                echo WT_MODULES_DIR . 'googlemap/extra/';
                ?>
						</span>
						<?php 
                foreach ($placefiles as $p => $placefile) {
                    unset($placefiles[$p]);
                    $p = Filter::escapeHtml($placefile);
                    if (substr($placefile, 0, 1) == "/") {
                        $placefiles[$p] = substr($placefile, 1);
                    } else {
                        $placefiles[$p] = $placefile;
                    }
                }
                echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"');
                ?>
					</div>
				</div>
			</div>
			<?php 
            }
            ?>

			<!-- CLEAR DATABASE -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Delete all existing geographic data before importing the file.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('cleardatabase', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- UPDATE ONLY -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Do not create new locations, just import coordinates for existing locations.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('updateonly', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- OVERWRITE DATA -->
			<fieldset class="form-group">
				<legend class="control-label col-sm-4">
					<?php 
            echo I18N::translate('Overwrite existing coordinates.');
            ?>
				</legend>
				<div class="col-sm-8">
					<?php 
            echo FunctionsEdit::editFieldYesNo('overwritedata', 0, 'class="radio-inline"');
            ?>
				</div>
			</fieldset>

			<!-- SAVE BUTTON -->
			<div class="form-group">
				<div class="col-sm-offset-4 col-sm-8">
					<button type="submit" class="btn btn-primary">
						<i class="fa fa-check"></i>
						<?php 
            echo I18N::translate('Continue adding');
            ?>
					</button>
				</div>
			</div>
		</form>
		<?php 
            exit;
        }
        if ($action === 'ImportFile2') {
            $country_names = array();
            $stats = new Stats($WT_TREE);
            foreach ($stats->iso3166() as $key => $value) {
                $country_names[$key] = I18N::translate($key);
            }
            if (Filter::postBool('cleardatabase')) {
                Database::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 = Database::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 (!Filter::postBool('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)) {
                                Database::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);
                                }
                                Database::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 (Filter::postBool('overwritedata') && $i + 1 == count($parent)) {
                            Database::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 {
                            // Update only if existing data is missing
                            if (!$row->pl_long && !$row->pl_lati) {
                                Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $parent_id));
                            }
                            if (!$row->pl_icon && $place['icon']) {
                                Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?")->execute(array($place['icon'], $parent_id));
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'DeleteRecord') {
            $exists = Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne();
            if (!$exists) {
                Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord));
            } else {
                echo '<table class="facts_table"><tr><td>', 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 I18N::translate('Remove this location?');
        ?>
');
			if (answer == true) {
				window.location = '<?php 
        echo Functions::getQueryUrl(array('action' => 'DeleteRecord'));
        ?>
&action=DeleteRecord&deleteRecord=' + placeid;
			}
		}
		</script>
		<p id="gm_breadcrumb">
			<?php 
        $where_am_i = $this->placeIdToHierarchy($parent);
        foreach (array_reverse($where_am_i, true) as $id => $place) {
            if ($id == $parent) {
                if ($place != 'Unknown') {
                    echo Filter::escapeHtml($place);
                } else {
                    echo I18N::translate('unknown');
                }
            } else {
                echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">';
                if ($place != 'Unknown') {
                    echo Filter::escapeHtml($place), '</a>';
                } else {
                    echo I18N::translate('unknown'), '</a>';
                }
            }
            echo ' - ';
        }
        ?>
			<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php 
        echo I18N::translate('Top level');
        ?>
</a>
		</p>

		<form class="form-inline" name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '">
			<div class="checkbox">
				<label for="inactive">
				   <?php 
        echo FunctionsEdit::checkbox('inactive', $inactive, 'onclick="updateList(this.checked)"');
        ?>
				   <?php 
        echo I18N::translate('Show inactive places');
        ?>
				</label>
			</div>
			<p class="small text-muted">
				<?php 
        echo I18N::translate('By default, the list shows only those places which can be found in your family trees.  You may have details for other places, such as those imported in bulk from an external file.  Selecting this option will show all places, including ones that are not currently used.');
        ?>
				<?php 
        echo I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.');
        ?>
			</p>
		</form>

		<?php 
        $placelist = $this->getPlaceListLocation($parent, $inactive);
        echo '<div class="gm_plac_edit">';
        echo '<table class="table table-bordered table-condensed table-hover"><tr>';
        echo '<th>', GedcomTag::getLabel('PLAC'), '</th>';
        echo '<th>', GedcomTag::getLabel('LATI'), '</th>';
        echo '<th>', GedcomTag::getLabel('LONG'), '</th>';
        echo '<th>', I18N::translate('Zoom level'), '</th>';
        echo '<th>', I18N::translate('Icon'), '</th>';
        echo '<th>';
        echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>';
        if (count($placelist) == 0) {
            echo '<tr><td colspan="7">', 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 Filter::escapeHtml($place['place']), '</a></td>';
            } else {
                echo 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']) {
                echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">';
            } else {
                if ($place['lati'] || $place['long']) {
                    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/images/mm_20_yellow.png">';
                }
            }
            echo '</td>';
            echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>';
            $noRows = Database::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 I18N::translate('Remove');
                ?>
"></a></td>
		<?php 
            } else {
                ?>
				<td><i class="icon-delete-grey"></i></td>
		<?php 
            }
            ?>
			</tr>
			<?php 
        }
        ?>
		</table>
		</div>

		<hr>
		<form class="form-horizontal" action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;">
			<div class="form-group">
				<label class="form-control-static col-sm-4" for="parent_id">
					<?php 
        echo I18N::translate('Add a new geographic location');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('parent_id', $where_am_i, I18N::translate('Top level'), $parent, 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-plus"></i>
						<?php 
        echo I18N::translate('Add');
        ?>
					</button>
				</div>
			</div>
		</form>

		<form class="form-horizontal" 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">
			<div class="form-group">
				<label class="form-control-static col-sm-4" for="ged">
					<?php 
        echo I18N::translate('Import all places from a family tree');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-upload"></i>
						<?php 
        echo I18N::translate('Import');
        ?>
					</button>
				</div>
			</div>
		</form>

		<form class="form-horizontal" 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">
			<div class="form-group">
				<label class="form-control-static col-sm-4">
					<?php 
        echo I18N::translate('Upload geographic data');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<button type="submit" class="btn btn-default">
							<i class="fa fa-upload"></i>
							<?php 
        echo I18N::translate('Upload');
        ?>
						</button>
					</div>
				</div>
			</div>
		</form>

		<form class="form-horizontal" 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">
			<div class="form-group">
				<label class="form-control-static col-sm-4">
					<?php 
        echo I18N::translate('Download geographic data');
        ?>
				</label>
				<div class="col-sm-8">
					<div class="col-sm-6">
						<?php 
        echo FunctionsEdit::selectEditControl('parent', $where_am_i, I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"');
        ?>
					</div>
					<button type="submit" class="btn btn-default">
						<i class="fa fa-download"></i>
						<?php 
        echo I18N::translate('Download');
        ?>
					</button>
				</div>
			</div>
		</form>
		<?php 
    }
    /**
     * Provide a form to manage the FAQs.
     */
    private function config()
    {
        global $WT_TREE;
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Frequently asked questions'))->pageHeader();
        $faqs = Database::prepare("SELECT block_id, block_order, gedcom_id, bs1.setting_value AS header, bs2.setting_value AS faqbody" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'header'" . " AND bs2.setting_name = 'faqbody'" . " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" . " ORDER BY block_order")->execute(array('module_name' => $this->getName(), 'tree_id_1' => $WT_TREE->getTreeId(), 'tree_id_2' => $WT_TREE->getTreeId()))->fetchAll();
        $min_block_order = Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name = 'faq' AND (gedcom_id = :tree_id OR gedcom_id IS NULL)")->execute(array('tree_id' => $WT_TREE->getTreeId()))->fetchOne();
        $max_block_order = Database::prepare("SELECT MAX(block_order) FROM `##block` WHERE module_name = 'faq' AND (gedcom_id = :tree_id OR gedcom_id IS NULL)")->execute(array('tree_id' => $WT_TREE->getTreeId()))->fetchOne();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
		<p>
			<?php 
        echo I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors.  Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.');
        ?>
			<?php 
        echo I18N::translate('You may use HTML to format the answer and to add links to other websites.');
        ?>
		</p>
		<form class="form form-inline">
			<label for="ged" class="sr-only">
				<?php 
        echo I18N::translate('Family tree');
        ?>
			</label>
			<input type="hidden" name="mod" value="<?php 
        echo $this->getName();
        ?>
">
			<input type="hidden" name="mod_action" value="admin_config">
			<?php 
        echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"');
        ?>
			<input type="submit" class="btn btn-primary" value="<?php 
        echo I18N::translate('show');
        ?>
">
		</form>

		<p>
			<a href="module.php?mod=<?php 
        echo $this->getName();
        ?>
&amp;mod_action=admin_edit" class="btn btn-default">
				<i class="fa fa-plus"></i>
				<?php 
        echo I18N::translate('Add an FAQ item');
        ?>
			</a>
		</p>

		<?php 
        echo '<table class="table table-bordered">';
        if (empty($faqs)) {
            echo '<tr><td class="error center" colspan="5">', I18N::translate('The FAQ list is empty.'), '</td></tr></table>';
        } else {
            foreach ($faqs as $faq) {
                // NOTE: Print the position of the current item
                echo '<tr class="faq_edit_pos"><td>';
                echo I18N::translate('#%s', $faq->block_order + 1), ' ';
                if ($faq->gedcom_id === null) {
                    echo I18N::translate('All');
                } else {
                    echo $WT_TREE->getTitleHtml();
                }
                echo '</td>';
                // NOTE: Print the edit options of the current item
                echo '<td>';
                if ($faq->block_order == $min_block_order) {
                    echo '&nbsp;';
                } else {
                    echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_moveup&amp;block_id=', $faq->block_id, '"><i class="fa fa-arrow-up"></i></i> ', I18N::translate('Move up'), '</a>';
                }
                echo '</td><td>';
                if ($faq->block_order == $max_block_order) {
                    echo '&nbsp;';
                } else {
                    echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_movedown&amp;block_id=', $faq->block_id, '"><i class="fa fa-arrow-down"></i></i> ', I18N::translate('Move down'), '</a>';
                }
                echo '</td><td>';
                echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit&amp;block_id=', $faq->block_id, '"><i class="fa fa-pencil"></i> ', I18N::translate('Edit'), '</a>';
                echo '</td><td>';
                echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_delete&amp;block_id=', $faq->block_id, '" onclick="return confirm(\'', I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeHtml($faq->header)), '\');"><i class="fa fa-trash"></i> ', I18N::translate('Delete'), '</a>';
                echo '</td></tr>';
                // NOTE: Print the title text of the current item
                echo '<tr><td colspan="5">';
                echo '<div class="faq_edit_item">';
                echo '<div class="faq_edit_title">', $faq->header, '</div>';
                // NOTE: Print the body text of the current item
                echo '<div class="faq_edit_content">', substr($faq->faqbody, 0, 1) == '<' ? $faq->faqbody : nl2br($faq->faqbody, false), '</div></div></td></tr>';
            }
            echo '</table>';
        }
    }
    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
            $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
            $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
            $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
            $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
            $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
            $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
            $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
            $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
            $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
            $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
            $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
            $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
            $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
            $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
            $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
            $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
            $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
            $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
        }
        $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
        $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
        $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
        $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
        $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
        $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
        $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
        $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
        $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
        $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
        $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
        $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
        $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
        $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
        $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
        $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
        $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
        ?>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Show date of last update?');
        ?>
			</td>
			<td class="optionbox">
				<?php 
        echo FunctionsEdit::editFieldYesNo('show_last_update', $show_last_update);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Show common surnames?');
        ?>
			</td>
			<td class="optionbox">
				<?php 
        echo FunctionsEdit::editFieldYesNo('show_common_surnames', $show_common_surnames);
        ?>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo I18N::translate('Select the stats to show in this block');
        ?>
</td>
			<td class="optionbox">
				<table>
					<tbody>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_indi" <?php 
        echo $stat_indi ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individuals');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_birth" <?php 
        echo $stat_first_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_surname" <?php 
        echo $stat_surname ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total surnames');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_birth" <?php 
        echo $stat_last_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_fam" <?php 
        echo $stat_fam ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Families');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_death" <?php 
        echo $stat_first_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_sour" <?php 
        echo $stat_sour ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Sources');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_last_death" <?php 
        echo $stat_last_death ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Latest death year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_media" <?php 
        echo $stat_media ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Media objects');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_long_life" <?php 
        echo $stat_long_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individual who lived the longest');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_repo" <?php 
        echo $stat_repo ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Repositories');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_life" <?php 
        echo $stat_avg_life ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average age at death');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_events" <?php 
        echo $stat_events ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total events');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_most_chil" <?php 
        echo $stat_most_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Family with the most children');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_users" <?php 
        echo $stat_users ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Total users');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_avg_chil" <?php 
        echo $stat_avg_chil ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Average number of children per family');
        ?>
								</label>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<?php 
    }
Ejemplo n.º 24
0
">
	<input type="hidden" name="action" value="filter">
	<input type="hidden" name="search" value="yes">
	<table class="list_table">
		<tbody>
			<tr>
				<td class="descriptionbox wrap">
					<label for="folder">
						<?php 
echo I18N::translate('Folder');
?>
					</label>
				</td>
				<td class="optionbox wrap">
					<?php 
echo FunctionsEdit::selectEditControl('folder', $folders, null, $folder);
?>
				</td>
				<?php 
if (Auth::isEditor($WT_TREE)) {
    ?>
				<td class="descriptionbox wrap">
					<label for="sortby">
						<?php 
    echo I18N::translate('Sort order');
    ?>
					</label>
				</td>
				<td class="optionbox wrap">
					<select name="sortby" id="sortby">
						<option value="title" <?php 
Ejemplo n.º 25
0
        echo I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.');
        ?>
				</p>
			</div>
		</div>

		<!-- THEME -->
		<div class="form-group">
			<label class="control-label col-sm-3" for="theme">
				<?php 
        echo I18N::translate('Theme');
        ?>
			</label>
			<div class="col-sm-9">
				<?php 
        echo FunctionsEdit::selectEditControl('theme', Theme::themeNames(), I18N::translate('<default theme>'), $user->getPreference('theme'), 'class="form-control"');
        ?>
			</div>
		</div>

		<!-- COMMENTS -->
		<div class="form-group">
			<label class="control-label col-sm-3" for="comment">
				<?php 
        echo I18N::translate('Administrator comments on user');
        ?>
			</label>
			<div class="col-sm-9">
				<textarea class="form-control" id="comment" name="comment" rows="5" maxlength="255"><?php 
        echo Filter::escapeHtml($user->getPreference('comment'));
        ?>
Ejemplo n.º 26
0
"></td>
				<td class="col-xs-5">
					<table class="table">
						<tbody>
							<?php 
    foreach (Tree::getAll() as $tree) {
        ?>
								<tr>
									<td>
										<?php 
        echo $tree->getTitleHtml();
        ?>
									</td>
									<td>
										<?php 
        echo FunctionsEdit::editFieldAccessLevel('access-' . $module->getName() . '-' . $tree->getTreeId(), $module->getAccessLevel($tree, 'sidebar'));
        ?>
									</td>
								</tr>
							<?php 
    }
    ?>
						</tbody>
					</table>
				</td>
			</tr>
		<?php 
}
?>
		</tbody>
	</table>
Ejemplo n.º 27
0
 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $num = $this->getBlockSetting($block_id, 'num', '10');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $block = $this->getBlockSetting($block_id, 'block', '0');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of items to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="num" size="2" value="', $num, '">';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
Ejemplo n.º 28
0
}
if (Auth::isAdmin() && $action === 'update') {
    echo '<tr><td class="descriptionbox wrap width25">';
    echo GedcomTag::getLabel('CHAN'), '</td><td class="optionbox wrap">';
    if ($NO_UPDATE_CHAN) {
        echo '<input type="checkbox" checked name="preserve_last_changed">';
    } else {
        echo '<input type="checkbox" name="preserve_last_changed">';
    }
    echo I18N::translate('Keep the existing “last change” information'), '<br>';
    echo '</td></tr>';
}
echo '</table>';
FunctionsEdit::printAddLayer('SOUR', 1);
FunctionsEdit::printAddLayer('NOTE', 1);
FunctionsEdit::printAddLayer('SHARED_NOTE', 1);
FunctionsEdit::printAddLayer('RESN', 1);
?>
		<p id="save-cancel">
			<input type="submit" class="save" value="<?php 
echo I18N::translate('save');
?>
">
			<input type="button" class="cancel" value="<?php 
echo I18N::translate('close');
?>
" onclick="window.close();">
		</p>
	</form>
</div>
<?php 
Ejemplo n.º 29
0
			<?php 
echo I18N::translate('Setup wizard for webtrees');
?>
		</h1>
<?php 
echo '<form name="config" action="', WT_SCRIPT_NAME, '" method="post" onsubmit="this.btncontinue.disabled=\'disabled\';">';
echo '<input type="hidden" name="lang" value="', WT_LOCALE, '">';
////////////////////////////////////////////////////////////////////////////////
// Step one - choose language and confirm server configuration
////////////////////////////////////////////////////////////////////////////////
if (!isset($_POST['lang'])) {
    $installed_languages = array();
    foreach (I18N::installedLocales() as $locale) {
        $installed_languages[$locale->languageTag()] = $locale->endonym();
    }
    echo '<p>', I18N::translate('Change language'), ' ', FunctionsEdit::selectEditControl('change_lang', $installed_languages, null, WT_LOCALE, 'onchange="window.location=\'' . WT_SCRIPT_NAME . '?lang=\'+this.value;">'), '</p>', '<h2>', I18N::translate('Checking server configuration'), '</h2>';
    $warnings = false;
    $errors = false;
    // Mandatory functions
    $disable_functions = preg_split('/ *, */', ini_get('disable_functions'));
    foreach (array('parse_ini_file') as $function) {
        if (in_array($function, $disable_functions)) {
            echo '<p class="bad">', I18N::translate('%s is disabled on this server.  You cannot install webtrees until it is enabled.  Please ask your server’s administrator to enable it.', $function . '()'), '</p>';
            $errors = true;
        }
    }
    // Mandatory extensions
    foreach (array('pcre', 'pdo', 'pdo_mysql', 'session', 'iconv') as $extension) {
        if (!extension_loaded($extension)) {
            echo '<p class="bad">', I18N::translate('PHP extension “%s” is disabled.  You cannot install webtrees until this is enabled.  Please ask your server’s administrator to enable it.', $extension), '</p>';
            $errors = true;
Ejemplo n.º 30
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        /** @var GeoAnalysis $ga */
        $ga = $this->data->get('geo_analysis');
        $is_new = is_null($ga);
        $places_hierarchy = $this->data->get('places_hierarchy');
        ?>
        
        <ol class="breadcrumb small">
        	<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li><a href="<?php 
        echo $this->data->get('admin_config_url');
        ?>
"><?php 
        echo $this->data->get('module_title');
        ?>
</a></li>
			<li class="active"><?php 
        echo $this->data->get('title');
        ?>
</li>
		</ol>
		
		<h1><?php 
        echo $this->data->get('title');
        ?>
</h1>
		
		<form class="form-horizontal" name="newform" method="post" role="form" action="<?php 
        echo $this->data->get('save_url');
        ?>
" autocomplete="off">
    		<?php 
        echo Filter::getCsrf();
        ?>
    		<?php 
        if (!$is_new) {
            ?>
    		<input type="hidden" name="ga_id" value="<?php 
            echo $ga->getId();
            ?>
">
    		<?php 
        }
        ?>
    
    		<!-- DESCRIPTION -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="description">
    				<?php 
        echo I18N::translate('Description');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php 
        if (!$is_new) {
            echo 'value="' . Filter::escapeHtml($ga->getTitle()) . '"';
        }
        ?>
 dir="auto">
    				<p class="small text-muted">
    					<?php 
        echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<!-- ANALYSIS LEVEL -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="analysislevel">
    				<?php 
        echo I18N::translate('Analysis level');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::selectEditControl('analysislevel', $places_hierarchy['hierarchy'], null, $is_new ? '' : $ga->getAnalysisLevel() - 1, 'class="form-control"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Subdivision level used for the analysis.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<h3><?php 
        echo I18N::translate('Display options');
        ?>
</h3>
    		
    		<!-- USE MAP -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="use_map">
    				<?php 
        echo I18N::translate('Use map');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('use_map', !$is_new && ($ga && $ga->hasMap()) ? 1 : 0, 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Displays the results on a map.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<div id="map_options">
    		
    		    <!-- MAP -->
        		<div class="form-group">
        			<label class="control-label col-sm-3" for="map_file">
        				<?php 
        echo I18N::translate('Map');
        ?>
        			</label>
        			<div class="col-sm-9">
        				<?php 
        echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list'), null, $is_new || !$ga->hasMap() ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"');
        ?>
        				<p class="small text-muted">
        					<?php 
        echo I18N::translate('Map outline to be used for the result display.');
        ?>
        				</p>
        			</div>
        		</div>
        		
        		<!-- MAP TOP LEVEL -->
        		<div class="form-group">
        			<label class="control-label col-sm-3" for="map_top_level">
        				<?php 
        echo I18N::translate('Map parent level');
        ?>
        			</label>
        			<div class="col-sm-9">
        				<?php 
        echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || !$ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"');
        ?>
        				<p class="small text-muted">
        					<?php 
        echo I18N::translate('Subdivision level of the parent subdivision(s) represented by the map.');
        ?>
<br />
        					<?php 
        echo I18N::translate('For instance, if the map is intended to represent a country by county analysis, then the map parent level would be “Country”, and the analysis level would be “County”.');
        ?>
        				</p>
        			</div>
        		</div>
    		</div>
    		
    		<!-- USE FLAGS -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="use_flags">
    				<?php 
        echo I18N::translate('Use flags');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('use_flags', !$is_new && ($ga && $ga->getOptions()->isUsingFlags()) ? 1 : 0, 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Display the place\'s flag, instead of or in addition to the place name.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<!-- GENERATION DETAILS -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="gen_details">
    				<?php 
        echo I18N::translate('Top places number');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::selectEditControl('gen_details', $this->data->get('generation_details'), null, !$is_new && ($ga && $ga->getOptions()) ? $ga->getOptions()->getMaxDetailsInGen() : 0, 'class="form-control"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Set the number of top places to display in the generation breakdown view.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<div class="form-group">
    			<div class="col-sm-offset-3 col-sm-9">
    				<button type="submit" class="btn btn-primary">
    					<?php 
        echo $is_new ? I18N::translate('Add') : I18N::translate('save');
        ?>
    				</button>
    			</div>
    		</div>
    	</form>
		
		<?php 
    }