initial commit
This commit is contained in:
230
r41/luxembourg/de/_core/includes/GeoCalc.class.php
Normal file
230
r41/luxembourg/de/_core/includes/GeoCalc.class.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
// This code was converted to PHP from Visual C++
|
||||
// by Steven Brendtro on behalf of imaginerc.com
|
||||
|
||||
// The original code and an article can be found
|
||||
// on CodeGuru at:
|
||||
// http://www.codeguru.com/Cpp/Cpp/algorithms/print.php/c5115/
|
||||
|
||||
// Example Usage:
|
||||
// $oGC = new GeoCalc();
|
||||
// print "GCDistance: " . $oGC->GCDistance(38.9333,-94.3253,38.9314,-94.4876) . "<br />\n";
|
||||
// print "GCAzimuth: " . $oGC->GCAzimuth(38.9333,-94.3253,38.9314,-94.4876) . "<br />\n";
|
||||
// print "ApproxDistance: " . $oGC->ApproxDistance(38.9333,-94.3253,38.9314,-94.4876) . "<br />\n";
|
||||
// print "EllipsoidDistance: " . $oGC->EllipsoidDistance(38.80126649,-94.44590241,43.3368,-96.8755) . "<br /><br />\n";
|
||||
// print "EllipsoidDistance In Miles: " . ConvKilometersToMiles($oGC->EllipsoidDistance(38.80126649,-94.44590241,43.3368,-96.8755));
|
||||
|
||||
class GeoCalc {
|
||||
|
||||
var $PI = 3.14159265359;
|
||||
var $TWOPI = 6.28318530718;
|
||||
var $DE2RA = 0.01745329252;
|
||||
var $RA2DE = 57.2957795129;
|
||||
var $ERAD = 6378.135;
|
||||
var $ERADM = 6378135.0;
|
||||
var $AVG_ERAD = 6371.0;
|
||||
var $EPS = 0.000000000005;
|
||||
var $KM2MI = 0.621371;
|
||||
var $FLATTENING = 0;
|
||||
|
||||
function __construct() {
|
||||
$this->FLATTENING = 1.0/298.26; // Earth flattening
|
||||
// (WGS 1972)
|
||||
return;
|
||||
}
|
||||
|
||||
function GCDistance($lat1, $lon1, $lat2, $lon2) {
|
||||
$lat1 *= $this->DE2RA;
|
||||
$lon1 *= $this->DE2RA;
|
||||
$lat2 *= $this->DE2RA;
|
||||
$lon2 *= $this->DE2RA;
|
||||
$d = sin($lat1)*sin($lat2) + cos($lat1)*cos($lat2)*cos($lon1 - $lon2);
|
||||
return ($this->AVG_ERAD * acos($d));
|
||||
}
|
||||
|
||||
|
||||
function GCAzimuth($lat1, $lon1, $lat2, $lon2) {
|
||||
$result = 0.0;
|
||||
|
||||
$ilat1 = intval(0.50 + $lat1 * 360000.0);
|
||||
$ilat2 = intval(0.50 + $lat2 * 360000.0);
|
||||
$ilon1 = intval(0.50 + $lon1 * 360000.0);
|
||||
$ilon2 = intval(0.50 + $lon2 * 360000.0);
|
||||
|
||||
$lat1 *= $this->DE2RA;
|
||||
$lon1 *= $this->DE2RA;
|
||||
$lat2 *= $this->DE2RA;
|
||||
$lon2 *= $this->DE2RA;
|
||||
|
||||
if (($ilat1 == $ilat2) && ($ilon1 == $ilon2)) {
|
||||
return result;
|
||||
}
|
||||
else if ($ilat1 == $ilat2) {
|
||||
if ($ilon1 > $ilon2)
|
||||
$result = 90.0;
|
||||
else
|
||||
$result = 270.0;
|
||||
}
|
||||
else if ($ilon1 == $ilon2) {
|
||||
if ($ilat1 > $ilat2)
|
||||
$result = 180.0;
|
||||
}
|
||||
else {
|
||||
$c = acos(sin($lat2)*sin($lat1) + cos($lat2)*cos($lat1)*cos(($lon2-$lon1)));
|
||||
$A = asin(cos($lat2)*sin(($lon2-$lon1))/sin($c));
|
||||
$result = ($A * $this->RA2DE);
|
||||
|
||||
|
||||
if (($ilat2 > $ilat1) && ($ilon2 > $ilon1)) {
|
||||
$result = $result;
|
||||
}
|
||||
else if (($ilat2 < $ilat1) && ($ilon2 < $ilon1)) {
|
||||
$result = 180.0 - $result;
|
||||
}
|
||||
else if (($ilat2 < $ilat1) && ($ilon2 > $ilon1)) {
|
||||
$result = 180.0 - $result;
|
||||
}
|
||||
else if (($ilat2 > $ilat1) && ($ilon2 < $ilon1)) {
|
||||
$result += 360.0;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function ApproxDistance($lat1, $lon1, $lat2, $lon2) {
|
||||
$lat1 = $this->DE2RA * $lat1;
|
||||
$lon1 = -$this->DE2RA * $lon1;
|
||||
$lat2 = $this->DE2RA * $lat2;
|
||||
$lon2 = -$this->DE2RA * $lon2;
|
||||
|
||||
$F = ($lat1 + $lat2) / 2.0;
|
||||
$G = ($lat1 - $lat2) / 2.0;
|
||||
$L = ($lon1 - $lon2) / 2.0;
|
||||
|
||||
$sing = sin($G);
|
||||
$cosl = cos($L);
|
||||
$cosf = cos($F);
|
||||
$sinl = sin($L);
|
||||
$sinf = sin($F);
|
||||
$cosg = cos($G);
|
||||
|
||||
$S = $sing*$sing*$cosl*$cosl + $cosf*$cosf*$sinl*$sinl;
|
||||
$C = $cosg*$cosg*$cosl*$cosl + $sinf*$sinf*$sinl*$sinl;
|
||||
$W = atan2(sqrt($S),sqrt($C));
|
||||
$R = sqrt(($S*$C))/$W;
|
||||
$H1 = (3 * $R - 1.0) / (2.0 * $C);
|
||||
$H2 = (3 * $R + 1.0) / (2.0 * $S);
|
||||
$D = 2 * $W * $this->ERAD;
|
||||
$return = ($D * (1 + $this->FLATTENING * $H1 * $sinf*$sinf*$cosg*$cosg - $this->FLATTENING*$H2*$cosf*$cosf*$sing*$sing));
|
||||
return $return;
|
||||
}
|
||||
|
||||
function EllipsoidDistance($lat1, $lon1, $lat2, $lon2) {
|
||||
$distance = 0.0;
|
||||
$faz = 0.0;
|
||||
$baz = 0.0;
|
||||
$r = 1.0 - $this->FLATTENING;
|
||||
$tu1 = 0.0;
|
||||
$tu2 = 0.0;
|
||||
$cu1 = 0.0;
|
||||
$su1 = 0.0;
|
||||
$cu2 = 0.0;
|
||||
$x = 0.0;
|
||||
$sx = 0.0;
|
||||
$cx = 0.0;
|
||||
$sy = 0.0;
|
||||
$cy = 0.0;
|
||||
$y = 0.0;
|
||||
$sa = 0.0;
|
||||
$c2a = 0.0;
|
||||
$cz = 0.0;
|
||||
$e = 0.0;
|
||||
$c = 0.0;
|
||||
$d = 0.0;
|
||||
|
||||
$cosy1 = 0.0;
|
||||
$cosy2 = 0.0;
|
||||
|
||||
if(($lon1 == $lon2) && ($lat1 == $lat2))
|
||||
return $distance;
|
||||
$lon1 *= $this->DE2RA;
|
||||
$lon2 *= $this->DE2RA;
|
||||
$lat1 *= $this->DE2RA;
|
||||
$lat2 *= $this->DE2RA;
|
||||
|
||||
$cosy1 = cos($lat1);
|
||||
$cosy2 = cos($lat2);
|
||||
|
||||
if($cosy1 == 0.0) $cosy1 = 0.0000000001;
|
||||
if($cosy2 == 0.0) $cosy2 = 0.0000000001;
|
||||
|
||||
$tu1 = $r * sin($lat1) / $cosy1;
|
||||
$tu2 = $r * sin($lat2) / $cosy2;
|
||||
$cu1 = 1.0 / sqrt($tu1 * $tu1 + 1.0);
|
||||
$su1 = $cu1 * $tu1;
|
||||
$cu2 = 1.0 / sqrt($tu2 * $tu2 + 1.0);
|
||||
$x = $lon2 - $lon1;
|
||||
|
||||
$distance = $cu1 * $cu2;
|
||||
$baz = $distance * $tu2;
|
||||
$faz = $baz * $tu1;
|
||||
|
||||
while(abs($d - $x) > $this->EPS) {
|
||||
$sx = sin($x);
|
||||
$cx = cos($x);
|
||||
$tu1 = $cu2 * $sx;
|
||||
$tu2 = $baz - $su1 * $cu2 * $cx;
|
||||
$sy = sqrt($tu1 * $tu1 + $tu2 * $tu2);
|
||||
$cy = $distance * $cx + $faz;
|
||||
$y = atan2($sy, $cy);
|
||||
$sa = $distance * $sx / $sy;
|
||||
$c2a = - $sa * $sa + 1.0;
|
||||
$cz = $faz + $faz;
|
||||
if($c2a > 0.0) $cz = - $cz / $c2a + $cy;
|
||||
$e = $cz * $cz * 2.0 - 1.0;
|
||||
$c = ((-3.0 * $c2a + 4.0) * $this->FLATTENING + 4.0) * $c2a * $this->FLATTENING / 16.0;
|
||||
$d = $x;
|
||||
$x = (($e * $cy * $c + $cz) * $sy * $c + $y) * $sa;
|
||||
$x = (1.0 - $c) * $x * $this->FLATTENING + $lon2 - $lon1;
|
||||
}
|
||||
|
||||
$x = sqrt((1.0 / $r / $r - 1.0) * $c2a + 1.0) + 1.0;
|
||||
$x = ($x - 2.0) / $x;
|
||||
$c = 1.0 - $x;
|
||||
$c = ($x * $x / 4.0 + 1.0) / $c;
|
||||
$d = (0.375 * $x * $x - 1.0) * $x;
|
||||
$x = $e * $cy;
|
||||
$distance = 1.0 - $e - $e;
|
||||
$distance = (((($sy * $sy * 4.0 - 3.0) * $distance * $cz * $d / 6.0 - $x) * $d / 4.0 + $cz) * $sy * $d + $y) * $c * $this->ERAD * $r;
|
||||
|
||||
return $distance;
|
||||
}
|
||||
|
||||
function getKmPerLonAtLat($dLatitude) {
|
||||
// Thanks to Eric Iverson for this correction! Must convert degrees to radians...
|
||||
$dLatitude *= $this->DE2RA;
|
||||
return 111.321 * cos($dLatitude);
|
||||
}
|
||||
|
||||
function getLonPerKmAtLat($dLatitude) {
|
||||
return 1 / $this->getKmPerLonAtLat($dLatitude);
|
||||
}
|
||||
|
||||
function getKmPerLat() {
|
||||
return 111.000;
|
||||
}
|
||||
|
||||
function getLatPerKm() {
|
||||
return 1 / $this->getKmPerLat();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function ConvKilometersToMiles($dValue) {
|
||||
return $dValue / 1.609344;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
312
r41/luxembourg/de/_core/includes/_application_init.inc.php
Normal file
312
r41/luxembourg/de/_core/includes/_application_init.inc.php
Normal file
@ -0,0 +1,312 @@
|
||||
<?php
|
||||
/**
|
||||
* ezSQL initialisation for mySQL (using PDO)
|
||||
* Initialise database object and establish a connection
|
||||
* @global object $db
|
||||
*
|
||||
*/
|
||||
// $db = new ezSQL_mysql(DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE,DB_SERVER);
|
||||
// $db = new ezSQL_mysqli(DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE,DB_SERVER);
|
||||
$db = new ezSQL_pdo('mysql:host='.DB_SERVER.';dbname='.DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
|
||||
// $db->use_disk_cache = off;
|
||||
$db->hide_errors();
|
||||
$db->query("SET NAMES utf8");
|
||||
|
||||
|
||||
$_SESSION['data']['person_calc_mode'] = 2;
|
||||
$_SESSION['data']['person_calc_mode_display'] = 2;
|
||||
|
||||
|
||||
/* Settings */
|
||||
if(!isset($_SESSION['data']['flag_settings'])) $_SESSION['data']['flag_settings'] = false;
|
||||
if(!isset($_SESSION['data']['flag_settings_living_hs'])) $_SESSION['data']['flag_settings_living_hs'] = false;
|
||||
if(!isset($_SESSION['data']['flag_settings_mobility'])) $_SESSION['data']['flag_settings_mobility'] = false;
|
||||
if(!isset($_SESSION['data']['flag_settings_mobility_travel'])) $_SESSION['data']['flag_settings_mobility_travel'] = false;
|
||||
if(!isset($_SESSION['data']['flag_settings_mobility_flight'])) $_SESSION['data']['flag_settings_mobility_flight'] = false;
|
||||
|
||||
|
||||
/* Bilanz */
|
||||
|
||||
// Page: living-hs
|
||||
if(!isset($_SESSION['data']['living_persons']) || empty($_SESSION['data']['living_persons'])) $_SESSION['data']['living_persons'] = $customer_settings['init']['living']['persons'];
|
||||
|
||||
if(!isset($_SESSION['data']['living_hc_type'])) $_SESSION['data']['living_hc_type'] = "mfh";
|
||||
if(!isset($_SESSION['data']['living_hc_cy'])) $_SESSION['data']['living_hc_cy'] = "nn";
|
||||
if(!isset($_SESSION['data']['living_hc_space'])) $_SESSION['data']['living_hc_space'] = $default_factor_living_hc_default_living_space;
|
||||
//if(!isset($_SESSION['data']['living_hc_space'])) $_SESSION['data']['living_hc_space'] = $factor_living_hc_default_living_space[$_SESSION['data']['living_persons']];
|
||||
|
||||
if(!isset($_SESSION['data']['living_hc_ownership'])) $_SESSION['data']['living_hc_ownership'] = "mieter";
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_consumption_type']))
|
||||
{
|
||||
if($customer_settings['init']['living_hs']['consumption_type_start'] == "1") $_SESSION['data']['living_hs_consumption_type'] = "detail";
|
||||
if($customer_settings['init']['living_hs']['consumption_type_start'] == "2") $_SESSION['data']['living_hs_consumption_type'] = "estimate";
|
||||
}
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_type'])) $_SESSION['data']['living_hs_type'] = "nn";
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_consumption']))
|
||||
{
|
||||
$_SESSION['data']['living_hs_consumption'] = bcmul($factor_living_hc_cy[$_SESSION['data']['living_hc_type']][$_SESSION['data']['living_hc_cy']], $_SESSION['data']['living_hc_space'], 2);
|
||||
}
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_consumption_type_2'])) $_SESSION['data']['living_hs_consumption_type_2'] = "detail";
|
||||
if(!isset($_SESSION['data']['living_hs_type_2'])) $_SESSION['data']['living_hs_type_2'] = "nn";
|
||||
if(!isset($_SESSION['data']['living_hs_consumption_2'])) $_SESSION['data']['living_hs_consumption_2'] = "0";
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_consumption_type_3'])) $_SESSION['data']['living_hs_consumption_type_3'] = "detail";
|
||||
if(!isset($_SESSION['data']['living_hs_type_3'])) $_SESSION['data']['living_hs_type_3'] = "nn";
|
||||
if(!isset($_SESSION['data']['living_hs_consumption_3'])) $_SESSION['data']['living_hs_consumption_3'] = "0";
|
||||
|
||||
|
||||
// Page: living-hs-estimate. Vorbelegung f<>r Jugendrechner
|
||||
if(!isset($_SESSION['data']['living_hs_heating_system'])) $_SESSION['data']['living_hs_heating_system'] = "zentral";
|
||||
if(!isset($_SESSION['data']['living_hs_heating_system_spec_central'])) $_SESSION['data']['living_hs_heating_system_spec_central'] = "brennwertkessel";
|
||||
if(!isset($_SESSION['data']['living_hs_saving_fittings'])) $_SESSION['data']['living_hs_saving_fittings'] = "keine";
|
||||
if(!isset($_SESSION['data']['living_hs_type_warmwater'])) $_SESSION['data']['living_hs_type_warmwater'] = "nn";
|
||||
if(!isset($_SESSION['data']['living_hs_heating_system_warmwater'])) $_SESSION['data']['living_hs_heating_system_warmwater'] = "dezentral";
|
||||
if(!isset($_SESSION['data']['living_hs_heating_system_warmwater_spec_decentral'])) $_SESSION['data']['living_hs_heating_system_warmwater_spec_decentral'] = "nn";
|
||||
if(!isset($_SESSION['data']['living_hs_avg_room_temp'])) $_SESSION['data']['living_hs_avg_room_temp'] = "20";
|
||||
if(!isset($_SESSION['data']['living_hs_airing_habits'])) $_SESSION['data']['living_hs_airing_habits'] = "einige";
|
||||
if(!isset($_SESSION['data']['living_hs_heating_habits'])) $_SESSION['data']['living_hs_heating_habits'] = "normal";
|
||||
if(!isset($_SESSION['data']['living_hs_warm_water_consumption'])) $_SESSION['data']['living_hs_warm_water_consumption'] = "oft_duschen";
|
||||
|
||||
// Page: living-pt
|
||||
if(!isset($_SESSION['data']['living_pt_type'])) $_SESSION['data']['living_pt_type'] = "strommix_de";
|
||||
|
||||
if(!isset($_SESSION['data']['living_pt_computer'])) $_SESSION['data']['living_pt_computer'] = $default_factor_living_pt_computer;
|
||||
if(!isset($_SESSION['data']['living_pt_gaming'])) $_SESSION['data']['living_pt_gaming'] = $default_factor_living_pt_gaming;
|
||||
if(!isset($_SESSION['data']['living_pt_elektro'])) $_SESSION['data']['living_pt_elektro'] = $default_factor_living_pt_elektro;
|
||||
if(!isset($_SESSION['data']['living_pt_energy_saving_bulbs'])) $_SESSION['data']['living_pt_energy_saving_bulbs'] = $default_factor_living_pt_energy_saving_bulbs;
|
||||
if(!isset($_SESSION['data']['living_pt_energy_standby'])) $_SESSION['data']['living_pt_energy_standby'] = $default_factor_living_pt_energy_standby;
|
||||
|
||||
|
||||
|
||||
// Page: mobility
|
||||
$_SESSION['data']['mobility_cars_persons'] = 1;
|
||||
|
||||
if(!isset($_SESSION['data']['mobility_cars_amount'])) $_SESSION['data']['mobility_cars_amount'] = 1;
|
||||
|
||||
if(!isset($_SESSION['data']['mobility_school_transportation'])) $_SESSION['data']['mobility_school_transportation'] = 'fahrrad';
|
||||
|
||||
|
||||
|
||||
// Ermittlung: Pauschal
|
||||
if(!isset($_SESSION['data']['mobility_travel_mode']))
|
||||
{
|
||||
$_SESSION['data']['mobility_travel_mode'] = "detail";
|
||||
|
||||
// Pauschal: Fahrten Eigenes Fahrzeug
|
||||
$_SESSION['data']['mobility_travel_general_performance'] = array();
|
||||
|
||||
// Scenario: Pauschal: Fahrten Eigenes Fahrzeug
|
||||
$_SESSION['data']['sc_mobility_travel_general_performance'] = array();
|
||||
|
||||
// Pauschal: Carsharing
|
||||
$_SESSION['data']['mobility_carsharing_general_performance'] = 0;
|
||||
|
||||
// Pauschal: Fahrrad
|
||||
$_SESSION['data']['mobility_bicycle_general_performance'] = 0;
|
||||
|
||||
// Pauschal: <20>PNV
|
||||
$_SESSION['data']['mobility_train_general_performance'] = 0;
|
||||
|
||||
// 1. Fahrzeug anlegen
|
||||
$_SESSION['data']['mobility_cars_values'] = array();
|
||||
|
||||
$_SESSION['data']['mobility_cars_values'][0] = array(
|
||||
'name' => '',
|
||||
'type' => 'kleinwagen',
|
||||
'age' => '11_15', // 2020-06-15. Mantis 1766
|
||||
'energy_source' => 'benzin',
|
||||
'consumption' => $factor_mobility_cars_consumption_default["benzin"]["kleinwagen"]
|
||||
);
|
||||
|
||||
|
||||
// Scenario
|
||||
$_SESSION['data']['sc_mobility_cars_values'] = $_SESSION['data']['mobility_cars_values'];
|
||||
|
||||
}
|
||||
|
||||
// 1. detaillierte Fahrt
|
||||
if(!isset($_SESSION['data']['mobility_travel_values']))
|
||||
{
|
||||
$_SESSION['data']['mobility_travel_values'] = array();
|
||||
|
||||
$_SESSION['data']['mobility_travel_values'][0] = array(
|
||||
'name' => '',
|
||||
'vehicle' => 'oepnv',
|
||||
'road_performance' => 0,
|
||||
'days' => 1,
|
||||
'person' => 1
|
||||
);
|
||||
|
||||
// Scenario
|
||||
$_SESSION['data']['sc_mobility_travel_values'] = $_SESSION['data']['mobility_travel_values'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!isset($_SESSION['data']['evaluation_mobility_car_co2_average'])) $_SESSION['data']['evaluation_mobility_car_co2_average'] = array();
|
||||
if(!isset($_SESSION['data']['evaluation_mobility_car_co2_difference'])) $_SESSION['data']['evaluation_mobility_car_co2_difference'] = 0;
|
||||
if(!isset($_SESSION['data']['evaluation_mobility_car_co2_saving'])) $_SESSION['data']['evaluation_mobility_car_co2_saving'] = 0;
|
||||
|
||||
|
||||
// Page: mobility-travel
|
||||
if($_SESSION['data']['person_calc_mode'] == 1) $_SESSION['data']['mobility_train_persons'] = $_SESSION['data']['living_persons'];
|
||||
if($_SESSION['data']['person_calc_mode'] == 2) $_SESSION['data']['mobility_train_persons'] = 1;
|
||||
|
||||
|
||||
// Page: mobility-air
|
||||
if(!isset($_SESSION['data']['mobility_air_mode']))
|
||||
{
|
||||
$_SESSION['data']['mobility_air_mode'] = "general";
|
||||
|
||||
if(!isset($_SESSION['data']['mobility_air_general']['europe']))
|
||||
{
|
||||
$_SESSION['data']['mobility_air_general']['europe']['hours'] = $default_factor_mobility_air_general_europe_hours;
|
||||
$_SESSION['data']['mobility_air_general']['europe']['flight_class'] = "economy";
|
||||
$_SESSION['data']['mobility_air_general']['europe']['flight_compensated'] = 0;
|
||||
}
|
||||
|
||||
if(!isset($_SESSION['data']['mobility_air_general']['world']))
|
||||
{
|
||||
$_SESSION['data']['mobility_air_general']['world']['hours'] = $default_factor_mobility_air_general_world_hours;
|
||||
$_SESSION['data']['mobility_air_general']['world']['flight_class'] = "economy";
|
||||
$_SESSION['data']['mobility_air_general']['world']['flight_compensated'] = 0;
|
||||
}
|
||||
|
||||
$_SESSION['data']['sc_mobility_air_general'] = $_SESSION['data']['mobility_air_general'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!isset($_SESSION['data']['evaluation_mobility_flight_co2_saving'])) $_SESSION['data']['evaluation_mobility_flight_co2_saving'] = 0;
|
||||
|
||||
if(!isset($_SESSION['data']['mobility_air']) || empty($_SESSION['data']['mobility_air'])) $_SESSION['data']['mobility_air'] = array();
|
||||
if(!isset($_SESSION['data']['sc_mobility_air']) || empty($_SESSION['data']['sc_mobility_air'])) $_SESSION['data']['sc_mobility_air'] = array();
|
||||
|
||||
|
||||
// Page: food
|
||||
$_SESSION['data']['food_persons'] = 1;
|
||||
$_SESSION['data']['food_calc_mode'] = "detail";
|
||||
|
||||
if(!isset($_SESSION['data']['food_details']['sex'])) $_SESSION['data']['food_details']['sex'] = $default_factor_food_details_sex;
|
||||
if(!isset($_SESSION['data']['food_details']['age'])) $_SESSION['data']['food_details']['age'] = $default_factor_food_details_age;
|
||||
if(!isset($_SESSION['data']['food_details']['weight'])) $_SESSION['data']['food_details']['weight'] = $default_factor_food_details_weight;
|
||||
if(!isset($_SESSION['data']['food_details']['activity'])) $_SESSION['data']['food_details']['activity'] = $default_factor_food_details_activity;
|
||||
if(!isset($_SESSION['data']['food_details']['sport'])) $_SESSION['data']['food_details']['sport'] = $default_factor_food_details_sport;
|
||||
|
||||
if(!isset($_SESSION['data']['food_eating_habits']['type'])) $_SESSION['data']['food_eating_habits']['type'] = $default_factor_food_eating_habits["type"];
|
||||
if(!isset($_SESSION['data']['food_eating_habits']['purchase'])) $_SESSION['data']['food_eating_habits']['purchase'] = $default_factor_food_eating_habits["purchase"];
|
||||
if(!isset($_SESSION['data']['food_eating_habits']['fastfood'])) $_SESSION['data']['food_eating_habits']['fastfood'] = $default_factor_food_eating_habits["fastfood"];
|
||||
if(!isset($_SESSION['data']['food_eating_habits']['packaging'])) $_SESSION['data']['food_eating_habits']['packaging'] = $default_factor_food_eating_habits["packaging"];
|
||||
// if(!isset($_SESSION['data']['food_eating_habits']['regional'])) $_SESSION['data']['food_eating_habits']['regional'] = $default_factor_food_eating_habits["regional"];
|
||||
// if(!isset($_SESSION['data']['food_eating_habits']['seasonal'])) $_SESSION['data']['food_eating_habits']['seasonal'] = $default_factor_food_eating_habits["seasonal"];
|
||||
// if(!isset($_SESSION['data']['food_eating_habits']['frozenfoods'])) $_SESSION['data']['food_eating_habits']['frozenfoods'] = $default_factor_food_eating_habits["frozenfoods"];
|
||||
// if(!isset($_SESSION['data']['food_eating_habits']['oeko'])) $_SESSION['data']['food_eating_habits']['oeko'] = $default_factor_food_eating_habits["oeko"];
|
||||
|
||||
|
||||
// Page: consumption
|
||||
if(!isset($_SESSION['data']['consumption_consumer_habits'])) $_SESSION['data']['consumption_consumer_habits'] = $default_factor_consumption_consumer_habits;
|
||||
if(!isset($_SESSION['data']['consumption_consumer_shirt'])) $_SESSION['data']['consumption_consumer_shirt'] = $default_factor_consumption_consumer_shirt;
|
||||
if(!isset($_SESSION['data']['consumption_consumer_criteria'])) $_SESSION['data']['consumption_consumer_criteria'] = $default_factor_consumption_consumer_criteria;
|
||||
if(!isset($_SESSION['data']['consumption_hotel_visits'])) $_SESSION['data']['consumption_hotel_visits'] = $default_factor_consumption_hotel_visits;
|
||||
if(!isset($_SESSION['data']['consumption_used_goods'])) $_SESSION['data']['consumption_used_goods'] = $default_factor_consumption_used_goods;
|
||||
if(!isset($_SESSION['data']['consumption_activity'])) $_SESSION['data']['consumption_activity'] = $default_factor_consumption_activity;
|
||||
if(!isset($_SESSION['data']['consumption_vehicles'])) $_SESSION['data']['consumption_vehicles'] = $default_factor_consumption_vehicles;
|
||||
if(!isset($_SESSION['data']['consumption_cf_investment'])) $_SESSION['data']['consumption_cf_investment'] = $default_factor_consumption_cf_investment;
|
||||
if(!isset($_SESSION['data']['consumption_compensate_emissions'])) $_SESSION['data']['consumption_compensate_emissions'] = $default_factor_consumption_compensate_emissions;
|
||||
|
||||
if(!isset($_SESSION['data']['consumption_animal']))
|
||||
{
|
||||
$_SESSION['data']['consumption_animal'][0] = array(
|
||||
'type' => '',
|
||||
);
|
||||
|
||||
|
||||
// Scenario
|
||||
$_SESSION['data']['sc_consumption_animal'] = $_SESSION['data']['consumption_animal'];
|
||||
}
|
||||
|
||||
// Page: consumption / streaming
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily']['music'])) $_SESSION['data']['streaming_internet_daily']['music'] = 0;
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily']['ip_phone'])) $_SESSION['data']['streaming_internet_daily']['ip_phone'] = 0;
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily']['video_conf'])) $_SESSION['data']['streaming_internet_daily']['video_conf'] = 0;
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily']['video_low_q'])) $_SESSION['data']['streaming_internet_daily']['video_low_q'] = 0;
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily']['video_high_q'])) $_SESSION['data']['streaming_internet_daily']['video_high_q'] = 0;
|
||||
|
||||
if(!isset($_SESSION['data']['streaming_internet_daily_wifi'])) $_SESSION['data']['streaming_internet_daily_wifi'] = 'manchmal';
|
||||
|
||||
|
||||
|
||||
|
||||
/* Szenario */
|
||||
|
||||
// Page: sc_living_hs
|
||||
if(!isset($_SESSION['data']['sc_living_hs_improve_mode'])) $_SESSION['data']['sc_living_hs_improve_mode'] = "no";
|
||||
|
||||
foreach($fd_sc_living_hs_acceptance as $key_slha => $val_slha)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_living_hs_acceptance'][$key_slha])) $_SESSION['data']['sc_living_hs_acceptance'][$key_slha] = $fd_sc_living_hs_acceptance[$key_slha]["default"];
|
||||
}
|
||||
|
||||
// Page: sc_living_pt
|
||||
if(!isset($_SESSION['data']['sc_living_pt_type'])) $_SESSION['data']['sc_living_pt_type'] = "strommix_de";
|
||||
if(!isset($_SESSION['data']['sc_living_pt_td_ee_kwk'])) $_SESSION['data']['sc_living_pt_td_ee_kwk'] = "yes";
|
||||
if(!isset($_SESSION['data']['sc_living_pt_ee_kwk'])) $_SESSION['data']['sc_living_pt_ee_kwk'] = "no";
|
||||
if(!isset($_SESSION['data']['sc_living_pt_pg_type'])) $_SESSION['data']['sc_living_pt_pg_type'] = "pv_2kwp";
|
||||
if(!isset($_SESSION['data']['sc_living_pt_pg_consumption'])) $_SESSION['data']['sc_living_pt_pg_consumption'] = 0;
|
||||
|
||||
foreach($fd_sc_living_pt_acceptance as $key_slpa => $val_slpa)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_living_pt_acceptance'][$key_slpa])) $_SESSION['data']['sc_living_pt_acceptance'][$key_slpa] = $fd_sc_living_pt_acceptance[$key_slpa]["default"];
|
||||
}
|
||||
|
||||
// Page: sc_mobility
|
||||
foreach($fd_sc_mobility_acceptance as $key_sma => $val_sma)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_mobility_acceptance'][$key_sma])) $_SESSION['data']['sc_mobility_acceptance'][$key_sma] = $fd_sc_mobility_acceptance[$key_sma]["default"];
|
||||
}
|
||||
|
||||
// Page: sc_mobility
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa])) $_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa] = $fd_sc_mobility_flight_acceptance[$key_smfa]["default"];
|
||||
}
|
||||
|
||||
// Page: sc_food
|
||||
if(!isset($_SESSION['data']['sc_food_details']['weight_reduced'])) $_SESSION['data']['sc_food_details']['weight_reduced'] = 0;
|
||||
|
||||
if(!isset($_SESSION['data']['sc_food_eating_habits']['type'])) $_SESSION['data']['sc_food_eating_habits']['type'] = $_SESSION['data']['food_eating_habits']['type'];
|
||||
|
||||
foreach($fd_sc_food_acceptance as $key_sma => $val_sma)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_food_acceptance'][$key_sma])) $_SESSION['data']['sc_food_acceptance'][$key_sma] = $fd_sc_food_acceptance[$key_sma]["default"];
|
||||
}
|
||||
|
||||
// Page: sc_consumption
|
||||
if(!isset($_SESSION['data']['sc_consumption_consumer_habits'])) $_SESSION['data']['sc_consumption_consumer_habits'] = $_SESSION['data']['consumption_consumer_habits'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_consumer_shirt'])) $_SESSION['data']['sc_consumption_consumer_shirt'] = $_SESSION['data']['consumption_consumer_shirt'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_consumer_criteria'])) $_SESSION['data']['sc_consumption_consumer_criteria'] = $_SESSION['data']['consumption_consumer_criteria'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_hotel_visits'])) $_SESSION['data']['sc_consumption_hotel_visits'] = $_SESSION['data']['consumption_hotel_visits'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_used_goods'])) $_SESSION['data']['sc_consumption_used_goods'] = $_SESSION['data']['consumption_used_goods'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_cf_investment'])) $_SESSION['data']['sc_consumption_cf_investment'] = $_SESSION['data']['consumption_cf_investment'];
|
||||
if(!isset($_SESSION['data']['sc_consumption_compensate_emissions'])) $_SESSION['data']['sc_consumption_compensate_emissions'] = 0;
|
||||
|
||||
foreach($fd_sc_consumption_acceptance as $key_sma => $val_sma)
|
||||
{
|
||||
if(!isset($_SESSION['data']['sc_consumption_acceptance'][$key_sma])) $_SESSION['data']['sc_consumption_acceptance'][$key_sma] = $fd_sc_consumption_acceptance[$key_sma]["default"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Background */
|
||||
if(!isset($_SESSION['optimum']['living_hs_by_persons'])) $_SESSION['optimum']['living_hs_by_persons'] = 0;
|
||||
if(!isset($_SESSION['optimum']['living_pt_by_persons'])) $_SESSION['optimum']['living_pt_by_persons'] = 0;
|
||||
if(!isset($_SESSION['optimum']['total_food_by_persons'])) $_SESSION['optimum']['total_food_by_persons'] = 0;
|
||||
if(!isset($_SESSION['optimum']['total_consumption_by_persons'])) $_SESSION['optimum']['total_consumption_by_persons'] = 0;
|
||||
|
||||
?>
|
||||
144
r41/luxembourg/de/_core/includes/_chart_avoidance_js.php
Normal file
144
r41/luxembourg/de/_core/includes/_chart_avoidance_js.php
Normal file
@ -0,0 +1,144 @@
|
||||
<script type="text/javascript">
|
||||
var chartCalcAvoidance = AmCharts.makeChart("chart-area-avoidance", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[
|
||||
{
|
||||
"category": "<?php echo TXT_RESULT_SELF; ?>",
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_consumption']); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_RESULT_OTHER; ?>",
|
||||
"<?php echo TXT_CHART_LIVING_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_consumption']); ?>
|
||||
}
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['living']; ?>",
|
||||
"id": "AmGraph-self-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['mobility']; ?>",
|
||||
"id": "AmGraph-self-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['food']; ?>",
|
||||
"id": "AmGraph-self-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['consumption']; ?>",
|
||||
"id": "AmGraph-self-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['living']; ?>",
|
||||
"id": "AmGraph-other-compensation",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
// "newStack": true,
|
||||
"title": "<?php echo TXT_CHART_LIVING_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['mobility']; ?>",
|
||||
"id": "AmGraph-other-ee",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['consumption']; ?>",
|
||||
"id": "AmGraph-other-oeko",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"maximum": <?php echo getMyResultChart($_SESSION['emission']['td']['total_max']); ?>,
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
// "totalText": "[[total]]",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
</script>
|
||||
91
r41/luxembourg/de/_core/includes/_chart_compare_js.php
Normal file
91
r41/luxembourg/de/_core/includes/_chart_compare_js.php
Normal file
@ -0,0 +1,91 @@
|
||||
<script type="text/javascript">
|
||||
var chartCalc = AmCharts.makeChart("chart-area-compare", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[{
|
||||
"category": "<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['chart_my_result']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total']); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_SUBLINE_GERMANY; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['chart_other_countries']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart(COMPARE_EMISSION_VALUE_GERMANY); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_SUBLINE_PERU; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['chart_other_countries']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart(COMPARE_EMISSION_VALUE_PERU); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_SUBLINE_INDIA; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['chart_other_countries']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart(COMPARE_EMISSION_VALUE_INDIA); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_SUBLINE_KENIA; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['chart_other_countries']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart(COMPARE_EMISSION_VALUE_KENIA); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_SUBLINE_TARGET_2050; ?>",
|
||||
"color": "<?php echo $customer_settings['css']['color']['quota']; ?>",
|
||||
"<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>": <?php echo getMyResultChart(COMPARE_EMISSION_VALUE_TARGET_2050); ?>
|
||||
}
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[category]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
// "fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"fillColorsField": "color",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
// "maximum": <?php echo getMyResultChart($_SESSION['emission']['td']['total_max']); ?>,
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
// "totalText": "[[total]]",
|
||||
// "totalTextColor": "#000000",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"labelRotation": 45,
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
208
r41/luxembourg/de/_core/includes/_chart_complete_js.php
Normal file
208
r41/luxembourg/de/_core/includes/_chart_complete_js.php
Normal file
@ -0,0 +1,208 @@
|
||||
<script type="text/javascript">
|
||||
var chartCalcComplete = AmCharts.makeChart("chart-area-complete", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_VALUE_AXIS_CO2_AND_SELF; ?>",
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_living']); ?>
|
||||
},
|
||||
{
|
||||
"category": "<?php echo TXT_RESULT_OTHER; ?>",
|
||||
"<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_living']); ?>
|
||||
}
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['consumption']; ?>",
|
||||
"id": "AmGraph-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['food']; ?>",
|
||||
"id": "AmGraph-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['consumption']; ?>",
|
||||
"id": "AmGraph-self-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['food']; ?>",
|
||||
"id": "AmGraph-self-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['mobility']; ?>",
|
||||
"id": "AmGraph-self-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['living']; ?>",
|
||||
"id": "AmGraph-self-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['consumption']; ?>",
|
||||
"id": "AmGraph-other-oeko",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['mobility']; ?>",
|
||||
"id": "AmGraph-other-ee",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['living']; ?>",
|
||||
"id": "AmGraph-other-compensation",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_OTHER; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"maximum": <?php echo getMyResultChart($_SESSION['emission']['td']['total_max']); ?>,
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
// "totalText": "[[total]]",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
</script>
|
||||
128
r41/luxembourg/de/_core/includes/_chart_js.php
Normal file
128
r41/luxembourg/de/_core/includes/_chart_js.php
Normal file
@ -0,0 +1,128 @@
|
||||
<script type="text/javascript">
|
||||
var chartCalc = AmCharts.makeChart("chart-area", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[{
|
||||
"category": "<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>",
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_STREAMING; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_streaming']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_consumption']); ?>
|
||||
}
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['food']; ?>",
|
||||
"id": "AmGraph-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['streaming']; ?>",
|
||||
"id": "AmGraph-streaming",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_STREAMING; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_STREAMING; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['consumption']; ?>",
|
||||
"id": "AmGraph-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"maximum": <?php echo getMyResultChart($_SESSION['emission']['td']['total_max']); ?>,
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
"totalText": "[[total]]",
|
||||
"totalTextColor": "#000000",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
287
r41/luxembourg/de/_core/includes/_chart_scenario_complete_js.php
Normal file
287
r41/luxembourg/de/_core/includes/_chart_scenario_complete_js.php
Normal file
@ -0,0 +1,287 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var chartScenarioComplete = AmCharts.makeChart("chart-scenario-complete-area", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_TD; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota2']) echo '"'.TXT_CHART_QUOTA_2.'": '.getMyResultChart(QUOTA_2_TD).','; ?>
|
||||
// "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_public_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_food']); ?>,
|
||||
// "<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_mobility']); ?>,
|
||||
// "<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['td']['total_living']); ?>
|
||||
},
|
||||
<?php if($customer_settings['display']['st'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_ST; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota2']) echo '"'.TXT_CHART_QUOTA_2.'": '.getMyResultChart(QUOTA_2_ST).','; ?>
|
||||
// "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_public_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_food']); ?>,
|
||||
// "<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_mobility']); ?>,
|
||||
// "<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['st']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['st']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['st']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['st']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['st']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['st']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['st']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['st']['total_living']); ?>
|
||||
},
|
||||
<?php endif; ?>
|
||||
<?php if($customer_settings['display']['mt'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_MT; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota2']) echo '"'.TXT_CHART_QUOTA_2.'": '.getMyResultChart(QUOTA_2_MT).','; ?>
|
||||
// "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_public_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_food']); ?>,
|
||||
// "<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_mobility']); ?>,
|
||||
// "<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['mt']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['mt']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['mt']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['mt']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['mt']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['mt']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['mt']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_OTHER; ?>": <?php echo getMyResultChart($_SESSION['emission_other']['mt']['total_living']); ?>
|
||||
},
|
||||
<?php endif; ?>
|
||||
<?php if($customer_settings['display']['lt'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_LT; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota2']) echo '"'.TXT_CHART_QUOTA_2.'": '.getMyResultChart(QUOTA_2_LT).','; ?>
|
||||
// "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_public_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_consumption']); ?>,
|
||||
// "<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_food']); ?>,
|
||||
// "<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_mobility']); ?>,
|
||||
// "<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['lt']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['lt']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['lt']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['lt']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_SELF; ?>": <?php echo getMyResultChart($_SESSION['emission_self']['lt']['total_living']); ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['consumption']; ?>",
|
||||
"id": "AmGraph-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['food']; ?>",
|
||||
"id": "AmGraph-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY; ?>"
|
||||
}, {
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['public-consumption']; ?>",
|
||||
"id": "AmGraph-self-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['consumption']; ?>",
|
||||
"id": "AmGraph-self-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['food']; ?>",
|
||||
"id": "AmGraph-self-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['mobility']; ?>",
|
||||
"id": "AmGraph-self-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['living']; ?>",
|
||||
"id": "AmGraph-self-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"newStack": true,
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['consumption']; ?>",
|
||||
"id": "AmGraph-other-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['mobility']; ?>",
|
||||
"id": "AmGraph-other-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['living']; ?>",
|
||||
"id": "AmGraph-other-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineColor": "<?php echo $customer_settings['css']['color']['quota2']; ?>",
|
||||
"lineThickness": 4,
|
||||
"lineAlpha": 0.4,
|
||||
"id": "AmGraph-quota2",
|
||||
"title": "<?php echo TXT_CHART_QUOTA_2; ?>",
|
||||
"type": "step",
|
||||
"bullet":"square",
|
||||
"bulletAlpha":1,
|
||||
"bulletSize":8,
|
||||
"bulletBorderAlpha":0,
|
||||
"valueField": "<?php echo TXT_CHART_QUOTA_2; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
// "totalText": "[[total]]",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
245
r41/luxembourg/de/_core/includes/_chart_scenario_js.php
Normal file
245
r41/luxembourg/de/_core/includes/_chart_scenario_js.php
Normal file
@ -0,0 +1,245 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var chartScenario = AmCharts.makeChart("chart-scenario-area", {
|
||||
"rotate": false,
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_TD; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota']) echo '"'.TXT_CHART_QUOTA.'": '.getMyResultChart(QUOTA_TD).''; ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_public_consumption']); ?>
|
||||
},
|
||||
<?php if($customer_settings['display']['st'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_ST; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota']) echo '"'.TXT_CHART_QUOTA.'": '.getMyResultChart(QUOTA_ST).''; ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['st']['total_public_consumption']); ?>
|
||||
},
|
||||
<?php endif; ?>
|
||||
<?php if($customer_settings['display']['mt'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_MT; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota']) echo '"'.TXT_CHART_QUOTA.'": '.getMyResultChart(QUOTA_MT).''; ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['mt']['total_public_consumption']); ?>
|
||||
},
|
||||
<?php endif; ?>
|
||||
<?php if($customer_settings['display']['lt'] == true): ?>
|
||||
{
|
||||
"category": "<?php echo TXT_TIME_PERIOD_LT; ?>",
|
||||
<?php if($customer_settings['display']['chart_quota']) echo '"'.TXT_CHART_QUOTA.'": '.getMyResultChart(QUOTA_LT).''; ?>,
|
||||
"<?php echo TXT_CHART_LIVING; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_living']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_mobility']); ?>,
|
||||
"<?php echo TXT_CHART_FOOD; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_food']); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['lt']['total_public_consumption']); ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['consumption']; ?>",
|
||||
"id": "AmGraph-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['food']; ?>",
|
||||
"id": "AmGraph-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY; ?>"
|
||||
}, {
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['living']; ?>",
|
||||
"id": "AmGraph-self-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_LIVING_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['mobility']; ?>",
|
||||
"id": "AmGraph-self-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['food']; ?>",
|
||||
"id": "AmGraph-self-food",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_FOOD_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_FOOD_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_self']['consumption']; ?>",
|
||||
"id": "AmGraph-self-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_SELF; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['living']; ?>",
|
||||
"id": "AmGraph-other-living",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"newStack": true,
|
||||
"title": "<?php echo TXT_CHART_LIVING_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['mobility']; ?>",
|
||||
"id": "AmGraph-other-mobility",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_OTHER; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 1,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color_other']['consumption']; ?>",
|
||||
"id": "AmGraph-other-consumption",
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION_OTHER; ?>",
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineColor": "<?php echo $customer_settings['css']['color']['quota']; ?>",
|
||||
"lineThickness": 4,
|
||||
"lineAlpha": 0.4,
|
||||
"id": "AmGraph-quota",
|
||||
"title": "<?php echo TXT_CHART_QUOTA; ?>",
|
||||
"type": "step",
|
||||
"bullet":"square",
|
||||
"bulletAlpha":1,
|
||||
"bulletSize":8,
|
||||
"bulletBorderAlpha":0,
|
||||
"valueField": "<?php echo TXT_CHART_QUOTA; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
251
r41/luxembourg/de/_core/includes/_chart_section_js.php
Normal file
251
r41/luxembourg/de/_core/includes/_chart_section_js.php
Normal file
@ -0,0 +1,251 @@
|
||||
<?php
|
||||
$js_chart_living_hs = 0.3;
|
||||
$js_chart_living_pt = 0.3;
|
||||
$js_chart_mobility_daily = 0.3;
|
||||
$js_chart_mobility_travel = 0.3;
|
||||
$js_chart_mobility_flight = 0.3;
|
||||
$js_chart_food = 0.3;
|
||||
$js_chart_consumption = 0.3;
|
||||
$js_chart_public_consumption = 0.3;
|
||||
|
||||
switch($cat)
|
||||
{
|
||||
case "living-hs":
|
||||
$js_chart_living_hs = 1;
|
||||
break;
|
||||
|
||||
case "living-pt":
|
||||
$js_chart_living_pt = 1;
|
||||
break;
|
||||
|
||||
case "mobility-daily":
|
||||
$js_chart_mobility_daily = 1;
|
||||
break;
|
||||
|
||||
case "mobility-travel":
|
||||
$js_chart_mobility_travel = 1;
|
||||
break;
|
||||
|
||||
case "mobility-flight":
|
||||
$js_chart_mobility_flight = 1;
|
||||
break;
|
||||
|
||||
case "food":
|
||||
$js_chart_food = 1;
|
||||
break;
|
||||
|
||||
case "consumption":
|
||||
$js_chart_consumption = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var update_section;
|
||||
var update_emission = "";
|
||||
|
||||
function drawChartCalcSection(update_section, update_emission) {
|
||||
|
||||
if(update_section.length > 0) {
|
||||
|
||||
if(update_section == "mobility-daily" && update_emission.length > 0) js_emission_td_mobility_daily = update_emission;
|
||||
if(update_section == "mobility-travel" && update_emission.length > 0) js_emission_td_mobility_car_total = update_emission;
|
||||
if(update_section == "mobility-flight" && update_emission.length > 0) js_emission_td_mobility_air_total = update_emission;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var chartCalcSection = AmCharts.makeChart("chart-area-section", {
|
||||
"baseHref": true,
|
||||
"rotate": true,
|
||||
"responsive": {
|
||||
"enabled": true,
|
||||
"addDefaultRules": false,
|
||||
"rules": [
|
||||
{
|
||||
"maxWidth": 500,
|
||||
"overrides": {
|
||||
"rotate": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"precision": 2,
|
||||
"addClassNames": "true",
|
||||
"type": "serial",
|
||||
"fontFamily": "Helvetica",
|
||||
"categoryField": "category",
|
||||
"startDuration": 0,
|
||||
"columnSpacing": 15,
|
||||
"trendLines": [],
|
||||
"dataProvider":[{
|
||||
"category": "<?php echo TXT_CHART_VALUE_AXIS_CO2; ?>",
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_public_consumption']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_PT; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['living_pt']); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_HS; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['living_hs']); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_AIR; ?>": js_emission_td_mobility_air_total,
|
||||
"<?php echo TXT_CHART_MOBILITY_TRAVEL; ?>": js_emission_td_mobility_car_total,
|
||||
"<?php echo TXT_CHART_MOBILITY_DAILY; ?>": js_emission_td_mobility_daily,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart($_SESSION['emission']['td']['total_lifestyle']); ?> // Lifestyle = Konsum + Ernährung
|
||||
}/*,
|
||||
{
|
||||
"category": "<?php echo TXT_CHART_VALUE_AXIS_CO2_DD; ?>",
|
||||
"<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_COMMON); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_PT; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_LIVING_POWER_TYPE); ?>,
|
||||
"<?php echo TXT_CHART_LIVING_HS; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_LIVING_HEATING_SYSTEM); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_AIR; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_MOBILITY_AIR); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_TRAVEL; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_MOBILITY_CAR + AVERAGE_EMISSION_VALUE_MOBILITY_TRAIN); ?>,
|
||||
"<?php echo TXT_CHART_MOBILITY_DAILY; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_MOBILITY_CAR_OWNERSHIP); ?>,
|
||||
"<?php echo TXT_CHART_CONSUMPTION; ?>": <?php echo getMyResultChart(AVERAGE_EMISSION_VALUE_LIFESTYLE); ?> // Lifestyle = Konsum + Ernährung
|
||||
}*/
|
||||
],
|
||||
"graphs": [
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_consumption; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['consumption']; ?>",
|
||||
"id": "AmGraph-consumption",
|
||||
<?php if($cat == "consumption"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_CONSUMPTION; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_mobility_daily; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility",
|
||||
<?php if($cat == "mobility-daily"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_DAILY; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_DAILY; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_mobility_travel; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility-travel",
|
||||
<?php if($cat == "mobility-travel"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_TRAVEL; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_TRAVEL; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_mobility_flight; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['mobility']; ?>",
|
||||
"id": "AmGraph-mobility-air",
|
||||
<?php if($cat == "mobility-flight"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_MOBILITY_AIR; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_MOBILITY_AIR; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_living_hs; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living-hs",
|
||||
<?php if($cat == "living-hs"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_LIVING_HS; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_HS; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_living_pt; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['living']; ?>",
|
||||
"id": "AmGraph-living-pt",
|
||||
<?php if($cat == "living-pt"): ?>
|
||||
"color": "#ffffff",
|
||||
"labelText": "[[value]] t",
|
||||
<?php endif; ?>
|
||||
"title": "<?php echo TXT_CHART_LIVING_PT; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_LIVING_PT; ?>"
|
||||
},
|
||||
{
|
||||
"balloonText": "[[title]]: <b>[[value]] t</b>",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": <?php echo $js_chart_public_consumption; ?>,
|
||||
"fillColors": "<?php echo $customer_settings['css']['color']['public-consumption']; ?>",
|
||||
"id": "AmGraph-public-consumption",
|
||||
"title": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>",
|
||||
"type": "column",
|
||||
"valueField": "<?php echo TXT_CHART_PUBLIC_CONSUMPTION; ?>"
|
||||
}
|
||||
],
|
||||
// EOF graphs
|
||||
// "guides": [],
|
||||
"valueAxes": [{
|
||||
"id": "axis-1",
|
||||
"stackType": "regular",
|
||||
"title": "<?php echo TXT_CHART_VALUE_AXIS; ?>",
|
||||
"totalText": "[[total]]",
|
||||
"labelsEnabled": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.1
|
||||
}],
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"boldLabels": true,
|
||||
"tickLength": 0,
|
||||
"axisAlpha": 0.4,
|
||||
"axisColor": "#eeeeee",
|
||||
"gridAlpha": 0.2
|
||||
},
|
||||
"allLabels": [],
|
||||
"balloon": {
|
||||
"fontSize": 14,
|
||||
"cornerRadius": 0,
|
||||
"borderThickness": 1,
|
||||
"fillAlpha": 0.9,
|
||||
"fixedPosition": false
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (AmCharts.isReady) {
|
||||
drawChartCalcSection('', '');
|
||||
}
|
||||
else {
|
||||
AmCharts.ready(function(){
|
||||
drawChartCalcSection('','');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function updateChartCalcSection(update_section, update_emission) {
|
||||
drawChartCalcSection(update_section, update_emission);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
98
r41/luxembourg/de/_core/includes/_db_configure.inc.php
Normal file
98
r41/luxembourg/de/_core/includes/_db_configure.inc.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Database settings
|
||||
*/
|
||||
// Database "A". Diese Datenbank wird immer verwendet wenn
|
||||
// - $customer_settings['customer']['database'] nicht definiert ist
|
||||
// - $customer_settings['customer']['database'] leer ist
|
||||
// - $customer_settings['customer']['database'] == "A" ist
|
||||
if(!isset($customer_settings['customer']['database']) OR empty($customer_settings['customer']['database']) OR $customer_settings['customer']['database'] == "A")
|
||||
{
|
||||
define('DB_SERVER', 'mysql'); // eg, localhost - should not be empty for productive servers
|
||||
define('DB_SERVER_USERNAME', 'db336658_28');
|
||||
define('DB_SERVER_PASSWORD', 'NrW!4n?V');
|
||||
define('DB_DATABASE', 'db336658_28');
|
||||
define('CFG_MYSQL4_COMPATIBILITY', false);
|
||||
define('DB_DATABASE_VERSION', '50');
|
||||
define('DEBUG_SQL', false);
|
||||
}
|
||||
|
||||
if(isset($customer_settings['customer']['database']) && $customer_settings['customer']['database'] == "B")
|
||||
{
|
||||
define('DB_SERVER', 'mysql'); // eg, localhost - should not be empty for productive servers
|
||||
define('DB_SERVER_USERNAME', 'db336658_30');
|
||||
define('DB_SERVER_PASSWORD', 'j2wGef7sN2g!');
|
||||
define('DB_DATABASE', 'db336658_30');
|
||||
define('CFG_MYSQL4_COMPATIBILITY', false);
|
||||
define('DB_DATABASE_VERSION', '50');
|
||||
define('DEBUG_SQL', false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Database tables
|
||||
* Prefix for all tables
|
||||
*/
|
||||
define("TABLE_PREFIX","");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* User account
|
||||
*/
|
||||
define("TABLE_USER", TABLE_PREFIX."user");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* bookmark_data bis Ende 2021
|
||||
*/
|
||||
define("TABLE_BOOKMARK_DATA", TABLE_PREFIX."bookmark_data");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* bookmark_data ab 2022
|
||||
*/
|
||||
define("TABLE_BOOKMARK_DATA_2", TABLE_PREFIX."bookmark_data_2");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* User data
|
||||
*/
|
||||
define("TABLE_DATA", TABLE_PREFIX."data");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* User data
|
||||
*/
|
||||
define("TABLE_OFFSET", TABLE_PREFIX."offset");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* Airports
|
||||
*/
|
||||
define("TABLE_AIRPORTS", TABLE_PREFIX."airports");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* Airports mit Regionen
|
||||
*
|
||||
* Neuer Berechnungsansatz. 20-12-2019
|
||||
*/
|
||||
define("TABLE_AIRPORTS_WITH_REGION", TABLE_PREFIX."airports_with_region");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* Airports Regionen Zuordnung
|
||||
*
|
||||
* Neuer Berechnungsansatz. 20-12-2019
|
||||
*/
|
||||
define("TABLE_AIRPORTS_REGION_LIST", TABLE_PREFIX."airports_region_list");
|
||||
|
||||
/**
|
||||
* Database table
|
||||
* Airports Aircraft
|
||||
*
|
||||
* Neuer Berechnungsansatz. 20-12-2019
|
||||
*/
|
||||
define("TABLE_AIRPORTS_AIRCRAFT", TABLE_PREFIX."airports_aircraft");
|
||||
|
||||
?>
|
||||
29
r41/luxembourg/de/_core/includes/_footer_navigation.inc.php
Normal file
29
r41/luxembourg/de/_core/includes/_footer_navigation.inc.php
Normal file
@ -0,0 +1,29 @@
|
||||
<div id="stickem">
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="text-center">
|
||||
<?php
|
||||
if($prev_page != "")
|
||||
{
|
||||
echo '<a class="btn btn-primary js-submit-form" href="'.$prev_page.'" id="submit-back" title="'.TXT_NAV_BOTTOM_ZURUECK.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-arrow-left fa-lg"></i>' : TXT_NAV_BOTTOM_ZURUECK;
|
||||
echo '</a>';
|
||||
}
|
||||
if($current_page != "")
|
||||
{
|
||||
echo '<button class="btn btn-primary" type="submit" id="submit-refresh" title="'.TXT_NAV_BOTTOM_REFRESH.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-refresh fa-lg"></i> '.TXT_NAV_BOTTOM_REFRESH : TXT_NAV_BOTTOM_REFRESH;
|
||||
echo '</button>';
|
||||
}
|
||||
if($next_page != "")
|
||||
{
|
||||
echo '<a class="btn btn-primary js-submit-form" href="'.$next_page.'" id="submit-forward" title="'.TXT_NAV_BOTTOM_WEITER.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-arrow-right fa-lg"></i>' : TXT_NAV_BOTTOM_WEITER;
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,36 @@
|
||||
<hr>
|
||||
<div class="row" style="margin-bottom:20px">
|
||||
<div class="col-xs-6 col-sm-2 col-sm-offset-4">
|
||||
<?php
|
||||
if($parent_page != "")
|
||||
{
|
||||
echo '<button class="btn btn-primary" type="submit" name="submit_target['.$parent_page.']" id="submit-overview" title="'.TXT_NAV_BOTTOM_OVERVIEW.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-arrow-up fa-lg"></i>' : TXT_NAV_BOTTOM_OVERVIEW;
|
||||
echo '</button>';
|
||||
}
|
||||
if($current_page != "")
|
||||
{
|
||||
echo '<button class="btn btn-primary" type="submit" id="submit-refresh" title="'.TXT_NAV_BOTTOM_REFRESH.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-refresh fa-lg"></i> '.TXT_NAV_BOTTOM_REFRESH : TXT_NAV_BOTTOM_REFRESH;
|
||||
echo '</button>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if($prev_page != "" || $next_page != "") echo '<div class="col-xs-6 text-right">';
|
||||
|
||||
if($prev_page != "") {
|
||||
echo '<button class="btn btn-primary" type="submit" name="submit_target['.$prev_page.']" id="submit-back" title="'.TXT_NAV_BOTTOM_ZURUECK.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-arrow-left fa-lg"></i>' : TXT_NAV_BOTTOM_ZURUECK;
|
||||
echo '</button>';
|
||||
|
||||
}
|
||||
if($next_page != "") {
|
||||
echo '<button class="btn btn-primary" type="submit" name="submit_target['.$next_page.']" id="submit-forward" title="'.TXT_NAV_BOTTOM_WEITER.'">';
|
||||
echo ($customer_settings['display']['use_icons']) ? '<i class="fa fa-arrow-right fa-lg"></i>' : TXT_NAV_BOTTOM_WEITER;
|
||||
echo '</button>';
|
||||
}
|
||||
|
||||
if($prev_page != "" || $next_page != "") echo '</div>';
|
||||
?>
|
||||
</div>
|
||||
201
r41/luxembourg/de/_core/includes/_front_controller.php
Normal file
201
r41/luxembourg/de/_core/includes/_front_controller.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
$include_file_calc = '_start.php';
|
||||
$include_file_scenario = '_sc_start.php';
|
||||
$include_file_login = '';
|
||||
|
||||
$display_tab_intro = false;
|
||||
$display_tab_calc = false;
|
||||
$display_tab_scenario = false;
|
||||
$display_tab_bookmark = false;
|
||||
|
||||
$display_tab_calc_nav = true;
|
||||
|
||||
$display_js_cat = 'home';
|
||||
|
||||
/**
|
||||
* Front controller
|
||||
*/
|
||||
if(isset($cat))
|
||||
{
|
||||
switch($cat)
|
||||
{
|
||||
case "start":
|
||||
$include_file_calc = '_start.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'start';
|
||||
break;
|
||||
case "living-hs":
|
||||
$include_file_calc = '_living_hs.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_NAV_HEIZUNG).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'living-hs';
|
||||
break;
|
||||
case "living-hs-estimate":
|
||||
$include_file_calc = '_living_hs_estimate.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_LIVING_HS_ESTIMATE_HEADLINE).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_tab_calc_nav = false;
|
||||
$display_js_cat = 'living-hs';
|
||||
break;
|
||||
case "living-pt":
|
||||
$include_file_calc = '_living_pt.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_NAV_STROM).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'living-pt';
|
||||
break;
|
||||
case "living-pt-estimate":
|
||||
$include_file_calc = '_living_pt_estimate.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_LIVING_PT_ESTIMATE_HEADLINE).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_tab_calc_nav = false;
|
||||
$display_js_cat = 'living-pt';
|
||||
break;
|
||||
case "mobility-daily":
|
||||
$include_file_calc = '_mobility-daily.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_NAV_MOBILITAET_DAILY).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "mobility-travel":
|
||||
$include_file_calc = '_mobility-travel.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_NAV_MOBILITAET_TRAVEL).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "mobility-flight":
|
||||
$include_file_calc = '_mobility-flight.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_NAV_MOBILITAET_FLIGHT).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "mobility-flight-calculator":
|
||||
$include_file_calc = '_mobility-flight-calculator.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_MOBILITY_FLIGHT_CALCULATOR_HEADLINE).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_tab_calc_nav = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "food":
|
||||
$include_file_calc = '_food.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_FOOD_HEADLINE).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'food';
|
||||
break;
|
||||
case "consumption":
|
||||
$include_file_calc = '_consumption.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR.': '.TXT_CONSUMPTION_HEADLINE).' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'consumption';
|
||||
break;
|
||||
case "footprint":
|
||||
$include_file_calc = '_footprint.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR).': '.TXT_FOOTPRINT_HEADLINE.' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'footprint';
|
||||
break;
|
||||
case "extended":
|
||||
$include_file_calc = '_extended.php';
|
||||
$title = strip_tags(TXT_NAV_CALCULATOR).': '.TXT_EXTENDED_HEADLINE.' | ';
|
||||
$display_tab_calc = true;
|
||||
$display_js_cat = 'extended';
|
||||
break;
|
||||
|
||||
// Scenario
|
||||
case "sc-start":
|
||||
$include_file_scenario = '_sc_start.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'start';
|
||||
break;
|
||||
case "sc-living-hs":
|
||||
$include_file_scenario = '_sc_living_hs.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_LIVING_HS_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'living-hs';
|
||||
break;
|
||||
case "sc-living-pt":
|
||||
$include_file_scenario = '_sc_living_pt.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_LIVING_PT_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'living-pt';
|
||||
break;
|
||||
case "sc-mobility":
|
||||
$include_file_scenario = '_sc_mobility.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_NAV_MOBILITAET_CARS).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "sc-mobility-travel":
|
||||
$include_file_scenario = '_sc_mobility-travel.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_MOBILITY_TRAVEL_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "sc-mobility-flight":
|
||||
$include_file_scenario = '_sc_mobility-flight.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_MOBILITY_FLIGHT_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'mobility';
|
||||
break;
|
||||
case "sc-food":
|
||||
$include_file_scenario = '_sc_food.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_FOOD_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'food';
|
||||
break;
|
||||
case "sc-consumption":
|
||||
$include_file_scenario = '_sc_consumption.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO.': '.TXT_CONSUMPTION_HEADLINE).' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'consumption';
|
||||
break;
|
||||
case "sc-footprint":
|
||||
$include_file_scenario = '_sc_footprint.php';
|
||||
$title = strip_tags(TXT_NAV_SCENARIO).': '.TXT_FOOTPRINT_HEADLINE.' | ';
|
||||
$display_tab_scenario = true;
|
||||
$display_js_cat = 'footprint';
|
||||
break;
|
||||
|
||||
case "account":
|
||||
$include_file_login = '_account.php';
|
||||
$title = strip_tags(TXT_LOGIN_ACCOUNT_HEADLINE).' | ';
|
||||
break;
|
||||
case "login":
|
||||
$include_file_login = '_login.php';
|
||||
$title = strip_tags(TXT_LOGIN_ACCOUNT_HEADLINE).' | ';
|
||||
break;
|
||||
case "register":
|
||||
$include_file_login = '_register.php';
|
||||
$title = strip_tags(TXT_LOGIN_ACCOUNT_HEADLINE).' | ';
|
||||
break;
|
||||
case "reminder":
|
||||
$include_file = '_account_reminder.inc.php';
|
||||
$title = strip_tags(TXT_PASSWORD_FORGOTTEN_HEADLINE).' | ';
|
||||
break;
|
||||
case "offset":
|
||||
$include_file = '_offset.inc.php';
|
||||
$title = strip_tags(TXT_OFFSET_HEADLINE).' | ';
|
||||
break;
|
||||
case "payment":
|
||||
$include_file = '_payment.inc.php';
|
||||
$title = strip_tags(TXT_OFFSET_HEADLINE).' | ';
|
||||
break;
|
||||
case "process_offset":
|
||||
updateOffset();
|
||||
case "bookmark":
|
||||
$display_tab_intro = false;
|
||||
$display_tab_bookmark = true;
|
||||
$title = "";
|
||||
break;
|
||||
|
||||
default:
|
||||
// $include_file_calc = '';
|
||||
$title = "";
|
||||
$display_tab_calc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
490
r41/luxembourg/de/_core/includes/_functions.inc.php
Normal file
490
r41/luxembourg/de/_core/includes/_functions.inc.php
Normal file
@ -0,0 +1,490 @@
|
||||
<?php
|
||||
/**
|
||||
* Fill $_SESSION array with form data
|
||||
*/
|
||||
/*
|
||||
function JSsessionData($_POST)
|
||||
{
|
||||
|
||||
// Set session variables
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if(is_array($val)) $_SESSION['data'][$key] = "";
|
||||
|
||||
$val = sanitizeInput($val);
|
||||
$_SESSION['data'][$key] = $val;
|
||||
}
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
function JSsessionData($data)
|
||||
{
|
||||
|
||||
/* Set session variables */
|
||||
foreach($data as $key => $val)
|
||||
{
|
||||
/* First array */
|
||||
if(is_array($val))
|
||||
{
|
||||
$_SESSION['data'][$key] = array();
|
||||
foreach($val as $key2 => $val2)
|
||||
{
|
||||
/* Second array */
|
||||
if(is_array($val2))
|
||||
{
|
||||
$_SESSION['data'][$key][$key2] = array();
|
||||
foreach($val2 as $key3 => $val3)
|
||||
{
|
||||
$_SESSION['data'][$key][$key2][$key3] = sanitizeInput($val3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['data'][$key][$key2] = sanitizeInput($val2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['data'][$key] = sanitizeInput($val);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy session data
|
||||
*/
|
||||
function JSkillSessionData()
|
||||
{
|
||||
if(isset($_SESSION['data']))
|
||||
{
|
||||
foreach($_SESSION['data'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['data'][$key]);
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['emission']))
|
||||
{
|
||||
$_SESSION['emission'] = array();
|
||||
}
|
||||
if(isset($_SESSION['emission_self']))
|
||||
{
|
||||
$_SESSION['emission_self'] = array();
|
||||
}
|
||||
if(isset($_SESSION['emission_other']))
|
||||
{
|
||||
$_SESSION['emission_other'] = array();
|
||||
}
|
||||
if(isset($_SESSION['emission_before']))
|
||||
{
|
||||
$_SESSION['emission_before'] = array();
|
||||
}
|
||||
if(isset($_SESSION['kwh']))
|
||||
{
|
||||
$_SESSION['kwh'] = array();
|
||||
}
|
||||
if(isset($_SESSION['performance']))
|
||||
{
|
||||
$_SESSION['performance'] = array();
|
||||
}
|
||||
if(isset($_SESSION['optimum']))
|
||||
{
|
||||
foreach($_SESSION['optimum'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['optimum'][$key]);
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['potential']))
|
||||
{
|
||||
foreach($_SESSION['potential'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['potential'][$key]);
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['target']))
|
||||
{
|
||||
foreach($_SESSION['target'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['target'][$key]);
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['pdf_output']))
|
||||
{
|
||||
foreach($_SESSION['pdf_output'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['pdf_output'][$key]);
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['debug']))
|
||||
{
|
||||
foreach($_SESSION['debug'] as $key => $val)
|
||||
{
|
||||
unset($_SESSION['debug'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize input
|
||||
*/
|
||||
function sanitizeInput($_input)
|
||||
{
|
||||
$_input = htmlspecialchars(strip_tags(trim($_input)), ENT_QUOTES);
|
||||
|
||||
return $_input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database error
|
||||
*
|
||||
* Display mysql_error and rollbacks database transactions
|
||||
* @param string $sql_query contains the SQL query that produced the error
|
||||
* @param string $line contains the line number
|
||||
* @param string $file contains the file name
|
||||
* @param bool $rollback defines if a rollback action is executed. Default = true
|
||||
* @param bool $exit defines if the script will be terminated. Default = false
|
||||
*/
|
||||
function db_error($sql_query = '', $line = '', $file = '', $rollback = true, $exit = false)
|
||||
{
|
||||
GLOBAL $db;;
|
||||
|
||||
echo '<div style="color:#ff0000;">'.mysql_error().'</div>';
|
||||
echo '<div style="color:#ff0000;">ezSQL error: ';
|
||||
$db->vardump($GLOBALS['EZSQL_ERROR']);
|
||||
echo '</div>';
|
||||
echo '<div style="color:#ff0000;">Line: '.$line.'</div>';
|
||||
echo '<div style="color:#ff0000;">File: '.$file.'</div>';
|
||||
|
||||
if($rollback) $db->query("ROLLBACK");
|
||||
if($exit) die("The script processing is terminated");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random number
|
||||
*
|
||||
* The created number is used to avoid form reloads
|
||||
*
|
||||
* @return integer random number
|
||||
*/
|
||||
function createRandomNumber()
|
||||
{
|
||||
srand((double)microtime()*10000000);
|
||||
$id = md5(uniqid(rand()));
|
||||
return($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get airports
|
||||
*
|
||||
* @param string $airport_name
|
||||
* @return array
|
||||
*/
|
||||
function getAirports($airport_name)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
$airport_id_array = array();
|
||||
|
||||
// $airport_name = utf8_decode($airport_name);
|
||||
/*
|
||||
$mysql_version = mysql_get_server_info();
|
||||
$mysql_version = str_replace(".", "", substr($mysql_version, 0, strpos($mysql_version, "-")));
|
||||
|
||||
if($mysql_version >= 4100)
|
||||
{
|
||||
$sql = "SET NAMES latin1";
|
||||
$result = mysql_query($sql,$conn);
|
||||
if (!$result)
|
||||
{
|
||||
echo mysql_error();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(strlen($airport_name) == 3)
|
||||
{
|
||||
$sql = "SELECT id, city, airport, iata, country FROM ".TABLE_AIRPORTS." ";
|
||||
$sql .= "WHERE city LIKE '".$db->escape($airport_name)."%' OR country LIKE '".$db->escape($airport_name)."%' ";
|
||||
$sql .= "ORDER BY country, city";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'weight' => '[0] '
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT id, city, airport, iata, country, MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."') AS weight FROM ".TABLE_AIRPORTS." ";
|
||||
$sql .= "WHERE MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."' IN BOOLEAN MODE) ";
|
||||
$sql .= "ORDER BY weight DESC, country, city";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'weight' => '[1] '. $query_result->weight
|
||||
);
|
||||
$airport_id_array[] = $query_result->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country, MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."*') AS weight FROM ".TABLE_AIRPORTS." ";
|
||||
$sql .= "WHERE MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."*' IN BOOLEAN MODE) ";
|
||||
$sql .= "ORDER BY weight DESC, country, city";
|
||||
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
if(!in_array($query_result->id, $airport_id_array)) // remove duplicate airport_id's
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'weight' => '[2] '. $query_result->weight
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
}
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
function getIATA($airport_name)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country FROM ".TABLE_AIRPORTS." ";
|
||||
$sql .= "WHERE iata = '".$db->escape($airport_name)."' ";
|
||||
$sql .= "ORDER BY iata";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
function getAirportById($airport_id)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country, lat_deg, lat_min, lat_sec, lat_pre, long_deg, long_min, long_sec, long_pre FROM ".TABLE_AIRPORTS." ";
|
||||
$sql .= "WHERE id = '".$airport_id."'";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'lat_deg' => $query_result->lat_deg,
|
||||
'lat_min' => $query_result->lat_min,
|
||||
'lat_sec' => $query_result->lat_sec,
|
||||
'lat_pre' => $query_result->lat_pre,
|
||||
'long_deg' => $query_result->long_deg,
|
||||
'long_min' => $query_result->long_min,
|
||||
'long_sec' => $query_result->long_sec,
|
||||
'long_pre' => $query_result->long_pre
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see: http://www.wiki.csoft.at/index.php/Umrechnung_Grad/Minuten/Sekunden_in_Dezimalgrad
|
||||
*/
|
||||
function convertCoordinates($degree, $minute, $second)
|
||||
{
|
||||
$result = bcdiv($second, 60, 8);
|
||||
$result = bcadd($result, $minute, 8);
|
||||
$result = bcdiv($result, 60, 8);
|
||||
$result = bcadd($result, $degree, 8);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function calculateFlightDistance($airport_start_array, $airport_stopover_array, $airport_dest_array)
|
||||
{
|
||||
include_once("GeoCalc.class.php");
|
||||
|
||||
$oGC = new GeoCalc();
|
||||
|
||||
/* Start airport */
|
||||
if(is_array($airport_start_array) && !empty($airport_start_array))
|
||||
{
|
||||
$lat1 = convertCoordinates($airport_start_array[0]['lat_deg'], $airport_start_array[0]['lat_min'], $airport_start_array[0]['lat_sec']);
|
||||
|
||||
if($airport_start_array[0]['lat_pre'] == "S") $lat1 = "-".$lat1;
|
||||
settype($lat1, "float");
|
||||
|
||||
$lon1 = convertCoordinates($airport_start_array[0]['long_deg'], $airport_start_array[0]['long_min'], $airport_start_array[0]['long_sec']);
|
||||
if($airport_start_array[0]['long_pre'] == "W") $lon1 = "-".$lon1;
|
||||
settype($lon1, "float");
|
||||
}
|
||||
|
||||
/* Stopover airport */
|
||||
if(is_array($airport_stopover_array) && !empty($airport_stopover_array))
|
||||
{
|
||||
$lat2 = convertCoordinates($airport_stopover_array[0]['lat_deg'], $airport_stopover_array[0]['lat_min'], $airport_stopover_array[0]['lat_sec']);
|
||||
if($airport_stopover_array[0]['lat_pre'] == "S") $lat2 = "-".$lat2;
|
||||
settype($lat2, "float");
|
||||
|
||||
$lon2 = convertCoordinates($airport_stopover_array[0]['long_deg'], $airport_stopover_array[0]['long_min'], $airport_stopover_array[0]['long_sec']);
|
||||
if($airport_stopover_array[0]['long_pre'] == "W") $lon2 = "-".$lon2;
|
||||
settype($lon2, "float");
|
||||
|
||||
$calc_stopover = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$calc_stopover = false;
|
||||
$first_distance = 0;
|
||||
}
|
||||
|
||||
/* if Stopover airport is given calculate first distance */
|
||||
if($calc_stopover == true)
|
||||
{
|
||||
$_SESSION['data']['flight_distance']['first_distance'] = $oGC->GCDistance($lat1, $lon1, $lat2, $lon2); // Great Circle Distance
|
||||
$lat1 = $lat2;
|
||||
$lon1 = $lon2;
|
||||
}
|
||||
|
||||
/* Destination airport */
|
||||
if(is_array($airport_dest_array) && !empty($airport_dest_array))
|
||||
{
|
||||
$lat2 = convertCoordinates($airport_dest_array[0]['lat_deg'], $airport_dest_array[0]['lat_min'], $airport_dest_array[0]['lat_sec']);
|
||||
if($airport_dest_array[0]['lat_pre'] == "S") $lat2 = "-".$lat2;
|
||||
settype($lat2, "float");
|
||||
|
||||
$lon2 = convertCoordinates($airport_dest_array[0]['long_deg'], $airport_dest_array[0]['long_min'], $airport_dest_array[0]['long_sec']);
|
||||
if($airport_dest_array[0]['long_pre'] == "W") $lon2 = "-".$lon2;
|
||||
settype($lon2, "float");
|
||||
}
|
||||
|
||||
|
||||
/* Destination airport */
|
||||
$_SESSION['data']['flight_distance']['second_distance'] = $oGC->GCDistance($lat1, $lon1, $lat2, $lon2); // Great Circle Distance
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function getMyResult($emission)
|
||||
{
|
||||
// emission_self und emission_other als positive Zahl ausgeben
|
||||
if($emission < 0) $emission *= -1;
|
||||
|
||||
$my_result = bcdiv($emission, 1000, 4); // kg => t
|
||||
$my_result = number_format($my_result, 2, ',', '');
|
||||
$my_result .= ' t';
|
||||
|
||||
return $my_result;
|
||||
}
|
||||
|
||||
|
||||
/* (V4.0) */
|
||||
function getMyResultChart($emission)
|
||||
{
|
||||
// emission_self und emission_other als positive Zahl ausgeben
|
||||
if($emission < 0) $emission *= -1;
|
||||
|
||||
$my_result = bcdiv($emission, 1000, 4); // kg => t
|
||||
$my_result = number_format($my_result, 2, '.', '');
|
||||
|
||||
return $my_result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* See: http://stackoverflow.com/questions/1846202/php-how-to-generate-a-random-unique-alphanumeric-string
|
||||
*/
|
||||
function crypto_rand_secure($min, $max)
|
||||
{
|
||||
$range = $max - $min;
|
||||
if ($range < 1) return $min; // not so random...
|
||||
$log = ceil(log($range, 2));
|
||||
$bytes = (int) ($log / 8) + 1; // length in bytes
|
||||
$bits = (int) $log + 1; // length in bits
|
||||
$filter = (int) (1 << $bits) - 1; // set all lower bits to 1
|
||||
do {
|
||||
$rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
|
||||
$rnd = $rnd & $filter; // discard irrelevant bits
|
||||
} while ($rnd >= $range);
|
||||
return $min + $rnd;
|
||||
}
|
||||
|
||||
function createBookmarkID($length)
|
||||
{
|
||||
$token = "";
|
||||
$codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
$codeAlphabet.= "abcdefghijklmnopqrstuvwxyz";
|
||||
$codeAlphabet.= "0123456789";
|
||||
$max = strlen($codeAlphabet) - 1;
|
||||
for ($i=0; $i < $length; $i++) {
|
||||
$token .= $codeAlphabet[crypto_rand_secure(0, $max)];
|
||||
}
|
||||
return $token;
|
||||
}
|
||||
?>
|
||||
441
r41/luxembourg/de/_core/includes/_functions_airports_ec.php
Normal file
441
r41/luxembourg/de/_core/includes/_functions_airports_ec.php
Normal file
@ -0,0 +1,441 @@
|
||||
<?php
|
||||
/**
|
||||
* Neuer Berechnungsansatz nach EuroControl (EC)
|
||||
*
|
||||
* 2019-12-20
|
||||
*
|
||||
* Funktionen für den neuen Berechnungsansatz haben die Erweiterung '_EC'
|
||||
*
|
||||
* 'TABLE_AIRPORTS' ersetzen durch 'TABLE_AIRPORTS_WITH_REGION'
|
||||
*
|
||||
* Neues Feld 'region' in 'TABLE_AIRPORTS_WITH_REGION'
|
||||
*/
|
||||
/**
|
||||
* Get airports
|
||||
*
|
||||
* @param string $airport_name
|
||||
* @return array
|
||||
*/
|
||||
function getAirports_EC($airport_name)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
$airport_id_array = array();
|
||||
|
||||
// $airport_name = utf8_decode($airport_name);
|
||||
/*
|
||||
$mysql_version = mysql_get_server_info();
|
||||
$mysql_version = str_replace(".", "", substr($mysql_version, 0, strpos($mysql_version, "-")));
|
||||
|
||||
if($mysql_version >= 4100)
|
||||
{
|
||||
$sql = "SET NAMES latin1";
|
||||
$result = mysql_query($sql,$conn);
|
||||
if (!$result)
|
||||
{
|
||||
echo mysql_error();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(strlen($airport_name) == 3)
|
||||
{
|
||||
$sql = "SELECT id, city, airport, iata, country, region FROM ".TABLE_AIRPORTS_WITH_REGION." ";
|
||||
$sql .= "WHERE city LIKE '".$db->escape($airport_name)."%' OR country LIKE '".$db->escape($airport_name)."%' ";
|
||||
$sql .= "ORDER BY country, city";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'region' => $query_result->region,
|
||||
'weight' => '[0] '
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT id, city, airport, iata, country, region, MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."') AS weight FROM ".TABLE_AIRPORTS_WITH_REGION." ";
|
||||
$sql .= "WHERE MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."' IN BOOLEAN MODE) ";
|
||||
$sql .= "ORDER BY weight DESC, country, city";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'region' => $query_result->region,
|
||||
'weight' => '[1] '. $query_result->weight
|
||||
);
|
||||
$airport_id_array[] = $query_result->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country, region, MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."*') AS weight FROM ".TABLE_AIRPORTS_WITH_REGION." ";
|
||||
$sql .= "WHERE MATCH(city, airport, country) AGAINST('".$db->escape($airport_name)."*' IN BOOLEAN MODE) ";
|
||||
$sql .= "ORDER BY weight DESC, country, city";
|
||||
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
if(!in_array($query_result->id, $airport_id_array)) // remove duplicate airport_id's
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'region' => $query_result->region,
|
||||
'weight' => '[2] '. $query_result->weight
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
}
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
function getIATA_EC($airport_name)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country, region FROM ".TABLE_AIRPORTS_WITH_REGION." ";
|
||||
$sql .= "WHERE iata = '".$db->escape($airport_name)."' ";
|
||||
$sql .= "ORDER BY iata";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'region' => $query_result->region
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
function getAirportById_EC($airport_id)
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$airport_array = array();
|
||||
|
||||
$sql = "SELECT id, city, airport, iata, country, lat_deg, lat_min, lat_sec, lat_pre, long_deg, long_min, long_sec, long_pre, region FROM ".TABLE_AIRPORTS_WITH_REGION." ";
|
||||
$sql .= "WHERE id = '".$airport_id."'";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$airport_array[] = array('id' => $query_result->id,
|
||||
'iata' => $query_result->iata,
|
||||
'city' => $query_result->city,
|
||||
'airport' => $query_result->airport,
|
||||
'country' => $query_result->country,
|
||||
'lat_deg' => $query_result->lat_deg,
|
||||
'lat_min' => $query_result->lat_min,
|
||||
'lat_sec' => $query_result->lat_sec,
|
||||
'lat_pre' => $query_result->lat_pre,
|
||||
'long_deg' => $query_result->long_deg,
|
||||
'long_min' => $query_result->long_min,
|
||||
'long_sec' => $query_result->long_sec,
|
||||
'long_pre' => $query_result->long_pre,
|
||||
'region' => $query_result->region
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($airport_array);
|
||||
}
|
||||
|
||||
// Regionen-Zuordnung
|
||||
function getAirporRegionList_EC($region_1 = '', $region_2 = '')
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$region = array();
|
||||
|
||||
if($region_1 == "" || $region_2 == "") return($region);
|
||||
|
||||
$sql = "SELECT load_factor, freight_factor FROM ".TABLE_AIRPORTS_REGION_LIST." ";
|
||||
$sql .= "WHERE region_1 = '".$region_1."' AND region_2 = '".$region_2."'";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$region = array('load_factor' => $query_result->load_factor,
|
||||
'freight_factor' => $query_result->freight_factor
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($region);
|
||||
}
|
||||
|
||||
|
||||
function getAirportAircraftList_EC($icao_code = '')
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$aircraft_list = array();
|
||||
|
||||
$sql = "SELECT aircraft_model, icao_type_code, usual FROM ".TABLE_AIRPORTS_AIRCRAFT." ";
|
||||
$sql .= "WHERE icao_type_code != 'NN' ";
|
||||
$sql .= "ORDER BY usual DESC, aircraft_model ASC";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$aircraft_list[] = array(
|
||||
'aircraft_model' => $query_result->aircraft_model,
|
||||
'icao_type_code' => $query_result->icao_type_code,
|
||||
'usual' => $query_result->usual
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($aircraft_list);
|
||||
}
|
||||
|
||||
function getAirportAircraftValues_EC($icao_code = '', $distance_class = '')
|
||||
{
|
||||
GLOBAL $db;
|
||||
|
||||
$aircraft_list = array();
|
||||
|
||||
$sql = "SELECT pax_min, fuel_tot, fuel_tot_marg_rate, corr_factor, icao_engine_desc FROM ".TABLE_AIRPORTS_AIRCRAFT." ";
|
||||
$sql .= "WHERE 1 ";
|
||||
$sql .= "AND icao_type_code = '".$icao_code."'";
|
||||
if($icao_code == "NN" && $distance_class == "short") $sql .= " AND short_distance_class = '1'"; // Unbekannter Flugzeug-Typ
|
||||
if($icao_code == "NN" && $distance_class == "middle") $sql .= " AND medium_distance_class = '1'"; // Unbekannter Flugzeug-Typ
|
||||
if($icao_code == "NN" && $distance_class == "long") $sql .= " AND long_distance_class = '1'"; // Unbekannter Flugzeug-Typ
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$aircraft_list = array(
|
||||
'pax_min' => $query_result->pax_min,
|
||||
'fuel_tot' => $query_result->fuel_tot,
|
||||
'fuel_tot_marg_rate' => $query_result->fuel_tot_marg_rate,
|
||||
'corr_factor' => $query_result->corr_factor,
|
||||
'icao_engine_desc' => $query_result->icao_engine_desc
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($aircraft_list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Neuer Berechnungsansatz nach EuroControl (EC)
|
||||
*
|
||||
* 2019-12-20
|
||||
*
|
||||
* Funktionen für den neuen Berechnungsansatz haben die Erweiterung '_EC'
|
||||
*
|
||||
*/
|
||||
// $aircraft_type = ICAO_TYPE_CODE oder leer
|
||||
function getEmissionByFlight_EC($simple_flight_distance, $distance, $airport_start_region = '', $airport_dest_region = '', $aircraft_type = '')
|
||||
{
|
||||
global $default_factor_mobility_air_distance_class_short_max_ec;
|
||||
global $default_factor_mobility_air_distance_class_middle_max;
|
||||
global $factor_mobility_air_flight_class_default;
|
||||
global $factor_mobility_air_distance_class_values;
|
||||
global $factor_mobility_air_flight_class_default_ec; // Im Pro nachführen
|
||||
global $factor_mobility_air_flight_co2_e_3_jet_a; // Im Pro nachführen
|
||||
global $factor_mobility_air_flight_rfi_base_jet_a; // Im Pro nachführen
|
||||
|
||||
$region_result = array();
|
||||
$aircraft_type_result = array();
|
||||
|
||||
$convert_km_nm = 0.53996; // Konvvertiert Kilometer in nautische Meilen. Eigentlich '1.852'
|
||||
|
||||
/* Input validation */
|
||||
$_SESSION['data']['airport_flight_amount'] = str_replace(",", ".", $_SESSION['data']['airport_flight_amount']);
|
||||
$_SESSION['data']['airport_flight_amount'] = (int) $_SESSION['data']['airport_flight_amount'];
|
||||
|
||||
$_SESSION['data']['airport_passengers_amount'] = str_replace(",", ".", $_SESSION['data']['airport_passengers_amount']);
|
||||
$_SESSION['data']['airport_passengers_amount'] = (int) $_SESSION['data']['airport_passengers_amount'];
|
||||
|
||||
switch($simple_flight_distance)
|
||||
{
|
||||
case $simple_flight_distance > 0 && $simple_flight_distance <= $default_factor_mobility_air_distance_class_short_max_ec:
|
||||
$distance_class = "short";
|
||||
break;
|
||||
case $simple_flight_distance > $default_factor_mobility_air_distance_class_short_max_ec && $simple_flight_distance <= $default_factor_mobility_air_distance_class_middle_max:
|
||||
$distance_class = "middle";
|
||||
break;
|
||||
case $simple_flight_distance > $default_factor_mobility_air_distance_class_middle_max:
|
||||
$distance_class = "long";
|
||||
break;
|
||||
default:
|
||||
$distance_class = "middle";
|
||||
}
|
||||
|
||||
|
||||
// Regionen Liste abfragen
|
||||
$region_result = getAirporRegionList_EC($airport_start_region, $airport_dest_region);
|
||||
|
||||
$load_factor = (isset($region_result['load_factor']) && $region_result['load_factor'] != "") ? $region_result['load_factor'] : 1;
|
||||
$freight_factor = (isset($region_result['freight_factor']) && $region_result['freight_factor'] != "") ? $region_result['freight_factor'] : 1;
|
||||
|
||||
// Wenn kein Ergebnis der Abfrage: Ergebnis = 0 - Return
|
||||
|
||||
// Aircraft Model abfragen
|
||||
if($aircraft_type != '')
|
||||
{
|
||||
$aircraft_type_result = getAirportAircraftValues_EC($aircraft_type, $distance_class);
|
||||
|
||||
$fuel_tot = $aircraft_type_result['fuel_tot'];
|
||||
$fuel_tot_marg_rate = $aircraft_type_result['fuel_tot_marg_rate'];
|
||||
$corr_factor = $aircraft_type_result['corr_factor'];
|
||||
$pax_min = $aircraft_type_result['pax_min'];
|
||||
$icao_engine_desc = $aircraft_type_result['icao_engine_desc'];
|
||||
|
||||
}
|
||||
|
||||
// Wenn kein Ergebnis der Abfrage: Ergebnis = 0 - Return
|
||||
|
||||
|
||||
$simple_flight_distance = $simple_flight_distance + MOBILITY_AIR_FLIGHT_RFI_DISTANCE_ADDED_EC;
|
||||
|
||||
// Ohne RFI
|
||||
if($simple_flight_distance > 0)
|
||||
{
|
||||
// Gesamtemissionen Flugzeug in KG ohne RFI
|
||||
$emissionPlane = 0;
|
||||
$emissionPlane = $fuel_tot;
|
||||
$emissionPlane = $emissionPlane + ($simple_flight_distance * $convert_km_nm * $fuel_tot_marg_rate);
|
||||
$emissionPlane = $emissionPlane * $corr_factor;
|
||||
$emissionPlane = $emissionPlane * $factor_mobility_air_flight_co2_e_3_jet_a;
|
||||
|
||||
// Gesamtemissionen Flugzeug in kg/pro Passager ohne RFI
|
||||
$emissionFlight = 0;
|
||||
$emissionFlight = $emissionPlane / $pax_min ;
|
||||
$emissionFlight = $emissionFlight * $factor_mobility_air_flight_class_default_ec[$_SESSION['data']['airport_flight_class']];
|
||||
$emissionFlight = $emissionFlight / $load_factor;
|
||||
$emissionFlight = $emissionFlight * $freight_factor;
|
||||
|
||||
// Passagiere, Hin- und Rückflug, Anzahl Flüge
|
||||
$emissionFlight = $emissionFlight * $_SESSION['data']['airport_passengers_amount'];
|
||||
$emissionFlight = $emissionFlight * $_SESSION['data']['airport_flight_mode'];
|
||||
$emissionFlight = $emissionFlight * $_SESSION['data']['airport_flight_amount'];
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$emissionFlight = 0;
|
||||
}
|
||||
// EOF Ohne RFI
|
||||
|
||||
|
||||
$rfi_simple_flight_distance = $simple_flight_distance - MOBILITY_AIR_FLIGHT_RFI_DISTANCE_WITHOUT_EC;
|
||||
|
||||
// NUR RFI
|
||||
if($rfi_simple_flight_distance > 0 && $icao_engine_desc == 'J') // J = Jet
|
||||
{
|
||||
// Gesamtemissionen Flugzeug in KG nur RFI
|
||||
$emissionPlaneRFI = 0;
|
||||
$emissionPlaneRFI = $emissionPlaneRFI + ($rfi_simple_flight_distance * $convert_km_nm * $fuel_tot_marg_rate);
|
||||
$emissionPlaneRFI = $emissionPlaneRFI * $corr_factor;
|
||||
$emissionPlaneRFI = $emissionPlaneRFI * $factor_mobility_air_flight_rfi_base_jet_a;
|
||||
$emissionPlaneRFI = $emissionPlaneRFI * (MOBILITY_AIR_FLIGHT_RFI_FACTOR_EC - 1);
|
||||
|
||||
|
||||
// Gesamtemissionen Flugzeug in kg/pro Passager nur RFI
|
||||
$emissionFlightRFI = 0;
|
||||
$emissionFlightRFI = $emissionPlaneRFI / $pax_min ;
|
||||
$emissionFlightRFI = $emissionFlightRFI * $factor_mobility_air_flight_class_default_ec[$_SESSION['data']['airport_flight_class']];
|
||||
$emissionFlightRFI = $emissionFlightRFI / $load_factor;
|
||||
$emissionFlightRFI = $emissionFlightRFI * $freight_factor;
|
||||
|
||||
// Passagiere, Hin- und Rückflug, Anzahl Flüge
|
||||
$emissionFlightRFI = $emissionFlightRFI * $_SESSION['data']['airport_passengers_amount'];
|
||||
$emissionFlightRFI = $emissionFlightRFI * $_SESSION['data']['airport_flight_mode'];
|
||||
$emissionFlightRFI = $emissionFlightRFI * $_SESSION['data']['airport_flight_amount'];
|
||||
|
||||
$_SESSION['data']['emissionFlightRFI'] = $emissionFlightRFI;
|
||||
$_SESSION['data']['rfi_simple_flight_distance'] = $rfi_simple_flight_distance;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$emissionFlightRFI = 0;
|
||||
|
||||
$_SESSION['data']['emissionFlightRFI'] = $emissionFlightRFI;
|
||||
$_SESSION['data']['rfi_simple_flight_distance'] = 0;
|
||||
|
||||
}
|
||||
// EOF Nur RFI
|
||||
|
||||
|
||||
$emissionFlightWithRFI = $emissionFlight + $emissionFlightRFI;
|
||||
|
||||
|
||||
$_SESSION['data']['emissionThisFlight'][$distance] = $emissionFlightWithRFI;
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
214
r41/luxembourg/de/_core/includes/_functions_calc.php
Normal file
214
r41/luxembourg/de/_core/includes/_functions_calc.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
// $_SESSION['emission_before'] wird für den vorher/nachher Vergleich benötigt
|
||||
$_SESSION['emission_before'] = array();
|
||||
$_SESSION['emission_before']['emission'] = (isset($_SESSION['emission'])) ? $_SESSION['emission'] : array();
|
||||
$_SESSION['emission_before']['emission_self'] = (isset($_SESSION['emission_self'])) ? $_SESSION['emission_self'] : array();
|
||||
$_SESSION['emission_before']['emission_other'] = (isset($_SESSION['emission_other'])) ? $_SESSION['emission_other'] : array();
|
||||
|
||||
|
||||
/**
|
||||
* Living: "Heizung": Get emission values
|
||||
*/
|
||||
getEmissionByHeating();
|
||||
|
||||
/**
|
||||
* Living: "Strom": Get emission values
|
||||
*/
|
||||
getEmissionByPower();
|
||||
|
||||
/**
|
||||
* Living: Get total emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_living'] = 0;
|
||||
$_SESSION['emission']['td']['total_living'] = bcadd($_SESSION['emission']['td']['living_hs'], $_SESSION['emission']['td']['total_living']);
|
||||
$_SESSION['emission']['td']['total_living'] = bcadd($_SESSION['emission']['td']['living_pt'], $_SESSION['emission']['td']['total_living']);
|
||||
|
||||
$_SESSION['emission']['st']['total_living'] = 0;
|
||||
|
||||
$_SESSION['emission']['mt']['total_living'] = 0;
|
||||
|
||||
$_SESSION['emission']['lt']['total_living'] = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* "Unterwegs": "Im Alltag": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['mobility_daily'] = 0;
|
||||
|
||||
getEmissionByDailyTravel();
|
||||
|
||||
/**
|
||||
* "Unterwegs": "Im Urlaub mit Auto oder Bahn": Get emission values
|
||||
*/
|
||||
getEmissionByTravel();
|
||||
|
||||
/**
|
||||
* "Mobilität": "Flug": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_self']['td']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_other']['td']['mobility_air_total'] = 0;
|
||||
|
||||
$_SESSION['emission']['st']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_self']['st']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_other']['st']['mobility_air_total'] = 0;
|
||||
|
||||
$_SESSION['emission']['mt']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_self']['mt']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_other']['mt']['mobility_air_total'] = 0;
|
||||
|
||||
$_SESSION['emission']['lt']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_self']['lt']['mobility_air_total'] = 0;
|
||||
$_SESSION['emission_other']['lt']['mobility_air_total'] = 0;
|
||||
|
||||
$_SESSION['performance']['td']['mobility_air'] = 0;
|
||||
$_SESSION['performance']['st']['mobility_air'] = 0;
|
||||
$_SESSION['performance']['mt']['mobility_air'] = 0;
|
||||
$_SESSION['performance']['lt']['mobility_air'] = 0;
|
||||
|
||||
// Pauschal
|
||||
if($_SESSION['data']['mobility_air_mode'] == "general") getEmissionByGeneralFlight();
|
||||
|
||||
// Detailliert
|
||||
if($_SESSION['data']['mobility_air_mode'] == "detail") getEmissionByDetailFlight();
|
||||
|
||||
|
||||
/**
|
||||
* Mobility: Get total emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_mobility'] = 0;
|
||||
$_SESSION['emission']['td']['total_mobility'] += $_SESSION['emission']['td']['mobility_daily']; // Mantis 1766
|
||||
$_SESSION['emission']['td']['total_mobility'] += $_SESSION['emission']['td']['mobility_car_total'];
|
||||
$_SESSION['emission']['td']['total_mobility'] += $_SESSION['emission']['td']['mobility_air_total'];
|
||||
|
||||
|
||||
/**
|
||||
* "Ernährung": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_food'] = 0;
|
||||
|
||||
getEmissionByFood();
|
||||
|
||||
|
||||
/**
|
||||
* "Sonstiger Konsum": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_consumption'] = 0;
|
||||
|
||||
getEmissionByConsumption();
|
||||
|
||||
|
||||
/**
|
||||
* "Streaming": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_streaming'] = 0;
|
||||
|
||||
getEmissionByStreaming();
|
||||
|
||||
|
||||
/**
|
||||
* "Lifestyle": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_lifestyle'] = 0;
|
||||
$_SESSION['emission']['td']['total_lifestyle'] = $_SESSION['emission']['td']['total_food'] + $_SESSION['emission']['td']['total_streaming'] + $_SESSION['emission']['td']['total_consumption'];
|
||||
|
||||
|
||||
/**
|
||||
* "Öffentliche Emissionen": Get emission values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_public_consumption'] = AVERAGE_EMISSION_VALUE_COMMON;
|
||||
$_SESSION['emission']['st']['total_public_consumption'] = AVERAGE_EMISSION_VALUE_COMMON_ST;
|
||||
$_SESSION['emission']['mt']['total_public_consumption'] = AVERAGE_EMISSION_VALUE_COMMON_MT;
|
||||
$_SESSION['emission']['lt']['total_public_consumption'] = AVERAGE_EMISSION_VALUE_COMMON_LT;
|
||||
$_SESSION['emission_self']['td']['total_public_consumption'] = 0;
|
||||
$_SESSION['emission_self']['st']['total_public_consumption'] = 0;
|
||||
$_SESSION['emission_self']['mt']['total_public_consumption'] = 0;
|
||||
$_SESSION['emission_self']['lt']['total_public_consumption'] = 0; // nur lt wird berechnet
|
||||
|
||||
getEmissionByPublicConsumption();
|
||||
|
||||
/**
|
||||
* Get emission total values
|
||||
*/
|
||||
$_SESSION['emission']['td']['total'] = 0;
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_living'];
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_mobility'];
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_food'];
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_consumption'];
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_streaming'];
|
||||
$_SESSION['emission']['td']['total'] += $_SESSION['emission']['td']['total_public_consumption'];
|
||||
|
||||
|
||||
/**
|
||||
* Get emission td max value for charts
|
||||
*/
|
||||
|
||||
$_SESSION['emission']['td']['total_max'] = AVERAGE_EMISSION_VALUE;
|
||||
|
||||
|
||||
|
||||
function compareEmissions($userEmission, $defaultEmission, $type = '')
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case "consumption":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_CONSUMPTION, 100, 2);
|
||||
break;
|
||||
|
||||
case "food":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_FOOD, 100, 2);
|
||||
break;
|
||||
|
||||
case "mobility_air":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_MOBILITY_AIR, 100, 2);
|
||||
break;
|
||||
|
||||
case "mobility_car":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_MOBILITY_CAR, 100, 2);
|
||||
break;
|
||||
|
||||
case "living_pt":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_LIVING_POWER_TYPE, 100, 2);
|
||||
break;
|
||||
|
||||
case "living_hs":
|
||||
$compare_emission_percent = bcdiv(COMPARE_EMISSION_VALUE_LIVING_HEATING_SYSTEM, 100, 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
$compareResult = '';
|
||||
return($compareResult);
|
||||
}
|
||||
|
||||
$compare_average_emission = bcmul((int)$defaultEmission, $compare_emission_percent, 2);
|
||||
$compare_average_emission_max = (int)$defaultEmission;
|
||||
$compare_average_emission_min = bcsub((int)$defaultEmission, $compare_average_emission, 2);
|
||||
|
||||
$compareResult = '';
|
||||
|
||||
if($userEmission < 1)
|
||||
{
|
||||
$compareResult = '<img src="../../_core/images/smiley_good.gif" alt="'.TXT_RESULT_SMILEY_GOOD.'" title="'.TXT_RESULT_SMILEY_GOOD.'" width="15" height="15" border="0" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
switch((int)$userEmission)
|
||||
{
|
||||
case $userEmission >= $compare_average_emission_min && $userEmission <= $compare_average_emission_max:
|
||||
$compareResult = ' <img src="../../_core/images/smiley_average.gif" alt="'.TXT_RESULT_SMILEY_AVERAGE.'" title="'.TXT_RESULT_SMILEY_AVERAGE.'" width="15" height="15" border="0" />';
|
||||
break;
|
||||
case $userEmission > $compare_average_emission_max:
|
||||
$compareResult = '<img src="../../_core/images/smiley_bad.gif" alt="'.TXT_RESULT_SMILEY_BAD.'" title="'.TXT_RESULT_SMILEY_BAD.'" width="15" height="15" border="0" />';
|
||||
break;
|
||||
case $userEmission < $compare_average_emission_min:
|
||||
$compareResult = '<img src="../../_core/images/smiley_good.gif" alt="'.TXT_RESULT_SMILEY_GOOD.'" title="'.TXT_RESULT_SMILEY_GOOD.'" width="15" height="15" border="0" />';
|
||||
break;
|
||||
default:
|
||||
$compareResult = '';
|
||||
}
|
||||
}
|
||||
|
||||
return($compareResult);
|
||||
}
|
||||
?>
|
||||
221
r41/luxembourg/de/_core/includes/_functions_calc_consumption.php
Normal file
221
r41/luxembourg/de/_core/includes/_functions_calc_consumption.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/**
|
||||
* "Konsum": Calculate emissions
|
||||
*/
|
||||
function getEmissionByConsumption()
|
||||
{
|
||||
global $factor_consumption_consumer_habits;
|
||||
global $factor_consumption_consumer_shirt;
|
||||
global $factor_consumption_consumer_criteria;
|
||||
// global $factor_consumption_hotel_visits;
|
||||
// global $factor_consumption_monthly_expense;
|
||||
global $factor_consumption_used_goods;
|
||||
global $factor_consumption_activity;
|
||||
global $factor_consumption_vehicles;
|
||||
global $factor_consumption_cf_investment;
|
||||
global $factor_sc_consumption_average;
|
||||
global $default_factor_consumption_animal_weight;
|
||||
global $factor_consumption_animal_food;
|
||||
global $default_factor_consumption_animal_food_share;
|
||||
|
||||
$_SESSION['emission']['td']['total_consumption'] = AVERAGE_EMISSION_VALUE_CONSUMPTION;
|
||||
$_SESSION['emission']['st']['total_consumption'] = $factor_sc_consumption_average['st'];
|
||||
$_SESSION['emission']['mt']['total_consumption'] = $factor_sc_consumption_average['mt'];
|
||||
$_SESSION['emission']['lt']['total_consumption'] = $factor_sc_consumption_average['lt'];
|
||||
|
||||
$_SESSION['emission_self']['td']['total_consumption'] = 0;
|
||||
$_SESSION['emission_self']['st']['total_consumption'] = 0;
|
||||
$_SESSION['emission_self']['mt']['total_consumption'] = 0;
|
||||
$_SESSION['emission_self']['lt']['total_consumption'] = 0;
|
||||
|
||||
$_SESSION['emission_other']['td']['total_consumption'] = 0;
|
||||
$_SESSION['emission_other']['st']['total_consumption'] = 0;
|
||||
$_SESSION['emission_other']['mt']['total_consumption'] = 0;
|
||||
$_SESSION['emission_other']['lt']['total_consumption'] = 0;
|
||||
|
||||
/**
|
||||
* "Konsum": "Haustiere"
|
||||
* 2020-06-19 - Mantis 1769
|
||||
*/
|
||||
$_SESSION['emission']['td']['total_consumption_animal'] = 0;
|
||||
$_SESSION['emission']['td']['consumption_animal'] = array();
|
||||
|
||||
$_SESSION['emission']['st']['total_consumption_animal'] = 0;
|
||||
$_SESSION['emission']['st']['consumption_animal'] = array();
|
||||
|
||||
$_SESSION['emission']['mt']['total_consumption_animal'] = 0;
|
||||
$_SESSION['emission']['mt']['consumption_animal'] = array();
|
||||
|
||||
$_SESSION['emission']['lt']['total_consumption_animal'] = 0;
|
||||
$_SESSION['emission']['lt']['consumption_animal'] = array();
|
||||
|
||||
$_SESSION['target']['total_consumption'] = 0;
|
||||
|
||||
$_SESSION['target']['consumption'] = array();
|
||||
|
||||
|
||||
// Prüfen ob die Eingabewerte in der Bilanz geändert wurden
|
||||
if(isset($_SESSION['data']['flag_settings_consumption']) && $_SESSION['data']['flag_settings_consumption'] == true)
|
||||
{
|
||||
if($factor_consumption_consumer_habits[$_SESSION['data']['consumption_consumer_habits']] < $factor_consumption_consumer_habits[$_SESSION['data']['sc_consumption_consumer_habits']])
|
||||
$_SESSION['data']['sc_consumption_consumer_habits'] = $_SESSION['data']['consumption_consumer_habits'];
|
||||
|
||||
if($factor_consumption_consumer_shirt[$_SESSION['data']['consumption_consumer_shirt']] < $factor_consumption_consumer_shirt[$_SESSION['data']['sc_consumption_consumer_shirt']])
|
||||
$_SESSION['data']['sc_consumption_consumer_shirt'] = $_SESSION['data']['consumption_consumer_shirt'];
|
||||
|
||||
if($factor_consumption_consumer_criteria[$_SESSION['data']['consumption_consumer_criteria']] < $factor_consumption_consumer_criteria[$_SESSION['data']['sc_consumption_consumer_criteria']])
|
||||
$_SESSION['data']['sc_consumption_consumer_criteria'] = $_SESSION['data']['consumption_consumer_criteria'];
|
||||
|
||||
// if($factor_consumption_hotel_visits[$_SESSION['data']['consumption_hotel_visits']] < $factor_consumption_hotel_visits[$_SESSION['data']['sc_consumption_hotel_visits']])
|
||||
// $_SESSION['data']['sc_consumption_hotel_visits'] = $_SESSION['data']['consumption_hotel_visits'];
|
||||
|
||||
if($factor_consumption_used_goods[$_SESSION['data']['consumption_used_goods']] < $factor_consumption_used_goods[$_SESSION['data']['sc_consumption_used_goods']])
|
||||
$_SESSION['data']['sc_consumption_used_goods'] = $_SESSION['data']['consumption_used_goods'];
|
||||
|
||||
// if($factor_consumption_monthly_expense[$_SESSION['data']['consumption_monthly_expense']] < $factor_consumption_monthly_expense[$_SESSION['data']['sc_consumption_monthly_expense']])
|
||||
// $_SESSION['data']['sc_consumption_monthly_expense'] = $_SESSION['data']['consumption_monthly_expense'];
|
||||
|
||||
unset($_SESSION['data']['flag_settings_consumption']);
|
||||
}
|
||||
|
||||
/* Today */
|
||||
|
||||
// input validation
|
||||
if($_SESSION['data']['consumption_cf_investment'] == "" || $_SESSION['data']['consumption_cf_investment'] < 0 ) $_SESSION['data']['consumption_cf_investment'] = 0;
|
||||
if($_SESSION['data']['consumption_compensate_emissions'] == "" || $_SESSION['data']['consumption_compensate_emissions'] < 0 ) $_SESSION['data']['consumption_compensate_emissions'] = 0;
|
||||
|
||||
/* Eingabewerte aus Bilanz für Hintergrundfaktoren */
|
||||
|
||||
// Hintergrundfaktor Haustyp
|
||||
$temp_data_consumption_house_type = isset($_SESSION['data']['living_hc_type']) ? $_SESSION['data']['living_hc_type'] : 'mfh';
|
||||
|
||||
// Hintergrundfaktor Wohnfläche
|
||||
$temp_data_consumption_living_space = isset($_SESSION['data']['living_hc_space']) ? $_SESSION['data']['living_hc_space'] : '';
|
||||
|
||||
// Hintergrundfaktor Anzahl Personen
|
||||
$temp_data_consumption_persons = $_SESSION['data']['living_persons'];
|
||||
|
||||
/* EOF Eingabewerte aus Bilanz für Hintergrundfaktoren */
|
||||
|
||||
|
||||
// emission
|
||||
|
||||
// "Kaufverhalten / Shoppen"
|
||||
$temp_emission_td_total_consumption = bcmul($_SESSION['emission']['td']['total_consumption'], $factor_consumption_consumer_habits[$_SESSION['data']['consumption_consumer_habits']], 2);
|
||||
|
||||
// "T-Shirt"
|
||||
$temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_consumer_shirt[$_SESSION['data']['consumption_consumer_shirt']], 2);
|
||||
|
||||
// "Kaufkriterien / Anforderungen"
|
||||
$temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_consumer_criteria[$_SESSION['data']['consumption_consumer_criteria']], 2);
|
||||
|
||||
// "Hotelübernachtungen"
|
||||
// $temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_hotel_visits[$_SESSION['data']['consumption_hotel_visits']], 2);
|
||||
|
||||
// "Konsumausgaben"
|
||||
// $temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_monthly_expense[$_SESSION['data']['consumption_monthly_expense']], 2);
|
||||
|
||||
// "Gebrauchte Gegenstände"
|
||||
$temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_used_goods[$_SESSION['data']['consumption_used_goods']], 2);
|
||||
|
||||
// "Aktivitäten"
|
||||
$temp_emission_td_total_consumption = bcmul($temp_emission_td_total_consumption, $factor_consumption_activity[$_SESSION['data']['consumption_activity']], 2);
|
||||
|
||||
// "Eigenes Fahrzeug" Aufaddieren!
|
||||
$temp_emission_td_total_consumption = bcadd($temp_emission_td_total_consumption, $factor_consumption_vehicles[$_SESSION['data']['consumption_vehicles']], 2);
|
||||
|
||||
|
||||
// Emissionen
|
||||
$_SESSION['emission']['td']['total_consumption'] = $temp_emission_td_total_consumption;
|
||||
|
||||
|
||||
/* EOF Today */
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Konsum": Calculate acceptance
|
||||
*/
|
||||
function getEmissionByAcceptanceConsumption($time_period, $emission)
|
||||
{
|
||||
global $fd_sc_consumption_acceptance;
|
||||
global $factor_sc_consumption_acceptance;
|
||||
global $factor_sc_meta_consumption_acceptance;
|
||||
|
||||
// Skalierung Akzeptanzfragen
|
||||
foreach($fd_sc_consumption_acceptance as $key => $val)
|
||||
{
|
||||
$emission = bcmul($emission, $factor_sc_consumption_acceptance[$key][$time_period][$_SESSION['data']['sc_consumption_acceptance'][$key]], 2);
|
||||
}
|
||||
|
||||
|
||||
// Skalierung "Meta"-Akzeptanzfragen
|
||||
$temp_factor = $factor_sc_meta_consumption_acceptance;
|
||||
|
||||
foreach($factor_sc_meta_consumption_acceptance[$time_period] as $sector => $val)
|
||||
{
|
||||
foreach($val as $index => $value)
|
||||
{
|
||||
if(isset($_SESSION['data']['sc_'.$sector.'_acceptance'][$index]))
|
||||
{
|
||||
$selected_value = $_SESSION['data']['sc_'.$sector.'_acceptance'][$index];
|
||||
|
||||
$emission = bcmul($emission, $temp_factor[$time_period][$sector][$index][$selected_value], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $emission;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* "Öffentliche Emissionen": Calculate emissions
|
||||
*/
|
||||
function getEmissionByPublicConsumption()
|
||||
{
|
||||
// emission st mit Akzeptanzfragen skalieren
|
||||
$_SESSION['emission']['st']['total_public_consumption'] = getEmissionByAcceptanceConsumption('st', $_SESSION['emission']['st']['total_public_consumption']);
|
||||
|
||||
// emission mt mit Akzeptanzfragen skalieren
|
||||
$_SESSION['emission']['mt']['total_public_consumption'] = getEmissionByAcceptanceConsumption('mt', $_SESSION['emission']['mt']['total_public_consumption']);
|
||||
|
||||
// emission lt mit Akzeptanzfragen skalieren
|
||||
$_SESSION['emission']['lt']['total_public_consumption'] = getEmissionByAcceptanceConsumption('lt', $_SESSION['emission']['lt']['total_public_consumption']);
|
||||
|
||||
// emission_self lt mit Akzeptanzfragen skalieren
|
||||
$_SESSION['emission_self']['lt']['total_public_consumption'] = bcsub($_SESSION['emission']['lt']['total_public_consumption'], $_SESSION['emission']['td']['total_public_consumption'], 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* "Öffentliche Emissionen": Calculate acceptance
|
||||
*/
|
||||
function getEmissionByAcceptancePublicConsumption($time_period, $emission)
|
||||
{
|
||||
global $factor_sc_meta_public_consumption_acceptance;
|
||||
|
||||
// Skalierung "Meta"-Akzeptanzfragen
|
||||
$temp_factor = $factor_sc_meta_public_consumption_acceptance;
|
||||
|
||||
foreach($factor_sc_meta_public_consumption_acceptance[$time_period] as $sector => $val)
|
||||
{
|
||||
foreach($val as $index => $value)
|
||||
{
|
||||
if(isset($_SESSION['data']['sc_'.$sector.'_acceptance'][$index]))
|
||||
{
|
||||
$selected_value = $_SESSION['data']['sc_'.$sector.'_acceptance'][$index];
|
||||
|
||||
$emission = bcmul($emission, $temp_factor[$time_period][$sector][$index][$selected_value], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $emission;
|
||||
}
|
||||
|
||||
?>
|
||||
59
r41/luxembourg/de/_core/includes/_functions_calc_food.php
Normal file
59
r41/luxembourg/de/_core/includes/_functions_calc_food.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* "Ernährung": Calculate emissions
|
||||
*/
|
||||
function getEmissionByFood()
|
||||
{
|
||||
global $factor_food_details_age;
|
||||
// global $factor_food_details_activity;
|
||||
global $factor_food_details_sport;
|
||||
global $factor_food_eating_habits;
|
||||
global $factor_sc_food_eating_habits;
|
||||
global $fd_sc_food_acceptance;
|
||||
global $factor_sc_food_acceptance;
|
||||
|
||||
$_SESSION['emission']['td']['total_food'] = 0;
|
||||
$_SESSION['emission']['st']['total_food'] = 0;
|
||||
$_SESSION['emission']['mt']['total_food'] = 0;
|
||||
$_SESSION['emission']['lt']['total_food'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['td']['total_food'] = 0;
|
||||
$_SESSION['emission_self']['st']['total_food'] = 0;
|
||||
$_SESSION['emission_self']['mt']['total_food'] = 0;
|
||||
$_SESSION['emission_self']['lt']['total_food'] = 0;
|
||||
|
||||
|
||||
$_SESSION['target']['total_food'] = 0;
|
||||
|
||||
// input validation
|
||||
$_SESSION['data']['food_details']['weight'] = str_replace(",", ".", $_SESSION['data']['food_details']['weight']);
|
||||
$_SESSION['data']['food_details']['weight'] = (float) $_SESSION['data']['food_details']['weight'];
|
||||
if(!$_SESSION['data']['food_details']['weight'] > 1) return;
|
||||
|
||||
// kcal / Person
|
||||
$_SESSION['data']['food_detail_kcal'] = 0;
|
||||
$_SESSION['data']['food_detail_kcal'] = bcmul($factor_food_details_age[$_SESSION['data']['food_details']['sex']][$_SESSION['data']['food_details']['age']]['kcal'], $_SESSION['data']['food_details']['weight'], 2); // Kalorienbedarf Frauen / Männer detailliert
|
||||
$_SESSION['data']['food_detail_kcal'] = bcadd($_SESSION['data']['food_detail_kcal'], $factor_food_details_age[$_SESSION['data']['food_details']['sex']][$_SESSION['data']['food_details']['age']]['offset'], 2); // Kalorienbedarf Frauen / Männer detailliert
|
||||
// $_SESSION['data']['food_detail_kcal'] = bcmul($_SESSION['data']['food_detail_kcal'], $factor_food_details_activity[$_SESSION['data']['food_details']['activity']], 2);
|
||||
$_SESSION['data']['food_detail_kcal'] = bcmul($_SESSION['data']['food_detail_kcal'], $factor_food_details_sport[$_SESSION['data']['food_details']['sport']], 2);
|
||||
|
||||
// CO2 Berechnung auf Basis des Kalorienbedarfs
|
||||
$_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['data']['food_detail_kcal'], FOOD_KCAL_CO2TONS, 2);
|
||||
|
||||
// Emission: CO2 Berechnung auf Basis des Kalorienbedarfs
|
||||
$_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['type'][$_SESSION['data']['food_eating_habits']['type']], 2);
|
||||
$_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['purchase'][$_SESSION['data']['food_eating_habits']['purchase']], 2);
|
||||
$_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['fastfood'][$_SESSION['data']['food_eating_habits']['fastfood']], 2);
|
||||
// $_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['packaging'][$_SESSION['data']['food_eating_habits']['packaging']], 2);
|
||||
// $_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['regional'][$_SESSION['data']['food_eating_habits']['regional']], 2);
|
||||
// $_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['seasonal'][$_SESSION['data']['food_eating_habits']['seasonal']], 2);
|
||||
// $_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['frozenfoods'][$_SESSION['data']['food_eating_habits']['frozenfoods']], 2);
|
||||
// $_SESSION['emission']['td']['food_detail'] = bcmul($_SESSION['emission']['td']['food_detail'], $factor_food_eating_habits['oeko'][$_SESSION['data']['food_eating_habits']['oeko']], 2);
|
||||
|
||||
// Get emission total values
|
||||
$_SESSION['emission']['td']['total_food'] += $_SESSION['emission']['td']['food_detail'];
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
1171
r41/luxembourg/de/_core/includes/_functions_calc_living_hs.php
Normal file
1171
r41/luxembourg/de/_core/includes/_functions_calc_living_hs.php
Normal file
File diff suppressed because it is too large
Load Diff
295
r41/luxembourg/de/_core/includes/_functions_calc_living_pt.php
Normal file
295
r41/luxembourg/de/_core/includes/_functions_calc_living_pt.php
Normal file
@ -0,0 +1,295 @@
|
||||
<?php
|
||||
/**
|
||||
* Calculate: "Zuhause": "Strom"
|
||||
*/
|
||||
function getEmissionByPower()
|
||||
{
|
||||
global $customer_settings;
|
||||
global $factor_living_pt_type;
|
||||
global $factor_living_pt_estimate_consumption_basic;
|
||||
global $factor_living_pt_computer;
|
||||
global $factor_living_pt_gaming;
|
||||
global $factor_living_pt_elektro;
|
||||
global $factor_living_pt_energy_saving_bulbs;
|
||||
global $factor_living_pt_energy_standby;
|
||||
|
||||
|
||||
$_SESSION['emission']['td']['living_pt'] = 0;
|
||||
|
||||
$_SESSION['kwh']['td']['living_pt'] = 0;
|
||||
$_SESSION['kwh']['td']['living_pt_1'] = 0;
|
||||
|
||||
if(!isset($_SESSION['data']['living_pt_type']) || empty($_SESSION['data']['living_pt_type'])) return;
|
||||
|
||||
if(!isset($_SESSION['data']['living_pt_consumption'])) $_SESSION['data']['living_pt_consumption'] = $factor_living_pt_estimate_consumption_basic[$_SESSION['data']['living_persons']];
|
||||
|
||||
if(!isset($_SESSION['data']['flag_settings_living_pt']) || !$_SESSION['data']['flag_settings_living_pt'])
|
||||
{
|
||||
if(isset($_SESSION['data']['flag_settings_init_living_pt']) && $_SESSION['data']['flag_settings_init_living_pt'])
|
||||
{
|
||||
$_SESSION['data']['living_pt_consumption'] = $factor_living_pt_estimate_consumption_basic[$_SESSION['data']['living_persons']];
|
||||
}
|
||||
}
|
||||
|
||||
$_temp_emission_living_pt = $factor_living_pt_estimate_consumption_basic[$_SESSION['data']['living_persons']];
|
||||
$_temp_emission_living_pt = bcdiv($_temp_emission_living_pt, $_SESSION['data']['living_persons']);
|
||||
|
||||
/* Eingabefaktoren berechnen */
|
||||
|
||||
/*
|
||||
if(isset($_SESSION['data']['living_pt_computer']))
|
||||
{
|
||||
// "Computer"
|
||||
$_temp_emission_living_pt =
|
||||
bcadd($_temp_emission_living_pt, $factor_living_pt_computer[$_SESSION['data']['living_pt_computer']]);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_SESSION['data']['living_pt_elekro']))
|
||||
{
|
||||
// "Elektrogeräte"
|
||||
$_temp_emission_living_pt =
|
||||
bcadd($_temp_emission_living_pt, $factor_living_pt_elektro[$_SESSION['data']['living_pt_elekro']]);
|
||||
}
|
||||
*/
|
||||
|
||||
if(isset($_SESSION['data']['living_pt_gaming']))
|
||||
{
|
||||
// "Gaming"
|
||||
$_temp_emission_living_pt =
|
||||
bcadd($_temp_emission_living_pt, $factor_living_pt_gaming[$_SESSION['data']['living_pt_gaming']]);
|
||||
}
|
||||
|
||||
if(isset($_SESSION['data']['living_pt_energy_saving_bulbs']))
|
||||
{
|
||||
/* "Energiesparlampen" */
|
||||
$_temp_emission_living_pt =
|
||||
bcadd($_temp_emission_living_pt, $factor_living_pt_energy_saving_bulbs[$_SESSION['data']['living_pt_energy_saving_bulbs']]);
|
||||
}
|
||||
|
||||
if(isset($_SESSION['data']['living_pt_energy_standby']))
|
||||
{
|
||||
/* "Stand-by" */
|
||||
$_temp_emission_living_pt =
|
||||
bcadd($_temp_emission_living_pt, $factor_living_pt_energy_standby[$_SESSION['data']['living_pt_energy_standby']]);
|
||||
}
|
||||
|
||||
$_temp_emission_living_pt = bcmul($_temp_emission_living_pt, $factor_living_pt_type[$_SESSION['data']['living_pt_type']]);
|
||||
|
||||
$_SESSION['emission']['td']['living_pt'] = $_temp_emission_living_pt;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate: "Szenario": "Strom" : "Short-time und Mid-time Berechnung"
|
||||
*
|
||||
*/
|
||||
function getEmissionScenarioByPower($time_period)
|
||||
{
|
||||
|
||||
global $factor_sc_living_pt_pg_type;
|
||||
global $factor_living_pt_pg_type;
|
||||
global $factor_living_pt_estimate_consumption_basic;
|
||||
global $factor_sc_living_pt_type;
|
||||
global $factor_living_pt_avoidance_other;
|
||||
|
||||
// Eigene Stromerzeugung im Szenario
|
||||
if($_SESSION['data']['sc_living_pt_ee_kwk'] == "yes")
|
||||
{
|
||||
$_SESSION['kwh'][$time_period]['living_pt_pg_consumption'] = bcmul($factor_sc_living_pt_pg_type[$_SESSION['data']['sc_living_pt_pg_type']], bcdiv($_SESSION['data']['sc_living_pt_pg_consumption'], 100, 2), 2);
|
||||
|
||||
// Emission: Eigene Stromerzeugung im Szenario
|
||||
$_SESSION['emission'][$time_period]['living_pt_pg_consumption'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_pg_consumption'], $factor_living_pt_pg_type[$_SESSION['data']['sc_living_pt_pg_type']], 2);
|
||||
|
||||
// Emission: Eigene Stromerzeugung im Szenario pro Person
|
||||
$_SESSION['emission'][$time_period]['living_pt_pg_consumption'] = bcdiv($_SESSION['emission'][$time_period]['living_pt_pg_consumption'], $_SESSION['data']['sc_living_pt_persons'], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['kwh'][$time_period]['living_pt_pg_consumption'] = 0;
|
||||
$_SESSION['emission'][$time_period]['living_pt_pg_consumption'] = 0;
|
||||
}
|
||||
|
||||
|
||||
// Eigene Stromerzeugung in Bilanz wird weiterhin verwendet
|
||||
if($_SESSION['data']['sc_living_pt_td_ee_kwk'] == "yes")
|
||||
{
|
||||
// Eigene Stromerzeugung in Szenario + Eigene Stromerzeugung in Bilanz
|
||||
$_SESSION['kwh'][$time_period]['living_pt_pg_total_consumption'] = bcadd($_SESSION['kwh'][$time_period]['living_pt_pg_consumption'], $_SESSION['kwh']['td']['living_pt_pg_total_consumption']);
|
||||
|
||||
/* Korrektur von $_SESSION['emission']['td']['living_pt_pg_total'] : Unterschiedliche Personenzahl in Bilanz und Szenario */
|
||||
$temp_emission_td_living_pt_pg_total = bcmul($_SESSION['emission']['td']['living_pt_pg_total'], $_SESSION['data']['living_persons'], 2);
|
||||
$temp_emission_td_living_pt_pg_total = bcdiv($temp_emission_td_living_pt_pg_total, $_SESSION['data']['sc_living_pt_persons'], 2);
|
||||
|
||||
$temp_emission_self_td_living_pt_pg_total = bcmul($_SESSION['emission_self']['td']['living_pt_pg_total'], $_SESSION['data']['living_persons'], 2);
|
||||
$temp_emission_self_td_living_pt_pg_total = bcdiv($temp_emission_self_td_living_pt_pg_total, $_SESSION['data']['sc_living_pt_persons'], 2);
|
||||
|
||||
$temp_emission_other_td_living_pt_pg_total = bcmul($_SESSION['emission_other']['td']['living_pt_pg_total'], $_SESSION['data']['living_persons'], 2);
|
||||
$temp_emission_other_td_living_pt_pg_total = bcdiv($temp_emission_other_td_living_pt_pg_total, $_SESSION['data']['sc_living_pt_persons'], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Eigene Stromerzeugung in Szenario
|
||||
$_SESSION['kwh'][$time_period]['living_pt_pg_total_consumption'] = bcadd($_SESSION['kwh'][$time_period]['living_pt_pg_consumption'], 0);
|
||||
|
||||
$temp_emission_td_living_pt_pg_total = 0;
|
||||
$temp_emission_self_td_living_pt_pg_total = 0;
|
||||
$temp_emission_other_td_living_pt_pg_total = 0;
|
||||
}
|
||||
|
||||
// Faktor für Hauptstrombezug
|
||||
$temp_consumption_basic_factor = bcdiv($_SESSION['kwh']['td']['living_pt_1'], $factor_living_pt_estimate_consumption_basic[$_SESSION['data']['living_persons']], 4);
|
||||
|
||||
// kWh: Hauptstrombezug neu berechnen
|
||||
$_SESSION['kwh'][$time_period]['living_pt_1'] = bcmul($factor_living_pt_estimate_consumption_basic[$_SESSION['data']['sc_living_pt_persons']], $temp_consumption_basic_factor);
|
||||
|
||||
// kWh: Hauptstrombezug - Eigene Stromerzeugung im Szenario
|
||||
$_SESSION['kwh'][$time_period]['living_pt_1'] = bcsub($_SESSION['kwh'][$time_period]['living_pt_1'], $_SESSION['kwh'][$time_period]['living_pt_pg_consumption']);
|
||||
|
||||
if($_SESSION['kwh'][$time_period]['living_pt_1'] < 0) $_SESSION['kwh'][$time_period]['living_pt_1'] = 0;
|
||||
|
||||
getEmissionScenarioPowerByAcceptance($time_period);
|
||||
|
||||
/* Emission Haupt-Stromerzeugung pro zukünftiger Person */
|
||||
$_SESSION['emission'][$time_period]['living_pt_1'] = bcdiv($_SESSION['emission'][$time_period]['living_pt_1'], $_SESSION['data']['sc_living_pt_persons']);
|
||||
|
||||
|
||||
/* Emission Strom gesamt: Haupt-Stromerzeugung + vorhandene eigene Stromerzeugung */
|
||||
$_SESSION['emission'][$time_period]['living_pt'] = bcadd($_SESSION['emission'][$time_period]['living_pt_1'], $temp_emission_td_living_pt_pg_total);
|
||||
|
||||
/* Emission Strom gesamt: + zukünftige eigene Stromerzeugung */
|
||||
$_SESSION['emission'][$time_period]['living_pt'] = bcadd($_SESSION['emission'][$time_period]['living_pt'], $_SESSION['emission'][$time_period]['living_pt_pg_consumption']);
|
||||
|
||||
// Vermeidung bei mir selbst: Emission
|
||||
$_SESSION['emission_self'][$time_period]['living_pt'] = 0;
|
||||
|
||||
if($_SESSION['data']['sc_living_pt_ee_kwk'] == "yes")
|
||||
{
|
||||
$temp_factor_sc_pt_pg = $factor_sc_living_pt_type["strommix_de"][$time_period] - $factor_living_pt_pg_type[$_SESSION['data']['sc_living_pt_pg_type']];
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_factor_sc_pt_pg = 0;
|
||||
}
|
||||
|
||||
/* Vermeidung bei mir selbst - Eigene Stromerzeugung im Szenario */
|
||||
$_SESSION['emission_self'][$time_period]['living_pt_pg'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_pg_consumption'], $temp_factor_sc_pt_pg);
|
||||
|
||||
// Vermeidung bei mir selbst - Eigene Stromerzeugung im Szenario : Emissionen pro Person
|
||||
$_SESSION['emission_self'][$time_period]['living_pt_pg'] = bcdiv($_SESSION['emission_self'][$time_period]['living_pt_pg'], $_SESSION['data']['sc_living_pt_persons']);
|
||||
|
||||
/* Vermeidung bei mir selbst: Eigene Stromerzeugung im Szenario + Eigene Stromerzeugung in Bilanz */
|
||||
$_SESSION['emission_self'][$time_period]['living_pt_pg'] = bcadd($_SESSION['emission_self'][$time_period]['living_pt_pg'], ($temp_emission_self_td_living_pt_pg_total*-1));
|
||||
|
||||
// Vermeidung bei mir selbst - Eigene Stromerzeugung im Szenario: Nur Werte über 0 sind gültig. Falls ja mit -1 multiplizieren
|
||||
($_SESSION['emission_self'][$time_period]['living_pt_pg'] > 0) ? $_SESSION['emission_self'][$time_period]['living_pt_pg'] = bcmul($_SESSION['emission_self'][$time_period]['living_pt_pg'], -1) : $_SESSION['emission_self'][$time_period]['living_pt_pg'] = 0;
|
||||
|
||||
|
||||
/* Quantifizierung der THG Vermeidung bei mir selbst im Falle Effizienz */
|
||||
$temp_st_total_kwh = bcadd($_SESSION['kwh'][$time_period]['living_pt_pg_total_consumption'], $_SESSION['kwh'][$time_period]['living_pt_1'], 2);
|
||||
|
||||
$_SESSION['kwh'][$time_period]['living_pt_eff'] = bcsub($factor_living_pt_estimate_consumption_basic[$_SESSION['data']['sc_living_pt_persons']], $temp_st_total_kwh, 2);
|
||||
|
||||
$_SESSION['emission_self'][$time_period]['living_pt_eff'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_eff'], $factor_sc_living_pt_type["strommix_de"][$time_period], 2);
|
||||
|
||||
// Pro Person
|
||||
$_SESSION['emission_self'][$time_period]['living_pt_eff'] = bcdiv($_SESSION['emission_self'][$time_period]['living_pt_eff'], $_SESSION['data']['sc_living_pt_persons'], 2);
|
||||
|
||||
$_SESSION['emission_self'][$time_period]['living_pt'] = bcadd($_SESSION['emission_self'][$time_period]['living_pt_pg'], $_SESSION['emission_self'][$time_period]['living_pt_eff']);
|
||||
|
||||
|
||||
if($_SESSION['emission_self'][$time_period]['living_pt'] > 0) $_SESSION['emission_self'][$time_period]['living_pt'] = 0;
|
||||
|
||||
|
||||
// Vermeidung bei Dritten: Emission
|
||||
$_SESSION['emission_other'][$time_period]['living_pt'] = 0;
|
||||
|
||||
// Vermeidung bei Dritten: Stromverbrauch
|
||||
$_SESSION['emission_other'][$time_period]['living_pt_1'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_1'], $factor_living_pt_avoidance_other[$_SESSION['data']['sc_living_pt_type']][$time_period]);
|
||||
|
||||
// Vermeidung bei Dritten: Stromverbrauch: Emissionen pro Person
|
||||
$_SESSION['emission_other'][$time_period]['living_pt_1'] = bcdiv($_SESSION['emission_other'][$time_period]['living_pt_1'], $_SESSION['data']['sc_living_pt_persons'])*-1;
|
||||
|
||||
/* Vermeidung bei Dritten: Eigene Stromerzeugung im Szenario */
|
||||
$_SESSION['emission_other'][$time_period]['living_pt_pg'] = bcmul($factor_sc_living_pt_pg_type[$_SESSION['data']['sc_living_pt_pg_type']]-$_SESSION['kwh'][$time_period]['living_pt_pg_consumption'], $temp_factor_sc_pt_pg);
|
||||
|
||||
// Vermeidung bei Dritten: Eigene Stromerzeugung: Emissionen pro Person
|
||||
$_SESSION['emission_other'][$time_period]['living_pt_pg'] = bcdiv($_SESSION['emission_other'][$time_period]['living_pt_pg'], $_SESSION['data']['sc_living_pt_persons']);
|
||||
|
||||
/* Vermeidung bei Dritten: Eigene Stromerzeugung im Szenario + Eigene Stromerzeugung in Bilanz */
|
||||
$_SESSION['emission_other'][$time_period]['living_pt_pg'] = bcadd($_SESSION['emission_other'][$time_period]['living_pt_pg'], ($temp_emission_other_td_living_pt_pg_total*-1));
|
||||
|
||||
// Vermeidung bei Dritten: Nur Werte über 0 sind gültig. Falls ja mit -1 multiplizieren
|
||||
($_SESSION['emission_other'][$time_period]['living_pt_pg'] > 0) ? $_SESSION['emission_other'][$time_period]['living_pt_pg'] = bcmul($_SESSION['emission_other'][$time_period]['living_pt_pg'], -1) : $_SESSION['emission_other'][$time_period]['living_pt_pg'] = 0;
|
||||
|
||||
$_SESSION['emission_other'][$time_period]['living_pt'] = bcadd($_SESSION['emission_other'][$time_period]['living_pt_1'], $_SESSION['emission_other'][$time_period]['living_pt_pg']);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate: "Szenario": "Akzeptantfragen"
|
||||
*
|
||||
*/
|
||||
function getEmissionScenarioPowerByAcceptance($time_period)
|
||||
{
|
||||
global $fd_sc_living_pt_acceptance;
|
||||
global $factor_sc_living_pt_acceptance;
|
||||
global $factor_sc_living_pt_acceptance_is_eff;
|
||||
global $factor_sc_living_pt_type;
|
||||
|
||||
$temp_factor = 1;
|
||||
|
||||
// Skalierung kWh Akzeptanzfragen
|
||||
foreach($fd_sc_living_pt_acceptance as $key_slha => $val_slha)
|
||||
{
|
||||
// Abfrage ob die Akzeptanzfrage die Effizienz betrifft
|
||||
if(in_array($key_slha, $factor_sc_living_pt_acceptance_is_eff))
|
||||
{
|
||||
$_SESSION['kwh'][$time_period]['living_pt_1'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_1'], $factor_sc_living_pt_acceptance[$key_slha][$time_period][$_SESSION['data']['sc_living_pt_acceptance'][$key_slha]], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_factor = bcmul($temp_factor, $factor_sc_living_pt_acceptance[$key_slha][$time_period][$_SESSION['data']['sc_living_pt_acceptance'][$key_slha]], 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Emissionen
|
||||
$_SESSION['emission'][$time_period]['living_pt_1'] = bcmul($_SESSION['kwh'][$time_period]['living_pt_1'], $factor_sc_living_pt_type[$_SESSION['data']['sc_living_pt_type']][$time_period]);
|
||||
$_SESSION['emission'][$time_period]['living_pt_1'] = bcmul($_SESSION['emission'][$time_period]['living_pt_1'], $temp_factor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Calculate: "Zuhause": "Strom" für Kommunen
|
||||
*
|
||||
* V3.0
|
||||
*/
|
||||
function getEmissionByPowerLocalFactor($default_emission)
|
||||
{
|
||||
GLOBAL $factor_living_pt_type_local;
|
||||
GLOBAL $factor_living_pt_type;
|
||||
|
||||
|
||||
$_SESSION['emission']['td']['living_pt_local'] = '';
|
||||
|
||||
// Prozentualen Anteil berechnen
|
||||
$local_percent = bcdiv($factor_living_pt_type[$_SESSION['data']['living_pt_type']], 100, 10);
|
||||
$local_percent = bcdiv($factor_living_pt_type_local[$_SESSION['data']['living_pt_type']], $local_percent, 10);
|
||||
|
||||
$_SESSION['emission']['td']['living_pt_local'] = bcdiv($default_emission, 100, 10);
|
||||
$_SESSION['emission']['td']['living_pt_local'] = bcmul($_SESSION['emission']['td']['living_pt_local'], $local_percent);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
980
r41/luxembourg/de/_core/includes/_functions_calc_mobility.php
Normal file
980
r41/luxembourg/de/_core/includes/_functions_calc_mobility.php
Normal file
@ -0,0 +1,980 @@
|
||||
<?php
|
||||
/**
|
||||
* "Im Alltag": Calculate emissions
|
||||
*/
|
||||
function getEmissionByDailyTravel()
|
||||
{
|
||||
global $factor_mobility_school_transportation;
|
||||
global $factor_mobility_spare_time_performance;
|
||||
global $factor_living_pt_type;
|
||||
|
||||
$_SESSION['emission']['td']['mobility_school'] = 0;
|
||||
$_SESSION['emission']['td']['mobility_spare_time'] = 0;
|
||||
|
||||
if(isset($_SESSION['data']['mobility_school_simple_distance']))
|
||||
{
|
||||
/* Input validation */
|
||||
$_SESSION['data']['mobility_school_simple_distance'] = str_replace(",", ".", $_SESSION['data']['mobility_school_simple_distance']);
|
||||
$_SESSION['data']['mobility_school_simple_distance'] = (float) $_SESSION['data']['mobility_school_simple_distance'];
|
||||
|
||||
$_temp_emission_mobility = 0;
|
||||
|
||||
$_temp_emission_mobility = bcmul($_SESSION['data']['mobility_school_simple_distance'], 2, 2); // Hin und zurück
|
||||
$_temp_emission_mobility = bcmul($_temp_emission_mobility, 220, 2); // 220 Tage im Jahr
|
||||
$_temp_emission_mobility = bcmul($_temp_emission_mobility, $factor_mobility_school_transportation[$_SESSION['data']['mobility_school_transportation']], 2);
|
||||
|
||||
// Ausnahme: e_roller
|
||||
if($_SESSION['data']['mobility_school_transportation'] == 'e_roller')
|
||||
{
|
||||
$_temp_emission_mobility = bcmul($_temp_emission_mobility, $factor_living_pt_type['strommix_de'], 2);
|
||||
}
|
||||
|
||||
$_SESSION['emission']['td']['mobility_school'] = $_temp_emission_mobility;
|
||||
}
|
||||
|
||||
if(isset($_SESSION['data']['mobility_spare_time_performance']) && is_array($_SESSION['data']['mobility_spare_time_performance']))
|
||||
{
|
||||
foreach($_SESSION['data']['mobility_spare_time_performance'] as $key => $val)
|
||||
{
|
||||
/* Input validation */
|
||||
$val = str_replace(",", ".", $val);
|
||||
$val = (float) $val;
|
||||
|
||||
$_temp_emission_mobility = 0;
|
||||
|
||||
$_temp_emission_mobility = bcmul($val, 52, 2); // 52 Wochen im Jahr
|
||||
|
||||
$_temp_emission_mobility = bcmul($_temp_emission_mobility, $factor_mobility_spare_time_performance[$key], 2);
|
||||
|
||||
// Ausnahme: e_roller
|
||||
if($key == 'e_roller')
|
||||
{
|
||||
$_temp_emission_mobility = bcmul($_temp_emission_mobility, $factor_living_pt_type['strommix_de'], 2);
|
||||
}
|
||||
|
||||
$_SESSION['emission']['td']['mobility_spare_time'] += $_temp_emission_mobility;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['emission']['td']['mobility_daily'] = $_SESSION['emission']['td']['mobility_school'] + $_SESSION['emission']['td']['mobility_spare_time'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Urlaub Auto/Bahn": Calculate emissions
|
||||
*/
|
||||
function getEmissionByTravel()
|
||||
{
|
||||
global $factor_mobility_cars_age;
|
||||
global $factor_sc_mobility_cars_age_reduction;
|
||||
|
||||
global $factor_mobility_cars_energy_source;
|
||||
global $factor_sc_mobility_cars_energy_source;
|
||||
|
||||
global $factor_mobility_cars_consumption_default;
|
||||
|
||||
global $factor_mobility_cars_energy_source_co2quota; // Unbenutzt
|
||||
|
||||
global $factor_mobility_car_sharing_energy_source;
|
||||
global $factor_sc_mobility_car_sharing_energy_source;
|
||||
global $factor_mobility_car_sharing_consumption;
|
||||
global $factor_sc_mobility_car_sharing_consumption;
|
||||
|
||||
global $factor_mobility_transport_type;
|
||||
|
||||
global $factor_mobility_train_general_performance;
|
||||
global $factor_sc_mobility_train_general_performance;
|
||||
|
||||
global $factor_living_pt_type;
|
||||
global $factor_sc_living_pt_type;
|
||||
|
||||
global $factor_mobility_bicycle_performance_avoidance_self;
|
||||
global $factor_sc_mobility_bicycle_performance_avoidance_self;
|
||||
|
||||
global $factor_mobility_train_general_performance_avoidance_self;
|
||||
global $factor_sc_mobility_train_general_performance_avoidance_self;
|
||||
|
||||
global $factor_mobility_transport_type_avoidance_self;
|
||||
|
||||
global $factor_sc_performance_mobility_miv_general;
|
||||
global $factor_sc_performance_mobility_train_general;
|
||||
global $factor_sc_performance_mobility_oeko_general;
|
||||
global $factor_sc_performance_mobility_miv_nt;
|
||||
|
||||
global $factor_sc_mobility_acceptance;
|
||||
|
||||
global $factor_performance_mobility_miv_general_lt;
|
||||
global $factor_performance_mobility_oeko_general_lt;
|
||||
global $factor_performance_mobility_train_general_lt;
|
||||
|
||||
$_SESSION['emission']['td']['mobility_car_total'] = 0;
|
||||
$_SESSION['emission']['td']['mobility_car_total_electrical'] = 0;
|
||||
|
||||
$_SESSION['emission']['td']['mobility_travel'] = array();
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'] = array();
|
||||
|
||||
$_SESSION['emission']['td']['mobility_travel_general_performance'] = array();
|
||||
$_SESSION['emission']['td']['mobility_travel_general_performance_electrical'] = array();
|
||||
|
||||
$_SESSION['performance']['td']['mobility_miv_general'] = 0; // = mobiler individual Verkehr
|
||||
$_SESSION['performance']['td']['mobility_oeko_general'] = 0; // zu Fuß, Fahrrad, Pedelec, E-Auto
|
||||
$_SESSION['performance']['td']['mobility_train_general'] = 0; // ÖPNV
|
||||
|
||||
$_SESSION['performance']['st']['mobility_miv_general'] = 0; // = mobiler individual Verkehr
|
||||
$_SESSION['performance']['st']['mobility_oeko_general'] = 0; // zu Fuß, Fahrrad, Pedelec, E-Auto
|
||||
$_SESSION['performance']['st']['mobility_train_general'] = 0; // ÖPNV
|
||||
|
||||
$_SESSION['performance']['lt']['mobility_miv_general'] = $factor_performance_mobility_miv_general_lt; // = mobiler individual Verkehr
|
||||
$_SESSION['performance']['lt']['mobility_oeko_general'] = $factor_performance_mobility_oeko_general_lt; // zu Fuß, Fahrrad, Pedelec, E-Auto
|
||||
$_SESSION['performance']['lt']['mobility_train_general'] = $factor_performance_mobility_train_general_lt; // ÖPNV
|
||||
|
||||
$_SESSION['target']['mobility_car_total'] = 0;
|
||||
|
||||
$flag_sc_mobility_car_miv_nt = false;
|
||||
|
||||
|
||||
/* Fahrzeuge: Änderungen in Settings */
|
||||
if(isset($_SESSION['data']['flag_settings_init_mobility']) && $_SESSION['data']['flag_settings_init_mobility'] == true)
|
||||
{
|
||||
if($_SESSION['data']['mobility_cars_amount'] == 0)
|
||||
{
|
||||
// Eigene Fahrzeuge zurücksetzen
|
||||
$_SESSION['data']['mobility_cars_values'] = array();
|
||||
|
||||
// Pauschal: Fahrten mit eigenen Fahrzeuge zurücksetzen
|
||||
$_SESSION['data']['mobility_travel_general_performance'] = array();
|
||||
|
||||
/* Scenario */
|
||||
// Eigene Fahrzeuge zurücksetzen
|
||||
$_SESSION['data']['sc_mobility_cars_values'] = array();
|
||||
|
||||
// Pauschal: Fahrten mit eigenen Fahrzeuge zurücksetzen
|
||||
$_SESSION['data']['sc_mobility_travel_general_performance'] = array();
|
||||
}
|
||||
|
||||
unset($_SESSION['data']['flag_settings_init_mobility']);
|
||||
}
|
||||
|
||||
|
||||
/* Detaillierte Erfassung. Im Jugendrechner gibt es keine pauschale Erfassung. */
|
||||
if($_SESSION['data']['mobility_travel_mode'] == "detail" && isset($_SESSION['data']['mobility_travel_values']) && count($_SESSION['data']['mobility_travel_values']) > 0)
|
||||
{
|
||||
/* today */
|
||||
foreach($_SESSION['data']['mobility_travel_values'] as $key_mtv => $val_mtv)
|
||||
{
|
||||
|
||||
// Eigene Fahrzeuge: Check if 'vehicle' == "user-" => User owned vehicle
|
||||
// Im Jugendrechner können keine Fahrzeuge angelegt werden. Deshalb erfolgt eine Vorbelegung der eigenen Fahrzeuge
|
||||
if(isset($val_mtv['vehicle']) && !empty($val_mtv['vehicle']) && substr($val_mtv['vehicle'], 0, 5) == "user-")
|
||||
{
|
||||
$vehicle_type = substr($val_mtv['vehicle'], 5);
|
||||
|
||||
// Daten des Fahrzeugs
|
||||
switch($vehicle_type)
|
||||
{
|
||||
case "kleinwagen":
|
||||
case "motorrad":
|
||||
case "motoroller":
|
||||
|
||||
$val_mtv['type'] = $vehicle_type;
|
||||
$val_mtv['energy_source'] = 'benzin';
|
||||
$val_mtv['consumption'] = $factor_mobility_cars_consumption_default['benzin'][$vehicle_type];
|
||||
break;
|
||||
|
||||
case "mittelklasse":
|
||||
case "oberklasse":
|
||||
|
||||
$val_mtv['type'] = $vehicle_type;
|
||||
$val_mtv['energy_source'] = 'diesel';
|
||||
$val_mtv['consumption'] = $factor_mobility_cars_consumption_default['diesel'][$vehicle_type];
|
||||
break;
|
||||
|
||||
case "bev":
|
||||
case "e_roller":
|
||||
|
||||
$val_mtv['type'] = $vehicle_type;
|
||||
$val_mtv['e_energy_source'] = 'strommix_de';
|
||||
$val_mtv['e_consumption'] = $factor_mobility_cars_consumption_default['kwh'][$vehicle_type];
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* input validation */
|
||||
if(!isset($val_mtv['consumption']) || empty($val_mtv['consumption'])) $val_mtv['consumption'] = 7;
|
||||
if(!isset($val_mtv['e_consumption']) || empty($val_mtv['e_consumption'])) $val_mtv['e_consumption'] = 15;
|
||||
if(!isset($val_mtv['energy_source']) || empty($val_mtv['energy_source'])) $val_mtv['energy_source'] = "benzin";
|
||||
if(!isset($val_mtv['e_energy_source']) || empty($val_mtv['e_energy_source'])) $val_mtv['e_energy_source'] = "strommix_de";
|
||||
if(!isset($val_mtv['type']) || empty($val_mtv['type'])) $val_mtv['type'] = "mittelklasse";
|
||||
|
||||
if(!isset($val_mtv['road_performance']) || empty($val_mtv['road_performance'])) $val_mtv['road_performance'] = 0;
|
||||
if(!isset($val_mtv['days']) || empty($val_mtv['days'])) $val_mtv['days'] = 0;
|
||||
if(!isset($val_mtv['person']) || empty($val_mtv['person'])) $val_mtv['person'] = 1;
|
||||
|
||||
$val_mtv['road_performance'] = str_replace(",", ".", $val_mtv['road_performance']);
|
||||
$val_mtv['road_performance'] = (float)$val_mtv['road_performance'];
|
||||
|
||||
$val_mtv['consumption'] = str_replace(",", ".", $val_mtv['consumption']);
|
||||
$val_mtv['consumption'] = (float) $val_mtv['consumption'];
|
||||
|
||||
if(!isset($val_mtv['days']) || (int)$val_mtv['days'] <= 0) $val_mtv['days'] = 1;
|
||||
|
||||
|
||||
$val_mtv['person'] = str_replace(",", ".", $val_mtv['person']);
|
||||
$val_mtv['person'] = (float) $val_mtv['person'];
|
||||
|
||||
// Gesamtkilometer (Kilometer, Personen, Tage)
|
||||
$val_mtv['total_road_performance'] = $val_mtv['road_performance']/$val_mtv['person'];
|
||||
$val_mtv['total_road_performance'] *= $val_mtv['days'];
|
||||
|
||||
$val_mtv['total_road_performance_all_persons'] = $val_mtv['road_performance']*$val_mtv['days'];
|
||||
|
||||
// Plug-in
|
||||
if($val_mtv['type'] == "phev")
|
||||
{
|
||||
// CO2-Tonnage
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($val_mtv['consumption'], $val_mtv['total_road_performance'], 2);
|
||||
// $_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $val_mtv['person'], 2);
|
||||
// $_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $val_mtv['days'], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $factor_mobility_cars_energy_source[$val_mtv['energy_source']], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], 100, 2);
|
||||
|
||||
// CO2-Tonnage elektrisch
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcmul($val_mtv['e_consumption'], $val_mtv['total_road_performance'], 2);
|
||||
|
||||
// auf 100 km
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv], 100, 8);
|
||||
|
||||
// Stromfaktor $factor_living_pt_type
|
||||
if($val_mtv['e_energy_source'] == "none")
|
||||
{
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = 0;
|
||||
|
||||
$_SESSION['kwh']['td']['mobility_travel_electrical'][$key_mtv] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['kwh']['td']['mobility_travel_electrical'][$key_mtv] = round($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv]);
|
||||
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv], $factor_living_pt_type[$val_mtv['e_energy_source']], 2);
|
||||
}
|
||||
|
||||
// "elektrische" Emissionen dazu addieren
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] += $_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv];
|
||||
|
||||
// Fahrleistung
|
||||
$_SESSION['performance']['td']['mobility_miv_general'] += $val_mtv['total_road_performance_all_persons'];
|
||||
}
|
||||
// Elektrofahrzeug / E-Roller
|
||||
elseif($val_mtv['type'] == "bev" || $val_mtv['type'] == "e_roller")
|
||||
{
|
||||
// CO2-Tonnage
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = 0;
|
||||
|
||||
// CO2-Tonnage elektrisch
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcmul($val_mtv['e_consumption'], $val_mtv['total_road_performance'], 2);
|
||||
|
||||
// auf 100 km
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv], 100, 8);
|
||||
|
||||
// Stromfaktor $factor_living_pt_type
|
||||
if($val_mtv['e_energy_source'] == "none")
|
||||
{
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = 0;
|
||||
|
||||
$_SESSION['kwh']['td']['mobility_travel_electrical'][$key_mtv] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['kwh']['td']['mobility_travel_electrical'][$key_mtv] = round($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv]);
|
||||
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv], $factor_living_pt_type[$val_mtv['e_energy_source']], 2);
|
||||
}
|
||||
|
||||
// "elektrische Emissionen" dazu addieren
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] += $_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv];
|
||||
|
||||
// Fahrleistung
|
||||
$_SESSION['performance']['td']['mobility_miv_general'] += $val_mtv['total_road_performance_all_persons'];
|
||||
}
|
||||
// Alle anderen Fahrzeuge
|
||||
else
|
||||
{
|
||||
// CO2-Tonnage elektrisch
|
||||
$_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv] = 0;
|
||||
|
||||
// CO2-Tonnage
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($val_mtv['consumption'], $val_mtv['total_road_performance'], 2);
|
||||
// $_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $val_mtv['person'], 2);
|
||||
// $_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $val_mtv['days'], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $factor_mobility_cars_energy_source[$val_mtv['energy_source']], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], 100, 2);
|
||||
|
||||
// Fahrleistung
|
||||
$_SESSION['performance']['td']['mobility_miv_general'] += $val_mtv['total_road_performance_all_persons'];
|
||||
}
|
||||
|
||||
// emission aufaddieren
|
||||
$_SESSION['emission']['td']['mobility_car_total'] += $_SESSION['emission']['td']['mobility_travel'][$key_mtv];
|
||||
|
||||
// "elektrische Emissionen" aufaddieren
|
||||
$_SESSION['emission']['td']['mobility_car_total_electrical'] += $_SESSION['emission']['td']['mobility_travel_electrical'][$key_mtv];
|
||||
|
||||
}
|
||||
// Carsharing & Andere Verkehrsmittel: Check if 'vehicle' exists => other vehicles
|
||||
elseif(isset($val_mtv['vehicle']) && !empty($val_mtv['vehicle']) && substr($val_mtv['vehicle'], 0, 5) != "user-")
|
||||
{
|
||||
// Carsharing
|
||||
if($val_mtv['vehicle'] == "carsharing")
|
||||
{
|
||||
/* input validation */
|
||||
$val_mtv['road_performance'] = str_replace(",", ".", $val_mtv['road_performance']);
|
||||
$val_mtv['road_performance'] = (float)$val_mtv['road_performance'];
|
||||
|
||||
if(!isset($val_mtv['days']) || (int)$val_mtv['days'] <= 0) $val_mtv['days'] = 1;
|
||||
|
||||
// Gesamtkilometer (Kilometer, Personen, Tage)
|
||||
$val_mtv['total_road_performance'] = $val_mtv['road_performance']/$val_mtv['person'];
|
||||
$val_mtv['total_road_performance'] *= $val_mtv['days'];
|
||||
|
||||
$val_mtv['total_road_performance_all_persons'] = $val_mtv['road_performance']*$val_mtv['days'];
|
||||
|
||||
|
||||
// CO2-Tonnage
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($factor_mobility_car_sharing_consumption, $val_mtv['total_road_performance'], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($_SESSION['emission']['td']['mobility_travel'][$key_mtv], $factor_mobility_car_sharing_energy_source, 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], 100, 2);
|
||||
|
||||
// emission aufaddieren (Carsharing)
|
||||
$_SESSION['emission']['td']['mobility_car_total'] += $_SESSION['emission']['td']['mobility_travel'][$key_mtv];
|
||||
|
||||
// Fahrleistung
|
||||
$_SESSION['performance']['td']['mobility_miv_general'] += $val_mtv['total_road_performance_all_persons'];
|
||||
}
|
||||
// Andere Verkehrsmittel
|
||||
else
|
||||
{
|
||||
$vehicle_type = $val_mtv['vehicle'];
|
||||
|
||||
/* input validation */
|
||||
$val_mtv['road_performance'] = str_replace(",", ".", $val_mtv['road_performance']);
|
||||
$val_mtv['road_performance'] = (float)$val_mtv['road_performance'];
|
||||
|
||||
if(!isset($val_mtv['days']) || (int)$val_mtv['days'] <= 0) $val_mtv['days'] = 1;
|
||||
|
||||
// Gesamtfahrleistung
|
||||
$val_mtv['total_road_performance'] = $val_mtv['road_performance']*$val_mtv['days'];
|
||||
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcmul($val_mtv['total_road_performance'], $factor_mobility_transport_type[$vehicle_type], 2);
|
||||
$_SESSION['emission']['td']['mobility_travel'][$key_mtv] = bcdiv($_SESSION['emission']['td']['mobility_travel'][$key_mtv], 1000, 2);
|
||||
|
||||
// emission aufaddieren (Andere Verkehrsmittel)
|
||||
$_SESSION['emission']['td']['mobility_car_total'] += $_SESSION['emission']['td']['mobility_travel'][$key_mtv];
|
||||
|
||||
// Fahrleistung
|
||||
if($vehicle_type == "bike" || $vehicle_type == "e_bike" || $vehicle_type == "on_foot")
|
||||
{
|
||||
$_SESSION['performance']['td']['mobility_oeko_general'] += $val_mtv['total_road_performance'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['performance']['td']['mobility_train_general'] += $val_mtv['total_road_performance'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* EOF today*/
|
||||
|
||||
}
|
||||
/* EOF Detaillierte Erfassung*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function getEmissionByFlight($simple_flight_distance, $distance)
|
||||
{
|
||||
global $factor_mobility_air_flight_class_default;
|
||||
global $factor_mobility_air_distance_class_values;
|
||||
|
||||
/* Input validation */
|
||||
$_SESSION['data']['airport_flight_amount'] = str_replace(",", ".", $_SESSION['data']['airport_flight_amount']);
|
||||
$_SESSION['data']['airport_flight_amount'] = (int) $_SESSION['data']['airport_flight_amount'];
|
||||
|
||||
$_SESSION['data']['airport_passengers_amount'] = str_replace(",", ".", $_SESSION['data']['airport_passengers_amount']);
|
||||
$_SESSION['data']['airport_passengers_amount'] = (int) $_SESSION['data']['airport_passengers_amount'];
|
||||
|
||||
switch($simple_flight_distance)
|
||||
{
|
||||
case $simple_flight_distance > 0 && $simple_flight_distance <= 900:
|
||||
$distance_class = "short";
|
||||
break;
|
||||
case $simple_flight_distance > 900 && $simple_flight_distance <= 2000:
|
||||
$distance_class = "middle";
|
||||
break;
|
||||
case $simple_flight_distance > 2000:
|
||||
$distance_class = "long";
|
||||
break;
|
||||
default:
|
||||
$distance_class = "middle";
|
||||
}
|
||||
|
||||
$rfi_simple_flight_distance = $simple_flight_distance + MOBILITY_AIR_FLIGHT_RFI_DISTANCE_ADDED;
|
||||
|
||||
$rfi_simple_flight_distance = $rfi_simple_flight_distance - MOBILITY_AIR_FLIGHT_RFI_DISTANCE_WITHOUT;
|
||||
|
||||
if($rfi_simple_flight_distance > 0)
|
||||
{
|
||||
$emissionFlightRFI = $rfi_simple_flight_distance * MOBILITY_AIR_FLIGHT_RFI_FACTOR * $factor_mobility_air_distance_class_values[$distance_class]["flight_co_aeq"] * $_SESSION['data']['airport_passengers_amount'] * $_SESSION['data']['airport_flight_amount'] * $_SESSION['data']['airport_flight_mode'] * $factor_mobility_air_flight_class_default[$_SESSION['data']['airport_flight_class']] * $factor_mobility_air_distance_class_values[$distance_class]["flight_load_factor"][$_SESSION['data']['airport_flight_class']] * MOBILITY_AIR_FLIGHT_BYLOAD;
|
||||
$_SESSION['data']['emissionFlightRFI'] = $emissionFlightRFI;
|
||||
$_SESSION['data']['rfi_simple_flight_distance'] = $rfi_simple_flight_distance;
|
||||
|
||||
$emissionFlight = MOBILITY_AIR_FLIGHT_RFI_DISTANCE_WITHOUT * $factor_mobility_air_distance_class_values[$distance_class]["flight_co_aeq"] * $_SESSION['data']['airport_passengers_amount'] * $_SESSION['data']['airport_flight_amount'] * $_SESSION['data']['airport_flight_mode'] * $factor_mobility_air_flight_class_default[$_SESSION['data']['airport_flight_class']] * $factor_mobility_air_distance_class_values[$distance_class]["flight_load_factor"][$_SESSION['data']['airport_flight_class']] * MOBILITY_AIR_FLIGHT_BYLOAD;
|
||||
|
||||
$emissionFlight = $emissionFlight + $emissionFlightRFI;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['data']['emissionFlightRFI'] = 0;
|
||||
$_SESSION['data']['rfi_simple_flight_distance'] = 0;
|
||||
$emissionFlight = $simple_flight_distance * $factor_mobility_air_distance_class_values[$distance_class]["flight_co_aeq"] * $_SESSION['data']['airport_passengers_amount'] * $_SESSION['data']['airport_flight_amount'] * $_SESSION['data']['airport_flight_mode'] * $factor_mobility_air_flight_class_default[$_SESSION['data']['airport_flight_class']] * $factor_mobility_air_distance_class_values[$distance_class]["flight_load_factor"][$_SESSION['data']['airport_flight_class']] * MOBILITY_AIR_FLIGHT_BYLOAD;
|
||||
}
|
||||
$_SESSION['data']['emissionThisFlight'][$distance] = $emissionFlight;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getEmissionByDetailFlight()
|
||||
{
|
||||
global $fd_sc_mobility_flight_acceptance;
|
||||
global $factor_sc_mobility_flight_acceptance;
|
||||
global $factor_performance_mobility_air_general_lt;
|
||||
global $factor_sc_mobility_air_lt;
|
||||
|
||||
if(isset($_POST['hidden_airport_values']) && $_POST['hidden_airport_values'] == true)
|
||||
{
|
||||
|
||||
$_SESSION['data']['mobility_air'][] = array(
|
||||
'start_iata' => $_POST['hidden_airport_start_iata'],
|
||||
'start_city' => $_POST['hidden_airport_start_city'],
|
||||
'stopover_iata' => $_POST['hidden_airport_stopover_iata'],
|
||||
'stopover_city' => $_POST['hidden_airport_stopover_city'],
|
||||
'dest_iata' => $_POST['hidden_airport_dest_iata'],
|
||||
'dest_city' => $_POST['hidden_airport_dest_city'],
|
||||
'simple_distance' => $_POST['hidden_airport_simple_distance'],
|
||||
'flight_class' => $_POST['hidden_airport_flight_class'],
|
||||
'flight_mode' => $_POST['hidden_airport_flight_mode'],
|
||||
'passengers_amount' => $_POST['hidden_airport_passengers_amount'],
|
||||
'flight_amount' => $_POST['hidden_airport_flight_amount'],
|
||||
'flight_compensated' => $_POST['hidden_airport_flight_compensated'],
|
||||
'emission' => $_POST['hidden_airport_emission'],
|
||||
'emission_other' => $_POST['hidden_airport_emission_other']
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
foreach($_SESSION['data']['mobility_air'] as $key => $val)
|
||||
{
|
||||
|
||||
// Flug im Scenario anlegen
|
||||
if(!isset($_SESSION['data']['sc_mobility_air'][$key]))
|
||||
{
|
||||
$_SESSION['data']['sc_mobility_air'][$key] = array();
|
||||
$_SESSION['data']['sc_mobility_air'][$key]['flight_amount'] = $val['flight_amount'];
|
||||
$_SESSION['data']['sc_mobility_air'][$key]['flight_compensated'] = 0;
|
||||
}
|
||||
|
||||
/* Today */
|
||||
|
||||
// emission td
|
||||
$_SESSION['emission']['td']['mobility_air'][$key] = $val['emission'];
|
||||
|
||||
// emission td aufaddieren
|
||||
$_SESSION['emission']['td']['mobility_air_total'] += $_SESSION['emission']['td']['mobility_air'][$key];
|
||||
|
||||
// emission_other td
|
||||
$_SESSION['emission_other']['td']['mobility_air'][$key] = $val['emission_other']*-1;
|
||||
|
||||
// emission_other td aufaddieren
|
||||
$_SESSION['emission_other']['td']['mobility_air_total'] += $_SESSION['emission_other']['td']['mobility_air'][$key];
|
||||
|
||||
$_SESSION['performance']['td']['mobility_air'] += $val['simple_distance']*$val['flight_mode']*$val['flight_amount'];
|
||||
|
||||
/* Today */
|
||||
|
||||
|
||||
/* Scenario */
|
||||
|
||||
/* Short-time */
|
||||
|
||||
// emission st
|
||||
$_temp_emission_st_mobility_air_total = bcdiv($_SESSION['emission']['td']['mobility_air'][$key], $val['flight_amount'], 2);
|
||||
|
||||
$_SESSION['emission']['st']['mobility_air'][$key] = bcmul($_temp_emission_st_mobility_air_total, $_SESSION['data']['sc_mobility_air'][$key]['flight_amount'], 2);
|
||||
|
||||
// emission st aufaddieren
|
||||
$_SESSION['emission']['st']['mobility_air_total'] += $_SESSION['emission']['st']['mobility_air'][$key];
|
||||
|
||||
// emission self st
|
||||
$_SESSION['emission_self']['st']['mobility_air'][$key] = $_SESSION['emission']['st']['mobility_air'][$key]-$_SESSION['emission']['td']['mobility_air'][$key];
|
||||
|
||||
// emission self st aufaddieren
|
||||
$_SESSION['emission_self']['st']['mobility_air_total'] += $_SESSION['emission_self']['st']['mobility_air'][$key];
|
||||
|
||||
// emission_other st
|
||||
if($_SESSION['data']['sc_mobility_air'][$key]['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['st']['mobility_air'][$key] = $_SESSION['emission']['st']['mobility_air'][$key]*-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['emission_other']['st']['mobility_air'][$key] = 0;
|
||||
}
|
||||
|
||||
// emission_other st aufaddieren
|
||||
$_SESSION['emission_other']['st']['mobility_air_total'] += $_SESSION['emission_other']['st']['mobility_air'][$key];
|
||||
|
||||
/* EOF Short-time */
|
||||
|
||||
/* Mid-time */
|
||||
|
||||
// emission mt
|
||||
$_temp_emission_mt_mobility_air = $_SESSION['emission']['st']['mobility_air'][$key];
|
||||
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
$_temp_emission_mt_mobility_air = bcmul($_temp_emission_mt_mobility_air, $factor_sc_mobility_flight_acceptance[$key_smfa]['mt'][$_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa]], 2);
|
||||
}
|
||||
|
||||
$_SESSION['emission']['mt']['mobility_air'][$key] = $_temp_emission_mt_mobility_air;
|
||||
|
||||
// emission mt aufaddieren
|
||||
$_SESSION['emission']['mt']['mobility_air_total'] += $_SESSION['emission']['mt']['mobility_air'][$key];
|
||||
|
||||
// emission self mt
|
||||
$_SESSION['emission_self']['mt']['mobility_air'][$key] = $_SESSION['emission']['mt']['mobility_air'][$key]-$_SESSION['emission']['td']['mobility_air'][$key];
|
||||
|
||||
if($_SESSION['emission_self']['mt']['mobility_air'][$key] > 0) $_SESSION['emission_self']['mt']['mobility_air'][$key] = 0;
|
||||
|
||||
// emission self mt aufaddieren
|
||||
$_SESSION['emission_self']['mt']['mobility_air_total'] += $_SESSION['emission_self']['mt']['mobility_air'][$key];
|
||||
|
||||
// emission_other mt
|
||||
if($_SESSION['data']['sc_mobility_air'][$key]['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['mt']['mobility_air'][$key] = $_SESSION['emission']['mt']['mobility_air'][$key]*-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['emission_other']['mt']['mobility_air'][$key] = 0;
|
||||
}
|
||||
|
||||
// emission_other mt aufaddieren
|
||||
$_SESSION['emission_other']['mt']['mobility_air_total'] += $_SESSION['emission_other']['mt']['mobility_air'][$key];
|
||||
|
||||
/* EOF Mid-time */
|
||||
}
|
||||
|
||||
|
||||
/* Long-time */
|
||||
|
||||
// emission lt
|
||||
$temp_emission_lt_mobility_air = $factor_sc_mobility_air_lt;
|
||||
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
$temp_emission_lt_mobility_air = bcmul($temp_emission_lt_mobility_air, $factor_sc_mobility_flight_acceptance[$key_smfa]['lt'][$_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa]], 2);
|
||||
}
|
||||
$_SESSION['emission']['lt']['mobility_air_total'] += $temp_emission_lt_mobility_air;
|
||||
|
||||
// emission_self lt
|
||||
$_SESSION['emission_self']['lt']['mobility_air'] = $_SESSION['emission']['lt']['mobility_air_total']-AVERAGE_EMISSION_VALUE_MOBILITY_AIR;
|
||||
if($_SESSION['emission_self']['lt']['mobility_air'] > 0) $_SESSION['emission_self']['lt']['mobility_air'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['lt']['mobility_air_total'] += $_SESSION['emission_self']['lt']['mobility_air'];
|
||||
|
||||
/* EOF Long-time */
|
||||
|
||||
/* EOF Scenario */
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getEmissionByGeneralFlight()
|
||||
{
|
||||
global $factor_mobility_air_flight_class_default;
|
||||
global $factor_mobility_air_flight_distance;
|
||||
global $factor_mobility_air_general_km;
|
||||
global $fd_sc_mobility_flight_acceptance;
|
||||
global $factor_sc_mobility_flight_acceptance;
|
||||
global $factor_performance_mobility_air_general_lt;
|
||||
global $factor_sc_mobility_air_lt;
|
||||
|
||||
$_SESSION['emission']['td']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission']['td']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_other']['td']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission_other']['td']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission']['st']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission']['st']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['st']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission_self']['st']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_other']['st']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission_other']['st']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission']['mt']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission']['mt']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['mt']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission_self']['mt']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_other']['mt']['mobility_air_general_europe'] = 0;
|
||||
$_SESSION['emission_other']['mt']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['performance']['td']['mobility_air'] = 0;
|
||||
|
||||
|
||||
|
||||
/* Input validation */
|
||||
$_SESSION['data']['mobility_air_general']['europe']['hours'] = str_replace(",", ".", $_SESSION['data']['mobility_air_general']['europe']['hours']);
|
||||
$_SESSION['data']['mobility_air_general']['europe']['hours'] = (int) $_SESSION['data']['mobility_air_general']['europe']['hours'];
|
||||
|
||||
$_SESSION['data']['mobility_air_general']['world']['hours'] = str_replace(",", ".", $_SESSION['data']['mobility_air_general']['world']['hours']);
|
||||
$_SESSION['data']['mobility_air_general']['world']['hours'] = (int) $_SESSION['data']['mobility_air_general']['world']['hours'];
|
||||
|
||||
|
||||
/* Pauschale Flüge: Änderungen in settings */
|
||||
if(isset($_SESSION['data']['flag_settings_init_mobility_flight']) && $_SESSION['data']['flag_settings_init_mobility_flight'] == true)
|
||||
{
|
||||
$_SESSION['data']['sc_mobility_air_general'] = $_SESSION['data']['mobility_air_general'];
|
||||
|
||||
unset($_SESSION['data']['flag_settings_init_mobility_flight']);
|
||||
}
|
||||
/* Pauschale Flüge: Änderungen in Bilanz */
|
||||
if(isset($_SESSION['data']['flag_settings_mobility_flight']) && $_SESSION['data']['flag_settings_mobility_flight'] == true)
|
||||
{
|
||||
// Prüfen ob die Flugeistung im Szenario grösser als die Flugeistung in der Bilanz ist. Falls ja = anpassen
|
||||
if(!isset($_SESSION['data']['sc_mobility_air_general']['europe']['hours']) || $_SESSION['data']['sc_mobility_air_general']['europe']['hours'] > $_SESSION['data']['mobility_air_general']['europe']['hours'])
|
||||
{
|
||||
$_SESSION['data']['sc_mobility_air_general']['europe']['hours'] = $_SESSION['data']['mobility_air_general']['europe']['hours'];
|
||||
}
|
||||
if(!isset($_SESSION['data']['sc_mobility_air_general']['world']['hours']) || $_SESSION['data']['sc_mobility_air_general']['world']['hours'] > $_SESSION['data']['mobility_air_general']['world']['hours'])
|
||||
{
|
||||
$_SESSION['data']['sc_mobility_air_general']['world']['hours'] = $_SESSION['data']['mobility_air_general']['world']['hours'];
|
||||
}
|
||||
|
||||
unset($_SESSION['data']['flag_settings_mobility_flight']);
|
||||
}
|
||||
/* EOF Pauschale Flüge: Änderungen in der Bilanz */
|
||||
|
||||
/* Today */
|
||||
|
||||
// Europe
|
||||
if($_SESSION['data']['mobility_air_general']['europe']['hours'] >= 0)
|
||||
{
|
||||
// emission
|
||||
$temp_emission_td_mobility_air_general_europe = bcmul($_SESSION['data']['mobility_air_general']['europe']['hours'], $factor_mobility_air_flight_distance["europe"], 2);
|
||||
$_SESSION['emission']['td']['mobility_air_general_europe'] = bcmul($temp_emission_td_mobility_air_general_europe, $factor_mobility_air_flight_class_default[$_SESSION['data']['mobility_air_general']['europe']['flight_class']], 2);
|
||||
|
||||
$_SESSION['emission']['td']['mobility_air_total'] += $_SESSION['emission']['td']['mobility_air_general_europe'];
|
||||
|
||||
// emission_other
|
||||
if($_SESSION['data']['mobility_air_general']['europe']['flight_compensated'] == 1)
|
||||
{
|
||||
$_SESSION['emission_other']['td']['mobility_air_general_europe'] = $_SESSION['emission']['td']['mobility_air_general_europe']*-1;
|
||||
|
||||
$_SESSION['emission_other']['td']['mobility_air_total'] += $_SESSION['emission_other']['td']['mobility_air_general_europe'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['td']['mobility_air'] += bcmul($_SESSION['data']['mobility_air_general']['europe']['hours'], $factor_mobility_air_general_km["europe"]);
|
||||
}
|
||||
|
||||
// World
|
||||
if($_SESSION['data']['mobility_air_general']['world']['hours'] >= 0)
|
||||
{
|
||||
// emission
|
||||
$temp_emission_td_mobility_air_general_world = bcmul($_SESSION['data']['mobility_air_general']['world']['hours'], $factor_mobility_air_flight_distance["world"], 2);
|
||||
$_SESSION['emission']['td']['mobility_air_general_world'] = bcmul($temp_emission_td_mobility_air_general_world, $factor_mobility_air_flight_class_default[$_SESSION['data']['mobility_air_general']['world']['flight_class']], 2);
|
||||
|
||||
$_SESSION['emission']['td']['mobility_air_total'] += $_SESSION['emission']['td']['mobility_air_general_world'];
|
||||
|
||||
// emission_other
|
||||
if($_SESSION['data']['mobility_air_general']['world']['flight_compensated'] == 1)
|
||||
{
|
||||
$_SESSION['emission_other']['td']['mobility_air_general_world'] = $_SESSION['emission']['td']['mobility_air_general_world']*-1;
|
||||
|
||||
$_SESSION['emission_other']['td']['mobility_air_total'] += $_SESSION['emission_other']['td']['mobility_air_general_world'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['td']['mobility_air'] += bcmul($_SESSION['data']['mobility_air_general']['world']['hours'], $factor_mobility_air_general_km["world"]);
|
||||
}
|
||||
/* EOF Today */
|
||||
|
||||
|
||||
/* Scenario */
|
||||
|
||||
// Europe
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['europe']['hours']) && $_SESSION['data']['sc_mobility_air_general']['europe']['hours'] >= 0)
|
||||
{
|
||||
/* Short-time */
|
||||
|
||||
// emission
|
||||
$temp_emission_st_mobility_air_general_europe = bcmul($_SESSION['data']['sc_mobility_air_general']['europe']['hours'], $factor_mobility_air_flight_distance["europe"], 2);
|
||||
$_SESSION['emission']['st']['mobility_air_general_europe'] = bcmul($temp_emission_st_mobility_air_general_europe, $factor_mobility_air_flight_class_default[$_SESSION['data']['mobility_air_general']['europe']['flight_class']], 2);
|
||||
|
||||
$_SESSION['emission']['st']['mobility_air_total'] += $_SESSION['emission']['st']['mobility_air_general_europe'];
|
||||
|
||||
// emission_self
|
||||
$_SESSION['emission_self']['st']['mobility_air_general_europe'] = $_SESSION['emission']['st']['mobility_air_general_europe']-$_SESSION['emission']['td']['mobility_air_general_europe'];
|
||||
if($_SESSION['emission_self']['st']['mobility_air_general_europe'] > 0) $_SESSION['emission_self']['st']['mobility_air_general_europe'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['st']['mobility_air_total'] += $_SESSION['emission_self']['st']['mobility_air_general_europe'];
|
||||
|
||||
// emission_other
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['europe']['flight_compensated']) && $_SESSION['data']['sc_mobility_air_general']['europe']['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['st']['mobility_air_general_europe'] = $_SESSION['emission']['st']['mobility_air_general_europe']*-1;
|
||||
|
||||
$_SESSION['emission_other']['st']['mobility_air_total'] += $_SESSION['emission_other']['st']['mobility_air_general_europe'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['st']['mobility_air'] += bcmul($_SESSION['data']['sc_mobility_air_general']['europe']['hours'], $factor_mobility_air_general_km["europe"]);
|
||||
/* EOF Short-time */
|
||||
|
||||
/* Mid-time */
|
||||
// emission
|
||||
$temp_emission_mt_mobility_air_general_europe = $_SESSION['emission']['st']['mobility_air_general_europe'];
|
||||
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
$temp_emission_mt_mobility_air_general_europe = bcmul($temp_emission_mt_mobility_air_general_europe, $factor_sc_mobility_flight_acceptance[$key_smfa]['mt'][$_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa]], 2);
|
||||
}
|
||||
$_SESSION['emission']['mt']['mobility_air_general_europe'] = $temp_emission_mt_mobility_air_general_europe;
|
||||
|
||||
$_SESSION['emission']['mt']['mobility_air_total'] += $_SESSION['emission']['mt']['mobility_air_general_europe'];
|
||||
|
||||
// emission_self
|
||||
$_SESSION['emission_self']['mt']['mobility_air_general_europe'] = $_SESSION['emission']['mt']['mobility_air_general_europe']-$_SESSION['emission']['st']['mobility_air_general_europe'];
|
||||
if($_SESSION['emission_self']['mt']['mobility_air_general_europe'] > 0) $_SESSION['emission_self']['mt']['mobility_air_general_europe'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['mt']['mobility_air_total'] += $_SESSION['emission_self']['mt']['mobility_air_general_europe'];
|
||||
|
||||
// emission_other
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['europe']['flight_compensated']) && $_SESSION['data']['sc_mobility_air_general']['europe']['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['mt']['mobility_air_general_europe'] = $_SESSION['emission']['mt']['mobility_air_general_europe']*-1;
|
||||
|
||||
$_SESSION['emission_other']['mt']['mobility_air_total'] += $_SESSION['emission_other']['mt']['mobility_air_general_europe'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['mt']['mobility_air'] += bcmul($_SESSION['data']['sc_mobility_air_general']['europe']['hours'], $factor_mobility_air_general_km["europe"]);
|
||||
|
||||
/* EOF Mid-time */
|
||||
}
|
||||
|
||||
// World
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['world']['hours']) && $_SESSION['data']['sc_mobility_air_general']['world']['hours'] >= 0)
|
||||
{
|
||||
// emission
|
||||
$temp_emission_st_mobility_air_general_world = bcmul($_SESSION['data']['sc_mobility_air_general']['world']['hours'], $factor_mobility_air_flight_distance["world"], 2);
|
||||
$_SESSION['emission']['st']['mobility_air_general_world'] = bcmul($temp_emission_st_mobility_air_general_world, $factor_mobility_air_flight_class_default[$_SESSION['data']['mobility_air_general']['world']['flight_class']], 2);
|
||||
|
||||
$_SESSION['emission']['st']['mobility_air_total'] += $_SESSION['emission']['st']['mobility_air_general_world'];
|
||||
|
||||
// emission_self
|
||||
$_SESSION['emission_self']['st']['mobility_air_general_world'] = $_SESSION['emission']['st']['mobility_air_general_world']-$_SESSION['emission']['td']['mobility_air_general_world'];
|
||||
if($_SESSION['emission_self']['st']['mobility_air_general_world'] > 0) $_SESSION['emission_self']['st']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['st']['mobility_air_total'] += $_SESSION['emission_self']['st']['mobility_air_general_world'];
|
||||
|
||||
// emission_other
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['world']['flight_compensated']) && $_SESSION['data']['sc_mobility_air_general']['world']['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['st']['mobility_air_general_world'] = $_SESSION['emission']['st']['mobility_air_general_world']*-1;
|
||||
|
||||
$_SESSION['emission_other']['st']['mobility_air_total'] += $_SESSION['emission_other']['st']['mobility_air_general_world'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['st']['mobility_air'] += bcmul($_SESSION['data']['sc_mobility_air_general']['world']['hours'], $factor_mobility_air_general_km["world"]);
|
||||
/* EOF Short-time */
|
||||
|
||||
/* Mid-time */
|
||||
// emission
|
||||
$temp_emission_mt_mobility_air_general_world = $_SESSION['emission']['st']['mobility_air_general_world'];
|
||||
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
$temp_emission_mt_mobility_air_general_world = bcmul($temp_emission_mt_mobility_air_general_world, $factor_sc_mobility_flight_acceptance[$key_smfa]['mt'][$_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa]], 2);
|
||||
}
|
||||
$_SESSION['emission']['mt']['mobility_air_general_world'] = $temp_emission_mt_mobility_air_general_world;
|
||||
|
||||
$_SESSION['emission']['mt']['mobility_air_total'] += $_SESSION['emission']['mt']['mobility_air_general_world'];
|
||||
|
||||
// emission_self
|
||||
$_SESSION['emission_self']['mt']['mobility_air_general_world'] = $_SESSION['emission']['mt']['mobility_air_general_world']-$_SESSION['emission']['st']['mobility_air_general_world'];
|
||||
if($_SESSION['emission_self']['mt']['mobility_air_general_world'] > 0) $_SESSION['emission_self']['mt']['mobility_air_general_world'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['mt']['mobility_air_total'] += $_SESSION['emission_self']['mt']['mobility_air_general_world'];
|
||||
|
||||
// emission_other
|
||||
if(isset($_SESSION['data']['sc_mobility_air_general']['world']['flight_compensated']) && $_SESSION['data']['sc_mobility_air_general']['world']['flight_compensated'] == "1")
|
||||
{
|
||||
$_SESSION['emission_other']['mt']['mobility_air_general_world'] = $_SESSION['emission']['mt']['mobility_air_general_world']*-1;
|
||||
|
||||
$_SESSION['emission_other']['mt']['mobility_air_total'] += $_SESSION['emission_other']['mt']['mobility_air_general_world'];
|
||||
}
|
||||
|
||||
// Flugleistung
|
||||
$_SESSION['performance']['mt']['mobility_air'] += bcmul($_SESSION['data']['sc_mobility_air_general']['world']['hours'], $factor_mobility_air_general_km["world"]);
|
||||
/* EOF Mid-time */
|
||||
|
||||
}
|
||||
|
||||
/* Long-time */
|
||||
|
||||
// emission lt
|
||||
$temp_emission_lt_mobility_air = $factor_sc_mobility_air_lt;
|
||||
|
||||
foreach($fd_sc_mobility_flight_acceptance as $key_smfa => $val_smfa)
|
||||
{
|
||||
$temp_emission_lt_mobility_air = bcmul($temp_emission_lt_mobility_air, $factor_sc_mobility_flight_acceptance[$key_smfa]['lt'][$_SESSION['data']['sc_mobility_flight_acceptance'][$key_smfa]], 2);
|
||||
}
|
||||
$_SESSION['emission']['lt']['mobility_air_total'] += $temp_emission_lt_mobility_air;
|
||||
|
||||
// emission_self lt
|
||||
$_SESSION['emission_self']['lt']['mobility_air'] = $_SESSION['emission']['lt']['mobility_air_total']-AVERAGE_EMISSION_VALUE_MOBILITY_AIR;
|
||||
if($_SESSION['emission_self']['lt']['mobility_air'] > 0) $_SESSION['emission_self']['lt']['mobility_air'] = 0;
|
||||
|
||||
$_SESSION['emission_self']['lt']['mobility_air_total'] += $_SESSION['emission_self']['lt']['mobility_air'];
|
||||
|
||||
/* EOF Long-time */
|
||||
|
||||
|
||||
|
||||
|
||||
/* EOF Scenario */
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Privatfahrzeuge": Calculate emissions
|
||||
*/
|
||||
function getEvaluationByCar()
|
||||
{
|
||||
GLOBAL $factor_mobility_cars_energy_source;
|
||||
GLOBAL $factor_mobility_cars_energy_source_co2quota;
|
||||
GLOBAL $factor_mobility_train_general_performance;
|
||||
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_average'] = array();
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_difference'] = 0;
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = 0;
|
||||
|
||||
$_SESSION['data']['improve_evaluation_mobility_car_co2_average'] = array();
|
||||
$_SESSION['data']['improve_evaluation_mobility_car_co2_difference'] = 0;
|
||||
$_SESSION['data']['improve_evaluation_mobility_car_co2_saving'] = 0;
|
||||
|
||||
if(isset($_SESSION['data']['mobility_cars_values']) && is_array($_SESSION['data']['mobility_cars_values']))
|
||||
{
|
||||
$total_road_performance = 0;
|
||||
|
||||
// Gesamtkilometer aller Fahrzeuge
|
||||
foreach($_SESSION['data']['mobility_cars_values'] as $key => $val)
|
||||
{
|
||||
if($key <= $_SESSION['data']['mobility_cars_amount'] && $_SESSION['emission']['td']['mobility_car_co2'][$key] > 0)
|
||||
{
|
||||
$total_road_performance = bcadd($val['road_performance'], $total_road_performance, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Berechnung durchschnittliche CO2Emissionen je Kilometer über alle Fahrzeuge ohne Vorkette
|
||||
foreach($_SESSION['data']['mobility_cars_values'] as $key => $val)
|
||||
{
|
||||
if($key <= $_SESSION['data']['mobility_cars_amount'] && $_SESSION['emission']['td']['mobility_car_co2'][$key] > 0)
|
||||
{
|
||||
$quota_road_performance = bcdiv($val['road_performance'], $total_road_performance, 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_average'][$key] = bcmul($_SESSION['emission']['td']['mobility_car_co2'][$key], $quota_road_performance, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Berechnung relative Abweichung: CO2_Mittel_Abweichung [%] = (1 - (Durchschnitt [g/km] / 120 [g/km])) x 100 )
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_difference'] = bcdiv(array_sum($_SESSION['data']['evaluation_mobility_car_co2_average']), EVALUATION_MOBILITY_ROAD, 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_difference'] = bcsub(1, $_SESSION['data']['evaluation_mobility_car_co2_difference'], 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_difference'] = bcmul(100, $_SESSION['data']['evaluation_mobility_car_co2_difference']);
|
||||
if($_SESSION['data']['evaluation_mobility_car_co2_difference'] < 0) $_SESSION['data']['evaluation_mobility_car_co2_difference'] = bcmul($_SESSION['data']['evaluation_mobility_car_co2_difference'], -1);
|
||||
|
||||
// Berechnung Alternative ÖV: CO2_Einsparung_OV [%] = {1 - (Summe Jahreskilometer Fhrzg [km] x Faktor öffentlicher Verkehr generell [kg/Pkm] / 1000) / Summe CO2Tonnage Fhrzge [t/a]}
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcmul($total_road_performance, $factor_mobility_train_general_performance, 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_car_co2_saving'], 1000, 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_car_co2_saving'], $_SESSION['emission']['td']['mobility_car_total'], 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcsub(1, $_SESSION['data']['evaluation_mobility_car_co2_saving'], 2);
|
||||
$_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcmul($_SESSION['data']['evaluation_mobility_car_co2_saving'], 100);
|
||||
// $_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_car_co2_saving'], $_SESSION['emission']['td']['mobility_car_total'], 2);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Flug": Evaluate evaluation
|
||||
*/
|
||||
function getEvaluationByFlight()
|
||||
{
|
||||
global $factor_mobility_cars_energy_source;
|
||||
global $factor_mobility_cars_energy_source_co2quota;
|
||||
global $factor_mobility_train_general_performance;
|
||||
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_short'] = false;
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_middle'] = false;
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_long'] = false;
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = 0;
|
||||
|
||||
$total_flight_performance = 0;
|
||||
|
||||
if(isset($_SESSION['data']['mobility_air']) && is_array($_SESSION['data']['mobility_air']))
|
||||
{
|
||||
|
||||
// Gesamtkilometer aller Flüge
|
||||
foreach($_SESSION['data']['mobility_air'] as $key => $val)
|
||||
{
|
||||
switch($val['simple_distance'])
|
||||
{
|
||||
case $val['simple_distance'] > 0 && $val['simple_distance'] <= 900:
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_short'] = true;
|
||||
break;
|
||||
case $val['simple_distance'] > 900 && $val['simple_distance'] <= 2000:
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_middle'] = true;
|
||||
break;
|
||||
case $val['simple_distance'] > 2000:
|
||||
$_SESSION['data']['evaluation_mobility_flight_distance_class_long'] = true;
|
||||
break;
|
||||
}
|
||||
$total_flight_performance = bcadd($total_flight_performance, $val['simple_distance']);
|
||||
}
|
||||
|
||||
// Berechnung Alternative ÖV: CO2_Einsparung_Kurzstreckenflug [%] = {1 - (SUMME Distanz Flug Kurzstrecke [km] x Faktor ÖV_Verkehr_Zug_Fernverkehr [kg/Pkm] / 1000) / Summe Emissionen Kurzstreckenflug [t/a]}
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = bcmul($total_flight_performance, $factor_mobility_train_general_performance, 2);
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_flight_co2_saving'], 1000, 2);
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_flight_co2_saving'], $_SESSION['emission']['td']['mobility_air_total'], 2);
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = bcsub(1, $_SESSION['data']['evaluation_mobility_flight_co2_saving'], 2);
|
||||
$_SESSION['data']['evaluation_mobility_flight_co2_saving'] = bcmul($_SESSION['data']['evaluation_mobility_flight_co2_saving'], 100);
|
||||
// $_SESSION['data']['evaluation_mobility_car_co2_saving'] = bcdiv($_SESSION['data']['evaluation_mobility_car_co2_saving'], $_SESSION['emission']['td']['mobility_car_total'], 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* "Streaming": Calculate emissions
|
||||
*/
|
||||
function getEmissionByStreaming()
|
||||
{
|
||||
|
||||
global $factor_streaming_internet_daily;
|
||||
global $factor_streaming_internet_daily_wifi;
|
||||
global $factor_streaming_internet_traffic_core_network;
|
||||
global $factor_living_pt_type;
|
||||
;
|
||||
|
||||
/* Today */
|
||||
|
||||
|
||||
// emission
|
||||
$temp_emission_td_total_streaming = array();
|
||||
|
||||
foreach($factor_streaming_internet_daily as $key => $val)
|
||||
{
|
||||
// CO2e [kg] = Streaming xy [h] * Datenmenge xy [GB/h] * Datenübertragung Kernnetzwerk [kWh/GB] * Anteil Mobil Faktor [ ] * Stromfaktor [kg CO2e/kWh] * 365
|
||||
$temp_emission_td_total_streaming[$key] =
|
||||
$_SESSION['data']['streaming_internet_daily'][$key] *
|
||||
$factor_streaming_internet_daily[$key] *
|
||||
$factor_streaming_internet_traffic_core_network *
|
||||
$factor_streaming_internet_daily_wifi[$_SESSION['data']['streaming_internet_daily_wifi']] *
|
||||
$factor_living_pt_type["strommix_de"] *
|
||||
365;
|
||||
}
|
||||
|
||||
|
||||
// Emissionen (auf 2 Stellen gerundet)
|
||||
$_SESSION['emission']['td']['total_streaming'] = bcmul(array_sum($temp_emission_td_total_streaming), 1, 2);
|
||||
|
||||
|
||||
/* EOF Today */
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
307
r41/luxembourg/de/_core/includes/_functions_chart.inc.php
Normal file
307
r41/luxembourg/de/_core/includes/_functions_chart.inc.php
Normal file
@ -0,0 +1,307 @@
|
||||
<?php
|
||||
/**
|
||||
* Get max. chart height (for 1 or all persons)
|
||||
*/
|
||||
$maxChart = 0;
|
||||
if($_SESSION['data']['person_calc_mode_display'] == 1)
|
||||
{
|
||||
if($_SESSION['emission']['td']['total'] >= $average_emission)
|
||||
{
|
||||
$maxChart = bcdiv($_SESSION['emission']['td']['total'], 1000); // kg -> t
|
||||
}
|
||||
else
|
||||
{
|
||||
$maxChart = bcdiv($average_emission, 1000); // kg -> t
|
||||
}
|
||||
}
|
||||
elseif($_SESSION['data']['person_calc_mode_display'] == 2)
|
||||
{
|
||||
if($_SESSION['emission']['td']['total_by_persons'] >= $average_emission_by_persons)
|
||||
{
|
||||
$maxChart = bcdiv($_SESSION['emission']['td']['total_by_persons'], 1000); // kg -> t
|
||||
}
|
||||
else
|
||||
{
|
||||
$maxChart = bcdiv($average_emission_by_persons, 1000); // kg -> t
|
||||
}
|
||||
}
|
||||
|
||||
/* Values for bar graph */
|
||||
switch($maxChart)
|
||||
{
|
||||
case $maxChart > 0 && $maxChart < 5:
|
||||
$maxChart = 5;
|
||||
break;
|
||||
|
||||
case $maxChart >= 5 && $maxChart < 10:
|
||||
$maxChart = 10;
|
||||
break;
|
||||
|
||||
case $maxChart >= 10 && $maxChart < 15:
|
||||
$maxChart = 15;
|
||||
break;
|
||||
|
||||
case $maxChart >= 15 && $maxChart < 20:
|
||||
$maxChart = 20;
|
||||
break;
|
||||
|
||||
case $maxChart >= 20 && $maxChart < 25:
|
||||
$maxChart = 25;
|
||||
break;
|
||||
|
||||
case $maxChart >= 25 && $maxChart < 30:
|
||||
$maxChart = 30;
|
||||
break;
|
||||
|
||||
case $maxChart >= 30 && $maxChart < 35:
|
||||
$maxChart = 35;
|
||||
break;
|
||||
|
||||
case $maxChart >= 40 && $maxChart < 45:
|
||||
$maxChart = 45;
|
||||
break;
|
||||
|
||||
case $maxChart >= 45 && $maxChart < 50:
|
||||
$maxChart = 50;
|
||||
break;
|
||||
|
||||
case $maxChart >= 50 && $maxChart < 55:
|
||||
$maxChart = 55;
|
||||
break;
|
||||
|
||||
case $maxChart >= 55 && $maxChart < 60:
|
||||
$maxChart = 60;
|
||||
break;
|
||||
|
||||
case $maxChart >= 60 && $maxChart < 65:
|
||||
$maxChart = 65;
|
||||
break;
|
||||
|
||||
case $maxChart >= 65 && $maxChart < 70:
|
||||
$maxChart = 70;
|
||||
break;
|
||||
|
||||
case $maxChart >= 70 && $maxChart < 75:
|
||||
$maxChart = 75;
|
||||
break;
|
||||
|
||||
case $maxChart >= 75 && $maxChart < 80:
|
||||
$maxChart = 80;
|
||||
break;
|
||||
|
||||
case $maxChart >= 80 && $maxChart < 85:
|
||||
$maxChart = 85;
|
||||
break;
|
||||
|
||||
case $maxChart >= 85 && $maxChart < 90:
|
||||
$maxChart = 90;
|
||||
break;
|
||||
|
||||
case $maxChart >= 90 && $maxChart < 95:
|
||||
$maxChart = 95;
|
||||
break;
|
||||
|
||||
case $maxChart >= 95 && $maxChart < 100:
|
||||
$maxChart = 100;
|
||||
break;
|
||||
|
||||
case $maxChart >= 100 && $maxChart < 1000:
|
||||
$maxChart = bcadd($maxChart, 10);
|
||||
break;
|
||||
|
||||
case $maxChart >= 1000:
|
||||
$maxChart = bcadd($maxChart, 100);
|
||||
break;
|
||||
|
||||
default:
|
||||
$maxChart = bcadd($maxChart, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get max. chart height ("Haushalt" or "Anteil 1 Pers.")
|
||||
*/
|
||||
if($_SESSION['data']['person_calc_mode_display'] == 1) // = "Haushalt"
|
||||
{
|
||||
/* Left bar: Tons */
|
||||
$leftBarDesc = getMyResult($_SESSION['emission']['td']['total']);
|
||||
|
||||
/* Target bar: Tons */
|
||||
$targetBarDesc = getMyResult($_SESSION['target']['total']);
|
||||
|
||||
/* Right bar: Tons */
|
||||
$rightBarDesc = getMyResult($average_emission);
|
||||
|
||||
/* Left bar: Living */
|
||||
$customChartHome = bcdiv($_SESSION['emission']['td']['total_living'], 1000, 2); // kg -> t
|
||||
$customChartHome = bcmul(300, $customChartHome);
|
||||
$customChartHome = bcdiv($customChartHome, $maxChart);
|
||||
|
||||
/* Target: Left bar: Living */
|
||||
$targetChartHome = bcdiv($_SESSION['target']['total_living'], 1000, 2); // kg -> t
|
||||
$targetChartHome = bcmul(300, $targetChartHome);
|
||||
$targetChartHome = bcdiv($targetChartHome, $maxChart);
|
||||
|
||||
/* Right bar: Living */
|
||||
$defaultChartHome = bcdiv($average_emission_living, 1000, 2); // kg -> t
|
||||
$defaultChartHome = bcmul(300, $defaultChartHome);
|
||||
$defaultChartHome = bcdiv($defaultChartHome, $maxChart);
|
||||
|
||||
/* Left bar: Mobility */
|
||||
$customChartMobility = bcdiv($_SESSION['emission']['td']['total_mobility'], 1000, 2); // kg -> t
|
||||
$customChartMobility = bcmul(300, $customChartMobility);
|
||||
$customChartMobility = bcdiv($customChartMobility, $maxChart);
|
||||
|
||||
/* Target: Left bar: Mobility */
|
||||
$targetChartMobility = bcdiv($_SESSION['target']['total_mobility'], 1000, 2); // kg -> t
|
||||
$targetChartMobility = bcmul(300, $targetChartMobility);
|
||||
$targetChartMobility = bcdiv($targetChartMobility, $maxChart);
|
||||
|
||||
/* Right bar: Mobility */
|
||||
$defaultChartMobility = bcdiv($average_emission_mobility, 1000, 2); // kg -> t
|
||||
$defaultChartMobility = bcmul(300, $defaultChartMobility);
|
||||
$defaultChartMobility = bcdiv($defaultChartMobility, $maxChart);
|
||||
|
||||
/* Left bar: Food */
|
||||
$customChartFood = bcdiv($_SESSION['emission']['td']['total_food'], 1000, 2); // kg -> t
|
||||
$customChartFood = bcmul(300, $customChartFood);
|
||||
$customChartFood = bcdiv($customChartFood, $maxChart);
|
||||
|
||||
/* Target: Left bar: Food */
|
||||
$targetChartFood = bcdiv($_SESSION['target']['total_food'], 1000, 2); // kg -> t
|
||||
$targetChartFood = bcmul(300, $targetChartFood);
|
||||
$targetChartFood = bcdiv($targetChartFood, $maxChart);
|
||||
|
||||
/* Right bar: Food */
|
||||
$defaultChartFood = bcdiv($average_emission_food, 1000, 2); // kg -> t
|
||||
$defaultChartFood = bcmul(300, $defaultChartFood);
|
||||
$defaultChartFood = bcdiv($defaultChartFood, $maxChart);
|
||||
|
||||
/* Left bar: Consumption */
|
||||
$customChartConsumption = bcdiv($_SESSION['emission']['td']['total_consumption'], 1000, 2); // kg -> t
|
||||
$customChartConsumption = bcmul(300, $customChartConsumption);
|
||||
$customChartConsumption = bcdiv($customChartConsumption, $maxChart);
|
||||
|
||||
/* Target: Left bar: Consumption */
|
||||
$targetChartConsumption = bcdiv($_SESSION['target']['total_consumption'], 1000, 2); // kg -> t
|
||||
$targetChartConsumption = bcmul(300, $targetChartConsumption);
|
||||
$targetChartConsumption = bcdiv($targetChartConsumption, $maxChart);
|
||||
|
||||
/* Right bar: Consumption */
|
||||
$defaultChartConsumption = bcdiv($average_emission_consumption, 1000, 2); // kg -> t
|
||||
$defaultChartConsumption = bcmul(300, $defaultChartConsumption);
|
||||
$defaultChartConsumption = bcdiv($defaultChartConsumption, $maxChart);
|
||||
|
||||
/* Left bar: Common */
|
||||
$customChartCommon = bcdiv($_SESSION['emission']['td']['total_common'], 1000, 2); // kg -> t
|
||||
$customChartCommon = bcmul(300, $customChartCommon, 2);
|
||||
$customChartCommon = bcdiv($customChartCommon, $maxChart);
|
||||
|
||||
/* Target: Left bar: Common */
|
||||
$targetChartCommon = bcdiv($_SESSION['target']['total_common'], 1000, 2); // kg -> t
|
||||
$targetChartCommon = bcmul(300, $targetChartCommon, 2);
|
||||
$targetChartCommon = bcdiv($targetChartCommon, $maxChart);
|
||||
|
||||
/* Right bar: Common */
|
||||
$defaultChartCommon = bcdiv($average_emission_common, 1000, 2); // kg -> t
|
||||
$defaultChartCommon = bcmul(300, $defaultChartCommon, 2);
|
||||
$defaultChartCommon = bcdiv($defaultChartCommon, $maxChart);
|
||||
}
|
||||
elseif($_SESSION['data']['person_calc_mode_display'] == 2) // "Anteil 1 Pers."
|
||||
{
|
||||
/* Left bar: Tons */
|
||||
$leftBarDesc = getMyResult($_SESSION['emission']['td']['total_by_persons']);
|
||||
|
||||
/* Target bar: Tons */
|
||||
$targetBarDesc = getMyResult($_SESSION['target']['total_by_persons']);
|
||||
|
||||
/* Right bar: Tons */
|
||||
$rightBarDesc = getMyResult($average_emission_by_persons);
|
||||
|
||||
/* Required for ntheChart */
|
||||
if($maxChart < bcdiv(NHTE_EMISSION_VALUE, 1000)) $maxChart = 3;
|
||||
|
||||
/* "Verträgliche Quote" */
|
||||
$ntheChart = bcdiv(NHTE_EMISSION_VALUE, 1000, 2); // kg -> t
|
||||
$ntheChart = bcmul(300, $ntheChart, 2);
|
||||
$ntheChart = bcdiv($ntheChart, $maxChart);
|
||||
|
||||
/* Left bar: Living */
|
||||
$customChartHome = bcdiv($_SESSION['emission']['td']['total_living_by_persons'], 1000, 2); // kg -> t
|
||||
$customChartHome = bcmul(300, $customChartHome);
|
||||
$customChartHome = bcdiv($customChartHome, $maxChart);
|
||||
|
||||
/* Target: Left bar: Living */
|
||||
$targetChartHome = bcdiv($_SESSION['target']['total_living_by_persons'], 1000, 2); // kg -> t
|
||||
$targetChartHome = bcmul(300, $targetChartHome);
|
||||
$targetChartHome = bcdiv($targetChartHome, $maxChart);
|
||||
|
||||
/* Right bar: Living */
|
||||
$defaultChartHome = bcdiv($average_emission_living_by_persons, 1000, 2); // kg -> t
|
||||
$defaultChartHome = bcmul(300, $defaultChartHome);
|
||||
$defaultChartHome = bcdiv($defaultChartHome, $maxChart);
|
||||
|
||||
/* Left bar: Mobility */
|
||||
$customChartMobility = bcdiv($_SESSION['emission']['td']['total_mobility_by_persons'], 1000, 2); // kg -> t
|
||||
$customChartMobility = bcmul(300, $customChartMobility);
|
||||
$customChartMobility = bcdiv($customChartMobility, $maxChart);
|
||||
|
||||
/* Target: Left bar: Mobility */
|
||||
$targetChartMobility = bcdiv($_SESSION['target']['total_mobility_by_persons'], 1000, 2); // kg -> t
|
||||
$targetChartMobility = bcmul(300, $targetChartMobility);
|
||||
$targetChartMobility = bcdiv($targetChartMobility, $maxChart);
|
||||
|
||||
/* Right bar: Mobility */
|
||||
$defaultChartMobility = bcdiv($average_emission_mobility_by_persons, 1000, 2); // kg -> t
|
||||
$defaultChartMobility = bcmul(300, $defaultChartMobility);
|
||||
$defaultChartMobility = bcdiv($defaultChartMobility, $maxChart);
|
||||
|
||||
/* Left bar: Food */
|
||||
$customChartFood = bcdiv($_SESSION['emission']['td']['total_food_by_persons'], 1000, 2); // kg -> t
|
||||
$customChartFood = bcmul(300, $customChartFood);
|
||||
$customChartFood = bcdiv($customChartFood, $maxChart);
|
||||
|
||||
/* Target: Left bar: Food */
|
||||
$targetChartFood = bcdiv($_SESSION['target']['total_food_by_persons'], 1000, 2); // kg -> t
|
||||
$targetChartFood = bcmul(300, $targetChartFood);
|
||||
$targetChartFood = bcdiv($targetChartFood, $maxChart);
|
||||
|
||||
/* Right bar: Food */
|
||||
$defaultChartFood = bcdiv($average_emission_food_by_persons, 1000, 2); // kg -> t
|
||||
$defaultChartFood = bcmul(300, $defaultChartFood);
|
||||
$defaultChartFood = bcdiv($defaultChartFood, $maxChart);
|
||||
|
||||
/* Left bar: Consumption */
|
||||
$customChartConsumption = bcdiv($_SESSION['emission']['td']['total_consumption_by_persons'], 1000, 2); // kg -> t
|
||||
$customChartConsumption = bcmul(300, $customChartConsumption);
|
||||
$customChartConsumption = bcdiv($customChartConsumption, $maxChart);
|
||||
|
||||
/* Target: Left bar: Consumption */
|
||||
$targetChartConsumption = bcdiv($_SESSION['target']['total_consumption_by_persons'], 1000, 2); // kg -> t
|
||||
$targetChartConsumption = bcmul(300, $targetChartConsumption);
|
||||
$targetChartConsumption = bcdiv($targetChartConsumption, $maxChart);
|
||||
|
||||
/* Right bar: Consumption */
|
||||
$defaultChartConsumption = bcdiv($average_emission_consumption_by_persons, 1000, 2); // kg -> t
|
||||
$defaultChartConsumption = bcmul(300, $defaultChartConsumption);
|
||||
$defaultChartConsumption = bcdiv($defaultChartConsumption, $maxChart);
|
||||
|
||||
/* Left bar: Common */
|
||||
$customChartCommon = bcdiv($_SESSION['emission']['td']['total_common_by_persons'], 1000, 2); // kg -> t
|
||||
$customChartCommon = bcmul(300, $customChartCommon, 2);
|
||||
$customChartCommon = bcdiv($customChartCommon, $maxChart);
|
||||
|
||||
/* Target: Left bar: Common */
|
||||
$targetChartCommon = bcdiv($_SESSION['target']['total_common_by_persons'], 1000, 2); // kg -> t
|
||||
$targetChartCommon = bcmul(300, $targetChartCommon, 2);
|
||||
$targetChartCommon = bcdiv($targetChartCommon, $maxChart);
|
||||
|
||||
/* Right bar: Common */
|
||||
$defaultChartCommon = bcdiv($average_emission_common_by_persons, 1000, 2); // kg -> t
|
||||
$defaultChartCommon = bcmul(300, $defaultChartCommon, 2);
|
||||
$defaultChartCommon = bcdiv($defaultChartCommon, $maxChart);
|
||||
}
|
||||
|
||||
$yMaxTxt = $maxChart;
|
||||
?>
|
||||
1411
r41/luxembourg/de/_core/includes/_functions_improve.inc.php
Normal file
1411
r41/luxembourg/de/_core/includes/_functions_improve.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
485
r41/luxembourg/de/_core/includes/_functions_layout.inc.php
Normal file
485
r41/luxembourg/de/_core/includes/_functions_layout.inc.php
Normal file
@ -0,0 +1,485 @@
|
||||
<?php
|
||||
/**
|
||||
* Layout: evaluate current and previous emission values
|
||||
*/
|
||||
function evaluateEmission($emission, $emission_before)
|
||||
{
|
||||
if($emission == $emission_before) return("equal");
|
||||
if($emission > $emission_before) return("better");
|
||||
if($emission < $emission_before) return("worse");
|
||||
}
|
||||
|
||||
function evaluate2Emission($emission, $emission_before)
|
||||
{
|
||||
if($emission == $emission_before) return array("equal", "");
|
||||
if($emission > $emission_before) return array("+", $emission-$emission_before);
|
||||
if($emission < $emission_before) return array("", $emission-$emission_before);
|
||||
}
|
||||
|
||||
function evaluate2NegEmission($emission, $emission_before)
|
||||
{
|
||||
if($emission == $emission_before) return array("equal", "");
|
||||
if($emission > $emission_before) return array("", $emission_before-$emission);
|
||||
if($emission < $emission_before) return array("+", $emission_before-$emission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout: output today or short-time emission for a given sector
|
||||
*
|
||||
* @param boolean $smaller
|
||||
* @param string $section
|
||||
* @param string $section_self
|
||||
* @param string $section_other
|
||||
* @param array $em
|
||||
* @param array $em_self
|
||||
* @param array $em_other
|
||||
* @param boolean $caption
|
||||
*/
|
||||
function showEmission($smaller = false, $section, $section_self, $section_other, $em, $em_self, $em_other, $caption = false)
|
||||
{
|
||||
|
||||
if($smaller)
|
||||
{
|
||||
$section .= ' badge-smaller ';
|
||||
$section_self .= ' badge-smaller ';
|
||||
$section_other .= ' badge-smaller ';
|
||||
}
|
||||
|
||||
if((array)$em === $em)
|
||||
{
|
||||
$emission = isset($em[3]) ? $_SESSION[$em[0]][$em[1]][$em[2]][$em[3]] : $_SESSION[$em[0]][$em[1]][$em[2]];
|
||||
@$emission_before = isset($em[3]) ? $_SESSION['emission_before'][$em[0]][$em[1]][$em[2]][$em[3]] : $_SESSION['emission_before'][$em[0]][$em[1]][$em[2]];
|
||||
|
||||
// $flag_state = evaluate2Emission($emission, $emission_before);
|
||||
$flag_state = evaluateEmission($emission, $emission_before);
|
||||
}
|
||||
if((array)$em_self === $em_self)
|
||||
{
|
||||
$emission_self = isset($em_self[3]) ? $_SESSION[$em_self[0]][$em_self[1]][$em_self[2]][$em_self[3]] : $_SESSION[$em_self[0]][$em_self[1]][$em_self[2]];
|
||||
@$emission_before_self = isset($em_self[3]) ? $_SESSION['emission_before'][$em_self[0]][$em_self[1]][$em_self[2]][$em_self[3]] : $_SESSION['emission_before'][$em_self[0]][$em_self[1]][$em_self[2]];
|
||||
|
||||
// $flag_state_self = evaluate2NegEmission($emission_self, $emission_before_self);
|
||||
$flag_state_self = evaluateEmission($emission_self, $emission_before_self);
|
||||
}
|
||||
if((array)$em_other === $em_other)
|
||||
{
|
||||
$emission_other = isset($em_other[3]) ? $_SESSION[$em_other[0]][$em_other[1]][$em_other[2]][$em_other[3]] : $_SESSION[$em_other[0]][$em_other[1]][$em_other[2]];
|
||||
@$emission_before_other = isset($em_other[3]) ? $_SESSION['emission_before'][$em_other[0]][$em_other[1]][$em_other[2]][$em_other[3]] : $_SESSION['emission_before'][$em_other[0]][$em_other[1]][$em_other[2]];
|
||||
|
||||
// $flag_state_other = evaluate2NegEmission($emission_other, $emission_before_other);
|
||||
$flag_state_other = evaluateEmission($emission_other, $emission_before_other);
|
||||
}
|
||||
|
||||
|
||||
echo '<div class="pull-right" style="margin-top:-5px">';
|
||||
|
||||
if(isset($emission)):
|
||||
echo '<div class="badge '.$section;
|
||||
// echo ($flag_state[0] != "equal") ? ' animated fadeIn' : '';
|
||||
echo ($flag_state != "equal") ? ' animated fadeIn' : '';
|
||||
echo '">';
|
||||
if($caption) echo '<span class="badge-headline hidden-xs">'.TXT_RESULT_CO2.'</span>';
|
||||
echo '<span';
|
||||
if(!$caption) echo ' style="cursor:help" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_CO2.': '.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"';
|
||||
echo '>';
|
||||
if(!$caption) echo '<span sr-only="'.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"></span>';
|
||||
|
||||
echo getMyResult($emission);
|
||||
echo '</span>';
|
||||
// if($flag_state[0] != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'" sr-only="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'">'.$flag_state[0].''.getMyResult($flag_state[1]).'</span>';
|
||||
if($flag_state != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'" sr-only="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($emission_before).'</span>';
|
||||
echo '</div>';
|
||||
endif;
|
||||
|
||||
if(isset($emission_self)):
|
||||
echo '<div class="badge '.$section_self;
|
||||
// echo ($flag_state_self[0] != "equal") ? ' animated fadeIn' : '';
|
||||
echo ($flag_state_self != "equal") ? ' animated fadeIn' : '';
|
||||
echo '">';
|
||||
if($caption) echo '<span class="badge-headline hidden-xs">'.TXT_RESULT_SELF.'</span>';
|
||||
echo '<span';
|
||||
if(!$caption) echo ' style="cursor:help" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_SELF.': '.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"';
|
||||
echo '>';
|
||||
if(!$caption) echo '<span sr-only="'.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"></span>';
|
||||
echo getMyResult($emission_self);
|
||||
echo '</span>';
|
||||
// if($flag_state_self[0] != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'" sr-only="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'">'.$flag_state_self[0].''.getMyResult($flag_state_self[1]).'</span>';
|
||||
if($flag_state_self != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'" sr-only="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($emission_before_self).'</span>';
|
||||
echo '</div>';
|
||||
endif;
|
||||
|
||||
|
||||
// if($emission_other != ""):
|
||||
if(isset($emission_other)):
|
||||
echo '<div class="badge '.$section_other;
|
||||
// echo ($flag_state_other[0] != "equal") ? ' animated fadeIn' : '';
|
||||
echo ($flag_state_other != "equal") ? ' animated fadeIn' : '';
|
||||
echo '">';
|
||||
if($caption) echo '<span class="badge-headline hidden-xs">'.TXT_RESULT_OTHER.'</span>';
|
||||
echo '<span';
|
||||
if(!$caption) echo ' style="cursor:help" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_OTHER.': '.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"';
|
||||
echo '>';
|
||||
if(!$caption) echo '<span sr-only="'.TXT_RESULT_TOOLTIP_CURRENT_VALUE.'"></span>';
|
||||
echo getMyResult($emission_other);
|
||||
echo '</span>';
|
||||
// if($flag_state_other[0] != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'" sr-only="'.TXT_RESULT_TOOLTIP_VALUE_CHANGE.'">'.$flag_state_other[0].''.getMyResult($flag_state_other[1]).'</span>';
|
||||
if($flag_state_other != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'" sr-only="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($emission_before_other).'</span>';
|
||||
echo '</div>';
|
||||
endif;
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout: output today, short-time, mid-time and long-time emission for a given sector in scenario
|
||||
*
|
||||
* @param string $section
|
||||
* @param string $section_self
|
||||
* @param string $section_other
|
||||
* @param boolean $flag_em
|
||||
* @param array $td_em
|
||||
* @param array $st_em
|
||||
* @param array $mt_em
|
||||
* @param array $lt_em
|
||||
* @param boolean $flag_em_self
|
||||
* @param array $td_em_self
|
||||
* @param array $st_em_self
|
||||
* @param array $mt_em_self
|
||||
* @param array $lt_em_self
|
||||
* @param boolean $flag_em_other
|
||||
* @param array $td_em_other
|
||||
* @param array $st_em_other
|
||||
* @param array $mt_em_other
|
||||
* @param array $lt_em_other
|
||||
*/
|
||||
function showEmissionScenario($section, $section_self, $section_other, $flag_em, $td_em, $st_em, $mt_em, $lt_em, $flag_em_self, $td_em_self, $st_em_self, $mt_em_self, $lt_em_self, $flag_em_other, $td_em_other, $st_em_other, $mt_em_other, $lt_em_other)
|
||||
{
|
||||
global $customer_settings;
|
||||
|
||||
// Today
|
||||
if((array)$td_em === $td_em)
|
||||
{
|
||||
$td_emission = $_SESSION[$td_em[0]][$td_em[1]][$td_em[2]];
|
||||
$td_emission_before = $_SESSION['emission_before'][$td_em[0]][$td_em[1]][$td_em[2]];
|
||||
|
||||
$td_flag_state = evaluateEmission($td_emission, $td_emission_before);
|
||||
|
||||
}
|
||||
if((array)$td_em_self === $td_em_self)
|
||||
{
|
||||
$td_emission_self = $_SESSION[$td_em_self[0]][$td_em_self[1]][$td_em_self[2]];
|
||||
$td_emission_before_self = $_SESSION['emission_before'][$td_em_self[0]][$td_em_self[1]][$td_em_self[2]];
|
||||
|
||||
$td_flag_state_self = evaluateEmission($td_emission_self, $td_emission_before_self);
|
||||
}
|
||||
if((array)$td_em_other === $td_em_other)
|
||||
{
|
||||
$td_emission_other = $_SESSION[$td_em_other[0]][$td_em_other[1]][$td_em_other[2]];
|
||||
$td_emission_before_other = $_SESSION['emission_before'][$td_em_other[0]][$td_em_other[1]][$td_em_other[2]];
|
||||
|
||||
$td_flag_state_other = evaluateEmission($td_emission_other, $td_emission_before_other);
|
||||
}
|
||||
|
||||
// Short-time
|
||||
if((array)$st_em === $st_em)
|
||||
{
|
||||
$st_emission = $_SESSION[$st_em[0]][$st_em[1]][$st_em[2]];
|
||||
$st_emission_before = $_SESSION['emission_before'][$st_em[0]][$st_em[1]][$st_em[2]];
|
||||
|
||||
$st_flag_state = evaluateEmission($st_emission, $st_emission_before);
|
||||
}
|
||||
if((array)$st_em_self === $st_em_self)
|
||||
{
|
||||
$st_emission_self = $_SESSION[$st_em_self[0]][$st_em_self[1]][$st_em_self[2]];
|
||||
$st_emission_before_self = $_SESSION['emission_before'][$st_em_self[0]][$st_em_self[1]][$st_em_self[2]];
|
||||
|
||||
$st_flag_state_self = evaluateEmission($st_emission_self, $st_emission_before_self);
|
||||
}
|
||||
if((array)$st_em_other === $st_em_other)
|
||||
{
|
||||
$st_emission_other = $_SESSION[$st_em_other[0]][$st_em_other[1]][$st_em_other[2]];
|
||||
$st_emission_before_other = $_SESSION['emission_before'][$st_em_other[0]][$st_em_other[1]][$st_em_other[2]];
|
||||
|
||||
$st_flag_state_other = evaluateEmission($st_emission_other, $st_emission_before_other);
|
||||
}
|
||||
|
||||
// Mid-time
|
||||
if((array)$mt_em === $mt_em)
|
||||
{
|
||||
$mt_emission = $_SESSION[$mt_em[0]][$mt_em[1]][$mt_em[2]];
|
||||
$mt_emission_before = $_SESSION['emission_before'][$mt_em[0]][$mt_em[1]][$mt_em[2]];
|
||||
|
||||
$mt_flag_state = evaluateEmission($mt_emission, $mt_emission_before);
|
||||
}
|
||||
if((array)$mt_em_self === $mt_em_self)
|
||||
{
|
||||
$mt_emission_self = $_SESSION[$mt_em_self[0]][$mt_em_self[1]][$mt_em_self[2]];
|
||||
$mt_emission_before_self = $_SESSION['emission_before'][$mt_em_self[0]][$mt_em_self[1]][$mt_em_self[2]];
|
||||
|
||||
$mt_flag_state_self = evaluateEmission($mt_emission_self, $mt_emission_before_self);
|
||||
}
|
||||
if((array)$mt_em_other === $mt_em_other)
|
||||
{
|
||||
$mt_emission_other = $_SESSION[$mt_em_other[0]][$mt_em_other[1]][$mt_em_other[2]];
|
||||
$mt_emission_before_other = $_SESSION['emission_before'][$mt_em_other[0]][$mt_em_other[1]][$mt_em_other[2]];
|
||||
|
||||
$mt_flag_state_other = evaluateEmission($mt_emission_other, $mt_emission_before_other);
|
||||
}
|
||||
|
||||
// Long-time
|
||||
if((array)$lt_em === $lt_em)
|
||||
{
|
||||
$lt_emission = $_SESSION[$lt_em[0]][$lt_em[1]][$lt_em[2]];
|
||||
$lt_emission_before = $_SESSION['emission_before'][$lt_em[0]][$lt_em[1]][$lt_em[2]];
|
||||
|
||||
$lt_flag_state = evaluateEmission($lt_emission, $lt_emission_before);
|
||||
}
|
||||
if((array)$lt_em_self === $lt_em_self)
|
||||
{
|
||||
$lt_emission_self = $_SESSION[$lt_em_self[0]][$lt_em_self[1]][$lt_em_self[2]];
|
||||
$lt_emission_before_self = $_SESSION['emission_before'][$lt_em_self[0]][$lt_em_self[1]][$lt_em_self[2]];
|
||||
|
||||
$lt_flag_state_self = evaluateEmission($lt_emission_self, $lt_emission_before_self);
|
||||
}
|
||||
if((array)$lt_em_other === $lt_em_other)
|
||||
{
|
||||
$lt_emission_other = $_SESSION[$lt_em_other[0]][$lt_em_other[1]][$lt_em_other[2]];
|
||||
$lt_emission_before_other = $_SESSION['emission_before'][$lt_em_other[0]][$lt_em_other[1]][$lt_em_other[2]];
|
||||
|
||||
$lt_flag_state_other = evaluateEmission($lt_emission_other, $lt_emission_before_other);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="table-responsive" id="sc-result">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><span class="lead"><?php echo TXT_RESULT; ?></span></th>
|
||||
<th scope="col"><?php echo TXT_TIME_PERIOD_TD; ?></th>
|
||||
<?php if($customer_settings['display']['st'] == true) echo '<th scope="col">'.TXT_TIME_PERIOD_ST.'</th>'; ?>
|
||||
<?php if($customer_settings['display']['mt'] == true) echo '<th scope="col">'.TXT_TIME_PERIOD_MT.'</th>'; ?>
|
||||
<?php if($customer_settings['display']['lt'] == true) echo '<th scope="col">'.TXT_TIME_PERIOD_LT.'</th>'; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php if($flag_em): ?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php echo TXT_RESULT_CO2; ?></th>
|
||||
<td>
|
||||
<span class="badge <?php echo ($td_flag_state != "equal") ? ' animated fadeIn '.$section : $section; ?>">
|
||||
<?php
|
||||
echo getMyResult($td_emission);
|
||||
if($td_flag_state != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($td_emission_before).'</span>';
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<?php
|
||||
if($customer_settings['display']['st'] == true):
|
||||
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($st_emission)): ?>
|
||||
<span class="badge <?php echo ($st_flag_state != "equal") ? ' animated fadeIn '.$section : $section; ?>">
|
||||
<?php
|
||||
echo getMyResult($st_emission);
|
||||
if($st_flag_state != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($st_emission_before).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['mt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($mt_emission)): ?>
|
||||
<span class="badge <?php echo ($mt_flag_state != "equal") ? ' animated fadeIn '.$section : $section; ?>">
|
||||
<?php
|
||||
echo getMyResult($mt_emission);
|
||||
if($mt_flag_state != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($mt_emission_before).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['lt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($lt_emission)): ?>
|
||||
<span class="badge <?php echo ($lt_flag_state != "equal") ? ' animated fadeIn '.$section : $section; ?>">
|
||||
<?php
|
||||
echo getMyResult($lt_emission);
|
||||
if($lt_flag_state != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($lt_emission_before).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php
|
||||
endif;
|
||||
if($flag_em_self):
|
||||
?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php echo TXT_RESULT_SELF; ?></th>
|
||||
<td>
|
||||
<span class="badge <?php echo ($td_flag_state_self != "equal") ? ' animated fadeIn '.$section_self : $section_self; ?>">
|
||||
<?php
|
||||
echo getMyResult($td_emission_self);
|
||||
if($td_flag_state_self != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($td_emission_before_self).'</span>';
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<?php
|
||||
if($customer_settings['display']['st'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($st_emission_self)): ?>
|
||||
<span class="badge <?php echo ($st_flag_state_self != "equal") ? ' animated fadeIn '.$section_self : $section_self; ?>">
|
||||
<?php
|
||||
echo getMyResult($st_emission_self);
|
||||
if($st_flag_state_self != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($st_emission_before_self).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['mt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($mt_emission_self)): ?>
|
||||
<span class="badge <?php echo ($mt_flag_state_self != "equal") ? ' animated fadeIn '.$section_self : $section_self; ?>">
|
||||
<?php
|
||||
echo getMyResult($mt_emission_self);
|
||||
if($mt_flag_state_self != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($mt_emission_before_self).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['lt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($lt_emission_self)): ?>
|
||||
<span class="badge <?php echo ($lt_flag_state_self != "equal") ? ' animated fadeIn '.$section_self : $section_self; ?>">
|
||||
<?php
|
||||
echo getMyResult($lt_emission_self);
|
||||
if($lt_flag_state_self != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($lt_emission_before_self).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php
|
||||
endif;
|
||||
if($flag_em_other):
|
||||
?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php echo TXT_RESULT_OTHER; ?></th>
|
||||
<td>
|
||||
<?php if(isset($td_emission_other)): ?>
|
||||
<span class="badge <?php echo ($td_flag_state_other != "equal") ? ' animated fadeIn '.$section_other : $section_other; ?>">
|
||||
<?php
|
||||
echo getMyResult($td_emission_other);
|
||||
if($td_flag_state_other != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($td_emission_before_other).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
if($customer_settings['display']['st'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($st_emission_other)): ?>
|
||||
<span class="badge <?php echo ($st_flag_state_other != "equal") ? ' animated fadeIn '.$section_other : $section_other; ?>">
|
||||
<?php
|
||||
echo getMyResult($st_emission_other);
|
||||
if($st_flag_state_other != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($st_emission_before_other).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['mt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($mt_emission_other)): ?>
|
||||
<span class="badge <?php echo ($mt_flag_state_other != "equal") ? ' animated fadeIn '.$section_other : $section_other; ?>">
|
||||
<?php
|
||||
echo getMyResult($mt_emission_other);
|
||||
if($mt_flag_state_other != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($mt_emission_before_other).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
if($customer_settings['display']['lt'] == true):
|
||||
?>
|
||||
<td>
|
||||
<?php if(isset($lt_emission_other)): ?>
|
||||
<span class="badge <?php echo ($lt_flag_state_other != "equal") ? ' animated fadeIn '.$section_other : $section_other; ?>">
|
||||
<?php
|
||||
echo getMyResult($lt_emission_other);
|
||||
if($lt_flag_state_other != "equal") echo '<span class="badge-compare" data-toggle="tooltip" data-html="true" title="'.TXT_RESULT_TOOLTIP_LAST_VALUE.'">'.getMyResult($lt_emission_before_other).'</span>';
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
function createHelpLink($help_id, $help_text)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
|
||||
if($help_text == "" || $customer_settings['display']['section_help'] !== true) return;
|
||||
|
||||
echo '<p class="sectionSteps small"><a href="#" data-help-id="'.$help_id.'-help" class="btn btn-success btn-xs js-section-help"><i class="fa fa-chevron-down"></i> '.TXT_NAV_HELP_AND_INFO.'</a></p>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function createHelpContent($help_id, $help_text, $help_text_bg)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
|
||||
if($help_text == "" || $customer_settings['display']['section_help'] !== true) return;
|
||||
|
||||
echo '<div class="sectionHelpContent '.$help_id.'-help alert alert-success alert-dismissible" role="alert">';
|
||||
echo '<button type="button" data-help-id="'.$help_id.'-help" class="close js-section-help" aria-label="'.TXT_CLOSE.'"><span aria-hidden="true"><i class="fa fa-times"></i></span></button>';
|
||||
echo $help_text;
|
||||
|
||||
if($help_text_bg != "") echo '<br><p><a data-toggle="modal" href="#" data-target="#modal-'.$help_id.'" class="alert-link"><i class="fa fa-chevron-right"></i> '.TXT_NAV_HELP_AND_INFO_BG.'</a></p>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
811
r41/luxembourg/de/_core/includes/_functions_login.inc.php
Normal file
811
r41/luxembourg/de/_core/includes/_functions_login.inc.php
Normal file
@ -0,0 +1,811 @@
|
||||
<?php
|
||||
/**
|
||||
* Frontend Functions: Login
|
||||
*
|
||||
* @package co2rechner
|
||||
* @filesource
|
||||
* @author Jochen Seiter <info@bfig.de>
|
||||
* @copyright 2008, Buero fuer Internet Gestaltung
|
||||
*/
|
||||
/**
|
||||
* Login process
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function userLogin($user_name, $user_pass)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $login_error_message;
|
||||
GLOBAL $db;
|
||||
|
||||
if($user_name == "")
|
||||
{
|
||||
$_SESSION['message']['error']['user_name'] = TXT_STATUS_LOGIN_MISSING_USER_NAME;
|
||||
return;
|
||||
}
|
||||
|
||||
if($user_name != "" && checkEmailAddress($user_name) === false)
|
||||
{
|
||||
$_SESSION['message']['error']['user_name'] = TXT_STATUS_LOGIN_INVALID_USER_NAME;
|
||||
return;
|
||||
}
|
||||
|
||||
if($user_pass == "")
|
||||
{
|
||||
$_SESSION['message']['error']['user_password'] = TXT_STATUS_LOGIN_MISSING_PASSWORD;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$user_name = trim($user_name);
|
||||
$md5_user_pass = md5(trim($user_pass));
|
||||
|
||||
$sql = "SELECT user_id, user_email, client_id, user_active, user_rights, DATE_FORMAT(last_login,'%d.%m.%Y, %H:%i') as f_last_login FROM ".TABLE_USER." ";
|
||||
$sql .= "WHERE user_email = '".$db->escape($user_name)."' ";
|
||||
$sql .= "AND user_pass = '".$db->escape($md5_user_pass)."' ";
|
||||
$sql .= "AND client_id = '".$customer_settings['customer']['session_id']."' ";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
// User name and pw is not valid
|
||||
if(count($row) != 1)
|
||||
{
|
||||
$_SESSION['message']['error']['status'] = TXT_STATUS_LOGIN_NOT_VALID;
|
||||
return;
|
||||
}
|
||||
// User name and pw is valid
|
||||
elseif(count($row) == 1)
|
||||
{
|
||||
// Check if user has been deactivated
|
||||
if($row[0]->user_active == 0)
|
||||
{
|
||||
$_SESSION['message']['error']['status'] = TXT_STATUS_LOGIN_USER_DISABLED;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set Session variables for this user
|
||||
$_SESSION['user']['user_id'] = $row[0]->user_id;
|
||||
$_SESSION['user']['email'] = $row[0]->user_email;
|
||||
$_SESSION['user']['client_id'] = $row[0]->client_id;
|
||||
$_SESSION['user']['user_rights'] = $row[0]->user_rights;
|
||||
$_SESSION['user']['last_login'] = $row[0]->f_last_login;
|
||||
$_SESSION['user']['user_logged_in'] = true;
|
||||
$_SESSION['user']['user_just_logged_in'] = true;
|
||||
|
||||
// Unset Guest user
|
||||
$_SESSION['guest'] = "";
|
||||
|
||||
// Update "last_login"
|
||||
$sql = "UPDATE ".TABLE_USER." SET last_login = NOW(), log_amount = log_amount+1 ";
|
||||
$sql .= "WHERE user_id = '".$_SESSION['user']['user_id']."' AND client_id = '".$customer_settings['customer']['session_id']."'";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
header("Location: http://".$_SERVER['SERVER_NAME']."/".CONTENT_LANGUAGE."/account");
|
||||
exit;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login process
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function userRegister($user_name, $user_pass, $user_pass_repeat, $user_as, $user_as_result, $login_user_campaign)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
if($user_name == "")
|
||||
{
|
||||
$_SESSION['message']['error']['user_name'] = TXT_STATUS_LOGIN_MISSING_USER_NAME;
|
||||
return;
|
||||
}
|
||||
|
||||
if($user_name != "" && checkEmailAddress($user_name) === false)
|
||||
{
|
||||
$_SESSION['message']['error']['user_name'] = TXT_STATUS_LOGIN_INVALID_USER_NAME;
|
||||
return;
|
||||
}
|
||||
|
||||
if($user_pass == "" || $user_pass_repeat == "")
|
||||
{
|
||||
$_SESSION['message']['error']['user_password'] = TXT_STATUS_CREATE_ACCOUNT_INCOMPLETE_PASSWORD;
|
||||
return;
|
||||
}
|
||||
|
||||
if(strlen($user_pass) < 8)
|
||||
{
|
||||
$_SESSION['message']['error']['user_password'] = TXT_STATUS_CREATE_ACCOUNT_TOOSHORT_PASSWORD;
|
||||
return;
|
||||
}
|
||||
|
||||
if($user_pass != $user_pass_repeat)
|
||||
{
|
||||
$_SESSION['message']['error']['user_password'] = TXT_STATUS_CREATE_ACCOUNT_NOT_MATCHING_PASSWORD;
|
||||
return;
|
||||
}
|
||||
|
||||
if(sha1(md5($user_as)) != $user_as_result)
|
||||
{
|
||||
$_SESSION['message']['error']['user_as'] = TXT_STATUS_CREATE_ACCOUNT_WRONG_ANTISPAM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$user_name = trim($user_name);
|
||||
$md5_user_pass = md5(trim($user_pass));
|
||||
|
||||
$sql = "SELECT user_id FROM ".TABLE_USER." ";
|
||||
$sql .= "WHERE user_email = '".$db->escape($user_name)."' ";
|
||||
$sql .= "AND client_id = '".$customer_settings['customer']['session_id']."' ";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
// User name and client_id already exist
|
||||
if(count($row) > 0)
|
||||
{
|
||||
$_SESSION['message']['error']['status'] = TXT_STATUS_CREATE_ACCOUNT_DUPLICATE_USER;
|
||||
return;
|
||||
}
|
||||
// User name and client_id doesn't exist
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".TABLE_USER." ";
|
||||
$sql .= "(date_added, last_modified, user_email, user_pass, client_id, user_active, last_login, log_amount) ";
|
||||
$sql .= "VALUES('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '".$db->escape($user_name)."', '".md5($user_pass)."', '".$customer_settings['customer']['session_id']."', '1', '".date("Y-m-d H:i:s")."', '1') ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
|
||||
$last_insert_id = $db->insert_id;
|
||||
// Set Session variables for this user
|
||||
$_SESSION['user']['user_id'] = $last_insert_id;
|
||||
$_SESSION['user']['email'] = $user_name;
|
||||
$_SESSION['user']['client_id'] = $customer_settings['customer']['session_id'];
|
||||
$_SESSION['user']['user_rights'] = 1;
|
||||
$_SESSION['user']['user_logged_in'] = true;
|
||||
$_SESSION['user']['user_just_logged_in'] = true;
|
||||
|
||||
// Unset Guest user
|
||||
$_SESSION['guest'] = "";
|
||||
|
||||
/* Kampagne eintragen */
|
||||
if(isset($customer_settings['customer']['campaign']) && $customer_settings['customer']['campaign'] != "")
|
||||
{
|
||||
$sql = "UPDATE ".TABLE_USER." SET campaign = '".$db->escape($login_user_campaign)."' ";
|
||||
$sql .= "WHERE user_email = '".$_SESSION['user']['email']."' ";
|
||||
$sql .= "AND client_id = '".$customer_settings['customer']['session_id']."' ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
}
|
||||
|
||||
header("Location: http://".$_SERVER['SERVER_NAME']."/".CONTENT_LANGUAGE."/account");
|
||||
exit;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out extranet user
|
||||
*
|
||||
* @return string log out confirmation
|
||||
*/
|
||||
function extranetLogout()
|
||||
{
|
||||
/* delete all session variables */
|
||||
unset($_SESSION);
|
||||
$_SESSION = array();
|
||||
// delete session
|
||||
@session_destroy();
|
||||
// delete session cookies
|
||||
setcookie("sess","",0,"/");
|
||||
|
||||
header('Location: '.CFG_PROJECT_SERVER.$GLOBALS['langID']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate email address
|
||||
*
|
||||
* @param integer $email
|
||||
* @return boolean
|
||||
*/
|
||||
function checkEmailAddress($mail)
|
||||
{
|
||||
// http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690
|
||||
if (strlen($mail) > 256) return false;
|
||||
/*
|
||||
Pattern:
|
||||
^ Anker Line-Start
|
||||
\S{1,64} kein Whitespace - 1 bis 64 mal (local part)
|
||||
@ @-Zeichen
|
||||
\S+ kein Whitespace - mind. einmal (second level Domain)
|
||||
\. Punkt
|
||||
\S{2,6} kein Whitespace, 2 bis 6 mal (top level domain)
|
||||
$ Anker Line-End
|
||||
i Modifier: case-insensitive
|
||||
*/
|
||||
$pattern = '#^\S{1,64}@\S+\.\S{2,6}$#i';
|
||||
return (bool) preg_match($pattern, $mail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password reminder
|
||||
*
|
||||
* @param string $user_name
|
||||
* @return string
|
||||
*/
|
||||
function passwordReminder($user_name)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
if($user_name == "")
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = false;
|
||||
$return_message['error'] = TXT_STATUS_LOGIN_MISSING_USER_NAME;
|
||||
return($return_message);
|
||||
}
|
||||
|
||||
if($user_name != "" && checkEmailAddress($user_name) === false)
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = false;
|
||||
$return_message['error'] = TXT_STATUS_LOGIN_INVALID_USER_NAME;
|
||||
return($return_message);
|
||||
}
|
||||
|
||||
$sql = "SELECT user_id, user_active, user_email FROM ".TABLE_USER." ";
|
||||
$sql .= "WHERE user_email = '".$db->escape($user_name)."' AND client_id = '".$customer_settings['customer']['session_id']."'";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
// User name not valid
|
||||
if(count($row) != 1)
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = false;
|
||||
$return_message['error'] = TXT_PASSWORD_FORGOTTEN_USER_NOT_VALID;
|
||||
return $return_message;
|
||||
}
|
||||
// User name name is valid
|
||||
elseif(count($row) == 1)
|
||||
{
|
||||
// Check if user has been deactivated
|
||||
if($row[0]->user_active == 0)
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = false;
|
||||
$return_message['error'] = TXT_PASSWORD_FORGOTTEN_USER_NOT_ACTIVE;
|
||||
return $return_message;
|
||||
}
|
||||
|
||||
// Create new password
|
||||
$new_password = passwordGenerator("8");
|
||||
|
||||
// Update password
|
||||
|
||||
|
||||
$sql = "UPDATE ".TABLE_USER." SET user_pass = '".$db->escape(md5($new_password))."' ";
|
||||
$sql .= "WHERE user_id = '".$row[0]->user_id."'";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
|
||||
// Create email message
|
||||
$email_message = sprintf(TXT_PASSWORD_FORGOTTEN_EMAIL_MESSAGE, $new_password)."\n";
|
||||
|
||||
$email_mailto = $row[0]->user_email;
|
||||
$email_subject = $customer_settings['customer']['real_name'].': '.TXT_PASSWORD_FORGOTTEN_MAIL_SUBJECT;
|
||||
|
||||
// Send email
|
||||
if(@mail("$email_mailto","$email_subject","$email_message","From: ".$customer_settings['customer']['support_mail']."\n"."Reply-To:".$customer_settings['customer']['support_mail']."\n"."MIME-Version: 1.0\n"."Content-type: text/plain; charset=\"utf-8\"\n"."Content-transfer-encoding: quoted-printable\n"))
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = true;
|
||||
$return_message['success'] = sprintf(TXT_PASSWORD_FORGOTTEN_MAIL_SUCCESS, $email_mailto);
|
||||
return $return_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['status']['password_reminder'] = false;
|
||||
$return_message['error'] = TXT_PASSWORD_FORGOTTEN_MAIL_FAILURE;
|
||||
return $return_message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Password generator
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
function passwordGenerator($length)
|
||||
{
|
||||
// bugfix. to avoid human reading errors, the chars o,O,i,I,l,L,1,0 do not appear any more in the result string.
|
||||
$w_s = array ('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z',);
|
||||
|
||||
$w_s = array_merge($w_s,array_map('strtoupper',$w_s));
|
||||
$w_s = array_merge($w_s,array(2,3,4,5,6,7,8,9));
|
||||
|
||||
$max = count($w_s) - 1;
|
||||
|
||||
$pw = "";
|
||||
|
||||
for($i=0;$i<$length;$i++)
|
||||
{
|
||||
srand((double)microtime()*1000000);
|
||||
$wg = rand(1,$max);
|
||||
$pw .= $w_s[$wg];
|
||||
}
|
||||
|
||||
return $pw;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve user data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getUserData($user_id, $data_id = "", $year = "")
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
$data_array = array();
|
||||
|
||||
$sql = "SELECT data_id, DATE_FORMAT(date_added,'%d.%m.%y') as f_date_added, DATE_FORMAT(last_modified,'%d.%m.%y') as f_last_modified, data, emission, emission_total, emission_total_by_persons, target, target_total, target_total_by_persons, living_persons, person_calc_mode, year, offset_real_value FROM ".TABLE_DATA." ";
|
||||
$sql .= "WHERE user_id = '".$user_id."' ";
|
||||
if($data_id != "") $sql .= "AND data_id = '".$data_id."' ";
|
||||
if($year != "") $sql .= "AND year = '".$year."' ";
|
||||
$sql .= "ORDER BY year DESC";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$data_array[] = array('data_id' => $query_result->data_id,
|
||||
'date_added' => $query_result->f_date_added,
|
||||
'last_modified' => $query_result->f_last_modified,
|
||||
'data' => unserialize($query_result->data),
|
||||
'emission' => unserialize($query_result->emission),
|
||||
'emission_total' => $query_result->emission_total,
|
||||
'emission_total_by_persons' => $query_result->emission_total_by_persons,
|
||||
'target' => unserialize($query_result->target),
|
||||
'target_total' => $query_result->target_total,
|
||||
'target_total_by_persons' => $query_result->target_total_by_persons,
|
||||
'living_persons' => $query_result->living_persons,
|
||||
'person_calc_mode' => $query_result->person_calc_mode,
|
||||
'year' => $query_result->year,
|
||||
'offset_real_value' => $query_result->offset_real_value
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return($data_array);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save user data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function saveUserData()
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
GLOBAL $login_save;
|
||||
|
||||
// Reload-Check
|
||||
if(isset($_POST['challengeID']) && $_SESSION['data']['check_challengeID'] != $_POST['challengeID'])
|
||||
{
|
||||
$_SESSION['data']['check_challengeID'] = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// if($login_save == true)
|
||||
// {
|
||||
|
||||
$data_already_exists = getUserData($_SESSION['user']['user_id'], $data_id = "", $_SESSION['data']['living_year']);
|
||||
|
||||
if(isset($data_already_exists[0]['year']) && $_SESSION['data']['living_year'] == $data_already_exists[0]['year'])
|
||||
{
|
||||
/*
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
// <![CDATA[
|
||||
var confirmOverwrite;
|
||||
confirmOverwrite = confirm("<?php printf(TXT_JS_OVERWRITE_WARNING, $data_already_exists[0]['year']) ;?>");
|
||||
if (confirmOverwrite == false) window.location.href = "?cat=improve&login_save=false";
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
<?php
|
||||
*/
|
||||
// If confirmed:
|
||||
$login_save = false;
|
||||
$_SESSION['status']['edit'] = true;
|
||||
$_SESSION['status']['year'] = $data_already_exists[0]['year'];
|
||||
}
|
||||
// }
|
||||
|
||||
if(isset($_SESSION['status']['edit']) && $_SESSION['status']['edit'] === true && isset($_SESSION['status']['year']) && !empty($_SESSION['status']['year']))
|
||||
{
|
||||
$sql = "UPDATE ".TABLE_DATA." ";
|
||||
$sql .= "SET last_modified = '".date("Y-m-d H:i:s")."', data = '".$db->escape(serialize($_SESSION['data']))."', emission = '".$db->escape(serialize($_SESSION['emission']['td']))."', emission_total = '".$_SESSION['emission']['td']['total']."', emission_total_by_persons = '".$_SESSION['emission']['td']['total_by_persons']."', target = '".$db->escape(serialize($_SESSION['target']))."', target_total = '".$_SESSION['target']['total']."', target_total_by_persons = '".$_SESSION['target']['total_by_persons']."', living_persons = '".$_SESSION['data']['living_persons']."', person_calc_mode = '".$_SESSION['data']['person_calc_mode']."', year = '".$_SESSION['data']['living_year']."' ";
|
||||
$sql .= "WHERE user_id = '".$_SESSION['user']['user_id']."' AND client_id = '".$_SESSION['user']['client_id']."' AND year = '".$_SESSION['status']['year']."' ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
|
||||
unset($_SESSION['status']['edit']);
|
||||
unset($_SESSION['status']['year']);
|
||||
|
||||
$_SESSION['message'] = sprintf(TXT_STATUS_LOGIN_DATA_UPDATED, $_SESSION['data']['living_year']);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".TABLE_DATA." ";
|
||||
$sql .= "(date_added, last_modified, user_id, client_id, data, emission, emission_total, emission_total_by_persons, target, target_total, target_total_by_persons, living_persons, person_calc_mode, year) ";
|
||||
$sql .= "VALUES('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '".$_SESSION['user']['user_id']."', '".$_SESSION['user']['client_id']."', '".$db->escape(serialize($_SESSION['data']))."', '".$db->escape(serialize($_SESSION['emission']['td']))."', '".$_SESSION['emission']['td']['total']."', '".$_SESSION['emission']['td']['total_by_persons']."', '".$db->escape(serialize($_SESSION['target']))."', '".$_SESSION['target']['total']."', '".$_SESSION['target']['total_by_persons']."', '".$_SESSION['data']['living_persons']."', '".$_SESSION['data']['person_calc_mode']."', '".$_SESSION['data']['living_year']."') ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
|
||||
$aID = $db->insert_id;
|
||||
|
||||
$_SESSION['message'] = sprintf(TXT_STATUS_LOGIN_DATA_SAVED, $_SESSION['data']['living_year']);
|
||||
}
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
$_SESSION['data']['check_challengeID'] = "";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save offset before compensation
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
function saveOffset($tid, $user_id, $client_id, $data_id, $offset_value, $offset_year)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
// Reload-Check
|
||||
if(isset($_POST['challengeID']) && $_SESSION['data']['check_challengeID'] != $_POST['challengeID'])
|
||||
{
|
||||
// $_SESSION['data']['check_challengeID'] = "";
|
||||
// return;
|
||||
}
|
||||
|
||||
if(isset($tid) && !empty($tid) && isset($user_id) && !empty($user_id) && isset($client_id) && !empty($client_id) && isset($offset_value) && !empty($offset_value) && isset($offset_year) && !empty($offset_year))
|
||||
{
|
||||
$sql = "INSERT INTO ".TABLE_OFFSET." ";
|
||||
$sql .= "(date_added, last_modified, t_id, user_id, client_id, offset_value, offset_year) ";
|
||||
$sql .= "VALUES('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '".$db->escape($tid)."', '".$user_id."', '".$client_id."', '".$db->escape($offset_value)."', '".$db->escape($offset_year)."') ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
|
||||
$aID = $db->insert_id;
|
||||
|
||||
// $_SESSION['message'] = sprintf(TXT_STATUS_LOGIN_DATA_SAVED, $_SESSION['data']['living_year']);
|
||||
}
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
$_SESSION['data']['check_challengeID'] = "";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update offset after compensation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function updateOffset()
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
if(isset($_POST['tid']) || !empty($_POST['tid'])) $tid = $_POST['tid'];
|
||||
else return;
|
||||
|
||||
if(isset($_POST['user_id']) || !empty($_POST['user_id'])) $user_id = $_POST['user_id'];
|
||||
else return;
|
||||
|
||||
if(isset($_POST['client_id']) || !empty($_POST['client_id'])) $client_id = $_POST['client_id'];
|
||||
else return;
|
||||
|
||||
if(isset($_POST['offset_value']) || !empty($_POST['offset_value'])) $offset_value = $_POST['offset_value'];
|
||||
else return;
|
||||
|
||||
if(isset($_POST['offset_year']) || !empty($_POST['offset_year'])) $offset_year = $_POST['offset_year'];
|
||||
else return;
|
||||
|
||||
|
||||
$sql = "SELECT user_id FROM ".TABLE_OFFSET." ";
|
||||
$sql .= "WHERE user_id = '".$db->escape($user_id)."' AND client_id = '".$db->escape($client_id)."' AND offset_year = '".$db->escape($offset_year)."' AND t_id = '".$db->escape($tid)."' ";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
// User id is valid
|
||||
if(count($row) == 1)
|
||||
{
|
||||
$sql = "UPDATE ".TABLE_DATA." ";
|
||||
$sql .= "SET offset_real_value = offset_real_value+".$offset_value." ";
|
||||
$sql .= "WHERE user_id = '".$db->escape($user_id)."' AND client_id = '".$db->escape($client_id)."' AND year = '".$db->escape($offset_year)."'";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if Guest User already has an account
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function checkGuestAccount()
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
$session_id = session_id();
|
||||
if($session_id == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$user_name = $session_id.'@'.$customer_settings['customer']['session_id'].'.guest';
|
||||
$user_pass = "default";
|
||||
|
||||
$sql = "SELECT user_id FROM ".TABLE_USER." ";
|
||||
$sql .= "WHERE user_email = '".$db->escape($user_name)."' ";
|
||||
$sql .= "AND client_id = '".$customer_settings['customer']['session_id']."'";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
// User name and client_id already exist
|
||||
if(count($row) > 0)
|
||||
{
|
||||
$_SESSION['guest']['user_id'] = $row[0]->user_id;
|
||||
$_SESSION['guest']['client_id'] = $customer_settings['customer']['session_id'];
|
||||
$_SESSION['guest']['user_logged_in'] = true;
|
||||
$_SESSION['guest']['account_exists'] = true;
|
||||
return;
|
||||
}
|
||||
// User name and client_id doesn't exist
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".TABLE_USER." ";
|
||||
$sql .= "(date_added, last_modified, user_email, user_pass, client_id, user_active, last_login, log_amount) ";
|
||||
$sql .= "VALUES('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '".$db->escape($user_name)."', '".md5($user_pass)."', '".$customer_settings['customer']['session_id']."', '1', '".date("Y-m-d H:i:s")."', '1') ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
|
||||
$last_insert_id = $db->insert_id;
|
||||
// Set Session variables for this user
|
||||
$_SESSION['guest']['user_id'] = $last_insert_id;
|
||||
$_SESSION['guest']['email'] = $user_name;
|
||||
$_SESSION['guest']['client_id'] = $customer_settings['customer']['session_id'];
|
||||
$_SESSION['guest']['user_logged_in'] = true;
|
||||
|
||||
$_SESSION['guest']['account_exists'] = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save guest user data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function saveGuestData()
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
if(!isset($_SESSION['guest']['user_id'])) return;
|
||||
|
||||
$sql = "SELECT data_id FROM ".TABLE_DATA." ";
|
||||
$sql .= "WHERE user_id = '".$db->escape($_SESSION['guest']['user_id'])."' ";
|
||||
$sql .= "AND client_id = '".$customer_settings['customer']['session_id']."' ";
|
||||
$sql .= "AND year = '".$_SESSION['data']['living_year']."'";
|
||||
|
||||
$row = $db->get_results($sql);
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
|
||||
// Guest user name and client_id already exist
|
||||
if(count($row) > 0)
|
||||
{
|
||||
$sql = "UPDATE ".TABLE_DATA." ";
|
||||
$sql .= "SET last_modified = '".date("Y-m-d H:i:s")."', data = '".$db->escape(serialize($_SESSION['data']))."', emission = '".$db->escape(serialize($_SESSION['emission']['td']))."', emission_total = '".$_SESSION['emission']['td']['total']."', emission_total_by_persons = '".$_SESSION['emission']['td']['total_by_persons']."', target = '".$db->escape(serialize($_SESSION['target']))."', target_total = '".$_SESSION['target']['total']."', target_total_by_persons = '".$_SESSION['target']['total_by_persons']."', living_persons = '".$_SESSION['data']['living_persons']."', person_calc_mode = '".$_SESSION['data']['person_calc_mode']."', year = '".$_SESSION['data']['living_year']."' ";
|
||||
$sql .= "WHERE user_id = '".$_SESSION['guest']['user_id']."' AND client_id = '".$_SESSION['guest']['client_id']."' AND year = '".$_SESSION['data']['living_year']."' ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".TABLE_DATA." ";
|
||||
$sql .= "(date_added, last_modified, user_id, client_id, data, emission, emission_total, emission_total_by_persons, target, target_total, target_total_by_persons, living_persons, person_calc_mode, year) ";
|
||||
$sql .= "VALUES('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '".$_SESSION['guest']['user_id']."', '".$_SESSION['guest']['client_id']."', '".$db->escape(serialize($_SESSION['data']))."', '".$db->escape(serialize($_SESSION['emission']['td']))."', '".$_SESSION['emission']['td']['total']."', '".$_SESSION['emission']['td']['total_by_persons']."', '".$db->escape(serialize($_SESSION['target']))."', '".$_SESSION['target']['total']."', '".$_SESSION['target']['total_by_persons']."', '".$_SESSION['data']['living_persons']."', '".$_SESSION['data']['person_calc_mode']."', '".$_SESSION['data']['living_year']."') ";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
}
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve bookmark_data
|
||||
* 2021-12-31: Zweite Tabelle 'bookmark_data_2' eingeführt für Daten ab 2022
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getBookmarkData($bookmark)
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
$data_array = array();
|
||||
|
||||
// 2021-12-31: Bookmarks VOR 2022 wurden in 'bookmark_data' gespeichert
|
||||
$sql = "SELECT data_id, DATE_FORMAT(date_added,'%d.%m.%y') as f_date_added, DATE_FORMAT(last_modified,'%d.%m.%y') as f_last_modified, email, name, address, zip, city, district, school, data, emission, emission_self, emission_other, kwh, performance FROM ".TABLE_BOOKMARK_DATA." ";
|
||||
$sql .= "WHERE bookmark_id = '".$db->escape($bookmark)."' AND client_id = '".$customer_settings['customer']['session_id']."'";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$data_array[] = array('data_id' => $query_result->data_id,
|
||||
'date_added' => $query_result->f_date_added,
|
||||
'last_modified' => $query_result->f_last_modified,
|
||||
'email' => $query_result->email,
|
||||
'name' => $query_result->name,
|
||||
'address' => $query_result->address,
|
||||
'zip' => $query_result->zip,
|
||||
'city' => $query_result->city,
|
||||
'district' => $query_result->district,
|
||||
'school' => $query_result->school,
|
||||
'data' => json_decode($query_result->data, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
|
||||
// Kein Treffer in 'bookmark_data':
|
||||
// 2021-12-31: Bookmarks AB 2022 werden in 'bookmark_data_2' gespeichert
|
||||
if(empty($data_array)):
|
||||
|
||||
$sql = "SELECT data_id, DATE_FORMAT(date_added,'%d.%m.%y') as f_date_added, DATE_FORMAT(last_modified,'%d.%m.%y') as f_last_modified, email, name, address, zip, city, district, school, data, emission, emission_self, emission_other, kwh, performance FROM ".TABLE_BOOKMARK_DATA_2." ";
|
||||
$sql .= "WHERE bookmark_id = '".$db->escape($bookmark)."' AND client_id = '".$customer_settings['customer']['session_id']."'";
|
||||
|
||||
if($result = $db->get_results($sql))
|
||||
{
|
||||
foreach($result as $query_result)
|
||||
{
|
||||
$data_array[] = array('data_id' => $query_result->data_id,
|
||||
'date_added' => $query_result->f_date_added,
|
||||
'last_modified' => $query_result->f_last_modified,
|
||||
'email' => $query_result->email,
|
||||
'name' => $query_result->name,
|
||||
'address' => $query_result->address,
|
||||
'zip' => $query_result->zip,
|
||||
'city' => $query_result->city,
|
||||
'district' => $query_result->district,
|
||||
'school' => $query_result->school,
|
||||
'data' => json_decode($query_result->data, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($GLOBALS['EZSQL_ERROR'])) db_error($GLOBALS['EZSQL_ERROR'], __LINE__, __FILE__, $rollback = false, $exit = true);
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
return($data_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save bookmark data
|
||||
* 2021-12-31: Zweite Tabelle 'bookmark_data_2' eingeführt für Daten ab 2022
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function saveBookmarkData()
|
||||
{
|
||||
GLOBAL $customer_settings;
|
||||
GLOBAL $db;
|
||||
|
||||
$bookmark_id = createBookmarkID('16'); // Note: DB field 'bookmark_id' is VARCHAR(16)
|
||||
$modules_data = '';
|
||||
|
||||
(isset($_SESSION['data']['bookmark_status']) && $_SESSION['data']['bookmark_status'] != "") ? $status = $_SESSION['data']['bookmark_status'] : $status = "0";
|
||||
|
||||
// 2020-06-23: Mantis 1770
|
||||
if(isset($customer_settings['modules']) && count($customer_settings['modules']) > 0):
|
||||
|
||||
if(isset($_POST['modules'])) $modules_data = json_encode($_POST['modules']);
|
||||
|
||||
endif;
|
||||
/*
|
||||
(isset($_SESSION['data']['bookmark_data']['email']) && $_SESSION['data']['bookmark_data']['email'] != "") ? $email = $_SESSION['data']['bookmark_data']['email'] : $email = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['password']) && $_SESSION['data']['bookmark_data']['password'] != "") ? $password = $_SESSION['data']['bookmark_data']['password'] : $password = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['name']) && $_SESSION['data']['bookmark_data']['name'] != "") ? $name = $_SESSION['data']['bookmark_data']['name'] : $name = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['address']) && $_SESSION['data']['bookmark_data']['address'] != "") ? $address = $_SESSION['data']['bookmark_data']['address'] : $address = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['zip']) && $_SESSION['data']['bookmark_data']['zip'] != "") ? $zip = $_SESSION['data']['bookmark_data']['zip'] : $zip = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['city']) && $_SESSION['data']['bookmark_data']['city'] != "") ? $city = $_SESSION['data']['bookmark_data']['city'] : $city = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['district']) && $_SESSION['data']['bookmark_data']['district'] != "") ? $district = $_SESSION['data']['bookmark_data']['district'] : $district = "";
|
||||
(isset($_SESSION['data']['bookmark_data']['school']) && $_SESSION['data']['bookmark_data']['school'] != "") ? $school = $_SESSION['data']['bookmark_data']['school'] : $school = "";
|
||||
*/
|
||||
|
||||
// Clean up 'data'
|
||||
unset($_SESSION['data']['bookmark_status']);
|
||||
unset($_SESSION['data']['do']);
|
||||
|
||||
// 2021-12-31: Ab 2022 in 'bookmark_data_2' speichern
|
||||
if(date('Y') >= 2022):
|
||||
$sql = "INSERT INTO ".TABLE_BOOKMARK_DATA_2." ";
|
||||
else:
|
||||
$sql = "INSERT INTO ".TABLE_BOOKMARK_DATA." ";
|
||||
endif;
|
||||
|
||||
$sql .= "(date_added, last_modified, bookmark_id, client_id, version, modules_data, data, emission, emission_self, emission_other, kwh, performance, emission_td_total, status) ";
|
||||
$sql .= "VALUES(
|
||||
'".date("Y-m-d H:i:s")."',
|
||||
'".date("Y-m-d H:i:s")."',
|
||||
'".$bookmark_id."',
|
||||
'".$customer_settings['customer']['session_id']."',
|
||||
'".$customer_settings['version']."',
|
||||
'".$db->escape($modules_data)."',
|
||||
'".json_encode($_SESSION['data'])."',
|
||||
'".json_encode($_SESSION['emission'])."',
|
||||
'".json_encode($_SESSION['emission_self'])."',
|
||||
'".json_encode($_SESSION['emission_other'])."',
|
||||
'".json_encode($_SESSION['kwh'])."',
|
||||
'".json_encode($_SESSION['performance'])."',
|
||||
'".$db->escape($_SESSION['emission']['td']['total'])."',
|
||||
'".$db->escape($status)."'
|
||||
)";
|
||||
|
||||
if($db->query($sql) === false) db_error($sql, __LINE__, __FILE__, $rollback = true, $exit = true);
|
||||
|
||||
if(DEBUG_SQL) $db->debug();
|
||||
|
||||
|
||||
return $bookmark_id;
|
||||
}
|
||||
|
||||
?>
|
||||
469
r41/luxembourg/de/_core/includes/_functions_scenario.inc.php
Normal file
469
r41/luxembourg/de/_core/includes/_functions_scenario.inc.php
Normal file
@ -0,0 +1,469 @@
|
||||
<?php
|
||||
/**
|
||||
* Calculate optimum: "Zuhause": "Heizung"
|
||||
*/
|
||||
function getOptimumByHeating()
|
||||
{
|
||||
global $factor_living_hs_type;
|
||||
global $factor_living_hc_cy;
|
||||
global $factor_living_hs_co2_conversion;
|
||||
|
||||
|
||||
|
||||
/* Input validation */
|
||||
if(isset($_SESSION['data']['living_hc_space']))
|
||||
{
|
||||
$_SESSION['data']['living_hc_space'] = str_replace(",", ".", $_SESSION['data']['living_hc_space']);
|
||||
$_SESSION['data']['living_hc_space'] = (float) $_SESSION['data']['living_hc_space'];
|
||||
}
|
||||
if(isset($_SESSION['data']['living_hs_consumption']))
|
||||
{
|
||||
$_SESSION['data']['living_hs_consumption'] = str_replace(",", ".", $_SESSION['data']['living_hs_consumption']);
|
||||
$_SESSION['data']['living_hs_consumption'] = (float) $_SESSION['data']['living_hs_consumption'];
|
||||
}
|
||||
|
||||
|
||||
$_SESSION['optimum']['living_hs'] = 0;
|
||||
|
||||
if(!isset($_SESSION['data']['living_hs_type']) || empty($_SESSION['data']['living_hs_type'])) return;
|
||||
|
||||
|
||||
/* Calculate optimum */
|
||||
$_SESSION['optimum']['living_hs'] =
|
||||
// bcmul($factor_living_hc_cy[$_SESSION['data']['living_hc_type']][$_SESSION['data']['living_hc_cy']], $_SESSION['data']['living_hc_space'], 2);
|
||||
bcmul($factor_living_hc_cy[$_SESSION['data']['living_hc_type']]['neh'], $_SESSION['data']['living_hc_space'], 2);
|
||||
|
||||
$_SESSION['optimum']['living_hs'] =
|
||||
bcmul($_SESSION['optimum']['living_hs'], $factor_living_hs_co2_conversion[$_SESSION['data']['living_hs_type']], 2);
|
||||
|
||||
|
||||
/* divided by $_SESSION['data']['living_persons'] */
|
||||
$_SESSION['optimum']['living_hs'] = bcdiv($_SESSION['optimum']['living_hs'], $_SESSION['data']['living_persons']);
|
||||
|
||||
|
||||
/* Calculate Potential */
|
||||
$_SESSION['potential']['living_hs'] = bcsub($_SESSION['emission']['td']['living_hs'], $_SESSION['optimum']['living_hs'], 2);
|
||||
|
||||
$_SESSION['potential']['living_hs'] = bcsub($_SESSION['emission']['td']['living_hs'], $_SESSION['optimum']['living_hs'], 2);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate optimum: "Zuhause": "Strom"
|
||||
*/
|
||||
function getOptimumByPower()
|
||||
{
|
||||
global $factor_living_pt_type;
|
||||
global $factor_living_pt_estimate_consumption;
|
||||
global $factor_living_pt_estimate_consumption_basic;
|
||||
global $factor_living_pt_type_greenpower;
|
||||
global $evaluation_emission_living_pt;
|
||||
|
||||
$_SESSION['optimum']['living_pt'] = 0;
|
||||
$_SESSION['optimum']['living_pt_by_persons'] = 0;
|
||||
|
||||
if($_SESSION['data']['living_pt_consumption_type'] == "detail")
|
||||
{
|
||||
$evaluation_living_pt_consumption_kwh = $_SESSION['data']['living_pt_consumption'];
|
||||
}
|
||||
if($_SESSION['data']['living_pt_consumption_type'] == "estimate")
|
||||
{
|
||||
$evaluation_living_pt_consumption_kwh = $_SESSION['data']['living_pt_consumption_estimate_kwh'];
|
||||
if(isset($_SESSION['data']['living_hs_consumption_estimate_warmwater_kwh'])) $evaluation_living_pt_consumption_kwh = bcsub($_SESSION['data']['living_pt_consumption_estimate_kwh'], $_SESSION['data']['living_hs_consumption_estimate_warmwater_kwh']);
|
||||
}
|
||||
|
||||
|
||||
/* Check if "living_pt_type" has an "Ökostrom-Flag" */
|
||||
if(in_array($_SESSION['data']['living_pt_type'], $factor_living_pt_type_greenpower))
|
||||
{
|
||||
/* 1 person */
|
||||
// $_SESSION['optimum']['living_pt'] =
|
||||
// bcsub($_SESSION['data']['living_pt_consumption'], $evaluation_emission_living_pt[$_SESSION['data']['living_persons']]["sehrgut"]["max"]);
|
||||
|
||||
$_SESSION['optimum']['living_pt'] =
|
||||
bcmul($evaluation_emission_living_pt[$_SESSION['data']['living_persons']]["sehrgut"]["max"], $factor_living_pt_type[$_SESSION['data']['living_pt_type']]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 1 person */
|
||||
$_SESSION['optimum']['living_pt'] =
|
||||
bcmul($evaluation_living_pt_consumption_kwh, $factor_living_pt_type["strom_oeko"]);
|
||||
}
|
||||
|
||||
|
||||
/* divided by $_SESSION['data']['living_persons'] */
|
||||
$_SESSION['optimum']['living_pt_by_persons'] =
|
||||
bcdiv($_SESSION['optimum']['living_pt'], $_SESSION['data']['living_persons']);
|
||||
|
||||
|
||||
/* Calculate Potential */
|
||||
$_SESSION['potential']['living_pt'] =
|
||||
bcsub($_SESSION['emission']['td']['living_pt'], $_SESSION['optimum']['living_pt'], 2);
|
||||
|
||||
$_SESSION['potential']['living_pt_by_persons'] =
|
||||
bcsub($_SESSION['emission']['td']['living_pt_by_persons'], $_SESSION['optimum']['living_pt_by_persons'], 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* "Ernährung": Calculate optimum
|
||||
*/
|
||||
function getOptimumByFood()
|
||||
{
|
||||
global $factor_food_details_age;
|
||||
global $factor_food_details_activity;
|
||||
global $factor_food_details_sport;
|
||||
global $factor_food_eating_habits;
|
||||
|
||||
$_SESSION['optimum']['total_food'] = 0;
|
||||
|
||||
if($_SESSION['data']['food_calc_mode'] == "detail")
|
||||
{
|
||||
foreach($_SESSION['data']['food_details'] as $key => $val)
|
||||
{
|
||||
if($key > 0 && $key <= $_SESSION['data']['food_persons'])
|
||||
{
|
||||
/* input validation */
|
||||
if(!isset($val['weight'])) $val['weight'] = 0;
|
||||
|
||||
$val['weight'] = str_replace(",", ".", $val['weight']);
|
||||
$val['weight'] = (float) $val['weight'];
|
||||
$_SESSION['data']['food_details'][$key]['weight'] = $val['weight'];
|
||||
|
||||
if($_SESSION['data']['food_details'][$key]['weight'] == 0) return;
|
||||
|
||||
/* kcal / Person */
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = 0;
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = bcmul($factor_food_details_age[$val['sex']][$val['age']]['kcal'], $val['weight'], 2); // Kalorienbedarf Frauen / Männer detailliert
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = bcadd($_SESSION['data']['food_detail_kcal'][$key], $factor_food_details_age[$val['sex']][$val['age']]['offset'], 2); // Kalorienbedarf Frauen / Männer detailliert
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = bcmul($_SESSION['data']['food_detail_kcal'][$key], $factor_food_details_activity[$val['activity']], 2);
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = bcmul($_SESSION['data']['food_detail_kcal'][$key], $factor_food_details_sport[$val['sport']], 2);
|
||||
|
||||
/* CO2 Berechnung auf Basis des Kalorienbedarfs */
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['data']['food_detail_kcal'][$key], FOOD_KCAL_CO2TONS, 2);
|
||||
}
|
||||
}
|
||||
foreach($_SESSION['data']['food_eating_habits'] as $key => $val)
|
||||
{
|
||||
if($key > 0 && $key <= $_SESSION['data']['food_persons'])
|
||||
{
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['type']["vegan"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['regional']["nur"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['seasonal']["nur"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['frozenfoods']["nie"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['oeko']["oft"], 2);
|
||||
|
||||
/**
|
||||
* Get optimum total values for "Ernährung"
|
||||
*/
|
||||
$_SESSION['optimum']['total_food'] += $_SESSION['optimum']['food_detail'][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($_SESSION['data']['food_calc_mode'] == "general")
|
||||
{
|
||||
$key = 0;
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = 0;
|
||||
$_SESSION['data']['food_detail_kcal'][$key] = bcmul($_SESSION['data']['food_persons'], FOOD_KCAL_DEFAULT_VALUE);
|
||||
|
||||
/* CO2 Berechnung auf Basis des Kalorienbedarfs */
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['data']['food_detail_kcal'][$key], FOOD_KCAL_CO2TONS, 2);
|
||||
foreach($_SESSION['data']['food_eating_habits'] as $key => $val)
|
||||
{
|
||||
if($key == 0)
|
||||
{
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['type']["vegan"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['regional']["nur"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['seasonal']["nur"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['frozenfoods']["nie"], 2);
|
||||
$_SESSION['optimum']['food_detail'][$key] = bcmul($_SESSION['optimum']['food_detail'][$key], $factor_food_eating_habits['oeko']["oft"], 2);
|
||||
|
||||
/**
|
||||
* Get optimum total values for "Ernährung"
|
||||
*/
|
||||
$_SESSION['optimum']['total_food'] += $_SESSION['optimum']['food_detail'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* divided by $_SESSION['data']['living_persons'] */
|
||||
$_SESSION['optimum']['total_food_by_persons'] =
|
||||
bcdiv($_SESSION['optimum']['total_food'], $_SESSION['data']['food_persons']);
|
||||
|
||||
|
||||
/* Calculate Potential */
|
||||
$_SESSION['potential']['total_food'] =
|
||||
bcsub($_SESSION['emission']['td']['total_food'], $_SESSION['optimum']['total_food'], 2);
|
||||
|
||||
$_SESSION['potential']['total_food_by_persons'] =
|
||||
bcsub($_SESSION['emission']['td']['total_food_by_persons'], $_SESSION['optimum']['total_food_by_persons'], 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Konsum": Calculate target emissions
|
||||
*/
|
||||
function getOptimumByConsumption()
|
||||
{
|
||||
global $factor_consumption_consumer_habits;
|
||||
global $factor_consumption_consumer_criteria;
|
||||
global $factor_consumption_hotel_visits;
|
||||
global $factor_consumption_house_type;
|
||||
global $factor_consumption_vehicles;
|
||||
global $factor_consumption_living_space_per_person;
|
||||
global $factor_consumption_household_size;
|
||||
|
||||
$_SESSION['optimum']['total_consumption'] = 0;
|
||||
|
||||
$_SESSION['optimum']['consumption'] = array();
|
||||
|
||||
if(isset($_SESSION['data']['consumption_persons']) && !empty($_SESSION['data']['consumption_persons']))
|
||||
{
|
||||
if($_SESSION['data']['consumption_mode'] == "yes")
|
||||
{
|
||||
for($ii = 1; $ii <= $_SESSION['data']['consumption_persons']; $ii++)
|
||||
{
|
||||
$_SESSION['optimum']['consumption'][$ii] = AVERAGE_EMISSION_VALUE_CONSUMPTION;
|
||||
|
||||
/* Eingabefaktoren berechnen */
|
||||
if(isset($_SESSION['data']['consumption_consumer_habits'][$ii]))
|
||||
{
|
||||
/* "Kaufverhalten" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_consumer_habits["sparsam"], 2);
|
||||
}
|
||||
if(isset($_SESSION['data']['consumption_consumer_criteria'][$ii]))
|
||||
{
|
||||
/* "Kaufkriterien" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_consumer_criteria["lang"], 2);
|
||||
}
|
||||
if(isset($_SESSION['data']['consumption_hotel_visits'][$ii]))
|
||||
{
|
||||
/* "Hotelübernachtungen" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_hotel_visits["zwei"], 2);
|
||||
}
|
||||
/**
|
||||
* Get optimum total values
|
||||
*/
|
||||
$_SESSION['optimum']['total_consumption'] += $_SESSION['optimum']['consumption'][$ii];
|
||||
}
|
||||
}
|
||||
if($_SESSION['data']['consumption_mode'] == "no")
|
||||
{
|
||||
$ii = 1;
|
||||
|
||||
$_SESSION['optimum']['consumption'][$ii] = AVERAGE_EMISSION_VALUE_CONSUMPTION;
|
||||
|
||||
/* Eingabefaktoren berechnen */
|
||||
if(isset($_SESSION['data']['consumption_consumer_habits'][$ii]))
|
||||
{
|
||||
/* "Kaufverhalten" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_consumer_habits["sparsam"], 2);
|
||||
}
|
||||
if(isset($_SESSION['data']['consumption_consumer_criteria'][$ii]))
|
||||
{
|
||||
/* "Kaufkriterien" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_consumer_criteria["lang"], 2);
|
||||
}
|
||||
if(isset($_SESSION['data']['consumption_hotel_visits'][$ii]))
|
||||
{
|
||||
/* "Hotelübernachtungen" */
|
||||
$_SESSION['optimum']['consumption'][$ii] =
|
||||
bcmul($_SESSION['optimum']['consumption'][$ii],
|
||||
$factor_consumption_hotel_visits["zwei"], 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get optimum total values
|
||||
*/
|
||||
$_SESSION['optimum']['total_consumption'] += $_SESSION['optimum']['consumption'][$ii];
|
||||
|
||||
$_SESSION['optimum']['total_consumption'] = bcmul($_SESSION['optimum']['total_consumption'], $_SESSION['data']['consumption_persons'], 2);
|
||||
}
|
||||
|
||||
/* Hintergrundfaktoren berechnen */
|
||||
if(isset($_SESSION['data']['consumption_house_type']))
|
||||
{
|
||||
/* "Haustyp" */
|
||||
$_SESSION['optimum']['total_consumption'] =
|
||||
bcmul($_SESSION['optimum']['total_consumption'],
|
||||
$factor_consumption_house_type[$_SESSION['data']['consumption_house_type']], 2);
|
||||
}
|
||||
if(isset($_SESSION['data']['consumption_vehicles']))
|
||||
{
|
||||
/* "Fahrzeuge" */
|
||||
$_SESSION['optimum']['total_consumption'] =
|
||||
bcmul($_SESSION['optimum']['total_consumption'],
|
||||
$factor_consumption_vehicles[$_SESSION['data']['consumption_vehicles']], 2);
|
||||
}
|
||||
|
||||
/* "Haushaltsgröße" */
|
||||
$_SESSION['optimum']['total_consumption'] =
|
||||
bcmul($_SESSION['optimum']['total_consumption'],
|
||||
$factor_consumption_household_size[$_SESSION['data']['living_persons']], 2);
|
||||
|
||||
if(isset($_SESSION['data']['consumption_living_space']) && !empty($_SESSION['data']['consumption_living_space']))
|
||||
{
|
||||
/* Input validation */
|
||||
if(isset($_SESSION['data']['consumption_living_space']))
|
||||
{
|
||||
$_SESSION['data']['consumption_living_space'] = str_replace(",", ".", $_SESSION['data']['consumption_living_space']);
|
||||
$_SESSION['data']['consumption_living_space'] = (float) $_SESSION['data']['consumption_living_space'];
|
||||
}
|
||||
/* "Wohnfläche pro Person" */
|
||||
|
||||
foreach($factor_consumption_living_space_per_person[$_SESSION['data']['living_persons']] as $key => $val)
|
||||
{
|
||||
if(bcdiv($_SESSION['data']['consumption_living_space'], $_SESSION['data']['living_persons']) >= $val["min"] && bcdiv($_SESSION['data']['consumption_living_space'], $_SESSION['data']['living_persons']) <= $val["max"])
|
||||
{
|
||||
$_SESSION['optimum']['total_consumption'] =
|
||||
bcmul($_SESSION['optimum']['total_consumption'], $key, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* divided by $_SESSION['data']['living_persons'] */
|
||||
$_SESSION['optimum']['total_consumption_by_persons'] =
|
||||
bcdiv($_SESSION['optimum']['total_consumption'], $_SESSION['data']['consumption_persons']);
|
||||
|
||||
|
||||
/* Calculate Potential */
|
||||
$_SESSION['potential']['total_consumption'] =
|
||||
bcsub($_SESSION['emission']['td']['total_consumption'], $_SESSION['optimum']['total_consumption'], 2);
|
||||
|
||||
$_SESSION['potential']['total_consumption_by_persons'] =
|
||||
bcsub($_SESSION['emission']['td']['total_consumption_by_persons'], $_SESSION['optimum']['total_consumption_by_persons'], 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function scenarioLivingHs()
|
||||
{
|
||||
|
||||
GLOBAL $factor_living_hs_type;
|
||||
GLOBAL $factor_living_hs_co2_conversion;
|
||||
GLOBAL $factor_living_hc_cy;
|
||||
GLOBAL $fd_living_hs_avg_room_temp;
|
||||
GLOBAL $fd_living_hs_airing_habits;
|
||||
GLOBAL $fd_living_hs_warm_water_consumption;
|
||||
GLOBAL $fd_living_hs_saving_fittings;
|
||||
GLOBAL $fd_living_hc_type;
|
||||
GLOBAL $fd_living_hc_cy;
|
||||
GLOBAL $fd_living_hs_type;
|
||||
GLOBAL $customer_settings;
|
||||
|
||||
if($_SESSION['data']['living_hs_consumption_type'] == "estimate") $evaluation_living_consumption = $_SESSION['data']['living_hs_consumption_estimate_kwh'] + $_SESSION['data']['living_hs_consumption_estimate_warmwater_kwh'];
|
||||
if($_SESSION['data']['living_hs_consumption_type'] == "detail") $evaluation_living_consumption = $_SESSION['data']['living_hs_consumption'];
|
||||
|
||||
if($_SESSION['data']['living_hs_consumption_type'] == "estimate") $evaluation_living_hs_kennwert = 1;
|
||||
if($_SESSION['data']['living_hs_consumption_type'] == "detail") $evaluation_living_hs_kennwert = bcdiv($factor_living_hs_type[$_SESSION['data']['living_hs_type']], $factor_living_hs_co2_conversion[$_SESSION['data']['living_hs_type']], 2 );
|
||||
$evaluation_living_hs_kennwert = bcmul($evaluation_living_hs_kennwert, $evaluation_living_consumption, 2);
|
||||
$evaluation_living_hs_kennwert = bcdiv($evaluation_living_hs_kennwert, $_SESSION['data']['living_hc_space'], 2 );
|
||||
|
||||
$evaluation_living_hs_kennwert_neh = $factor_living_hc_cy[$_SESSION['data']['living_hc_type']]["neh"];
|
||||
|
||||
$evaluation_living_hs_difference = bcdiv($evaluation_living_hs_kennwert, $evaluation_living_hs_kennwert_neh, 2);
|
||||
$evaluation_living_hs_difference = bcsub(1, $evaluation_living_hs_difference, 2);
|
||||
$evaluation_living_hs_difference = bcmul($evaluation_living_hs_difference, 100);
|
||||
if($evaluation_living_hs_difference < 0) $evaluation_living_hs_difference = bcmul($evaluation_living_hs_difference, -1);
|
||||
|
||||
$text = "";
|
||||
|
||||
|
||||
/* Set flag for "berechnen"-Button */
|
||||
$improve_button_flag = false;
|
||||
|
||||
// $text .= '<h3>'.TXT_IMPROVE_EVALUATION.'</h3>';
|
||||
|
||||
/* Added on 2009/02/04: Lokale Berechnung für Kommunen */
|
||||
$text_local_factor = "";
|
||||
if(isset($customer_settings['display']['local_heating_and_power_calculation']) && $customer_settings['display']['local_heating_and_power_calculation'] === true)
|
||||
{
|
||||
if($_SESSION['data']['living_hs_type'] == "strom" || $_SESSION['data']['living_hs_type'] == "strom_oeko")
|
||||
{
|
||||
getEmissionByHeatingLocalFactor($_SESSION['emission']['td']['living_hs']);
|
||||
|
||||
if($_SESSION['data']['living_hs_type'] == "strom") $text_local_factor .= '<p>'.sprintf(TXT_LIVING_HS_PT_LOCAL_FACTOR_STROM, getMyResult($_SESSION['emission']['td']['living_hs_local'])).'</p>';
|
||||
if($_SESSION['data']['living_hs_type'] == "strom_oeko") $text_local_factor .= '<p>'.sprintf(TXT_LIVING_HS_PT_LOCAL_FACTOR_STROMOEKO, getMyResult($_SESSION['emission']['td']['living_hs_local'])).'</p>';
|
||||
}
|
||||
}
|
||||
|
||||
/* Baujahr / Hausstandard = Passivhaus ? */
|
||||
if($_SESSION['data']['living_hc_cy'] == "passivhaus")
|
||||
{
|
||||
$text .= '<p>'.TXT_IMPROVE_LIVING_HS_EVALUATION_1.'</p>';
|
||||
$text .= $text_local_factor;
|
||||
}
|
||||
/* Baujahr / Hausstandard = NEH ? */
|
||||
/* siehe: http://mantis.co2-handel.de/view.php?id=247
|
||||
elseif($_SESSION['data']['living_hc_cy'] == "neh")
|
||||
{
|
||||
echo '<p>Glückwunsch, Sie wohnen bereits in einem Gebäude mit hohem energetischen Standard!</p>';
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
/* Baujahr / Hausstandard = NEH ? */
|
||||
/* siehe: http://mantis.co2-handel.de/view.php?id=247 */
|
||||
if($_SESSION['data']['living_hc_cy'] == "neh")
|
||||
{
|
||||
$text .= '<p>'.TXT_IMPROVE_LIVING_HS_EVALUATION_2.'</p>';
|
||||
$text .= $text_local_factor;
|
||||
}
|
||||
|
||||
/* Energiekennwert <= Richtwert? */
|
||||
if($evaluation_living_hs_kennwert <= $evaluation_living_hs_kennwert_neh)
|
||||
{
|
||||
$text .= '<p>'.sprintf(TXT_IMPROVE_LIVING_HS_EVALUATION_3, $_SESSION['data']['living_hc_space'], $evaluation_living_hs_difference).'</p>';
|
||||
$text .= $text_local_factor;
|
||||
}
|
||||
|
||||
/* Energiekennwert > Richtwert? */
|
||||
else
|
||||
{
|
||||
$improve_emission = getMyResult($_SESSION['potential']['living_hs']);
|
||||
|
||||
/* Eigentümer? */
|
||||
if($_SESSION['data']['living_hc_ownership'] == "besitzer")
|
||||
{
|
||||
$text .= '<p>'.sprintf(TXT_IMPROVE_LIVING_HS_EVALUATION_4, $_SESSION['data']['living_hc_space'], $evaluation_living_hs_difference, $improve_emission).'</p>';
|
||||
$text .= $text_local_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= '<p>'.sprintf(TXT_IMPROVE_LIVING_HS_EVALUATION_5, $_SESSION['data']['living_hc_space'], $evaluation_living_hs_difference, $improve_emission).'</p>';
|
||||
$text .= $text_local_factor;
|
||||
}
|
||||
|
||||
} /* EOF Energiekennwert > Richtwert? */
|
||||
|
||||
}
|
||||
|
||||
// Needed in "includes/_footer_navigation.inc.php"
|
||||
$improve_button_flag === true ? $_SESSION['$improve_button_flag'] = true : $_SESSION['$improve_button_flag'] = false;
|
||||
|
||||
return $text;
|
||||
}
|
||||
/* EOF improveTableLivingHs */
|
||||
|
||||
|
||||
?>
|
||||
144
r41/luxembourg/de/_core/includes/_input_data.inc.php
Normal file
144
r41/luxembourg/de/_core/includes/_input_data.inc.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
$cat = "";
|
||||
if(isset($_POST['cat'])) $cat = sanitizeInput($_POST['cat']);
|
||||
if(isset($_GET['cat'])) $cat = sanitizeInput($_GET['cat']);
|
||||
|
||||
|
||||
$do = "";
|
||||
if(isset($_POST['do'])) $do = sanitizeInput($_POST['do']);
|
||||
if(isset($_GET['do'])) $do = sanitizeInput($_GET['do']);
|
||||
|
||||
$data_id = "";
|
||||
if(isset($_POST['data_id'])) $data_id = sanitizeInput($_POST['data_id']);
|
||||
if(isset($_GET['data_id'])) $data_id = sanitizeInput($_GET['data_id']);
|
||||
|
||||
$year = "";
|
||||
if(isset($_POST['year'])) $year = sanitizeInput($_POST['year']);
|
||||
if(isset($_GET['year'])) $year = sanitizeInput($_GET['year']);
|
||||
|
||||
$key = "";
|
||||
if(isset($_POST['key'])) $key = sanitizeInput((int)$_POST['key']);
|
||||
if(isset($_GET['key'])) $key = sanitizeInput((int)$_GET['key']);
|
||||
|
||||
$bookmark = "";
|
||||
if(isset($_POST['bookmark'])) $bookmark = sanitizeInput($_POST['bookmark']);
|
||||
if(isset($_GET['bookmark'])) $bookmark = sanitizeInput($_GET['bookmark']);
|
||||
|
||||
$new_calculation_year = "";
|
||||
if(isset($_POST['new_calculation_year'])) $new_calculation_year = sanitizeInput($_POST['new_calculation_year']);
|
||||
if(isset($_GET['new_calculation_year'])) $new_calculation_year = sanitizeInput($_GET['new_calculation_year']);
|
||||
|
||||
$new_calculation_base_year = "";
|
||||
if(isset($_POST['new_calculation_base_year'])) $new_calculation_base_year = sanitizeInput($_POST['new_calculation_base_year']);
|
||||
if(isset($_GET['new_calculation_base_year'])) $new_calculation_base_year = sanitizeInput($_GET['new_calculation_base_year']);
|
||||
|
||||
$login_sent = false;
|
||||
if(isset($_POST['login_sent'])) $login_sent = sanitizeInput($_POST['login_sent']);
|
||||
if(isset($_GET['login_sent'])) $login_sent = sanitizeInput($_GET['login_sent']);
|
||||
|
||||
$register_sent = false;
|
||||
if(isset($_POST['register_sent'])) $register_sent = sanitizeInput($_POST['register_sent']);
|
||||
if(isset($_GET['register_sent'])) $register_sent = sanitizeInput($_GET['register_sent']);
|
||||
|
||||
$login_save = false;
|
||||
if(isset($_POST['login_save'])) $login_save = sanitizeInput($_POST['login_save']);
|
||||
if(isset($_GET['login_save'])) $login_save = sanitizeInput($_GET['login_save']);
|
||||
|
||||
$password_sent = false;
|
||||
if(isset($_POST['password_sent'])) $password_sent = sanitizeInput($_POST['password_sent']);
|
||||
if(isset($_GET['password_sent'])) $password_sent = sanitizeInput($_GET['password_sent']);
|
||||
|
||||
$login_user_name = "";
|
||||
if(isset($_POST['login_user_name'])) $login_user_name = sanitizeInput($_POST['login_user_name']);
|
||||
if(isset($_GET['login_user_name'])) $login_user_name = sanitizeInput($_GET['login_user_name']);
|
||||
|
||||
$login_user_password = "";
|
||||
if(isset($_POST['login_user_password'])) $login_user_password = sanitizeInput($_POST['login_user_password']);
|
||||
if(isset($_GET['login_user_password'])) $login_user_password = sanitizeInput($_GET['login_user_password']);
|
||||
|
||||
$login_user_password_repeat = "";
|
||||
if(isset($_POST['login_user_password_repeat'])) $login_user_password_repeat = sanitizeInput($_POST['login_user_password_repeat']);
|
||||
if(isset($_GET['login_user_password_repeat'])) $login_user_password_repeat = sanitizeInput($_GET['login_user_password_repeat']);
|
||||
|
||||
$login_user_as = "";
|
||||
if(isset($_POST['login_user_as'])) $login_user_as = sanitizeInput($_POST['login_user_as']);
|
||||
if(isset($_GET['login_user_as'])) $login_user_as = sanitizeInput($_GET['login_user_as']);
|
||||
|
||||
$login_user_as_result = "";
|
||||
if(isset($_POST['login_user_as_result'])) $login_user_as_result = sanitizeInput($_POST['login_user_as_result']);
|
||||
if(isset($_GET['login_user_as_result'])) $login_user_as_result = sanitizeInput($_GET['login_user_as_result']);
|
||||
|
||||
|
||||
$login_user_campaign = "";
|
||||
if(isset($_POST['login_user_campaign'])) $login_user_campaign = sanitizeInput($_POST['login_user_campaign']);
|
||||
if(isset($_GET['login_user_campaign'])) $login_user_campaign = sanitizeInput($_GET['login_user_campaign']);
|
||||
|
||||
$offset_sent = false;
|
||||
if(isset($_POST['offset_sent'])) $offset_sent = sanitizeInput($_POST['offset_sent']);
|
||||
if(isset($_GET['offset_sent'])) $offset_sent = sanitizeInput($_GET['offset_sent']);
|
||||
|
||||
$offset_tid = "";
|
||||
if(isset($_POST['offset_tid'])) $offset_tid = sanitizeInput($_POST['offset_tid']);
|
||||
if(isset($_GET['offset_tid'])) $offset_tid = sanitizeInput($_GET['offset_tid']);
|
||||
|
||||
$offset_value = array();
|
||||
if(isset($_POST['offset_value'])) $offset_value = sanitizeInput($_POST['offset_value']);
|
||||
if(isset($_GET['offset_value'])) $offset_value = sanitizeInput($_GET['offset_value']);
|
||||
|
||||
|
||||
|
||||
$sent_form_airports = "";
|
||||
if(isset($_POST['sent_form_airports'])) $sent_form_airports = sanitizeInput($_POST['sent_form_airports']);
|
||||
if(isset($_GET['sent_form_airports'])) $sent_form_airports = sanitizeInput($_GET['sent_form_airports']);
|
||||
|
||||
$airport_search = "";
|
||||
if(isset($_POST['airport_search'])) $airport_search = sanitizeInput($_POST['airport_search']);
|
||||
if(isset($_GET['airport_search'])) $airport_search = sanitizeInput($_GET['airport_search']);
|
||||
|
||||
$airport_calculate = "";
|
||||
if(isset($_POST['airport_calculate'])) $airport_calculate = sanitizeInput($_POST['airport_calculate']);
|
||||
if(isset($_GET['airport_calculate'])) $airport_calculate = sanitizeInput($_GET['airport_calculate']);
|
||||
|
||||
$airport_start = "";
|
||||
if(isset($_POST['airport_start'])) $airport_start = sanitizeInput($_POST['airport_start']);
|
||||
if(isset($_GET['airport_start'])) $airport_start = sanitizeInput($_GET['airport_start']);
|
||||
|
||||
$airport_start_id = "";
|
||||
if(isset($_POST['airport_start_id'])) $airport_start_id = sanitizeInput($_POST['airport_start_id']);
|
||||
if(isset($_GET['airport_start_id'])) $airport_start_id = sanitizeInput($_GET['airport_start_id']);
|
||||
|
||||
$airport_stopover = "";
|
||||
if(isset($_POST['airport_stopover'])) $airport_stopover = sanitizeInput($_POST['airport_stopover']);
|
||||
if(isset($_GET['airport_stopover'])) $airport_stopover = sanitizeInput($_GET['airport_stopover']);
|
||||
|
||||
$airport_stopover_id = "";
|
||||
if(isset($_POST['airport_stopover_id'])) $airport_stopover_id = sanitizeInput($_POST['airport_stopover_id']);
|
||||
if(isset($_GET['airport_stopover_id'])) $airport_stopover_id = sanitizeInput($_GET['airport_stopover_id']);
|
||||
|
||||
$airport_dest = "";
|
||||
if(isset($_POST['airport_dest'])) $airport_dest = sanitizeInput($_POST['airport_dest']);
|
||||
if(isset($_GET['airport_dest'])) $airport_dest = sanitizeInput($_GET['airport_dest']);
|
||||
|
||||
$airport_dest_id = "";
|
||||
if(isset($_POST['airport_dest_id'])) $airport_dest_id = sanitizeInput($_POST['airport_dest_id']);
|
||||
if(isset($_GET['airport_dest_id'])) $airport_dest_id = sanitizeInput($_GET['airport_dest_id']);
|
||||
|
||||
$airport_flight_mode = "";
|
||||
if(isset($_POST['airport_flight_mode'])) $airport_flight_mode = sanitizeInput($_POST['airport_flight_mode']);
|
||||
if(isset($_GET['airport_flight_mode'])) $airport_flight_mode = sanitizeInput($_GET['airport_flight_mode']);
|
||||
|
||||
$airport_flight_amount = "";
|
||||
if(isset($_POST['airport_flight_amount'])) $airport_flight_amount = sanitizeInput($_POST['airport_flight_amount']);
|
||||
if(isset($_GET['airport_flight_amount'])) $airport_flight_amount = sanitizeInput($_GET['airport_flight_amount']);
|
||||
|
||||
$airport_passengers_amount = "";
|
||||
if(isset($_POST['airport_passengers_amount'])) $airport_passengers_amount = sanitizeInput($_POST['airport_passengers_amount']);
|
||||
if(isset($_GET['airport_passengers_amount'])) $airport_passengers_amount = sanitizeInput($_GET['airport_passengers_amount']);
|
||||
|
||||
$airport_flight_compensated = "";
|
||||
if(isset($_POST['airport_flight_compensated'])) $airport_flight_compensated = sanitizeInput($_POST['airport_flight_compensated']);
|
||||
if(isset($_GET['airport_flight_compensated'])) $airport_flight_compensated = sanitizeInput($_GET['airport_flight_compensated']);
|
||||
|
||||
|
||||
$login_error_message = "";
|
||||
?>
|
||||
70
r41/luxembourg/de/_core/includes/_language_files.inc.php
Normal file
70
r41/luxembourg/de/_core/includes/_language_files.inc.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Include other language files
|
||||
*/
|
||||
if(isset($customer_settings['overwrite']['languages']['section']) && $customer_settings['overwrite']['languages']['section'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_section.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_section.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_section.inc.php');
|
||||
}
|
||||
|
||||
/*
|
||||
if(isset($customer_settings['overwrite']['languages']['result']) && $customer_settings['overwrite']['languages']['result'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_result.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_result.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_result.inc.php');
|
||||
}
|
||||
*/
|
||||
|
||||
if(isset($customer_settings['overwrite']['languages']['improve']) && $customer_settings['overwrite']['languages']['improve'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_improve.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_improve.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_improve.inc.php');
|
||||
}
|
||||
|
||||
if(isset($customer_settings['overwrite']['languages']['intro']) && $customer_settings['overwrite']['languages']['intro'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_intro.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_intro.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_intro.inc.php');
|
||||
}
|
||||
|
||||
if(isset($customer_settings['overwrite']['languages']['impressum']) && $customer_settings['overwrite']['languages']['impressum'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_impressum.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_impressum.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_impressum.inc.php');
|
||||
}
|
||||
|
||||
if(isset($customer_settings['overwrite']['languages']['account']) && $customer_settings['overwrite']['languages']['account'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_account.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_account.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_account.inc.php');
|
||||
}
|
||||
|
||||
if(isset($customer_settings['overwrite']['languages']['offset']) && $customer_settings['overwrite']['languages']['offset'] === true && file_exists('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_offset.inc.php'))
|
||||
{
|
||||
require_once('../'.CUSTOMER_DIR.'/languages/'.CONTENT_LANGUAGE.'/_offset.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('languages/'.CONTENT_LANGUAGE.'/_offset.inc.php');
|
||||
}
|
||||
|
||||
?>
|
||||
@ -0,0 +1,5 @@
|
||||
<ul class="nav nav-tabs" style="margin-top:5px">
|
||||
<li role="presentation"<?php if($cat == "mobility-daily") echo ' class="active"'; ?>><a href="mobility-daily#panel-calc" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_DAILY; ?></a></li>
|
||||
<li role="presentation"<?php if($cat == "mobility-travel") echo ' class="active"'; ?>><a href="mobility-travel#panel-calc" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_TRAVEL; ?></a></li>
|
||||
<li role="presentation"<?php if($cat == "mobility-flight" || $cat == "mobility-flight-calculator") echo ' class="active"'; ?>><a href="mobility-flight#panel-calc" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_FLIGHT; ?></a></li>
|
||||
</ul>
|
||||
@ -0,0 +1,5 @@
|
||||
<ul class="nav nav-tabs" style="margin-top:5px">
|
||||
<li role="presentation"<?php if($cat == "sc-mobility") echo ' class="active"'; ?>><a href="sc-mobility#panel-scenario" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_CARS; ?></a></li>
|
||||
<li role="presentation"<?php if($cat == "sc-mobility-travel") echo ' class="active"'; ?>><a href="sc-mobility-travel#panel-scenario" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_TRAVEL; ?></a></li>
|
||||
<li role="presentation"<?php if($cat == "sc-mobility-flight") echo ' class="active"'; ?>><a href="sc-mobility-flight#panel-scenario" class="js-submit-form"><?php echo TXT_NAV_MOBILITAET_FLIGHT; ?></a></li>
|
||||
</ul>
|
||||
36
r41/luxembourg/de/_core/includes/_navigation_top.php
Normal file
36
r41/luxembourg/de/_core/includes/_navigation_top.php
Normal file
@ -0,0 +1,36 @@
|
||||
<div id="header-login" class="container<?php if($customer_settings['css']['fluid'] === true) echo '-fluid'; ?>">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
// Login
|
||||
if($customer_settings['display']['co2account'] === true):
|
||||
if(!isset($_SESSION['user']['user_logged_in']) || $_SESSION['user']['user_logged_in'] === false)
|
||||
{
|
||||
echo '<div class="col-xs-6">';
|
||||
echo ' <a href="login" class="btn btn-success" role="button">'.TXT_LOGIN_ACCOUNT_LEGEND.'</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<div class="col-xs-6">';
|
||||
echo '<a href="account" class="btn btn-success" role="button">'.$_SESSION['user']['email'].'</a> ';
|
||||
echo '<a href="?do=logout" class="btn btn-danger" role="button">'.TXT_NAV_LOGOUT.'</a> ';
|
||||
echo '</div>';
|
||||
}
|
||||
endif;
|
||||
// Languages
|
||||
if(count($customer_settings['display']['languages']) > 1):
|
||||
echo $customer_settings['display']['co2account'] === true ? '<div class="col-xs-6 text-right">' : '<div class="col-xs-12 text-right">';
|
||||
// Other languages
|
||||
foreach($customer_settings['display']['languages'] as $key_lang)
|
||||
{
|
||||
if($key_lang != CONTENT_LANGUAGE) echo '<a href="../'.$key_lang.'/" class="btn btn-primary">'.$txt_language[$key_lang].'</a> ';
|
||||
}
|
||||
echo '</div>';
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
22
r41/luxembourg/de/_core/includes/_session.inc.php
Normal file
22
r41/luxembourg/de/_core/includes/_session.inc.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// Session lifetime: 24 h
|
||||
$ini_set_session_gc_maxlifetime = ini_set("session.gc_maxlifetime",86400);
|
||||
|
||||
if (empty($ini_set_session_gc_maxlifetime) or (!$ini_set_session_gc_maxlifetime)) {
|
||||
echo "session.gc_maxlifetime konnte nicht geändert werden!";
|
||||
}
|
||||
// Define session name
|
||||
$sess = "sess_".$customer_settings['customer']['session_id'];
|
||||
|
||||
session_name("$sess");
|
||||
|
||||
// Session Name already defined?
|
||||
if(isset($sess) && !$sess)
|
||||
{
|
||||
srand((double)microtime()*10000000);
|
||||
$id = md5(uniqid(rand()));
|
||||
session_id($id);
|
||||
|
||||
}
|
||||
session_start();
|
||||
?>
|
||||
Reference in New Issue
Block a user