Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first draft to use the joomla core module techniques #1813

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion media/css/jem-responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ body.com_jem.body-overlayed {
}

#jem .buttons {
float: right;
text-align: right;
}

#jem .buttons::after {
Expand Down
8 changes: 3 additions & 5 deletions modules/mod_jem/mod_jem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

defined('_JEXEC') or die;

use Joomla\CMS\Helper\ModuleHelper;
use Joomla\Module\Menu\Site\Helper\MenuHelper;
use Joomla\CMS\Factory;
// get helper
require_once __DIR__ . '/helper.php';
Expand All @@ -28,11 +30,7 @@
return;
}

$mod_name = 'mod_jem';

// maybe a layout style provides a css file
JemHelper::loadModuleStyleSheet($mod_name);
// load icon font if needed
JemHelper::loadIconFont();

require(JemHelper::getModuleLayoutPath($mod_name));
require ModuleHelper::getLayoutPath('mod_jem', $params->get('layout', 'default'));
70 changes: 47 additions & 23 deletions modules/mod_jem/mod_jem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
<option value="0">JNO</option>
</field>
<field name="highlight_featured" type="radio"
default="0"
label="MOD_JEM_HIGHLIGHT_FEATURED"
description="MOD_JEM_HIGHLIGHT_FEATURED_DESC"
class="btn-group btn-group-yesno"
default="0"
label="MOD_JEM_HIGHLIGHT_FEATURED"
description="MOD_JEM_HIGHLIGHT_FEATURED_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
Expand Down Expand Up @@ -95,10 +95,10 @@
<option value="2">MOD_JEM_TITLE</option>
</field>
<field name="showiconcountry" type="radio"
default="0"
label="MOD_JEM_SHOW_ICON_COUNTRY_VENUE"
description="MOD_JEM_SHOW_ICON_COUNTRY_VENUE_DESC"
class="btn-group btn-group-yesno"
default="0"
label="MOD_JEM_SHOW_ICON_COUNTRY_VENUE"
description="MOD_JEM_SHOW_ICON_COUNTRY_VENUE_DESC"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
Expand Down Expand Up @@ -126,27 +126,51 @@
label="MOD_JEM_TIME_FORMAT"
description="MOD_JEM_TIME_FORMAT_DESC"
/>
<field name="moduleclass_sfx" type="text"
default=""
label="MOD_JEM_MODULE_CLASS_SUFFIX"
description="MOD_JEM_MODULE_CLASS_SUFFIX_DESC"
/>
</fieldset>

<fieldset name="advanced">
<field name="cache" type="list"
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
class="form-select"
validate="moduleLayout"
/>

<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
rows="3"
validate="CssIdentifier"
/>

<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
default="1"
label="MOD_JEM_CACHING"
description="MOD_JEM_CACHING_DESC"
>
<option value="1">MOD_JEM_USE_GLOBAL</option>
<option value="0">MOD_JEM_NO_CACHING</option>
filter="integer"
validate="options"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text"

<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
default="900"
label="MOD_JEM_CACHE_TIME"
description="MOD_JEM_CACHE_TIME_DESC"
filter="integer"
/>

<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
Expand Down
114 changes: 66 additions & 48 deletions modules/mod_jem/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,84 @@

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;

$app = Factory::getApplication();
$document = $app->getDocument();
$module_name = 'mod_jem';

/*
$uri = Uri::getInstance();
$css_path = JPATH_THEMES. '/'.$document->template.'/css/'.$module_name;
if(file_exists($css_path.'/'.$module_name.'.css')) {
unset($document->_styleSheets[$uri->base(true).'/modules/mod_jem_/tmpl/mod_jem.css']);
$document->addStylesheet($uri->base(true) . '/templates/'.$document->template.'/css/'. $module_name.'/'.$module_name.'.css');
} else {
$document->addStyleSheet($uri->base(true).'/modules/mod_jem/tmpl/mod_jem_responsive.css');
}
*/

$highlight_featured = $params->get('highlight_featured');
$showtitloc = $params->get('showtitloc');
$linkloc = $params->get('linkloc');
$linkdet = $params->get('linkdet');
$showiconcountry = $params->get('showiconcountry');
$settings = JemHelper::config();

