primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Field\CalendarField;
FormHelper::loadFieldClass('calendar');
/**
* Form Field class for JEM needs.
*
* Advances CalendarField for better country-specific date format support.
*
* @since 2.2.3
*/
class JFormFieldCalendarJem extends CalendarField
{
/**
* The form field type.
*
* @var string
*/
protected $type = 'CalendarJem';
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
if (!empty($this->hint)) {
return $data;
}
// add hint regarding date/time format accepted in edit field
$exampleTimestamp = strtotime("NOW");
$date_format = str_replace("%","",$this->format);
$hint = Text::sprintf('COM_JEM_DATEFIELD_HINT', date($date_format, $exampleTimestamp));
$extraData = array(
'hint' => $hint,
);
return array_merge($data, $extraData);
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* @version 2.2.3
* @package JEM
* @copyright (C) 2013-2017 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('calendar');
/**
* Form Field class for JEM needs.
*
* Advances JFormFieldCalendar for better country-specific date format support.
*
* @since 2.2.3
*/
if (version_compare(JVERSION, '3.7', 'ge')) {
class JFormFieldCalendarJem extends JFormFieldCalendar
{
/**
* The form field type.
*
* @var string
*/
protected $type = 'CalendarJem';
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
if (!empty($this->hint)) {
return $data;
}
// add hint regarding date/time format accepted in edit field
$exampleTimestamp = strtotime("NOW");
$hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
$extraData = array(
'hint' => $hint,
);
return array_merge($data, $extraData);
}
}
} else {
class JFormFieldCalendarJem extends JFormFieldCalendar
{
/**
* The form field type.
*
* @var string
* @note MUST be public.
*/
public $type = 'CalendarJem';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
// don't translate format; it MUST be Y-m-d to keep calendar popup working
if (empty($this->hint)) {
// add hint regarding date/time format accepted in edit field
$exampleTimestamp = strtotime("NOW");
$this->hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
}
return parent::getInput();
}
}
}

View File

