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' => '2021-07-07', ), 'container' => array( 'column' => 'Content.Container', 'type' => ($direction == 'previous') ? 'LT' : 'GT', 'value' => '3969861', ), ), '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' => '2021-07-07', ), ), '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 - KENYAS´S DAIRY VALUE CHAIN PROJECT ON AIR

KENYAS´S DAIRY VALUE CHAIN PROJECT ON AIR

Posted on 7 Jul, 2021 by Judith Lauzemis

The dairy value chain project in Kenya had four very lively and participated radio shows in two local radio stations assuring coverage over the entire working area of the project. The shows were designed to address milk producers, processors and consumers with key information on the importance of milk in nutrition, on milk quality and on the food safety aspects, related to milk. TV-features on the “making-of” the radio shows were produced by WEST-FM channel - you can watch them on Youtube (first video / second video). They are on Kisuaheli but it is interesting to follow some of the video scenes that are shown.

On behalf of the Green Innovation Centres for the Agriculture and Food Sector (GIAE) program of Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ), GFA consultants are implementing the dairy value chain component that aims at increasing productivity and income for smallholder dairy farmers in selected counties of Western Kenya. Financed by the German initiative One World Without Hunger, innovations and the alleviation of technical challenges is to strengthen the regional food supply. GFA develops and implements training modules on e.g. fodder production, feed formulation, feeding dairy cows, and calf rearing.

Project news, March 2021
Project in brief

#dairy #valuechain #Africa #agriculture #kenya #GIAE #GIZ

Accept cookies