Skip to content

Commit

Permalink
Admin module (joomla#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
obuisard authored Feb 1, 2023
1 parent e422470 commit 572b9f0
Show file tree
Hide file tree
Showing 19 changed files with 448 additions and 288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,5 @@ INSERT IGNORE INTO `#__guidedtour_steps` (`id`, `tour_id`, `title`, `published`,
-- Add new `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'com_guidedtours', 'component', 'com_guidedtours', '', 1, 1, 0, 0, 1, '', '{}', '', 0, 0),
(0, 'mod_guidedtours', 'module', 'mod_guidedtours', '', 1, 1, 1, 0, 1, '', '{}', '', 0, 0),
(0, 'plg_system_tour', 'plugin', 'tour', 'system', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,5 @@ SELECT setval('#__guidedtour_steps_id_seq', 102, false);
-- Add new `#__extensions`
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'com_guidedtours', 'component', 'com_guidedtours', '', 1, 1, 0, 0, 1, '', '{}', '', 0, 0),
(0, 'mod_guidedtours', 'module', 'mod_guidedtours', '', 1, 1, 1, 0, 1, '', '{}', '', 0, 0),
(0, 'plg_system_tour', 'plugin', 'tour', 'system', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);
40 changes: 16 additions & 24 deletions administrator/components/com_guidedtours/tmpl/tours/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,37 +188,29 @@
); ?>
</td>

<!-- Item name, edit link, and note (@todo: should it be moved?) -->
<th scope="row">
<?php if ($canEdit) :
?>
<a href="<?php
echo Route::_('index.php?option=com_guidedtours&task=tour.edit&id=' . $item->id); ?>
" title="<?php echo Text::_('JACTION_EDIT'); ?>
<?php echo $this->escape($item->title); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else :
?>
<?php echo $this->escape($item->title); ?>

<?php endif; ?>

