Beispiel #1
0
function checkData()
{
    $res = PQuery('BEGIN WORK; LOCK "MapSettings";');
    if (isset($res['error'])) {
        return array('error' => $res['error']);
    }
    $query = 'SELECT * FROM "MapSettings"
                WHERE "LastChangedMap" >= "LastChangedTmpMap"';
    $res = PQuery($query);
    if (isset($res['error'])) {
        return array('error' => $res['error']);
    }
    if ($res['count'] == 1) {
        $res = dropTmpTables(true);
        $res = createTmpTables(true);
        setTmpMapLastEdit();
    } else {
        $res = createTmpTables(true);
    }
    $res = PQuery('COMMIT WORK');
    return array('error' => isset($res['error']) ? $res['error'] : false);
}
Beispiel #2
0
     if ($ret['error']) {
         print json_encode($ret);
     } else {
         setTmpMapLastEdit();
         print json_encode(array("error" => false));
     }
 } elseif ($_POST['mode'] == "addNetworkBox") {
     $networkBoxType = $obj->{'networkBoxType'};
     $invNum = $obj->{'invNum'};
     $boxId = addNetworkBox($networkBoxType, $invNum, TRUE);
     if (isset($boxId['id'])) {
         $result = array("NetworkBoxId" => $boxId['id']);
     } else {
         $result = array("error" => isset($boxId['error']) ? $boxId['error'] : NULL);
     }
     setTmpMapLastEdit();
     setMapUserActivity($uId);
     print json_encode($result);
     die;
 } elseif ($_POST['mode'] == "save") {
     $result = saveTmpData();
     if (defined($result['error'])) {
         print json_encode(array("error" => $result['error']));
     } else {
         print json_encode(array("error" => false));
     }
 } elseif ($_POST['mode'] == "cancel") {
     setMapLastEdit();
     $result = checkData();
     print json_encode($result);
 }