HTMLHelper::_('stylesheet', 'modules/mod_jem/tmpl/default.css');

?>

<div class="jemmodulebasic<?php echo $params->get('moduleclass_sfx')?>" id="jemmodulebasic">
<?php if (count($list)): ?>
<ul class="jemmod">
<?php foreach ($list as $item) : ?>
<li>
<?php if($highlight_featured && $item->featured): ?>
<span class="event-title highlight_featured">
<?php else : ?>
<span class="event-title">
<?php endif; ?>
<?php if (($showiconcountry == 1) && !empty($item->country)) : ?>
<?php $flagpath = $settings->flagicons_path . (str_ends_with($settings->flagicons_path, '/')?'':'/');
$flagext = substr($flagpath, strrpos($flagpath,"-")+1,-1) ;
$flagfile = Uri::getInstance()->base() . $flagpath . strtolower($item->country) . '.' . $flagext;
echo '<img src="' . $flagfile . '" alt="' . $item->country . ' ' , Text::_('MOD_JEM_SHOW_FLAG_ICON') . '">' ?>
<?php endif; ?>
<?php if ($showtitloc == 0 && $linkloc == 1) : ?>
<a href="<?php echo $item->venueurl; ?>">
<?php echo $item->text; ?>
</a>
<?php elseif ($showtitloc == 1 && $linkdet == 2) : ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->text; ?>
</a>
<?php
else :
echo $item->text;
endif;
?>
</span>
<br />
<?php if($highlight_featured && $item->featured): ?>
<span class="event-title highlight_featured">
<?php else : ?>
<span class="event-title">
<?php endif; ?>
<?php if ($params->get('linkdet') == 1) : ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->dateinfo; ?>
</a>
<?php else :
echo $item->dateinfo;
endif;
?>
</span>
</li>
<?php endforeach; ?>
</ul>
<ul>
<?php foreach ($list as $item) : ?>
<li>
<i class="far fa-calendar-alt"></i>
<?php if($highlight_featured && $item->featured): ?>
<span class="event-title highlight_featured">
<?php else : ?>
<span class="event-title">
<?php endif; ?>
<?php if (($showiconcountry == 1) && !empty($item->country)) : ?>
<?php $flagpath = $settings->flagicons_path . (str_ends_with($settings->flagicons_path, '/')?'':'/');
$flagext = substr($flagpath, strrpos($flagpath,"-")+1,-1) ;
$flagfile = Uri::getInstance()->base() . $flagpath . strtolower($item->country) . '.' . $flagext;
echo '<img src="' . $flagfile . '" alt="' . $item->country . ' ' , Text::_('MOD_JEM_SHOW_FLAG_ICON') . '">' ?>
<?php endif; ?>
<?php if ($showtitloc == 0 && $linkloc == 1) : ?>
<a href="<?php echo $item->venueurl; ?>">
<?php echo $item->text; ?>
</a>
<?php elseif ($showtitloc == 1 && $linkdet == 2) : ?>
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->text); ?>">
<?php echo $item->text; ?>
</a>
<?php else :
echo $item->text;
endif; ?>
</span>
<br />
<?php if($highlight_featured && $item->featured): ?>
<span class="event-title highlight_featured">
<?php else : ?>
<span class="event-title">
<?php endif; ?>
<?php if ($linkdet == 1) : ?>
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->dateinfo); ?>">
<?php echo $item->dateinfo; ?>
</a>
<?php else :
echo $item->dateinfo;
endif; ?>
</span>
</li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<?php echo Text::_('MOD_JEM_NO_EVENTS'); ?>
<?php echo Text::_('COM_JEM_NO_EVENTS'); ?>
<?php endif; ?>
</div>
</div>
89 changes: 0 additions & 89 deletions modules/mod_jem/tmpl/responsive/default.php

This file was deleted.

1 change: 0 additions & 1 deletion modules/mod_jem/tmpl/responsive/index.html

This file was deleted.

File renamed without changes.
Loading