<span class="small">
<?php if (empty($item->note)) :
?>
<?php echo Text::_('COM_GUIDEDTOURS_NO_NOTE'); ?>
<?php else :
?>
<?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
<th scope="row" class="has-context">
<div class="break-word">
<?php if ($canEdit) : ?>
<a href="<?php echo Route::_('index.php?option=com_guidedtours&task=tour.edit&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
<?php echo $this->escape($item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</span>
<div class="small break-word">
<?php if ($item->note) : ?>
<?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
<?php endif; ?>
</div>
</div>
</th>

<td class="">
<?php echo $item->description; ?>
</td>

<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn btn-info "
<a class="btn btn-info "
href="index.php?option=com_guidedtours&view=steps&tour_id=<?php echo $item->id; ?>">
<?php echo $item->steps; ?>
</a>
Expand Down
6 changes: 1 addition & 5 deletions administrator/language/en-GB/com_guidedtours.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ COM_GUIDEDTOURS_TOUR_TITLE="Tour Title"
COM_GUIDEDTOURS_TYPE_REDIRECT_URL_DESC="Enter the Relative URL of the page from where you want to Start the Tour e.g administrator/index.php?option=com_guidedtours&view=tours for guided tour relative URL."
COM_GUIDEDTOURS_TYPE_REDIRECT_URL_LABEL="URL"
COM_GUIDEDTOURS_XML_DESCRIPTION="Component for managing Guided Tours functionality"
COM_GUIDEDTOURS="Guided Tours"
JDESCRIPTION_ASC="Description ascending"
JDESCRIPTION_DESC="Description ascending"
MOD_MENU_MANAGE_GUIDEDTOURS="Guided Tours"
COM_GUIDEDTOURS_URL_LABEL = "URL"
COM_GUIDEDTOURS_URL_DESC = "Enter the Relative URL of the page from where you want to Start the Tour e.g administrator/index.php?option=com_guidedtours&view=tours for guided tour relative URL."
COM_GUIDEDTOURS_TYPE_LABEL = "Type"
Expand All @@ -66,4 +62,4 @@ COM_GUIDEDTOURS_INTERACTIVE_TOUR_DESC = "Click on the type of interactive step w
COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_LABEL = "Interactive Step"
COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_BUTTON_LABEL = "Button"
COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_TEXT_FIELD_LABEL = "Text Field"
COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_OTHERS_LABEL = "Others"
COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_OTHERS_LABEL = "Others"
1 change: 0 additions & 1 deletion administrator/language/en-GB/com_guidedtours.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ COM_GUIDEDTOURS_GUIDEDTOUR_STEPS_PAGE_TITLE="Guided Tours - List of Steps"
COM_GUIDEDTOURS_GUIDEDTOURS_PAGE_TITLE="Guided Tours - List of Tours"
COM_GUIDEDTOURS_GUIDEDTOURS_TABLE_CAPTION="List of Tours"
COM_GUIDEDTOURS_XML_DESCRIPTION="Component for managing Guided Tours functionality in Joomla 4"
MOD_MENU_MANAGE_GUIDEDTOURS="Guided Tours"
8 changes: 8 additions & 0 deletions administrator/language/en-GB/mod_guidedtours.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; Joomla! Project
; (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

MOD_GUIDEDTOURS="Guided Tours"
MOD_GUIDEDTOURS_MENU="Take a Tour"
MOD_GUIDEDTOURS_XML_DESCRIPTION="This module shows a list of the available guided tours."
7 changes: 7 additions & 0 deletions administrator/language/en-GB/mod_guidedtours.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Joomla! Project
; (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

MOD_GUIDEDTOURS="Guided Tours"
MOD_GUIDEDTOURS_XML_DESCRIPTION="This module shows a list of the available guided tours."
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@

PLG_SYSTEM_TOUR="System - Guided Tours Plugin"
PLG_SYSTEM_TOUR_DESCRIPTION="System Guided Tour Plugin"
PLG_SYSTEM_TAKE_THE_TOUR="Take the Tour"
PLG_SYSTEM_TAKE_THE_TOUR="Take the Tour"

PLG_SYSTEM_TOUR_START="Start"
PLG_SYSTEM_TOUR_COMPLETE="Complete"
PLG_SYSTEM_TOUR_NEXT="Next"
PLG_SYSTEM_TOUR_BACK="Back"
27 changes: 27 additions & 0 deletions administrator/modules/mod_guidedtours/mod_guidedtours.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_guidedtours
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Module\GuidedTours\Administrator\Helper\GuidedToursHelper;

if (!PluginHelper::isEnabled('system', 'tour')) {
return;
}

$tours = GuidedToursHelper::getList($params);

if (empty($tours)) {
return;
}

require ModuleHelper::getLayoutPath('mod_guidedtours', $params->get('layout', 'default'));
43 changes: 43 additions & 0 deletions administrator/modules/mod_guidedtours/mod_guidedtours.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" client="administrator" method="upgrade">
<name>mod_guidedtours</name>
<author>Joomla! Project</author>
<creationDate>2023-01</creationDate>
<copyright>(C) 2019 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.3.0</version>
<description>MOD_GUIDEDTOURS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\GuidedTours</namespace>
<files>
<filename module="mod_guidedtours">mod_guidedtours.php</filename>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/mod_guidedtours.ini</language>
<language tag="en-GB">language/en-GB/mod_guidedtours.sys.ini</language>
</languages>
<help key="Admin_Modules:_Tours_Menu" />
<config>
<fields name="params">
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
class="form-select"
/>

<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
rows="3"
validate="CssIdentifier"
/>
</fieldset>
</fields>
</config>
</extension>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_guidedtours
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Module\GuidedTours\Administrator\Helper;

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

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Helper for mod_login
*
* @since __DEPLOY_VERSION__
*/
abstract class GuidedToursHelper
{
/**
* Get a list of tours from a specific context
*
* @param \Joomla\Registry\Registry &$params object holding the module parameters
*
* @return mixed
*
* @since __DEPLOY_VERSION__
*/
public static function getList(&$params)
{
$app = Factory::getApplication();

$factory = $app->bootComponent('com_guidedtours')->getMVCFactory();

// Get an instance of the guided tour model
$tours = $factory->createModel('Tours', 'Administrator', ['ignore_request' => true]);

//$tours->setState('list.extensions', $app->input->get('option'));
$tours->setState('filter.published', 1);

$items = $tours->getItems();

return $items;
}
}
38 changes: 38 additions & 0 deletions administrator/modules/mod_guidedtours/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_guidedtours
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

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

// Load the Bootstrap Dropdown
HTMLHelper::_('bootstrap.dropdown', '.dropdown-toggle');
?>
<div class="header-item-content dropdown header-profile">
<button class="dropdown-toggle d-flex align-items-center ps-0 py-0" data-bs-toggle="dropdown" type="button"
title="<?php echo Text::_('MOD_GUIDEDTOURS_MENU'); ?>">
<div class="header-item-icon">
<span class="icon-map-signs" aria-hidden="true"></span>
</div>
<div class="header-item-text">
<?php echo Text::_('MOD_GUIDEDTOURS_MENU'); ?>
</div>
<span class="icon-angle-down" aria-hidden="true"></span>
</button>
<div class="dropdown-menu dropdown-menu-end">
<?php foreach ($tours as $i => $tour) : ?>
<a class="button-tour dropdown-item" onclick="tourWasSelected(this); return false" href="#" data-id="<?php echo $tour->id ?>">
<span class="icon-map-signs" aria-hidden="true"></span>
<?php echo Text::_($tour->title); ?>
</a>
<?php endforeach; ?>
</div>
</div>
Loading

0 comments on commit 572b9f0

Please sign in to comment.