Exemple #1
0
 * as well as the path to I2CE which may not work right using the one
 * from the config file.
 * The ID for the User object should be valid in your user table.
 * The $forms array is an associative array with the value being
 * an array of forms that are required for the given form to work e.g. 
 * region needs country first since it uses country as a map for a field.
 */
$script = array_shift($argv);
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pages/local' . DIRECTORY_SEPARATOR . 'config.values.php')) {
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pages/local' . DIRECTORY_SEPARATOR . 'config.values.php';
} else {
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pages/config.values.php';
}
$i2ce_site_i2ce_path = "../../I2CE";
require_once $i2ce_site_i2ce_path . DIRECTORY_SEPARATOR . 'I2CE_config.inc.php';
I2CE::initialize($i2ce_site_database_user, $i2ce_site_database_password, $i2ce_site_database, $i2ce_site_user_database, $i2ce_site_module_config);
global $maps, $forms, $user, $db, $form_factory;
$maps = array();
$user = new I2CE_User(1);
$db = MDB2::singleton();
$form_factory = I2CE_FormFactory::instance();
$forms = array("academic_level" => array(), "certificate" => array("academic_level"), "qualification" => array(), "cadre" => array("qualification"), "country" => array(), "region" => array("country"), "district" => array("region"), "county" => array("district"), "marital_status" => array(), "training_disruption_category" => array(), "training_disruption_reason" => array("training_disruption_category"), "facility_agent" => array(), "facility_type" => array(), "out_migration_reason" => array(), "tribe" => array(), "facility_status" => array(), "health_facility" => array("facility_agent", "facility_type", "facility_status"));
echo "Memory Limit: " . ini_get("memory_limit") . "\n";
echo "Execution Time: " . ini_get("max_execution_time") . "\n";
$cache_filename = "convert_maps.save";
if (file_exists($cache_filename)) {
    echo "Reading saved maps file...";
    $cache_file = fopen($cache_filename, "r");
    $cache_content = fread($cache_file, filesize($cache_filename));
    fclose($cache_file);
    $maps = unserialize($cache_content);