Members-Manager/site/layouts/profileextra_uikit_three.php

104 lines
3.6 KiB
PHP
Raw Permalink Normal View History

2018-07-11 00:35:10 +00:00
<?php
2022-03-03 02:58:38 +00:00
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @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
2022-03-03 02:58:38 +00:00
$hidden = ($displayData->setCharts) ? '' : ' hidden';
?>
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): ?>
2021-01-06 14:00:15 +00:00
<ul class="uk-thumbnav" uk-margin>
2018-12-27 10:38:37 +00:00
<?php foreach ($displayData->charts as $name => $codes): ?>
<?php foreach ($codes as $code): ?>
2021-01-06 14:00:15 +00:00
<li><a href="#getreport" onclick="loadTheChartInModal(<?php echo $code['function_name']; ?>, '<?php echo $code['id_name']; ?>')" class="<?php echo $code['id_name']; ?>_target" uk-toggle><?php echo $code['div']; ?></a></li>
2018-12-27 10:38:37 +00:00
<?php endforeach; ?>
<?php endforeach; ?>
2021-01-06 14:00:15 +00:00
</ul>
2018-12-27 10:38:37 +00:00
<?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; ?>
2022-03-03 02:58:38 +00:00
</div>