@ -0,0 +1,126 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
FormHelper::loadFieldClass('list');
/**
* Category select
*
* @package JEM
*
*/
class JFormFieldCategories extends ListField
{
protected $type = 'Categories';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
*/
protected function getInput()
{
$app = Factory::getApplication();
$document = $app->getDocument();
$wa = $document->getWebAssetManager();
// Build the script.
$script = array();
$script[] = ' function jSelectCategory_'.$this->id.'(id, category, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = category;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#categories-modal").modal("hide");';
$script[] = ' };';
// Add the script to the document head.
$wa->addInlineScript(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_jem&amp;view=categoryelement&amp;tmpl=component&amp;function=jSelectCategory_'.$this->id;
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('catname');
$query->from('#__jem_categories');
$query->where('id='.(int)$this->value);
try
{
$db->setQuery($query);
$category = $db->loadResult();
}
catch (RuntimeException $e)
{
$app->enqueueMessage($e->getMessage(), 'warning');
}
// if ($error = $db->getErrorMsg()) {
// Factory::getApplication()->enqueueMessage($error, 'warning');
// }
if (empty($category)) {
$category = Text::_('COM_JEM_SELECT_CATEGORY');
}
$category = htmlspecialchars($category, ENT_QUOTES, 'UTF-8');
// The current user display field.
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$category.'" disabled="disabled" size="35" class="form-control valid form-control-success" />';
$html[] = '</div>';
// The user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'categories-modal',
array(
'url' => $link.'&amp;'.Session::getFormToken().'=1',
'title' => Text::_('COM_JEM_SELECT_CATEGORY'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#categories-modal">'.Text::_('COM_JEM_SELECT_CATEGORY').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
// The active category-id field.
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,237 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
// ensure JemFactory is loaded (because field maybe used by modules too)
require_once(JPATH_SITE.'/components/com_jem/factory.php');
FormHelper::loadFieldClass('list');
/**
* Category Form
*/
class JFormFieldCategoryEdit extends ListField
{
/**
* A flexible category list that respects access controls
*
* @var string
*/
public $type = 'CategoryEdit';
/**
* Method to get a list of categories that respects access controls and can be used for
* either category assignment or parent category assignment in edit screens.
* Use the parent element to indicate that the field will be used for assigning parent categories.
*
* @return array The field option objects.
*/
protected function getOptions()
{
// Initialise variables.
$options = array();
$published = $this->element['published']? $this->element['published'] : array(0,1);
$name = (string) $this->element['name'];
// Let's get the id for the current item, either category or content item.
$jinput = Factory::getApplication()->input;
// Load the category options for a given extension.
// For categories the old category is the category id or 0 for new category.
if ($this->element['parent'])
{
$oldCat = $jinput->get('id', 0);
$oldParent = $this->form->getValue($name, 0);
//$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('extension','com_content');
}
else
// For items the old category is the category they are in when opened or 0 if new.
{
$thisItem = $jinput->get('id',0);
$oldCat = $this->form->getValue($name, 0);
//$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('option','com_content');
}
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('a.id AS value, a.catname AS text, a.level, a.published');
$query->from('#__jem_categories AS a');
$query->join('LEFT', $db->quoteName('#__jem_categories').' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
// Filter by the extension type
//if ($this->element['parent'] == true)
//{
// $query->where('(a.parent_id = 0)');
//}
// If parent isn't explicitly stated but we are in com_categories assume we want parents
if ($oldCat != 0 && ($this->element['parent'] == true ))
{
// Prevent parenting to children of this item.
// To rearrange parents and children move the children up, not the parents down.
$query->join('LEFT', $db->quoteName('#__jem_categories').' AS p ON p.id = '.(int) $oldCat);
$query->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.catname AS text, a.level, a.parent_id');
$rowQuery->from('#__jem_categories AS a');
$rowQuery->where('a.id = ' . (int) $oldCat);
$db->setQuery($rowQuery);
$row = $db->loadObject();
}
// Filter on the published state
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif (is_array($published) && count($published))
{
\Joomla\Utilities\ArrayHelper::toInteger($published);
$query->where('a.published IN (' . implode(',', $published) . ')');
}
if ($this->element['removeroot'] == true) {
$query->where('a.catname NOT LIKE "root"');
}
$query->group('a.id, a.catname, a.level, a.lft, a.rgt, a.parent_id, a.published');
$query->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
// Check for a database error.
// if ($db->getErrorNum()) {
// Factory::getApplication()->enqueueMessage($db->getErrorMsg(), 'warning');
// }
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getErrorMsg(), 'warning');
}
// Pad the option text with spaces using depth level as a multiplier.
for ($i = 0, $n = (is_array($options) ? count($options) : 0); $i < $n; $i++)
{
// remove root
if ($this->element['removeroot'] == true)
{
if ($options[$i]->level == 0)
{
unset($options[$i]);
continue;
}
$options[$i]->level = $options[$i]->level-1;
}
// Translate ROOT
if ($this->element['parent'] == true)
{
if ($options[$i]->level == 0)
{
$options[$i]->text = Text::_('JGLOBAL_ROOT_PARENT');
}
}
if ($options[$i]->published == 1)
{
$options[$i]->text = str_repeat('- ', $options[$i]->level). $options[$i]->text ;
}
else
{
$options[$i]->text = str_repeat('- ', $options[$i]->level). '[' .$options[$i]->text . ']';
}
}
// Get the current user object.
$user = JemFactory::getUser();
// For new items we want a list of categories you are allowed to create in.
if ($oldCat == 0)
{
foreach ($options as $i => $option)
{
// To take save or create in a category you need to have create rights for that category
// unless the item is already in that category.
// Unset the option if the user isn't authorised for it. In this field assets are always categories.
if ($user->authorise('core.create', 'com_jem' . '.category.' . $option->value) != true )
{
unset($options[$i]);
}
}
}
// If you have an existing category id things are more complex.
else
{
// If you are only allowed to edit in this category but not edit.state, you should not get any
// option to change the category parent for a category or the category for a content item,
// but you should be able to save in that category.
foreach ($options as $i => $option)
{
if ($user->authorise('core.edit.state', 'com_jem' . '.category.' . $oldCat) != true && !isset($oldParent))
{
if ($option->value != $oldCat )
{
unset($options[$i]);
}
}
if ($user->authorise('core.edit.state', 'com_jem' . '.category.' . $oldCat) != true
&& (isset($oldParent)) && $option->value != $oldParent)
{
unset($options[$i]);
}
// However, if you can edit.state you can also move this to another category for which you have
// create permission and you should also still be able to save in the current category.
if (($user->authorise('core.create', 'com_jem' . '.category.' . $option->value) != true)
&& ($option->value != $oldCat && !isset($oldParent)))
{
{
unset($options[$i]);
}
}
if (($user->authorise('core.create', 'com_jem' . '.category.' . $option->value) != true)
&& (isset($oldParent)) && $option->value != $oldParent)
{
{
unset($options[$i]);
}
}
}
}
if (($this->element['parent'] == true)
&& (isset($row) && !isset($options[0])) && isset($this->element['show_root']))
{
if ($row->parent_id == '1') {
$parent = new stdClass();
$parent->text = Text::_('JGLOBAL_ROOT_PARENT');
array_unshift($options, $parent);
}
array_unshift($options, HTMLHelper::_('select.option', '0', Text::_('JGLOBAL_ROOT')));
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@ -0,0 +1,179 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
// ensure JemFactory is loaded (because field maybe used by modules too)
require_once(JPATH_SITE.'/components/com_jem/factory.php');
FormHelper::loadFieldClass('list');
/**
* Category formfield.
*
*/
class JFormFieldCategoryParent extends ListField
{
/**
* The form field type.
*
* @var string
*/
protected $type = 'CategoryParent';
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
// Initialise variables.
$options = array();
$name = (string) $this->element['name'];
// Let's get the id for the current item, either category or content item.
$jinput = Factory::getApplication()->input;
// For categories the old category is the category id 0 for new category.
if ($this->element['parent'])
{
$oldCat = $jinput->get('id',0);
$oldParent = $this->form->getValue($name);
}
else
// For items the old category is the category they are in when opened or 0 if new.
{
$thisItem = $jinput->get('id',0);
$oldCat = $this->form->getValue($name);
}
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('a.id AS value, a.title AS text, a.level');
$query->from('#__categories AS a');
$query->join('LEFT', $db->quoteName('#__categories').' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
// Filter by the type
if ($extension = $this->form->getValue('extension')) {
$query->where('(a.extension = '.$db->quote($extension).' OR a.parent_id = 0)');
}
if ($this->element['parent'])
{
// Prevent parenting to children of this item.
if ($id = $this->form->getValue('id')) {
$query->join('LEFT', $db->quoteName('#__categories').' AS p ON p.id = '.(int) $id);
$query->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id');
$rowQuery->from('#__categories AS a');
$rowQuery->where('a.id = ' . (int) $id);
$db->setQuery($rowQuery);
$row = $db->loadObject();
}
}
$query->where('a.published IN (0,1)');
$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id');
$query->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
// Check for a database error.
// if ($db->getErrorNum()) {
// Factory::getApplication()->enqueueMessage($db->getErrorMsg(), 'warning');
// }
try
{
$options = $db->loadObjectList();
}
catch (\InvalidArgumentException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}
// Pad the option text with spaces using depth level as a multiplier.
for ($i = 0, $n = (is_array($options) ? count($options) : 0); $i < $n; $i++)
{
// Translate ROOT
if ($options[$i]->level == 0) {
$options[$i]->text = Text::_('JGLOBAL_ROOT_PARENT');
}
$options[$i]->text = str_repeat('- ', $options[$i]->level).$options[$i]->text;
}
// Initialise variables.
// Get the current user object.
$user = JemFactory::getUser();
// For new items we want a list of categories you are allowed to create in.
if ($oldCat == 0)
{
foreach ($options as $i => $option)
{
// To take save or create in a category you need to have create rights for that category
// unless the item is already in that category.
// Unset the option if the user isn't authorised for it. In this field assets are always categories.
if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true )
{
unset($options[$i]);
}
}
}
// If you have an existing category id things are more complex.
else
{
//$categoryOld = $this->form->getValue($name);
foreach ($options as $i => $option)
{
// If you are only allowed to edit in this category but not edit.state, you should not get any
// option to change the category parent for a category or the category for a content item,
// but you should be able to save in that category.
if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true)
{
if ($option->value != $oldCat)
{//echo 'y';
unset($options[$i]);
}
}
// However, if you can edit.state you can also move this to another category for which you have
// create permission and you should also still be able to save in the current category.
elseif
(($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& $option->value != $oldCat)
{//echo 'x';
unset($options[$i]);
}
}
}
if (isset($row) && !isset($options[0])) {
if ($row->parent_id == '1') {
$parent = new stdClass();
$parent->text = Text::_('JGLOBAL_ROOT_PARENT');
array_unshift($options, $parent);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@ -0,0 +1,114 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
FormHelper::loadFieldClass('list');
/**
* CatOptions Field class.
*/
class JFormFieldCatOptions extends ListField
{
/**
* The category options field type.
*/
protected $type = 'CatOptions';
/**
* Create Input
* @see ListField::getInput()
*/
public function getInput()
{
$attr = '';
// Initialize field attributes.
$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true')
{
$attr .= ' disabled="disabled"';
}
// Initialize JavaScript field attributes.
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
// Get the field options.
$options = (array) $this->getOptions();
$jinput = Factory::getApplication()->input;
$currentid = $jinput->getInt('id');
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('DISTINCT catid');
$query->from('#__jem_cats_event_relations');
$query->where('itemid = '. $db->quote($currentid));
$db->setQuery($query);
$selectedcats = $db->loadColumn();
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
{
$html[] = HTMLHelper::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $selectedcats,$this->id);
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($selectedcats, ENT_COMPAT, 'UTF-8') . '"/>';
}
else
// Create a regular list.
{
$html[] = HTMLHelper::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $selectedcats,$this->id);
}
return implode($html);
}
/**
* Retrieve Options
* @see ListField::getOptions()
*/
protected function getOptions()
{
$options = JemCategories::getCategoriesTree();
$options = array_values($options);
// Pad the option text with spaces using depth level as a multiplier
# the level has to be decreased as we are having a (invisible) root
# treename is generated by the function so let's use that one instead of the Joomla way
for ($i = 0, $n = (is_array($options) ? count($options) : 0); $i < $n; $i++)
{
/*
if ($options[$i]->published == 1)
{
$options[$i]->text = str_repeat('- ', ($options[$i]->level - 1)) . $options[$i]->text;
}
else
{
$options[$i]->text = str_repeat('- ', ($options[$i]->level - 1)) . '[' . $options[$i]->text . ']';
}
*/
$options[$i]->text = $options[$i]->treename;
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@ -0,0 +1,74 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
//JFormHelper::loadFieldClass('list');
jimport('joomla.html.html');
/**
* CountryOptions Field class.
*
*
*/
class JFormFieldCatOptions2 extends FormField
{
/**
* The form field type.
*
*/
protected $type = 'CatOptions2';
public function getInput()
{
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
$attr .= ' disabled="disabled"';
}
//$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
//$attr .= $this->element['required'] ? ' class="required modal-value"' : "";
// if ($this->required) {
// $class = ' class="required modal-value"';
// }
// Output
//$categories = JEMCategories::getCategoriesTree(0);
//$Lists['parent_id'] = JEMCategories::buildcatselect($categories, 'parent_id', $row->parent_id, 1);
$currentid = Factory::getApplication()->input->getInt('id');
$categories = JEMCategories::getCategoriesTree(0);
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query = 'SELECT DISTINCT parent_id FROM #__jem_categories WHERE id = '. $db->quote($currentid);
$db->setQuery($query);
$currentparent_id = $db->loadColumn();
return JEMCategories::buildcatselect($categories, 'parent_id', $currentparent_id, 1);
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
FormHelper::loadFieldClass('list');
/**
* CountryOptions Field class.
*
*
*/
class JFormFieldCountryOptions extends ListField
{
/**
* The form field type.
*
*/
protected $type = 'CountryOptions';
/**
* Method to get the Country options.
*
*/
public function getOptions()
{
return JEMHelperBackend::getCountryOptions();
}
}

View File

@ -0,0 +1,62 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormField;
/**
* Color Form Field
*/
class JFormFieldCustomColor extends FormField
{
/**
* The form field type.
*/
protected $type = 'CustomColor';
/**
* Method to get the field input markup.
*/
protected function getInput()
{
// Initialize field attributes.
$size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$classes = (string) $this->element['class'];
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
if (!$disabled)
{
$classes .= ' colorpicker';
}
// load script.
$script = array();
$script[] = ' function jClearColor(id) {';
$script[] = ' document.getElementById(id).value = "";';
$script[] = ' document.getElementById(id).style.background = "";';
$script[] = ' }';
// Add the script to the document head.
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Initialize JavaScript field attributes.
$onclick = ' onclick="openPicker(\''.$this->id.'\', -200, 20)"';
$class = $classes ? ' class="' . trim($classes) . '"' : '';
$html = array();
$html[] = '<input style="background:'.$this->value.'" type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size .$onclick. '/>';
$html[] = '<input title="'.Text::_('JCLEAR').'" type="text" class="button" size="1" value="" id="clear" onclick="return jClearColor(\''.$this->id.'\')">';
return implode("\n", $html);
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
//JFormHelper::loadFieldClass('list');
jimport('joomla.html.html');
/**
* Endtime Field class.
*
*
*/
class JFormFieldEndtime extends FormField
{
/**
* The form field type.
*
*/
protected $type = 'Endtime';
public function getInput()
{
$endhours = JEMHelper::buildtimeselect(23, 'endhours', substr( $this->value, 0, 2 ),array('class'=>'form-select','class'=>'select-time'));
$endminutes = JEMHelper::buildtimeselect(59, 'endminutes', substr($this->value, 3, 2 ),array('class'=>'form-select','class'=>'select-time'));
$var2 = $endhours.$endminutes;
return $var2;
}
}

View File

@ -0,0 +1,120 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
jimport('joomla.form.formfield');
jimport('joomla.html.parameter.element');
FormHelper::loadFieldClass('list');
/**
* Renders an event element
*
* @package JEM
*
*/
class JFormFieldEvent extends ListField
{
protected $type = 'title';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
*/
protected function getInput()
{
// Build the script.
$script = array();
$script[] = ' function elSelectEvent(id, title, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = title;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#event-modal").modal("hide");';
$script[] = ' }';
// Add the script to the document head.
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_jem&amp;view=eventelement&amp;tmpl=component&amp;object='.$this->id;
$db = Factory::getContainer()->get('DatabaseDriver');
$db->setQuery(
'SELECT title' .
' FROM #__jem_events' .
' WHERE id = '.(int) $this->value
);
try
{
$title = $db->loadResult();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}
if (empty($title)) {
$title = Text::_('COM_JEM_SELECT_EVENT');
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current user display field.
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" class="form-control valid form-control-success" />';
$html[] = '</div>';
// The user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'event-modal',
array(
'url' => $link.'&amp;'.Session::getFormToken().'=1',
'title' => Text::_('COM_JEM_SELECT_EVENT'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#event-modal">'.Text::_('COM_JEM_SELECT_EVENT').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
// The active event-id field.
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,38 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\FormField;
/**
*/
class JFormFieldFootertext extends FormField
{
/**
* The form field type.
*/
protected $type = 'Footertext';
/**
*/
protected function getInput()
{
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$columns = $this->element['cols'] ? ' cols="' . (int) $this->element['cols'] . '"' : '';
$rows = $this->element['rows'] ? ' rows="' . (int) $this->element['rows'] . '"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
return '<textarea name="' . $this->name . '" id="' . $this->id . '"' . $columns . $rows . $class . $disabled . $onchange . '>'
. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>';
}
}

View File

@ -0,0 +1,36 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormField;
/**
* Hits Field.
*/
class JFormFieldHits extends FormField
{
/**
* The form field type.
* @var string
*/
protected $type = 'Hits';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
$onclick = ' onclick="document.getElementById(\''.$this->id.'\').value=\'0\';"';
return '<input type="text" name="'.$this->name.'" id="'.$this->id.'" class="form-control field-user-input-name valid form-control-success w-20" value="'.htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8').'" readonly="readonly" style="display:inline-block;" /><input type="button"'.$onclick.' value="'.Text::_('COM_JEM_RESET_HITS').'" class="btn btn-primary selectcat" />';
}
}

View File

@ -0,0 +1,129 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.form.formfield');
jimport('joomla.html.parameter.element');
FormHelper::loadFieldClass('list');
/**
* Imageselect Field
*
*/
class JFormFieldImageselect extends ListField
{
protected $type = 'Imageselect';
public function getLabel() {
// code that returns HTML that will be shown as the label
}
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
*/
public function getInput()
{
// ImageType
$imagetype = $this->element['imagetype'];
// Build the script.
$script = array();
$script[] = ' function SelectImage(image, imagename) {';
$script[] = ' document.getElementById(\'a_image\').value = image';
$script[] = ' document.getElementById(\'a_imagename\').value = imagename';
$script[] = ' document.getElementById(\'imagelib\').src = \'../images/jem/'.$imagetype.'/\' + image';
// $script[] = ' window.parent.SqueezeBox.close()';
$script[] = ' $(".btn-close").trigger("click");';
$script[] = ' }';
switch ($imagetype)
{
case 'categories':
$task = 'categoriesimg';
$taskselect = 'selectcategoriesimg';
break;
case 'events':
$task = 'eventimg';
$taskselect = 'selecteventimg';
break;
case 'venues':
$task = 'venueimg';
$taskselect = 'selectvenueimg';
break;
}
// Add the script to the document head.
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_jem&amp;view=imagehandler&amp;layout=uploadimage&amp;task='.$task.'&amp;tmpl=component';
$link2 = 'index.php?option=com_jem&amp;view=imagehandler&amp;task='.$taskselect.'&amp;tmpl=component';
//
$html[] = "<div class=\"fltlft\">";
$html[] = "<input class=\"form-control\" style=\"background: #fff;\" type=\"text\" id=\"a_imagename\" value=\"$this->value\" disabled=\"disabled\" onchange=\"javascript:if (document.forms[0].a_imagename.value!='') {document.imagelib.src='../images/jem/$imagetype/' + document.forms[0].a_imagename.value} else {document.imagelib.src='../media/com_jem/images/blank.png'}\"; />";
$html[] = "</div>";
$html[] = "<div class=\"button2-left\"><div class=\"blank\">";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'imageupload-modal',
array(
'url' => $link,
'title' => Text::_('COM_JEM_UPLOAD'),
'width' => '650px',
'height' => '500px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-primary btn-margin" data-bs-toggle="modal" data-bs-target="#imageupload-modal">'.Text::_('COM_JEM_UPLOAD').'
</button>';
$html[] ='</div></div>';
// $html[] = "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"".Text::_('COM_JEM_SELECTIMAGE')."\" href=\"$link2\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">".Text::_('COM_JEM_SELECTIMAGE')."</a></div></div>\n";
$html[] = "<div class=\"button2-left\"><div class=\"blank\">";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'imageselect-modal',
array(
'url' => $link2,
'title' => Text::_('COM_JEM_SELECTIMAGE'),
'width' => '650px',
'height' => '500px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] = "<button type=\"button\" class=\"btn btn-primary btn-margin\" data-bs-toggle=\"modal\" data-bs-target=\"#imageselect-modal\">".Text::_('COM_JEM_SELECTIMAGE')."
</button>";
$html[] = "</div></div>";
$html[] = "\n&nbsp;<input class=\"btn btn-danger btn-margin\" type=\"button\" onclick=\"SelectImage('', '".Text::_('COM_JEM_SELECTIMAGE')."');\" value=\"".Text::_('COM_JEM_RESET')."\" />";
$html[] = "\n<input type=\"hidden\" id=\"a_image\" name=\"$this->name\" value=\"$this->value\" />";
$html[] = "<img src=\"../media/com_jem/images/blank.png\" name=\"imagelib\" id=\"imagelib\" class=\"venue-image\" alt=\"".Text::_('COM_JEM_SELECTIMAGE_PREVIEW')."\" />";
$html[] = "<script type=\"text/javascript\">";
$html[] = "if (document.forms[0].a_imagename.value!='') {";
$html[] = "var imname = document.forms[0].a_imagename.value;";
$html[] = "jsimg='../images/jem/$imagetype/' + imname;";
$html[] = "document.getElementById('imagelib').src= jsimg;";
$html[] = "}";
$html[] = "</script>";
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,119 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Form\FormField;
/**
* Contact select
*/
class JFormFieldModal_Contact extends FormField
{
/**
* field type
*/
protected $type = 'Modal_Contact';
/**
* Method to get the field input markup
*/
protected function getInput()
{
// Build the script
$script = array();
$script[] = ' function jSelectContact_'.$this->id.'(id, name, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = name;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#contact-modal").modal("hide");';
$script[] = ' }';
// Add to document head
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Setup variables for display
$html = array();
$link = 'index.php?option=com_jem&amp;view=contactelement&amp;tmpl=component&amp;function=jSelectContact_'.$this->id;
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('name');
$query->from('#__contact_details');
$query->where(array('id='.(int)$this->value));
// if ($error = $db->getErrorMsg()) {
// Factory::getApplication()->enqueueMessage($error, 'warning');
// }
try
{
$db->setQuery($query);
$contact = $db->loadResult();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'notice');
}
if (empty($contact)) {
$contact = Text::_('COM_JEM_SELECTCONTACT');
}
$contact = htmlspecialchars($contact, ENT_QUOTES, 'UTF-8');
// The current contact input field
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$contact.'" disabled="disabled" size="35" class="form-control valid form-control-success" />';
$html[] = '</div>';
// The contact select button
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
// $html[] = ' <a class="modal" title="'.Text::_('COM_JEM_SELECT').'" href="'.$link.'&amp;'.Session::getFormToken().'=1" rel="{handler: \'iframe\', size: {x:800, y:450}}">'.
// Text::_('COM_JEM_SELECT').'</a>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'contact-modal',
array(
'url' => $link.'&amp;'.Session::getFormToken().'=1',
'title' => Text::_('COM_JEM_SELECT'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-link btn-primary" data-bs-toggle="modal" data-bs-target="#contact-modal">'.Text::_('COM_JEM_SELECT').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
// The active contact id field
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,119 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Form\FormField;
/**
* Venue Select
*/
class JFormFieldModal_Venue extends FormField
{
/**
* field type
* @var string
*/
protected $type = 'Modal_Venue';
/**
* Method to get the field input markup
*/
protected function getInput()
{
// Build the script
$script = array();
$script[] = ' function jSelectVenue_'.$this->id.'(id, venue, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = venue;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#venue-modal-1").modal("hide");';
$script[] = ' }';
// Add to document head
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Setup variables for display
$html = array();
$link = 'index.php?option=com_jem&amp;view=venueelement&amp;tmpl=component&amp;function=jSelectVenue_'.$this->id;
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('venue');
$query->from('#__jem_venues');
$query->where(array('id='.(int)$this->value));
// if ($error = $db->getErrorMsg()) {
// Factory::getApplication()->enqueueMessage($error, 'warning');
// }
try
{
$db->setQuery($query);
$venue = $db->loadResult();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'notice');
}
if (empty($venue)) {
$venue = Text::_('COM_JEM_SELECTVENUE');
}
$venue = htmlspecialchars($venue, ENT_QUOTES, 'UTF-8');
// The current venue input field
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$venue.'" disabled="disabled" size="35" class="form-control valid form-control-success" />';
$html[] = '</div>';
// The venue select button
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
// $html[] = ' <a class="modal" title="'.Text::_('COM_JEM_SELECT').'" href="'.$link.'&amp;'.Session::getFormToken().'=1" rel="{handler: \'iframe\', size: {x:800, y:450}}">'.
// Text::_('COM_JEM_SELECT').'</a>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'venue-modal-1',
array(
'url' => $link.'&amp;'.Session::getFormToken().'=1',
'title' => Text::_('COM_JEM_SELECT'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-link btn-primary" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#venue-modal-1">'.Text::_('COM_JEM_SELECT').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
// The active venue id field
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,43 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
//JFormHelper::loadFieldClass('list');
jimport('joomla.html.html');
/**
* StartHours Field class.
*
*
*/
class JFormFieldStarthours extends FormField
{
/**
* The form field type.
*
*/
protected $type = 'Starthours';
public function getInput()
{
$starthours = JEMAdmin::buildtimeselect(23, 'starthours', substr( $this->name, 0, 2 ));
$startminutes = JEMAdmin::buildtimeselect(59, 'startminutes', substr( $this->name, 3, 2 ));
$var2 = $starthours.$startminutes;
return $var2;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
//JFormHelper::loadFieldClass('list');
jimport('joomla.html.html');
/**
* CountryOptions Field class.
*
*
*/
class JFormFieldStartminutes extends FormField
{
/**
* The form field type.
*
*/
protected $type = 'Startminutes';
public function getInput()
{
$startminutes = JEMAdmin::buildtimeselect(59, 'startminutes', substr( $this->name, 3, 2 ), array('class'=>'form-select','class'=>'select-time'));
return $startminutes;
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
//JFormHelper::loadFieldClass('list');
jimport('joomla.html.html');
/**
* CountryOptions Field class.
*
*
*/
class JFormFieldStarttime extends FormField
{
/**
* The form field type.
*
*/
protected $type = 'Starttime';
public function getInput()
{
$starthours = JEMHelper::buildtimeselect(23, 'starthours', substr( $this->value, 0, 2 ),array('class'=>'form-select','class'=>'select-time'));
$startminutes = JEMHelper::buildtimeselect(59, 'startminutes', substr($this->value, 3, 2 ),array('class'=>'form-select','class'=>'select-time'));
$var2 = $starthours.$startminutes;
return $var2;
}
}

View File

@ -0,0 +1,123 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
jimport('joomla.form.formfield');
jimport('joomla.html.parameter.element');
FormHelper::loadFieldClass('list');
/**
* Renders an venue element
*
* @package JEM
*
*/
class JFormFieldVenue extends ListField
{
protected $type = 'Venue';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
*/
protected function getInput()
{
// Build the script.
$script = array();
$script[] = ' function elSelectVenue(id, venue, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = venue;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#venue-modal").modal("hide");';
$script[] = ' }';
// Add the script to the document head.
Factory::getApplication()->getDocument()->getWebAssetManager()->addInlineScript(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_jem&amp;view=venueelement&amp;tmpl=component&amp;object='.$this->id;
$db = Factory::getContainer()->get('DatabaseDriver');
$db->setQuery(
'SELECT venue' .
' FROM #__jem_venues' .
' WHERE id = '.(int) $this->value
);
try
{
$title = $db->loadResult();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}
if (empty($title)) {
$title = Text::_('COM_JEM_SELECT_VENUE');
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current user display field.
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" class="form-control valid form-control-success" />';
$html[] = '</div>';
//
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
// $html[] = ' <a class="modal" title="'.Text::_('COM_JEM_SELECT_VENUE').'" href="'.$link.'&amp;'.Session::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.Text::_('COM_JEM_SELECT_VENUE').'</a>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'venue-modal',
array(
'url' => $link.'&amp;'.Session::getFormToken().'=1',
'title' => Text::_('COM_JEM_SELECT_VENUE'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('COM_JEM_CLOSE') . '</button>'
)
);
$html[] ='<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#venue-modal">'.Text::_('COM_JEM_SELECT_VENUE').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
// The active venue-id field.
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,78 @@
<?php
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
FormHelper::loadFieldClass('list');
/**
* Field: Venueoptions
*/
class JFormFieldVenueoptions extends ListField
{
/**
* A venue list
*/
public $type = 'Venueoptions';
/**
* @return array The field option objects.
*/
protected function getOptions()
{
// Initialise variables.
$options = array();
$published = $this->element['published']? $this->element['published'] : array(0,1);
$name = (string) $this->element['name'];
// Let's get the id for the current item
$jinput = Factory::getApplication()->input;
// Create SQL
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('l.id AS value, l.venue AS text, l.published');
$query->from('#__jem_venues AS l');
// Filter on the published state
if (is_numeric($published))
{
$query->where('l.published = ' . (int) $published);
}
elseif (is_array($published))
{
\Joomla\Utilities\ArrayHelper::toInteger($published);
$query->where('l.published IN (' . implode(',', $published) . ')');
}
$query->group('l.id');
$query->order('l.venue');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage, 'warning');
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}