<?php
define('TYPO3_MOD_PATH', '../typo3conf/ext/tuw_informations/');
$BACK_PATH = '../../../typo3/';
require ($BACK_PATH . 'init.php');
if ($_GET['update'] == 1) {
    include ('./tasks/class.tx_tuwinformations_sync.php');
    $sync = new tx_tuwinformations_sync();
    switch ($_GET['get']) {
        case "STAFF":
            $x = $sync->syncStaff($_GET['P']['currentValue']);
        break;
        case "PUBLICATIONS":
            $x = $sync->syncPublications("inst=" . $_GET['P']['currentValue']);
        break;
        case "PROJECTS":
            $x = $sync->syncProjects($_GET['P']['currentValue']);
        break;
    }
    print "Import OK";
} else {
    print 'You are going to update the database. This will take some time (typically less than a minute).<br>';
    print 'Click <a href="test2.php?' . $_SERVER['QUERY_STRING'] . '&update=1">here</a> to start to update now.';
}
?>    
    
