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,110 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Form\FormField;
/**
* Contact select
*/
class JFormFieldModal_Contact extends FormField
{
/**
* field type
* @var string
*/
protected $type = 'Modal_Contact';
/**
* Method to get the field input markup
*/
protected function getInput()
{
$app = Factory::getApplication();
$document = $app->getDocument();
$wa = $document->getWebAssetManager();
// 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
$wa->addInlineScript(implode("\n", $script));
// Setup variables for display
$html = array();
$link = 'index.php?option=com_jem&amp;view=editevent&amp;layout=choosecontact&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));
$db->setQuery($query);
try
{
$contact = $db->loadResult();
}
catch (RuntimeException $e)
{
$app->enqueueMessage($e->getMessage(), 'warning');
}
if (empty($contact)) {
$contact = Text::_('COM_JEM_SELECT_CONTACT');
}
$contact = htmlspecialchars($contact, ENT_QUOTES, 'UTF-8');
// The current contact input field
$html[] = ' <input type="text" id="'.$this->id.'_name" class="form-control readonly inputbox valid form-control-success" value="'.$contact.'" style="display:inline-block;" disabled="disabled" size="35" />';
// The contact select button
$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-success button-select" data-bs-toggle="modal" data-bs-target="#contact-modal">'.Text::_('COM_JEM_SELECT').'</button>';
// 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,124 @@
<?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\Form\FormField;
use Joomla\CMS\Session\Session;
/**
* Contact select
*/
class JFormFieldModal_Users extends FormField
{
/**
* field type
* @var string
*/
protected $type = 'Modal_Users';
/**
* Method to get the field input markup
*/
protected function getInput()
{
$app = Factory::getApplication();
$document = $app->getDocument();
$wa = $document->getWebAssetManager();
// Build the script
$script = array();
$script[] = ' function jSelectUsers_'.$this->id.'(ids, count, object) {';
$script[] = ' document.getElementById("'.$this->id.'_ids").value = ids;';
$script[] = ' document.getElementById("'.$this->id.'_count").value = count;';
// $script[] = ' SqueezeBox.close();';
$script[] = ' $("#user-modal").modal("hide");';
$script[] = ' }';
// Add to document head
$wa->addInlineScript(implode("\n", $script));
// Setup variables for display
$html = array();
$eventid = isset($this->element['eventid']) ? (int)$this->element['eventid'] : 0;
$link = 'index.php?option=com_jem&amp;view=editevent&amp;layout=chooseusers&amp;tmpl=component&amp;function=jSelectUsers_'.$this->id.'&amp;a_id='.$eventid;
// we expect a list of unique, non-zero numbers
$ids = explode(',', $this->value);
array_walk($ids, function(&$v, $k){$v = (int)$v;});
$ids = array_filter($ids);
$ids = array_unique($ids);
$idlist = implode(',', $ids);
if (!empty($idlist)) {
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('COUNT(id)');
$query->from('#__users');
$query->where('id IN ('.$idlist.')');
$db->setQuery($query);
// if ($error = $db->getErrorMsg()) {
// \Joomla\CMS\Factory::getApplication()->enqueueMessage($error, 'warning');
// }
try
{
$count = (int)$db->loadResult();
}
catch (RuntimeException $e)
{
\Joomla\CMS\Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}
} else {
$count = 0;
}
// if (empty($count)) {
// $count = Text::_('COM_JEM_SELECT_USERS');
// }
// $count = htmlspecialchars($count, ENT_QUOTES, 'UTF-8');
// The current contact input field
$html[] = ' <input type="text" id="'.$this->id.'_count" value="'.$count.'" disabled="disabled" size="4" />';
// The contact select button
// $html[] = ' <a class="flyermodal" 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',
'user-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" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#user-modal">'.Text::_('COM_JEM_SELECT').'
</button>';
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_ids"'.$class.' name="'.$this->name.'" value="'.$idlist.'" />';
$html[] = '<input type="hidden" id="'.$this->id.'_evid"'.$class.' value="'.$eventid.'" />';
return implode("\n", $html);
}
}
?>

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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Uri\Uri;
/**
* 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()
{
$app = Factory::getApplication();
$document = $app->getDocument();
$wa = $document->getWebAssetManager();
// 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").modal("hide");';
$script[] = ' }';
// Add to document head
$wa->addInlineScript(implode("\n", $script));
// Setup variables for display
$html = array();
$link = Uri::base() . 'index.php?option=com_jem&amp;view=editevent&amp;layout=choosevenue&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));
$db->setQuery($query);
// if ($error = $db->getErrorMsg()) {
// \Joomla\CMS\Factory::getApplication()->enqueueMessage($error, 'warning');
// }
try
{
$venue = $db->loadResult();
}
catch (RuntimeException $e)
{
\Joomla\CMS\Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}
if (empty($venue)) {
$venue = Text::_('COM_JEM_SELECT_VENUE');
}
$venue = htmlspecialchars($venue, ENT_QUOTES, 'UTF-8');
// The current venue input field
$html[] = ' <input type="text" id="'.$this->id.'_name" value="'.$venue.'" disabled="disabled" size="35" />';
// The venue select button
// $html[] = ' <a class="flyermodal" 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',
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" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#venue-modal">'.Text::_('COM_JEM_SELECT').'
</button>';
// 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);
}
}
?>