@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
/-------------------------------------------------------------------------------------------------------/
Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
// set som user permissions
$user = JFactory::getUser();
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $displayData->checked_out == $user->id || $displayData->checked_out == 0;
$userChkOut = JFactory::getUser($displayData->checked_out);
$canDo = CostbenefitprojectionHelper::getActions('company',$displayData,'companies');
// setup the cause risk list
$causesrisks = '
'.JText::_('COM_COSTBENEFITPROJECTION_NO_CAUSERISK_SELECTED').'
';
if (isset($displayData->causesrisks) && CostbenefitprojectionHelper::checkArray($displayData->causesrisks))
{
$causesrisks = '';
$body = '';
$keys = array(
'name' => JText::_('COM_COSTBENEFITPROJECTION_NAME'), 'description' => JText::_('COM_COSTBENEFITPROJECTION_DESCRIPTION'),
'ref' => JText::_('REF'),'importname' => JText::_('COM_COSTBENEFITPROJECTION_FULL_NAME'));
$getValues = array('name','description','ref','importname');
// header switces
$dataSwitch = array('name' => ' data-toggle="true"','description' => ' data-hide="phone"', 'ref' => ' data-hide="phone,tablet"', 'importname' => ' data-hide="all"');
foreach ($displayData->causesrisks as $id)
{
// get cause risk details
$details = CostbenefitprojectionHelper::getCauseRiskDetails($id,$getValues);
if (CostbenefitprojectionHelper::checkObject($details))
{
// build the dl list
$row = '';
foreach ($details as $title => $value)
{
// fix the ref display
if ('ref' == $title)
{
$key = explode('.0',$value);
$sort = explode('.',$value);
$value = implode('.',$key);
$sort = implode('',$key);
// now set
$row .= '' . $value . ' | ';
}
else
{
$row .= '' . $value . ' | ';
}
}
$row .= '
';
$body .= $row;
}
}
$head = '';
foreach ($keys as $key => $header)
{
$head .= '';
}
$causesrisks .= '';
}
// setup the age groups display
$agepercents = ''.JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET').' ';
$agepercents_numbers = ''.JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET').' ';
$genderArray = array('male','female');
// loading option var
$both = 0;
foreach ($genderArray as $gender)
{
// setup the related gender age groups
if (isset($displayData->{'percent'.$gender}) && CostbenefitprojectionHelper::checkString($displayData->{'percent'.$gender}))
{
// load chart builder
$chart = new Chartbuilder('PieChart');
$i = 0;
$data = array();
$rowArray = array();
$rowArray_numbers = array();
$dataset = json_decode($displayData->{'percent'.$gender});
foreach ($dataset as $key => &$set)
{
if ('age' == $key)
{
$type = 'string';
$percent = false;
}
else
{
$type = 'number';
$percent = true;
}
// set header
$data['cols'][$i] = array('id' => '', 'lable' => CostbenefitprojectionHelper::safeString($key,'Ww'), 'type' => $type);
foreach ($set as $nr => $val)
{
if (!isset($rowArray_numbers[$nr]))
{
$rowArray_numbers[$nr] = '';
}
if ($percent)
{
$rowArray[$nr]['c'][] = array('v' => (int) $val);
// set the table values
$rowArray_numbers[$nr] .= ' | ' . $val . '% | ';
}
else
{
$rowArray[$nr]['c'][] = array('v' => $val, 'f' => JText::_('COM_COSTBENEFITPROJECTION_AGE').' '.$val);
// set the table values
$rowArray_numbers[$nr] .= ''.JText::_('COM_COSTBENEFITPROJECTION_AGE').' '. $val . ' | ';
}
}
$i++;
}
$data['rows'] = $rowArray;
$string = json_encode($data);
$chart->load($string);
$title = ($gender == 'male') ? JText::_('COM_COSTBENEFITPROJECTION_MALES'):JText::_('COM_COSTBENEFITPROJECTION_FEMALES');
$options = array('backgroundColor' => '#fafafa', 'title' => $title, 'height' => '500', 'width' => '500','is3D' => 'true', 'tabclickdraw' => 'charttab');
echo $chart->draw('age_'.$gender.'_'.$displayData->id,$options);
// set chart array
$age[] = '';
$gen[$title] = ''.implode('
',$rowArray_numbers).'
';
$both++;
}
}
// now set the group percentages to the view
if ($both)
{
// setup the chart
$agepercents = '';
foreach ($age as $gender)
{
$agepercents .= '
';
$agepercents .= '
';
$agepercents .= $gender;
$agepercents .= '
';
$agepercents .= '
';
}
$agepercents .= '
';
// setup the table
$agepercents_numbers = '';
foreach ($gen as $title => $body)
{
$agepercents_numbers .= '
';
$agepercents_numbers .= '
';
$agepercents_numbers .= '
'.$title.'
';
$agepercents_numbers .= '';
$agepercents_numbers .= '';
$agepercents_numbers .= '
';
}
$agepercents_numbers .= '
';
}
// set scaling factors
$scalingfactors = ''.JText::_('COM_COSTBENEFITPROJECTION_NO_SCALING_FACTORS_AVAILABLE_PLEASE_SELECT_A_CAUSERISK_TO_ACTIVATE').'
';
if (isset($displayData->idCompanyScaling_factorD) && CostbenefitprojectionHelper::checkArray($displayData->idCompanyScaling_factorD))
{
// the values to display
$keys = array(
'causerisk_name' => JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK'), 'reference' => JText::_('COM_COSTBENEFITPROJECTION_REFERENCE'),
'yld_scaling_factor_males' => JText::_('COM_COSTBENEFITPROJECTION_ABSENTEEISM_MALES'),'yld_scaling_factor_females' => JText::_('COM_COSTBENEFITPROJECTION_ABSENTEEISM_FEMALES'),
'mortality_scaling_factor_males' => JText::_('COM_COSTBENEFITPROJECTION_MORTALITY_MALES'),'mortality_scaling_factor_females' => JText::_('COM_COSTBENEFITPROJECTION_MORTALITY_FEMALES'),
'presenteeism_scaling_factor_males' => JText::_('COM_COSTBENEFITPROJECTION_PRESENTEEISM_MALES'),'presenteeism_scaling_factor_females' => JText::_('COM_COSTBENEFITPROJECTION_PRESENTEEISM_FEMALES'),
'published' => JText::_('COM_COSTBENEFITPROJECTION_STATUS'),'id' => JText::_('ID'));
$rows = array('published' => 'setPublised', 'causerisk_name' => 'setScalingFactorLink');
// header switces
$datahide = array(
'reference' => ' data-hide="all"', 'id' => ' data-ignore="true" data-hide="all"',
'yld_scaling_factor_males' => ' data-hide="phone,tablet"','yld_scaling_factor_females' => ' data-hide="phone,tablet"',
'mortality_scaling_factor_males' => ' data-hide="phone,tablet"','mortality_scaling_factor_females' => ' data-hide="phone,tablet"',
'presenteeism_scaling_factor_males' => ' data-hide="phone,tablet"','presenteeism_scaling_factor_females' => ' data-hide="phone,tablet"');
$datatype = array(
'yld_scaling_factor_males' => ' data-type="numeric"','yld_scaling_factor_females' => ' data-type="numeric"',
'mortality_scaling_factor_males' => ' data-type="numeric"','mortality_scaling_factor_females' => ' data-type="numeric"',
'presenteeism_scaling_factor_males' => ' data-type="numeric"','presenteeism_scaling_factor_females' => ' data-type="numeric"',
'id' => ' data-type="numeric"');
$datatoggle = array('causerisk_name' => ' data-toggle="true"');
// set the body
$body = '';
foreach ($displayData->idCompanyScaling_factorD as $details)
{
if (CostbenefitprojectionHelper::checkObject($details))
{
// build the dl list
$body .= '';
foreach ($keys as $key => $header)
{
if (array_key_exists($key, $rows))
{
// this should be save since all data passed is internal
$body .= "{$rows[$key]($details)}";
}
else
{
$body .= ''. $details->$key.' | ';
}
}
$body .= '
';
}
}
// set the header dynamic
$head = '';
foreach ($keys as $key => $header)
{
$head .= '';
}
$scalingfactors = '';
}
// set interventions
$interventions = ' '.JText::_('COM_COSTBENEFITPROJECTION_NO_INTERVENTIONS_SET').' ';
if (isset($displayData->idCompanyInterventionE) && CostbenefitprojectionHelper::checkArray($displayData->idCompanyInterventionE))
{
// the values to display
$keys = array(
'id' => JText::_('ID'),'name' => JText::_('COM_COSTBENEFITPROJECTION_NAME'),
'type' => JText::_('COM_COSTBENEFITPROJECTION_TYPE'),'coverage' => JText::_('COM_COSTBENEFITPROJECTION_COVERAGE'),
'share' => JText::_('COM_COSTBENEFITPROJECTION_SHARE'),'description' => JText::_('COM_COSTBENEFITPROJECTION_DESCRIPTION'),
'reference' => JText::_('COM_COSTBENEFITPROJECTION_REFERENCE'),
'intervention' => JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION'),'published' => JText::_('COM_COSTBENEFITPROJECTION_STATUS'));
$rows = array('published' => 'setPublised', 'intervention' => 'setIntervention', 'name' => 'setInterventionLink', 'type' => 'setInterventionType', 'share' => 'setInterventionShare');
// header switces
$datahide = array(
'id' => ' data-ignore="true" data-hide="all"',
'share' => ' data-hide="phone,tablet"','description' => ' data-hide="all"',
'reference' => ' data-hide="all"',
'intervention' => ' data-hide="all"');
$datatype = array(
'id' => ' data-type="numeric"', 'coverage' => ' data-type="numeric"');
$datatoggle = array('name' => ' data-toggle="true"');
// set the body
$body = '';
foreach ($displayData->idCompanyInterventionE as $details)
{
if (CostbenefitprojectionHelper::checkObject($details))
{
// build the dl list
$body .= ' | ';
foreach ($keys as $key => $header)
{
if (array_key_exists($key, $rows))
{
// this should be save since all data passed is internal
$body .= "{$rows[$key]($details)}";
}
else
{
$body .= ''. $details->$key.' | ';
}
}
$body .= '
';
}
}
// set the header dynamic
$head = '';
foreach ($keys as $key => $header)
{
$head .= '';
}
$interventions = '';
}
?>
get('company.edit')): ?>
checked_out): ?>
id, $userChkOut->name, $displayData->checked_out_time, 'company.', $canCheckin); ?>
get('company.edit') && $canDo->get('company.delete')): ?>
get('company.edit')): ?>
-
- user)->name; ?>
- email; ?>
- department ==1) ? JText::_('COM_COSTBENEFITPROJECTION_BASIC') : JText::_('COM_COSTBENEFITPROJECTION_ADVANCED'); ?>
- country_name; ?>
service_provider_publicname): ?>
- service_provider_publicname; ?>
- service_provider_name; ?>
service_provider_publicnumber): ?>
- service_provider_publicnumber; ?>
service_provider_publicemail): ?>
- service_provider_publicemail; ?>
country_publicname): ?>
- country_publicname; ?>
country_publicname): ?>
- country_publicnumber; ?>
country_publicemail): ?>
- country_publicemail; ?>
- datayear; ?>
- working_days; ?>
- total_salary); ?>
total_healthcare && (2 == $displayData->department)): ?>
- total_healthcare); ?>
productivity_losses && (2 == $displayData->department)): ?>
- productivity_losses; ?>
- males; ?>
- females; ?>
medical_turnovers_males && (2 == $displayData->department)): ?>
- medical_turnovers_males; ?>
medical_turnovers_females && (2 == $displayData->department)): ?>
- medical_turnovers_females; ?>
sick_leave_males && (2 == $displayData->department)): ?>
- sick_leave_males; ?>
sick_leave_females && (2 == $displayData->department)): ?>
- sick_leave_females; ?>
-
-
-
-
|