Beispiel #1
0
<?php

use Apelon\Sync\ihrisSync, Apelon\Sync\rmapSync, Apelon\Object\rmFacilityTypeConfig;
require __DIR__ . '/vendor/autoload.php';
//Dependencies
require './etc/config.values.php';
//CONFIG
//Sync-Tool URL
$url = $site_url . "index.php";
//Config Value Checks
if (!isset($fhir_valueset_countries) || !isset($fhir_valueset_positions) || !isset($fhir_valueset_facilities) || !isset($fhir_valueset_counties) || !isset($fhir_valueset_regions) || !isset($fhir_valueset_districts) || !isset($fhir_valueset_countries)) {
    alertDanger("The Default ValueSet was not set in config.values.php");
}
$is = new ihrisSync();
//$mysql_auth = parse_url($i2ce_site_dsn); //USE THIS IF YOUR USING THE IHRIS CONFIG FILE
//$mysql_check = $is->setMysqlConnection($mysql_auth['host'], $mysql_auth['user'], $mysql_auth['pass'], substr($mysql_auth['path'], 1));
$mysql_check = $is->setMysqlConnection($mysql_server, $mysql_user, $mysql_password, $mysql_database);
$fhir_check = $is->setFhirServer($fhir_server_url, $fhir_server_username, $fhir_server_password);
// if(!$fhir_check) { //TODO: Finish this config
// 	alertDanger("FHIR Connection failed. Please verify credentials in config.values.php");
// }
if ($mysql_check == false) {
    alertDanger("MySQL Connection failed. Please verify credentials in config.values.php");
}
//HTML Helper Functions
function button($text, $action, $level = danger, $disabled = false)
{
    echo '<input type="hidden" id="action" name="action" value="' . $action . '" />';
    echo '<input type="hidden" id="pageTitle" name="pageTitle" value="' . $text . '" />';
    if ($disabled) {
        $disabledButton = 'disabled="disabled"';
    $load_error = true;
}
// User Interface
$gui = new Gui($url);
// Authenticated
$logged_in = false;
$apelon_user = false;
if (isset($_SESSION)) {
    if (isset($_SESSION["user"])) {
        if (in_array($_SESSION["user"], $apelon_sync_users)) {
            $logged_in = true;
            $apelon_user = $_SESSION["user"];
        }
    }
}
$is = new ihrisSync();
//$mysql_auth = parse_url($i2ce_site_dsn); //USE THIS IF YOUR USING THE IHRIS CONFIG FILE
//$mysql_check = $is->setMysqlConnection($mysql_auth['host'], $mysql_auth['user'], $mysql_auth['pass'], substr($mysql_auth['path'], 1));
$mysql_check = $is->setMysqlConnection($mysql_server, $mysql_user, $mysql_password, $mysql_database);
$fhir_check = $is->setFhirServer($fhir_server_url, $fhir_server_username, $fhir_server_password);
// if(!$fhir_check) { //TODO: Finish this config
// 	alertDanger("FHIR Connection failed. Please verify credentials in config.values.php");
// }
if ($mysql_check == false) {
    $gui->alertDanger("MySQL Connection failed. Please verify credentials in config.values.php");
}
$gui->loadView('head');
$gui->loadView('navbar');
if ($logged_in = false) {
    $gui->alertSuccess("Please login");
} else {