|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
function admin_import_title() {
|
|
|
|
|
return _("Frab import");
|
|
|
|
|
}
|
|
|
|
@ -116,8 +117,11 @@ function admin_import() {
|
|
|
|
|
sql_query("DELETE FROM `Room` WHERE `Name`='" . sql_escape($room) . "' LIMIT 1");
|
|
|
|
|
|
|
|
|
|
list($events_new, $events_updated, $events_deleted) = prepare_events($import_file);
|
|
|
|
|
foreach ($events_new as $event)
|
|
|
|
|
sql_query("INSERT INTO `Shifts` SET `name`='" . sql_escape($event['name']) . "', `start`=" . sql_escape($event['start']) . ", `end`=" . sql_escape($event['end']) . ", `RID`=" . sql_escape($event['RID']) . ", `PSID`=" . sql_escape($event['PSID']) . ", `URL`='" . sql_escape($event['URL']) . "'");
|
|
|
|
|
foreach ($events_new as $event) {
|
|
|
|
|
$result = Shift_create($event);
|
|
|
|
|
if ($result === false)
|
|
|
|
|
engelsystem_error('Unable to create shift.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($events_updated as $event)
|
|
|
|
|
sql_query("UPDATE `Shifts` SET `name`='" . sql_escape($event['name']) . "', `start`=" . sql_escape($event['start']) . ", `end`=" . sql_escape($event['end']) . ", `RID`=" . sql_escape($event['RID']) . ", `PSID`=" . sql_escape($event['PSID']) . ", `URL`='" . sql_escape($event['URL']) . "' WHERE `PSID`=" . sql_escape($event['PSID']) . " LIMIT 1");
|
|
|
|
|