Members-Manager/site/layouts/profileassessment_uikit_three.php

111 lines
6.0 KiB
PHP

<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th September, 2015
* @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');
// get all the assessment Components
$displayData->assessmentAvailable = MembersmanagerHelper::getAssessmentAvaillable($displayData->type, $displayData->account);
$displayData->setAssessment = MembersmanagerHelper::checkArray($displayData->assessmentAvailable);
// get names and values if found
if ($displayData->setAssessment)
{
// get assessment details
$displayData->assessments = array();
foreach ($displayData->assessmentAvailable as $_name => $assessment)
{
if (MembersmanagerHelper::checkArray($assessment))
{
$displayData->assessments[$_name] = array();
foreach ($assessment as $_nr => $assess)
{
$displayData->assessments[$_name][$_nr] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assess->element, 'object', 'profile');
if (MembersmanagerHelper::checkArray($displayData->assessments[$_name][$_nr]))
{
foreach ($displayData->assessments[$_name][$_nr] as $_pointer => &$value)
{
$value->name = $assess->name;
}
}
elseif (MembersmanagerHelper::checkObject($displayData->assessments[$_name][$_nr]))
{
$displayData->assessments[$_name][$_nr]->name = $assess->name;
}
}
}
elseif (MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
{
$displayData->assessments[$_name] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assessment->element, 'object', 'profile');
if (MembersmanagerHelper::checkObject($displayData->assessments[$_name]))
{
$displayData->assessments[$_name]->name = $assessment->name;
}
}
}
}
?>
<?php if ($displayData->setAssessment) : ?>
<?php if (MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id)) : ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_S_S', MembersmanagerHelper::safeString($displayData->type_name, 'W'), implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php else: ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_MEMBER_S', implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php endif; ?>
<div class="uk-button-group uk-width-1-1">
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: #assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>">
<i class="uk-icon-check-square-o"></i> <?php echo JText::_('COM_MEMBERSMANAGER_FORMS'); ?>
</button>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: .extra<?php echo $displayData->id; ?>">
<i class="uk-icon-bar-chart"></i> <?php echo JText::_('COM_MEMBERSMANAGER_REPORTS'); ?>
</button>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" >
<i class="uk-icon-paper-plane"></i> <?php echo JText::_('COM_MEMBERSMANAGER_SEND_REPORT'); ?>
</button>
</div>
<br /><br />
<?php echo JLayoutHelper::render('profileextra_uikit_three', $displayData); ?>
<?php echo JLayoutHelper::render('profilereports_uikit_three', $displayData); ?>
<div id="assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" uk-offcanvas="mode: push; overlay: true; flip: true">
<div class="uk-offcanvas-bar uk-flex uk-flex-column">
<ul class="uk-nav uk-nav-primary uk-nav-center uk-margin-auto-vertical">
<?php foreach ($displayData->assessmentAvailable as $typeAssesmentName => $components) : ?>
<?php if (MembersmanagerHelper::checkArray($components) || MembersmanagerHelper::checkObject($components)): ?>
<li class="uk-nav-header"><?php echo JText::sprintf('COM_MEMBERSMANAGER_S_OPTIONS', $typeAssesmentName); ?></li>
<?php if (MembersmanagerHelper::checkArray($components)): ?>
<?php foreach ($components as $component) : ?>
<li><a href="index.php?option=<?php echo $component->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $component->name; ?></a></li>
<?php endforeach; ?>
<?php elseif (MembersmanagerHelper::checkObject($components)): ?>
<?php if (($id = MembersmanagerHelper::getVar('form', $displayData->id, 'member', 'id', '=', str_replace("com_", "", $components->element))) !== false): ?>
<?php if (($link = MembersmanagerHelper::getEditURL($id, 'form', 'form', '&return=' . $displayData->return_path, $components->element)) !== false): ?>
<li><a href="<?php echo $link; ?>"><?php echo $components->name; ?></a></li>
<?php endif; ?>
<?php else: ?>
<li><a href="index.php?option=<?php echo $components->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $components->name; ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
</div>
<div id="getreport" class="uk-flex-top" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<button class="uk-modal-close-default" type="button" uk-close></button>
<div id="report-spinner"><?php echo JText::_('COM_MEMBERSMANAGER_LOADING'); ?><span class="loading-dots"></span>.</div>
<div id="setreport" uk-overflow-auto></div>
</div>
</div>
<?php else: ?>
<?php echo JLayoutHelper::render('profileextra_uikit_three', $displayData); ?>
<?php endif; ?>