示例#1
0
<?php

require_once './includes/config.inc.php';
require_once './includes/functions.inc.php';
sleep(2);
// Don't touch this!
$key = (string) $_GET['data'];
if (file_exists(FACULTY_FILE)) {
    echo json_encode(searching($key));
} else {
    buildCSV();
    echo json_encode(searching($key));
}
//print_r($clean);
// for($i = 0; $i < 20; $i++){
// }
//var_dump($matches);
// Do any magic you want!
示例#2
0
    }
}
//Transcriptions to work with:
$transcriptions = array();
foreach (DataProvider::getTranscriptions($_GET['study']) as $t) {
    $lIx = $t['LanguageIx'];
    if (array_key_exists($lIx, $languages)) {
        $wIx = $t['IxElicitation'] . $t['IxMorphologicalInstance'];
        if (array_key_exists($wIx, $words)) {
            $tIx = $lIx . '-' . $wIx;
            if (array_key_exists($tIx, $transcriptions)) {
                array_push($transcriptions[$tIx], $t);
            } else {
                $transcriptions[$tIx] = array($t);
            }
        }
    }
}
//Building the .csv:
$filename = 'Customexport';
$headline = array("LanguageId", "LanguageName", "Latitude", "Longitude", "WordId", "WordModernName1", "WordModernName2", "WordProtoName1", "WordProtoName2", "Phonetic", "SpellingAltv1", "SpellingAltv2", "NotCognateWithMainWordInThisFamily2");
$rows = array();
foreach ($languages as $lIx => $l) {
    foreach ($words as $wIx => $w) {
        foreach ($transcriptions[$lIx . '-' . $wIx] as $t) {
            array_push($rows, array($lIx, $l['ShortName'], $l['Latitude'], $l['Longtitude'], $wIx, $w['FileNameRfcModernLg01'], $w['FileNameRfcModernLg02'], $w['FileNameRfcProtoLg01'], $w['FileNameRfcProtoLg02'], $t['Phonetic'], $t['SpellingAltv1'], $t['SpellingAltv2'], $t['NotCognateWithMainWordInThisFamily']));
        }
    }
}
buildCSV($filename, $headline, $rows);