<?php

include_once "Config.inc";
try {
    if (count($argv) < 2) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tSupprimeClient.php nomClient client email serveur\n" . "\tclient\t\tIdentifiant unique du client voir ListeClients.php\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $clientId = $argv[1];
    $clients = $bpl->getClientData(array("clientId" => $clientId));
    if (is_array($clients) and count($clients)) {
        $bpl->delVirtualClient($clients[0]);
    } else {
        throw new Exception("Cannot find client {$clientId}\n");
    }
} catch (Exception $e) {
    echo "Exception reçue : " . $e->getMessage() . "\n";
}
            }
        }
    }
}
function getClientIdFromRef($ref)
{
    $elts = explode("_", $ref, 2);
    return $elts[0];
}
try {
    if (count($argv) < 4) {
        echo "Erreur:\tErreur: Arguments manquants\n" . "Usage:\tGenereTachesJoursClient.php clientId dateDebut dateFin\n" . "\tAjoute les tâches par jour pour les données ZoneCountingProcessing et FlowCountingProcessing pour " . "l'intercalle [ dateDebut ; dataFin [\n" . "\tref\t\tIdentifiant du client voir ListeClients.php\n" . "\tdateDebut\tDate du début de la période au format 'YYYYMMDD'\n" . "\tdateFin\t\tDate de fin de la période au format 'YYYYMMDD'\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $ref = $argv[1];
    $period = array("start" => $argv[2], "end" => $argv[3]);
    $clients = $bpl->getClients();
    $clientId = null;
    for ($i = 0; $clientId == null && $i < count($clients); ++$i) {
        if ($clients[$i]["clientId"] == $ref) {
            $clientId = $ref;
        }
    }
    if (!$clientId) {
        throw new Exception("Identifiant client {$ref} non trouvé");
    }
    $bpl->setClientId($clientId);
    include_once "BluePHP/Utils/DateOps.inc";
    $res = getTimeSlicesAsStrings($period["start"] . "000000", $period["end"] . "000000", array('second' => 0, 'minute' => 0, 'hour' => 0, 'day' => 1, 'month' => 0, 'year' => 0));
                        }
                    }
                }
            }
        }
    }
    $str .= sprintf("%'-52s\n%22s%5d%5d%5d%5d%5d%5d\n", "-", "Total = ", $total["value0"], $total["nbcumul0"], $total["nbexpected0"], $total["value1"], $total["nbcumul1"], $total["nbexpected1"]);
    return $str;
}
try {
    if (count($argv) < 6) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tVisualiseDonneesHeures.php ref dateDebut dateFin heureDebut heureFin\n" . "\tref\t\tIdentifiant du capteur voir ListeIdentifiantCapteur.php\n" . "\tdateDebut\tDate du début de la période au format 'YYYYMMDD'\n" . "\tdateFin\t\tDate de fin de la période au format 'YYYYMMDD'\n" . "\theureDebut\tHeure de début de la période au format HH\n" . "\theureFin\tHeure de fin de la période au format HH\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $ref = $argv[1];
    $period = array("start" => $argv[2], "end" => $argv[3], "hstart" => $argv[4], "hend" => $argv[5]);
    $capteurs = $bpl->getIPTable();
    $clientId = null;
    for ($i = 0; $clientId == null && $i < count($capteurs); ++$i) {
        if ($capteurs[$i]["bluecountId"] == $ref) {
            $clientId = $capteurs[$i]["clientId"];
        }
    }
    if (!$clientId) {
        throw new Exception("Identifiant capteur {$ref} non trouvé");
    }
    $bpl->setClientId($clientId);
    include_once "BluePHP/Utils/DateOps.inc";
    $res = getTimeSlicesAsStrings($period["start"] . "000000", $period["end"] . "000000", array('second' => 0, 'minute' => 0, 'hour' => 0, 'day' => 1, 'month' => 0, 'year' => 0));
<?php

include_once "Config.inc";
try {
    if (count($argv) < 2) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tSupprimeClientLients.php client\n" . "\tclient\t\tIdentifiant unique du client voir ListeClients.php\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $clientId = $argv[1];
    $bpl->deleteBlueCountClientAssoc(array("clientId" => $clientId));
} catch (Exception $e) {
    echo "Exception reçue : " . $e->getMessage() . "\n";
}
                            $out = "value0";
                        }
                        $str .= $cp["name"] . ";" . strftime("%d/%m/%Y", $time) . ";" . $v[$in] . ";" . $v[$out] . "\n";
                    }
                }
            }
        }
    }
    return $str;
}
try {
    if (count($argv) < 3) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tgetCSVDay.php dateDebut dateFin\n" . "\tdateDebut\tDate du début de la période au format 'YYYYMMDD'\n" . "\tdateFin\t\tDate de fin de la période au format 'YYYYMMDD'\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    include_once "BluePHP/Utils/DateOps.inc";
    $bpl = new BluePortailLang(array());
    $refs = $bpl->getIPTable();
    $clientId = "CRTBretagne";
    $bpl->setClientId($clientId);
    include_once "BluePHP/BTopLocalServer/FlowCountingProcessing.inc";
    $period = array("start" => $argv[1], "end" => $argv[2]);
    $res = getTimeSlicesAsStrings($period["start"] . "000000", $period["end"] . "000000", array('second' => 0, 'minute' => 0, 'hour' => 0, 'day' => 1, 'month' => 0, 'year' => 0));
    echo "Porte ; Date ; Entrees ; Sorties\n";
    $cp = new FlowCountingProcessing();
    $cpList = $cp->getFlows();
    echo showCountingData($res, $cpList, $cp, 8);
} catch (Exception $e) {
    echo "Exception reçue : ", $e->getMessage(), "\n";
}
<?php

