Example #1
0
/**
 * Show an option to preserve the existing CHAN record when editing.
 *
 * @param GedcomRecord $record
 *
 * @return string
 */
function keep_chan(GedcomRecord $record = null)
{
    global $WT_TREE;
    if (Auth::isAdmin()) {
        if ($record) {
            $details = GedcomTag::getLabelValue('DATE', $record->lastChangeTimestamp()) . GedcomTag::getLabelValue('_WT_USER', Filter::escapeHtml($record->lastChangeUser()));
        } else {
            $details = '';
        }
        return '<tr><td class="descriptionbox wrap width25">' . GedcomTag::getLabel('CHAN') . '</td><td class="optionbox wrap">' . '<input type="checkbox" name="keep_chan" value="1" ' . ($WT_TREE->getPreference('NO_UPDATE_CHAN') ? 'checked' : '') . '>' . I18N::translate('Keep the existing “last change” information') . $details . '</td></tr>';
    } else {
        return '';
    }
}
 /**
  * Sort the records by (1) last change date and (2) name
  *
  * @param GedcomRecord $a
  * @param GedcomRecord $b
  *
  * @return int
  */
 private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b)
 {
     return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
 }