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-01-13',
),
'container' => array(
'column' => 'Content.Container',
'type' => ($direction == 'previous') ? 'LT' : 'GT',
'value' => '3954904',
),
),
'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-01-13',
),
),
'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 - FOREST MINISTER LAUNCHES OFFICIAL COSFOM PROJECT WEBSITE IN MANIPUR
FOREST MINISTER LAUNCHES OFFICIAL COSFOM PROJECT WEBSITE IN MANIPUR
Posted on 13 Jan, 2021 by Bianca Schlegel
A website for the Community-based Sustainable Forest Management for Water Resource Conservation in Manipur (CSOFOM) project was officially launched by the Hon'ble Forest, Environment and Climate Change Minister Awangbow Newmai in Imphal, Manipur on January 8th, 2021. Through the website , the project will regularly inform about its activities and progress.
COSFOM is a development project of the Government of India (GoI) supported by the Federal Government of Germany through KfW within the context of the Indo-German program on Climate Change Adaptation in the Himalaya. The project is implemented by the Manipur Forest Department (MFD, the Project Executing Agency) and managed by the Community Forestry and Water Conservation Society-Manipur (CF&WCS-M) with support by GFA Consulting Group in consortium with Unique forestry and land use and IORA Ecological solutions.
The project aims at improving or sustainably restoring climate resilience of upper watershed ecosystems and increasing the adaptive capacity of forest dependent communities through sustainable forest management and water resource conservation. The project is working in three catchment areas and aims at delivering four results: (1) Participatory watershed planning, coordination and monitoring; (2) restoration and sustainable management of upper watersheds; (3) security and improvements of livelihoods; and (4) capacity building for community based watershed management.
The launching event was also attended by MH Khan, Additional Chief Secretary and Chairman Community Forestry & Water Conservation Society-Manipur (CF&WCS-M), K Angami, IFS, PCCF&HOFF, officers and staffs of the Manipur Forest Department including Lamkhosei Baite, PCCF and Project Director (CF&WCS-M), Aditya Joshi, PCCF & Chief Wildlife Warden, N Sonzalian, Additional PD (CF&WCS-M), Konthoujam Hrishikesh Singh, Assistant Chief Technical Advisor, GFA among others.