Skip to content

Commit 0ab338f

Browse files
authored
Merge pull request #23 from CCPBioSim/views
Views
2 parents ca96cbe + 1c34ef6 commit 0ab338f

8 files changed

Lines changed: 955 additions & 14 deletions

File tree

com_ccpbiosim/site/src/View/Coreteammembers/HtmlView.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function display($tpl = null)
4545
$this->items = $this->get('Items');
4646
$this->pagination = $this->get('Pagination');
4747
$this->params = $app->getParams('com_ccpbiosim');
48-
48+
$this->layout = $app->getInput()->get('_layout', 'default', 'STRING');
49+
$this->setLayout($this->layout);
4950

5051
// Check for errors.
5152
if (count($errors = $this->get('Errors')))

com_ccpbiosim/site/src/View/Managementteams/HtmlView.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function display($tpl = null)
4545
$this->items = $this->get('Items');
4646
$this->pagination = $this->get('Pagination');
4747
$this->params = $app->getParams('com_ccpbiosim');
48-
48+
$this->layout = $app->getInput()->get('_layout', 'default', 'STRING');
49+
$this->setLayout($this->layout);
4950

5051
// Check for errors.
5152
if (count($errors = $this->get('Errors')))
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<metadata>
3-
<layout title="COM_CCPBIOSIM_TITLE_LIST_VIEW_CORETEAMMEMBERS" option="View">
4-
<message>
5-
<![CDATA[COM_CCPBIOSIM_TITLE_LIST_VIEW_CORETEAMMEMBERS_DESC]]>
6-
</message>
7-
</layout>
8-
3+
<layout title="COM_CCPBIOSIM_TITLE_LIST_VIEW_CORETEAMMEMBERS" option="View">
4+
<message><![CDATA[COM_CCPBIOSIM_TITLE_LIST_VIEW_CORETEAMMEMBERS_DESC]]></message>
5+
</layout>
6+
<fields name="request">
7+
<fieldset name="request">
8+
<field
9+
name="_layout"
10+
type="list"
11+
label="Layouts"
12+
description="Available View Layouts"
13+
required="true"
14+
>
15+
<option value="-1">Choose a Layout</option>
16+
<option value="default">Default</option>
17+
<option value="profile">Profile</option>
18+
<option value="list">List</option>
19+
</field>
20+
</fieldset>
21+
</fields>
922
</metadata>
23+
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
<?php
2+
/**
3+
* @package com_ccpbiosim
4+
* @copyright 2025 CCPBioSim Team
5+
* @license MIT
6+
*/
7+
// No direct access
8+
defined('_JEXEC') or die;
9+
10+
use \Joomla\CMS\HTML\HTMLHelper;
11+
use \Joomla\CMS\Factory;
12+
use \Joomla\CMS\Uri\Uri;
13+
use \Joomla\CMS\Router\Route;
14+
use \Joomla\CMS\Language\Text;
15+
use \Joomla\CMS\Layout\LayoutHelper;
16+
use \Joomla\CMS\Session\Session;
17+
use \Joomla\CMS\User\UserFactoryInterface;
18+
19+
HTMLHelper::_('bootstrap.tooltip');
20+
HTMLHelper::_('behavior.multiselect');
21+
22+
$user = Factory::getApplication()->getIdentity();
23+
$userId = $user->get('id');
24+
$listOrder = $this->state->get('list.ordering');
25+
$listDirn = $this->state->get('list.direction');
26+
$canCreate = $user->authorise('core.create', 'com_ccpbiosim') && file_exists(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'coreteammemberform.xml');
27+
$canEdit = $user->authorise('core.edit', 'com_ccpbiosim') && file_exists(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'coreteammemberform.xml');
28+
$canCheckin = $user->authorise('core.manage', 'com_ccpbiosim');
29+
$canChange = $user->authorise('core.edit.state', 'com_ccpbiosim');
30+
$canDelete = $user->authorise('core.delete', 'com_ccpbiosim');
31+
32+
// Import CSS
33+
$wa = $this->document->getWebAssetManager();
34+
$wa->useStyle('com_ccpbiosim.list');
35+
?>
36+
37+
<?php if ($this->params->get('show_page_heading')) : ?>
38+
<div class="page-header">
39+
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
40+
</div>
41+
<?php endif;?>
42+
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post"
43+
name="adminForm" id="adminForm">
44+
45+
<div class="table-responsive">
46+
<table class="table table-striped" id="coreteammemberList">
47+
<thead>
48+
<tr>
49+
50+
<th class=''>
51+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_ID', 'a.id', $listDirn, $listOrder); ?>
52+
</th>
53+
54+
<th >
55+
<?php echo HTMLHelper::_('grid.sort', 'JPUBLISHED', 'a.state', $listDirn, $listOrder); ?>
56+
</th>
57+
58+
<th class=''>
59+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_TITLE', 'a.title', $listDirn, $listOrder); ?>
60+
</th>
61+
62+
<th class=''>
63+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_FIRSTNAME', 'a.firstname', $listDirn, $listOrder); ?>
64+
</th>
65+
66+
<th class=''>
67+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_SURNAME', 'a.surname', $listDirn, $listOrder); ?>
68+
</th>
69+
70+
<th class=''>
71+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_PROFILEPHOTO', 'a.profilephoto', $listDirn, $listOrder); ?>
72+
</th>
73+
74+
<th class=''>
75+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_ROLE', 'a.role', $listDirn, $listOrder); ?>
76+
</th>
77+
78+
<th class=''>
79+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_INSITUTION', 'a.insitution', $listDirn, $listOrder); ?>
80+
</th>
81+
82+
<th class=''>
83+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_GROUPWEBSITE', 'a.groupwebsite', $listDirn, $listOrder); ?>
84+
</th>
85+
86+
<th class=''>
87+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_PROGRAMME', 'a.programme', $listDirn, $listOrder); ?>
88+
</th>
89+
90+
<th class=''>
91+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_SOCIAL', 'a.social', $listDirn, $listOrder); ?>
92+
</th>
93+
94+
<th class=''>
95+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_CHAIR', 'a.chair', $listDirn, $listOrder); ?>
96+
</th>
97+
98+
<th class=''>
99+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_COSECPROJECTLEAD', 'a.cosecprojectlead', $listDirn, $listOrder); ?>
100+
</th>
101+
102+
<th class=''>
103+
<?php echo HTMLHelper::_('grid.sort', 'COM_CCPBIOSIM_CORETEAMMEMBERS_ADMINASSISTANT', 'a.adminassistant', $listDirn, $listOrder); ?>
104+
</th>
105+
106+
<?php if ($canEdit || $canDelete): ?>
107+
<th class="center">
108+
<?php echo Text::_('COM_CCPBIOSIM_CORETEAMMEMBERS_ACTIONS'); ?>
109+
</th>
110+
<?php endif; ?>
111+
112+
</tr>
113+
</thead>
114+
<tfoot>
115+
<tr>
116+
<td colspan="<?php echo isset($this->items[0]) ? count(get_object_vars($this->items[0])) : 10; ?>">
117+
<div class="pagination">
118+
<?php echo $this->pagination->getPagesLinks(); ?>
119+
</div>
120+
</td>
121+
</tr>
122+
</tfoot>
123+
<tbody>
124+
<?php foreach ($this->items as $i => $item) : ?>
125+
<?php $canEdit = $user->authorise('core.edit', 'com_ccpbiosim'); ?>
126+
<?php if (!$canEdit && $user->authorise('core.edit.own', 'com_ccpbiosim')): ?>
127+
<?php $canEdit = Factory::getApplication()->getIdentity()->id == $item->created_by; ?>
128+
<?php endif; ?>
129+
130+
<tr class="row<?php echo $i % 2; ?>">
131+
132+
<td>
133+
<?php echo $item->id; ?>
134+
</td>
135+
<td>
136+
<?php $class = ($canChange) ? 'active' : 'disabled'; ?>
137+
<a class="btn btn-micro <?php echo $class; ?>" href="<?php echo ($canChange) ? Route::_('index.php?option=com_ccpbiosim&task=coreteammember.publish&id=' . $item->id . '&state=' . (($item->state + 1) % 2), false, 2) : '#'; ?>">
138+
<?php if ($item->state == 1): ?>
139+
<i class="icon-publish"></i>
140+
<?php else: ?>
141+
<i class="icon-unpublish"></i>
142+
<?php endif; ?>
143+
</a>
144+
</td>
145+
<td>
146+
<?php echo $item->title; ?>
147+
</td>
148+
<td>
149+
<?php echo $item->firstname; ?>
150+
</td>
151+
<td>
152+
<?php echo $item->surname; ?>
153+
</td>
154+
<td>
155+
<img src="<?php echo Uri::root() . $item->profilephoto; ?>" alt="Preview" style="max-height: 50px;" />
156+
</td>
157+
<td>
158+
<?php echo $item->role; ?>
159+
</td>
160+
<td>
161+
<?php echo $item->insitution; ?>
162+
</td>
163+
<td>
164+
<?php echo $item->groupwebsite; ?>
165+
</td>
166+
<td>
167+
<?php echo $item->programme; ?>
168+
</td>
169+
<td>
170+
<?php echo $item->social; ?>
171+
</td>
172+
<td>
173+
<?php echo $item->chair; ?>
174+
</td>
175+
<td>
176+
<?php echo $item->cosecprojectlead; ?>
177+
</td>
178+
<td>
179+
<?php echo $item->adminassistant; ?>
180+
</td>
181+
<?php if ($canEdit || $canDelete): ?>
182+
<td class="center">
183+
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_ccpbiosim.' . $item->id) || $item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
184+
185+
<?php if($canEdit && $item->checked_out == 0): ?>
186+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=coreteammember.edit&id=' . $item->id, false, 2); ?>" class="btn btn-mini" type="button"><i class="icon-edit" ></i></a>
187+
<?php endif; ?>
188+
<?php if ($canDelete): ?>
189+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=coreteammemberform.remove&id=' . $item->id, false, 2); ?>" class="btn btn-mini delete-button" type="button"><i class="icon-trash" ></i></a>
190+
<?php endif; ?>
191+
</td>
192+
<?php endif; ?>
193+
194+
</tr>
195+
<?php endforeach; ?>
196+
</tbody>
197+
</table>
198+
</div>
199+
<?php if ($canCreate) : ?>
200+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=coreteammemberform.edit&id=0', false, 0); ?>"
201+
class="btn btn-success btn-small"><i
202+
class="icon-plus"></i>
203+
<?php echo Text::_('COM_CCPBIOSIM_ADD_ITEM'); ?></a>
204+
<?php endif; ?>
205+
206+
<input type="hidden" name="task" value=""/>
207+
<input type="hidden" name="boxchecked" value="0"/>
208+
<input type="hidden" name="filter_order" value=""/>
209+
<input type="hidden" name="filter_order_Dir" value=""/>
210+
<?php echo HTMLHelper::_('form.token'); ?>
211+
</form>
212+
213+
<?php
214+
if($canDelete) {
215+
$wa->addInlineScript("
216+
jQuery(document).ready(function () {
217+
jQuery('.delete-button').click(deleteItem);
218+
});
219+
220+
function deleteItem() {
221+
222+
if (!confirm(\"" . Text::_('COM_CCPBIOSIM_DELETE_MESSAGE') . "\")) {
223+
return false;
224+
}
225+
}
226+
", [], [], ["jquery"]);
227+
}
228+
?>

0 commit comments

Comments
 (0)