|
|
<?php
|
|
|
|
|
|
require_once('smeti_db.inc.php');
|
|
|
|
|
|
SMETI_db::init();
|
|
|
|
|
|
$libelle = 'Collectivités';
|
|
|
echo 'VACUUM ';
|
|
|
SMETI_db::removePlugin($libelle);
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
|
|
echo "Ajout du plugin '$libelle' ";
|
|
|
SMETI_db::addPlugin($libelle);
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
|
|
echo "Plugin courant : '$libelle' ";
|
|
|
SMETI_db::setCurPlugin($libelle);
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
|
|
echo "Ajout d'une racine: '$libelle' ";
|
|
|
// Ajouter un item
|
|
|
SMETI_db::$libelle = $libelle;
|
|
|
SMETI_db::$code = 'COLL';
|
|
|
SMETI_db::$req1->execute();
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
// Ajouter un lien sur cet item
|
|
|
SMETI_db::$link = 0;
|
|
|
SMETI_db::$req2->execute();
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
// Positionner ce lien comme parent
|
|
|
SMETI_db::$parent = SMETI_db::$item;
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
|
|
$counter = 0;
|
|
|
$shipments = json_decode(file_get_contents("../data/json/BMO/01_COLLECTIVITES.json"), true);
|
|
|
foreach($shipments as $element)
|
|
|
{
|
|
|
// Gestion d'une barre de progression
|
|
|
progressBar($counter, $nb_shipments);
|
|
|
$counter += 1;
|
|
|
// Gestion d'une barre de progression
|
|
|
|
|
|
// Ajouter un item
|
|
|
SMETI_db::$code = $element['collcod'];
|
|
|
SMETI_db::$libelle = $element['collnom'];
|
|
|
SMETI_db::$req1->execute();
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
|
|
|
// Ajouter un lien
|
|
|
SMETI_db::$link = 0;
|
|
|
SMETI_db::$req2->execute();
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
|
|
|
// Le rattacher à la racine
|
|
|
SMETI_db::$child = SMETI_db::$item;
|
|
|
SMETI_db::$req3->execute();
|
|
|
}
|
|
|
|
|
|
?>
|