Skip to content

Commit 07c2015

Browse files
committed
rearrange front end event form to match admin and add frontend buttons
1 parent 4211901 commit 07c2015

2 files changed

Lines changed: 49 additions & 18 deletions

File tree

com_ccpbiosim/site/tmpl/eventform/default.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,17 @@
5959
<?php echo $this->form->getInput('modified_by'); ?>
6060
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => 'event')); ?>
6161
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'event', Text::_('COM_CCPBIOSIM_TAB_EVENT', true)); ?>
62-
<?php echo $this->form->renderField('title'); ?>
6362

64-
<?php echo $this->form->renderField('category'); ?>
65-
66-
<?php echo $this->form->renderField('startdatetime'); ?>
67-
68-
<?php echo $this->form->renderField('enddatetime'); ?>
69-
70-
<?php echo $this->form->renderField('eventdetails'); ?>
71-
72-
<?php echo $this->form->renderField('location'); ?>
73-
74-
<?php echo $this->form->renderField('shortdesc'); ?>
75-
76-
<?php echo $this->form->renderField('youtube'); ?>
77-
78-
<?php echo $this->form->renderField('postevent'); ?>
79-
80-
<?php echo $this->form->renderField('shorturl'); ?>
63+
<?php echo $this->form->renderField('title'); ?>
64+
<?php echo $this->form->renderField('shorturl'); ?>
65+
<?php echo $this->form->renderField('category'); ?>
66+
<?php echo $this->form->renderField('location'); ?>
67+
<?php echo $this->form->renderField('startdatetime'); ?>
68+
<?php echo $this->form->renderField('enddatetime'); ?>
69+
<?php echo $this->form->renderField('shortdesc'); ?>
70+
<?php echo $this->form->renderField('eventdetails'); ?>
71+
<?php echo $this->form->renderField('youtube'); ?>
72+
<?php echo $this->form->renderField('postevent'); ?>
8173

8274
<?php echo HTMLHelper::_('uitab.endTab'); ?>
8375
<div class="control-group">

com_ccpbiosim/site/tmpl/events/upcoming-accordion.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,31 @@ class="list-group-item list-group-item-action d-flex align-items-start gap-3">
8080
<h6 class="mb-1"><?php echo $this->escape($item->title); ?></h6>
8181
<small class="text-muted"><?php echo $this->escape($item->location); ?></small>
8282
<p class="mb-1"><?php echo $this->escape($item->shortdesc); ?></p>
83+
84+
<?php $class = ($canChange) ? 'active' : 'disabled'; ?>
85+
<a class="btn btn-micro <?php echo $class; ?>" href="<?php echo ($canChange) ? Route::_('index.php?option=com_ccpbiosim&task=event.publish&id=' . $item->id . '&state=' . (($item->state + 1) % 2), false, 2) : '#'; ?>">
86+
<?php if ($item->state == 1): ?>
87+
<i class="icon-publish"></i>
88+
<?php else: ?>
89+
<i class="icon-unpublish"></i>
90+
<?php endif; ?>
91+
</a>
92+
93+
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_ccpbiosim.' . $item->id) || $item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
94+
<?php if($canCheckin && $item->checked_out > 0) : ?>
95+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=event.checkin&id=' . $item->id .'&'. Session::getFormToken() .'=1'); ?>">
96+
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->uEditor, $item->checked_out_time, 'event.', false); ?></a>
97+
<?php endif; ?>
98+
99+
<?php if ($canEdit || $canDelete): ?>
100+
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_ccpbiosim.' . $item->id) || $item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
101+
<?php if($canEdit && $item->checked_out == 0): ?>
102+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=event.edit&id=' . $item->id, false, 2); ?>" class="btn btn-mini" type="button"><i class="icon-edit" ></i></a>
103+
<?php endif; ?>
104+
<?php if ($canDelete): ?>
105+
<a href="<?php echo Route::_('index.php?option=com_ccpbiosim&task=eventform.remove&id=' . $item->id, false, 2); ?>" class="btn btn-mini delete-button" type="button"><i class="icon-trash" ></i></a>
106+
<?php endif; ?>
107+
<?php endif; ?>
83108
</div>
84109
</a>
85110
</ul>
@@ -164,3 +189,17 @@ class="list-group-item list-group-item-action d-flex align-items-start gap-3">
164189
</div>
165190
</div>
166191
</div>
192+
<?php
193+
if($canDelete) {
194+
$wa->addInlineScript("
195+
jQuery(document).ready(function () {
196+
jQuery('.delete-button').click(deleteItem);
197+
});
198+
function deleteItem() {
199+
if (!confirm(\"" . Text::_('COM_CCPBIOSIM_DELETE_MESSAGE') . "\")) {
200+
return false;
201+
}
202+
}
203+
", [], [], ["jquery"]);
204+
}
205+
?>

0 commit comments

Comments
 (0)