false,
'ttl' => 60,
);
# CCDB Suche
protected static $ccdbsearch = null;
public static $ccdb_config = array(
'convert_to_utf8' => false, # Kludge: Daten aus der CP1252-CCDB auf der UTF-8-Seite ausgeben
);
# Debug Konfiguration
protected static $debug_config = array(
'enabled' => false,
'logfile' => '/tmp/ir_debug.log',
);
protected static $debug_logfile_postfix = '';
public static function error()
{
if (IRGlobal::$debug_config['enabled'])
{
$debug_logfile = null;
if (is_scalar(IRGlobal::$debug_config['logfile']) && IRGlobal::$debug_config['logfile'] && !is_null(static::$debug_logfile_postfix))
{
$debug_logfile = IRGlobal::$debug_config['logfile'] . (static::$debug_logfile_postfix ? '.' . static::$debug_logfile_postfix : '');
}
if (!is_null($debug_logfile))
{
ob_start();
}
print '###FEHLER###' . "\n";
foreach (func_get_args() as $_errorinfo)
{
print (is_scalar($_errorinfo) ? $_errorinfo : print_r($_errorinfo, true)) . "\n";
}
debug_print_backtrace();
print "\n" . '###/FEHLER###' . "\n";
if (!is_null($debug_logfile))
{
file_put_contents($debug_logfile, ob_get_contents(), FILE_APPEND);
ob_end_clean();
}
}
}
####
# Cache-Funktionen
####
protected static function cache_get_object(array $options = array())
/*
* Gibt das IR_Cache Objekt zurück
* Parameter:
* $options: Parameter für das IRCache Modul
* Rückgabewert:
* IR_Cache Objekt / null
*/
{
$return = null;
$cacheparams = array(
'ttl' => static::$cache_config['ttl'],
'keyonly' => true,
);
if (!static::$cache_config['disabled'])
{
foreach ($options as $_key => $_value)
{
$cacheparams[$_key] = $_value;
}
$return = new IR_Cache($cacheparams);
if (!is_object($return))
{
$return = null;
static::error('cache init error');
}
}
return $return;
}
public static function cache_get($cachekey, &$target, array $options = array())
/**
* liest Daten aus dem Cache
* Parameter:
* - Cachekey
* - Name des Ziel-Keys in $cache_data
* - Optionen für Cache-Objekt (ttl)
* Rückgabewert:
* - Erfolg (true/false)
*/
{
$success = false;
$cachedata = false;
$cache = static::cache_get_object($options);
if (is_object($cache))
{
try
{
$cachedata = unserialize($cache->get($cachekey));
if ($cachedata !== false && is_array($cachedata) && array_key_exists('data', $cachedata))
{
$target = $cachedata['data'];
$success = true;
}
}
catch (Exception $exception)
{
static::error($exception);
}
}
return $success;
}
public static function cache_put($cachekey, $source, array $options = array())
/**
* schreibt Daten in den Cache
* Parameter:
* - Cachekey
* - Name des Quell-Keys in $cache
* Rückgabewert:
* - Erfolg (true/false)
*/
{
$success = false;
$cache = static::cache_get_object($options);
if (is_object($cache))
{
try
{
$cache->put(serialize(array( 'data' => $source )), $cachekey);
$success = true;
}
catch (Exception $exception)
{
static::error($exception);
}
}
return $success;
}
####
# CCDB-Funktionen
####
public static function ccdb_init()
# Initialisiert das IR_CCDB_Search Objekt für die CCDB-Suche
# Rückgabewert:
# true (initialisert) / false (Fehler)
{
$success = false;
if (!(self::$ccdbsearch instanceof IR_CCDB_Search))
{
try
{
self::$ccdbsearch = new IR_CCDB_search();
$success = true;
}
catch (Exception $exception)
{
static::error($exception);
}
}
return $success;
}
public static function ccdb_get_count($ccdbsearchconfig, &$target)
/**
* Liest die Anzahl der Datensätze zu einer CCDB Konfiguration aus.
* Parameter:
* $ccdbsearchconfig: Konfiguration der CCDB
* &$target: Referenzvariable für das Ergebnis der CCDB Suche
* Rückgabewert:
* true (erfolgreich) / false (Fehler)
*/
{
$success = false;
static::ccdb_init();
if (self::$ccdbsearch instanceof IR_CCDB_Search)
{
try
{
self::$ccdbsearch->config($ccdbsearchconfig);
$target = self::$ccdbsearch->fetch_count();
$success = true;
}
catch (Exception $exception)
{
$target = 0;
static::error($exception);
}
}
return $success;
}
public static function ccdb_get_data($ccdbsearchconfig, &$target)
/**
* Liest die Datensätze zu einer CCDB Konfiguration aus.
* Parameter:
* $ccdbsearchconfig: Konfiguration der CCDB
* &$target: Referenzvariable für das Ergebnis der CCDB Suche
* Rückgabewert:
* true (erfolgreich) / false (Fehler)
*/
{
$success = false;
static::ccdb_init();
if (self::$ccdbsearch instanceof IR_CCDB_Search)
{
try
{
self::$ccdbsearch->config($ccdbsearchconfig);
$target = self::$ccdbsearch->fetch_data();
for ($_counter = 0; $_counter < count($target); $_counter++)
{
if (self::$ccdb_config['convert_to_utf8'])
{
foreach (array_keys($target[$_counter]) as $_key)
{
$target[$_counter][$_key] = iconv('Windows-1252', 'UTF-8', $target[$_counter][$_key]);
}
}
// # Prüft ob die URL mit einem Slash beginnt und der Bereich existiert
// if (array_key_exists('url', $target[$_counter]) && preg_match('/\A\//', $target[$_counter]['url']) && array_key_exists('bereich', $target[$_counter]) && array_key_exists((string) $target[$_counter]['bereich'], static::$bereich_info))
// {
// $target[$_counter]['url'] = static::$bereich_info[$target[$_counter]['bereich']]['baseurl'] . $target[$_counter]['url'];
// }
}
$success = true;
}
catch (Exception $exception)
{
$target = array();
static::error($exception);
}
}
return $success;
}
public static function ccdb_get_last_query()
/**
* Gibt das letzte SQL-Statement der CCDB Suche zurück (für Debugzwecke)
* Rückgabewert:
* SQL-Statement
*/
{
return self::$ccdbsearch->get_last_query();
}
public static function ccdbcache_get_count($ccdbsearchconfig, &$target)
/**
* Liest die Anzahl der Datensätze zu einer CCDB Konfiguration aus. (mit Caching der Daten)
* Parameter:
* $ccdbsearchconfig: Konfiguration der CCDB
* &$target: Referenzvariable für das Ergebnis der CCDB Suche
* Rückgabewert:
* true (erfolgreich) / false (Fehler)
*/
{
$success = false;
unset($ccdbsearchconfig['order'], $ccdbsearchconfig['maxshow'], $ccdbsearchconfig['offset']);
$cachekey = 'count_' . md5(serialize($ccdbsearchconfig));
if (static::cache_get($cachekey, $target))
{
$success = true;
}
else
{
$success = static::ccdb_get_count($ccdbsearchconfig, $target);
if ($success)
{
static::cache_put($cachekey, $target);
}
}
return $success;
}
public static function ccdbcache_get_data($ccdbsearchconfig, &$target)
/**
* Liest die Datensätze zu einer CCDB Konfiguration aus. (mit Caching der Daten)
* Parameter:
* $ccdbsearchconfig: Konfiguration der CCDB
* &$target: Referenzvariable für das Ergebnis der CCDB Suche
* Rückgabewert:
* true (erfolgreich) / false (Fehler)
*/
{
$success = false;
$cachekey = 'data_' . md5(serialize($ccdbsearchconfig));
if (static::cache_get($cachekey, $target))
{
$success = true;
}
else
{
$success = static::ccdb_get_data($ccdbsearchconfig, $target);
if ($success)
{
static::cache_put($cachekey, $target);
}
}
return $success;
}
}
/**
* Funktion die NUR das Layout "2018_GFA_Consulting_Group_News" berücksichtigt.
* @param string $direction [previouse|next]
* @return array
*/
function get_browse_link($direction)
{
$return = array();
if (in_array($direction, array('previous', 'next')))
{
$ccdb_data = array();
# Zuerst prüfen, ob es einen Container mit gleichem Datum gibt, jedoch mit größerer oder kleinerer Container ID
$search_config = array(
// 'distinct' => 1,
'result_columns' => array(
'Content.URL',
),
'layout' => array(2559),
'search_values' => array(
'datum' => array(
'column' => 'Content.Datum',
'type' => 'EQ',
'value' => '2017-11-08',
),
'container' => array(
'column' => 'Content.Container',
'type' => ($direction == 'previous') ? 'LT' : 'GT',
'value' => '3839002',
),
),
'connector' => '##datum## AND ##container##',
// 'connector' => '##datum##',
'order' => 'Content.Container ' . (($direction == 'previous') ? 'DESC' : 'ASC'),
'maxshow' => 1,
'offset' => 0,
);
IRGlobal::ccdbcache_get_data($search_config, $ccdb_data);
# nach größerem oder kleinerem Datum suchen, falls die erste Abfrage kein Ergebnis liefert
if (!count($ccdb_data ))
{
$search_config = array(
// 'distinct' => 1,
'result_columns' => array(
'Content.URL',
'Content.Layout',
),
'layout' => array(2559),
'search_values' => array(
'datum' => array(
'column' => 'Content.Datum',
'type' => ($direction == 'previous') ? 'LT' : 'GT',
'value' => '2017-11-08',
),
),
'connector' => '##datum##',
'order' => 'Content.Datum ' . (($direction == 'previous') ? 'DESC' : 'ASC') . ', Content.Container ' . (($direction == 'previous') ? 'DESC' : 'ASC'),
'maxshow' => 1,
'offset' => 0,
);
IRGlobal::ccdbcache_get_data($search_config, $ccdb_data);
}
if (count($ccdb_data))
{
$return = $ccdb_data[0];
}
}
return $return;
}
?>
GFA - Democratic Republic of the Congo: Improvement of an orphanage
Democratic Republic of the Congo: Improvement of an orphanage
Posted on 8 Nov, 2017 by GFA
In October 2017 GFA Bridges launched a project to support the only orphanage in Madimba, a town about 100 kilometers far from the capital city of Kinshasa. The project aims at improving the equipment and infrastructure of the orphanage originally established in 2007. The center provides food, shelter and basic education. The funding provided by GFA is for beds, mattresses, tables, chairs, and a solar equipment to make the center energy self-sustainable. Further, one newly constructed room in the backyard will be finished, walls be plastered, windows and doors purchased to create more space for the children and equipment for home gardening will be purchased. Currently there are 24 children between a few months and 17 years living in the orphanage and being supported by the project. Most of these children were found on the streets abandoned at birth, others lived on the street since their parents died.
This project is undertaken by by Laure Mbiakop Ndom, spouse of Martijn ter Heegde, TL of the PBF-KFW in Kinshasa.