Ejemplo n.º 1
0
function addNormalizedYear($row)
{
    $normalizedYear = '';
    if (isset($row['year'])) {
        $normalizedYear = normalizeYear($row['year']);
        if ($normalizedYear == '') {
            if (isset($row['titleCat'])) {
                $normalizedYear = getYearFromTitle($row['titleCat']);
            }
        }
        if ($normalizedYear != '') {
            $row['yearNormalized'] = $normalizedYear;
        }
    }
    return $row;
}
Ejemplo n.º 2
0
function preprocessFields($field, $value, $item)
{
    if ($field == 'persName') {
        $value = removeSpecial(trim($value, '[]'));
        $value = replaceArrowBrackets($value);
    } elseif ($field == 'placeName') {
        $value = trim($value, '[]');
        $test = preg_match('~[oOsS][\\. ]?[OlL]|[oO]hne Ort|[sS]ine [lL]oco|[oO]hne Druckort|[oO]hne Angabe~', $value);
        if ($value == '' or $test == 1) {
            $value = 's. l.';
        }
    } elseif ($field == 'year') {
        $value = normalizeYear($value);
        if ($value == '') {
            $value = getYearFromTitle($item->titleCat);
        }
        if ($value == '') {
            $value = 9999;
            // Makes empty year fields be sorted to the end
        }
    } elseif ($field == 'format') {
        $value = sortingFormat($value);
    } elseif ($field == 'titleWork') {
        if ($value == '') {
            $value = 'ohne Werktitel';
        }
    } elseif ($value == '') {
        $value = 'ohne Kategorie';
    }
    return $value;
}