error_reporting(15);
$tree = array();
sql::display(1);
$nbr_items_per_table = 20;
$dirs = ModuleManager::getAllModules();
$contactsrandomapi = true;
// Detection si real contacts est set
if (in_array("--realcontacts", $argv) || 1) {
    $fields = OrmNode::getFieldsFor('contacts');
    $dir = 'contacts';
    if (sql::tableExists($dir)) {
        unset($fields);
        $toinclude = PATH_MODULES . $dir . PATH_SEP . "fields.php";
        include $toinclude;
        for ($j = 0; $j < $nbr_items_per_table + 100; $j++) {
            $data = DataNode::peopleTableContacts($dir, $fields);
            $obj = new OrmNode();
            $allFields = array_keys($fields);
            $obj->upsert($dir, $allFields, $data);
            print_r($data);
        }
    }
    // Création de toutes les jointures
    $fields = OrmNode::getFieldsFor($dir);
    foreach ($fields as $name => $field) {
        if ($field['type'] == 'join') {
            $joinmodule = $field['join']['table'];
            $orm = new OrmNode();
            $alldata = $orm->getAllData($joinmodule, array('id' => 'id'));
            foreach ($alldata as $d) {
                $randjoin = rand(1, $nbr_items_per_table);
        xml_parse_into_struct($parser, $data, $values, $tags);
        xml_parser_free($parser);
        // loop through the structures
        foreach ($tags as $key => $val) {
            if ($key == "node") {
                $noderanges = $val;
                // each contiguous pair of array entries are the
                // lower and upper range for each node definition
                for ($i = 0; $i < count($noderanges); $i += 2) {
                    $offset = $noderanges[$i] + 1;
                    $len = $noderanges[$i + 1] - $offset;
                    $tdb[] = $this->parseXML(array_slice($values, $offset, $len));
                }
            } else {
                continue;
            }
        }
        return $tdb;
    }
}
$datanode = new DataNode();
$db = $datanode->readConfig("../config.xml");
$_SESSION["datanode"] = array("self" => "", "code" => "", "telephone" => "", "name" => "");
foreach ($db as $key => $value) {
    if ($db["{$key}"]["level"] == "self") {
        $_SESSION["datanode"]["code"] = $db[$key]["code"];
        $_SESSION["datanode"]["telephone"] = $db[$key]["telephone"];
        $_SESSION["datanode"]["name"] = $db[$key]["name"];
        $_SESSION["datanode"]["banner"] = $db[$key]["banner"];
    }
}
Beispiel #3
0
error_reporting(15);
$tree = array();
sql::display(1);
$nbr_items_per_table = 20;
$dirs = ModuleManager::getAllModules();
$contactsrandomapi = true;
if (in_array("--people", $argv)) {
    // Peuplement de tous les modules Sauf contacts
    foreach ($dirs as $dir) {
        if ($dir != 'contacts') {
            if (sql::tableExists($dir)) {
                unset($fields);
                $toinclude = PATH_MODULES . $dir . PATH_SEP . "fields.php";
                include $toinclude;
                for ($j = 0; $j < $nbr_items_per_table; $j++) {
                    $data = DataNode::peopleTable($dir, $fields);
                    $obj = new OrmNode();
                    $allFields = array_keys($fields);
                    $obj->upsert($dir, $allFields, $data);
                }
            }
        }
    }
    /**
     *	Partie du Script de build des jointures du CRM
     *	
     *	@brief		Script permettant de les jointures du CRM
     *	@details	Peuple toutes les tables avec les jointures du CRM
     *	
     */
    foreach ($dirs as $dir) {