@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('_JEXEC') or die('Restricted access'); // load chart builder $chart = new Chartbuilder('BarChart'); // set scaled array $scaled = array('unscaled','scaled'); // check if items are set if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($this->results->items)){ foreach ($scaled as $scale){ $i =0; $rowArray = array(); foreach ($this->results->items as $key => &$item){ $rowArray[] = array('c' => array( array('v' => $item->details->name), array('v' => $item->{'subtotal_cost_morbidity_'.$scale}, 'f' => $item->{'subtotal_costmoney_morbidity_'.$scale}), array('v' => $item->{'subtotal_cost_presenteeism_'.$scale}, 'f' => $item->{'subtotal_costmoney_presenteeism_'.$scale}), array('v' => $item->{'subtotal_cost_mortality_'.$scale}, 'f' => $item->{'subtotal_costmoney_mortality_'.$scale}), array('v' => $item->{'subtotal_cost_'.$scale}, 'f' => $item->{'subtotal_costmoney_'.$scale}) )); $i++; } usort($rowArray, function($b, $a) { return $a['c'][4]['v'] - $b['c'][4]['v']; }); $data = array( 'cols' => array( array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_FACTOR'), 'type' => 'string'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_MORBIDITY'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_PRESENTEEISM_MORBIDITY'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_MORTALITY'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_TOTAL_COST'), 'type' => 'number') ), 'rows' => $rowArray ); $height = ($i * 110)+10; $title = JText::sprintf('COM_COSTBENEFITPROJECTION_COST_IN_S', $this->item->currency_name); $chart->load(json_encode($data)); $options = array( 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle'])); echo $chart->draw('c_'.$scale, $options); } } ?>

results->items) && CostbenefitprojectionHelper::checkObject($this->results->items)) : ?>