Members-Manager/site/layouts/profileextra_uikit_three.php

101 lines
3.6 KiB
PHP
Raw Normal View History

2018-07-11 00:35:10 +00:00
<?php
/**
2018-07-25 03:00:13 +00:00
* @package Joomla.Members.Manager
2018-07-11 00:35:10 +00:00
*
2018-12-27 10:38:37 +00:00
* @created 6th July, 2018
2018-07-11 00:35:10 +00:00
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
2018-07-25 03:00:13 +00:00
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
2018-07-11 00:35:10 +00:00
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
2018-12-27 10:38:37 +00:00
// set default chart switch to false
$displayData->setCharts = false;
// get names and values if found
if ($displayData->setAssessment)
{
// get Document
$document = JFactory::getDocument();
// Chart Target Types
$targets = array(2,3);
// get chart details
$displayData->charts = array();
$_y = MembersmanagerHelper::safeString($displayData->id);
foreach ($displayData->assessmentAvailable as $_name => $assessment)
{
// set the chart array per/assessment type
$displayData->charts[$_name] = array();
if (MembersmanagerHelper::checkArray($assessment))
{
foreach ($assessment as $_nr => $assess)
{
2019-04-04 11:58:49 +00:00
if ($displayData->_USER->authorise('form.report.viewtab', $assess->element))
2018-12-27 10:38:37 +00:00
{
2019-04-04 11:58:49 +00:00
foreach ($targets as $target)
2018-12-27 10:38:37 +00:00
{
2019-04-04 11:58:49 +00:00
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
2018-12-27 10:38:37 +00:00
{
2019-04-04 11:58:49 +00:00
foreach ($carts as $key => $cartData)
2018-12-27 10:38:37 +00:00
{
2019-04-04 11:58:49 +00:00
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assess->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assess->element)) !== false)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
}
2018-12-27 10:38:37 +00:00
}
}
}
}
}
}
2019-04-04 11:58:49 +00:00
elseif ($displayData->_USER->authorise('form.report.viewtab', $assessment->element) && MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
2018-12-27 10:38:37 +00:00
{
foreach ($targets as $target)
{
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
{
foreach ($carts as $key => $cartData)
{
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assessment->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assessment->element)) !== false)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
}
}
}
}
}
}
}
2019-04-04 11:58:49 +00:00
// switch hidden state
$hidden = ($displayData->setCharts) ? '' : ' hidden';
2018-07-11 00:35:10 +00:00
?>
2019-04-04 11:58:49 +00:00
<div class="extra<?php echo $displayData->id; ?>"<?php echo $hidden; ?>>
2018-12-27 10:38:37 +00:00
<?php if ($displayData->setCharts): ?>
<?php foreach ($displayData->charts as $name => $codes): ?>
<?php foreach ($codes as $code): ?>
<a href="#getreport" onclick="loadTheChartInModal(<?php echo $code['function_name']; ?>, '<?php echo $code['id_name']; ?>')" class="uk-thumbnail uk-thumbnail-small <?php echo $code['id_name']; ?>_target" uk-toggle><?php echo $code['div']; ?></a>
<?php endforeach; ?>
<?php endforeach; ?>
<?php else: ?>
<div uk-alert>
<p><?php echo JText::_('COM_MEMBERSMANAGER_NOT_ENOUGH_DATA'); ?>.</p>
</div>
2018-12-27 10:38:37 +00:00
<?php endif; ?>
</div>