include_once "Config.inc";
try {
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $links = $bpl->getLinks();
    $refs = array();
    foreach ($links as $l) {
        $elts = explode("_", $l["bluecountId"]);
        $l["ref"] = $elts[0];
        if (!isset($refs[$elts[0]])) {
            $refs[$elts[0]] = array($l["clientId"] => $l);
        } else {
            if (!isset($refs[$elts[0]][$l["clientId"]])) {
                $refs[$elts[0]][$l["clientId"]] = $l;
            }
        }
    }
    echo sprintf("%32s%16s%32s%12s\n", "Identifiant", "Client", "Serveur", "Activé");
    foreach ($refs as $ref) {
        foreach ($ref as $r) {
            echo sprintf("%32s%16s%32s%12s\n", $r["ref"], $r["clientId"], $r["server"], $r["isActivated"]);
        }
    }
} catch (Exception $e) {
    echo "Exception reçue : " . $e->getMessage() . "\n";
}
<?php

include_once "Config.inc";
try {
    if (count($argv) < 2) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tListeCalendrier.php client\n" . "\tclient\t\tIdentifiant client voir ListeIdentifiantCapteur.php\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $clientId = $argv[1];
    $clientIdInfo = $bpl->getClientData(array("clientId" => $clientId));
    if (!count($clientIdInfo)) {
        throw new Exception("Client {$clientId} non trouvé");
    }
    $bpl->setClientId($clientId);
    include_once "BluePHP/BTopLocalServer/Calendar.inc";
    $cal = new Calendar();
    echo sprintf("%16s%16s%16s%16s\n", "Identifiant", "Nom", "Plage Début", "Plage Fin");
    foreach ($cal->getCalendars() as $v) {
        echo sprintf("%16s%16s%16s%16s\n", $v["calId"], $v["calName"], strftime($v["testts"], strtotime($v["ts"])), strftime($v["testte"], strtotime($v["te"])));
    }
} catch (Exception $e) {
    echo "Exception reçue : ", $e->getMessage(), "\n";
}
<?php

include_once "Config.inc";
try {
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $capteurs = $bpl->getIPTable(array("extra" => "order by clientId"));
    echo sprintf("%22s%26s%16s\n", "Identifiant", "Nom", "Client");
    foreach ($capteurs as $v) {
        echo sprintf("%22s%26s%16s\n", $v["bluecountId"], $v["name"], $v["clientId"]);
    }
} catch (Exception $e) {
    echo "Exception reçue : ", $e->getMessage(), "\n";
}
<?php

include_once "Config.inc";
try {
    if (count($argv) < 3) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tDupliqueClientLiens.php clientSource clientDest\n" . "\tclientSrc\t\tIdentifiant unique du client voir ListeClients.php\n" . "\tclientDest\t\tIdentifiant unique du client voir ListeClients.php\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $clientSrc = $argv[1];
    $clientDst = $argv[2];
    $bpl->cloneBlueCountClientAssoc(array("srcClientId" => $clientSrc, "dstClientId" => $clientDst));
} catch (Exception $e) {
    echo "Exception reçue : " . $e->getMessage() . "\n";
}
<?php

include_once "Config.inc";
try {
    if (count($argv) < 5) {
        echo "Erreur:\tArguments manquants\n" . "Usage:\tAjoutClient.php nomClient client email serveur\n" . "\tnomClient\tNom du client voir ListeClients.php\n" . "\tclient\t\tIdentifiant unique du client void ListeClients.php\n" . "\temail\t\tAddresse e-mail du client\n" . "\tserveur\t\tAddresse du server ceCountLocalServer (http://localhost/)\n";
        exit(1);
    }
    include_once "BluePHP/BluePortail/BluePortailLang.inc";
    $bpl = new BluePortailLang(array());
    $bpl->addVirtualClient(array("clientName" => $argv[1], "clientId" => $argv[2], "email" => $argv[3], "server" => $argv[4], "access" => 0));
} catch (Exception $e) {
    echo "Exception reçue : " . $e->getMessage() . "\n";
}