@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'); // get user type $useris = CostbenefitprojectionHelper::userIs($this->user->id); $usergroup = CostbenefitprojectionHelper::setGroupNames($this->user->get('groups')); // load modules if public $login_cp = false; $public_cp = false; $top_cp = array(); if(!$useris) { $login_cp = $this->getModules('login-cp','div','uk-panel'); $public_cp = $this->getModules('public-cp','div','uk-panel'); $top_cp = $this->getModules('top_cp','array'); } // quick header fix function function setHeaderString($n) { return CostbenefitprojectionHelper::safeString($n,'Ww'); } // setting the published state function setPublised($item) { $state = ''.$item->published.''; switch($item->published) { case 1: // Published $state = ''; break; case 0: // UnPublished $state = ''; break; case 2: // Archived $state = ''; break; case -2: // Trashed $state = ''; break; } return $state; } // set scaling factor link function setScalingFactorLink($item) { $user = JFactory::getUser(); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('scaling_factor',$item,'scaling_factors'); if ($canDo->get('scaling_factor.edit')) { if ($item->checked_out && $canCheckin) { $link = '' . $item->causerisk_name. ''; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'scaling_factors.', $canCheckin).''; } elseif ($item->checked_out && !$canCheckin) { $link = '' . $item->causerisk_name; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'scaling_factors.', $canCheckin).''; } else { $link = '' . $item->causerisk_name. ''; } } else { $link = '' . $item->causerisk_name . ''; } return $link; } // set intervention link function setInterventionLink($item) { $user = JFactory::getUser(); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('intervention',$item,'interventions'); if ($canDo->get('intervention.edit')) { if ($item->checked_out && $canCheckin) { $link = '' . $item->name. ''; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'interventions.', $canCheckin).''; } elseif ($item->checked_out && !$canCheckin) { $link = '' . $item->name; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'interventions.', $canCheckin).''; } else { $link = '' . $item->name. ''; } } else { $link = '' . $item->name . ''; } return $link; } // setting the intervetnion type function setInterventionType($item) { $state = ''.$item->type.''; switch($item->type) { case 1: // Single $state = ''.JText::_('COM_COSTBENEFITPROJECTION_SINGLE').''; break; case 2: // Cluster $state = ''.JText::_('COM_COSTBENEFITPROJECTION_CLUSTER').''; break; } return $state; } // setting the intervetnion share function setInterventionShare($item) { $state = ''.$item->share.''; switch($item->share) { case 1: // Only Me $state = ''.JText::_('COM_COSTBENEFITPROJECTION_ONLY_ME').''; break; case 2: // My Service Provider $state = ''.JText::_('COM_COSTBENEFITPROJECTION_MY_SERVICE_PROVIDER').''; break; break; case 3: // All Service Providers $state = ''.JText::_('COM_COSTBENEFITPROJECTION_ALL_SERVICE_PROVIDERS').''; break; } return $state; } // set the intervention details function setIntervention($item) { if (CostbenefitprojectionHelper::isJson($item->intervention)) { $bucket = array(); $bucketsmall = array(); $interventions = json_decode($item->intervention); foreach ($interventions as $name => $values) { if (CostbenefitprojectionHelper::checkArray($values)) { foreach ($values as $pointer => $value) { if (!isset($bucket[$pointer])) { $bucket[$pointer] = ''; $bucketsmall[$pointer] = ''; } switch($name) { case 'causerisk': $causeName = CostbenefitprojectionHelper::getVar('causerisk', $value, 'id', 'name'); $bucket[$pointer] .= ''.$causeName.""; $bucketsmall[$pointer] .= $causeName.': '; break; case 'cpe': $bucket[$pointer] .= ''.$value.''; $bucketsmall[$pointer] .= ''.$name.' '.$value.' '; break; case 'mbr': $bucket[$pointer] .= ''.$value.''; $bucketsmall[$pointer] .= ''.$name.' '.$value.' '; break; case 'mtr': $bucket[$pointer] .= ''.$value.''; $bucketsmall[$pointer] .= ''.$name.' '.$value.''; break; } } } } } return ''.implode('',$bucket).'
'.JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK').''.JText::_('COM_COSTBENEFITPROJECTION_COST_PER_EMPLOYEE').''.JText::_('COM_COSTBENEFITPROJECTION_MORBIDITY_REDUCTION').''.JText::_('COM_COSTBENEFITPROJECTION_MORTALITY_REDUCTION').'
'.implode('
',$bucketsmall).'
'; } ?>
toolbar->render(); ?>

.......