First version template
All checks were successful
Release Workflow / validate_commit_message (push) Successful in 5s
Release Workflow / create_release (push) Has been skipped

This commit is contained in:
George van Engers
2025-04-23 15:11:28 +02:00
parent aba1b933d7
commit 040a6f6a48
24 changed files with 1201 additions and 3 deletions

18
psmodule/composer.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "websmid/psmodule",
"description": "",
"type": "prestashop-module",
"license": "mit",
"autoload": {
"psr-4": {
"Websmid\\PsModule": "src/"
}
},
"authors": [
{
"name": "George van Engers",
"email": "george@dewebsmid.nl"
}
],
"minimum-stability": "dev"
}

View File

@ -0,0 +1,6 @@
imports:
- { resource: services/*.yml }
services:
_defaults:
public: true

View File

@ -0,0 +1,3 @@
services:
_defaults:
public: true

BIN
psmodule/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

BIN
psmodule/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2024 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

64
psmodule/psmodule.php Normal file
View File

@ -0,0 +1,64 @@
<?php
/**
* 2007-2025 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2025 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
use Websmid\Muller\WsMullerModule\Module\Helper\Config;
use Websmid\Muller\WsMullerModule\Module\Helper\ConfigForm;
use Websmid\Muller\WsMullerModule\Module\Helper\Install;
if (!defined('_PS_VERSION_')) {
exit;
}
require_once __DIR__ . '/vendor/autoload.php';
class psmodule extends Module
{
// use hooks
use Config;
use Install;
use ConfigForm;
public function __construct()
{
$this->name = 'psmodule';
$this->tab = 'administration';
$this->version = '0.0.1';
$this->author = 'George van Engers | De Websmid';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
'min' => '8.2.0',
'max' => _PS_VERSION_,
];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->trans('Ps Module', [], 'Modules.PsModule.Module');
$this->description = $this->trans('Ps Module', [], 'Modules.PsModule.Module');
$this->confirmUninstall = $this->trans('Are you sure you want to uninstall?', [], 'Modules.PsModule.Module');
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Websmid\Muller\WsMullerModule\Module\Helper;
trait Config
{
public static $hooks = [
];
public static $config = [
'TEST' => 'test',
];
}

View File

@ -0,0 +1,120 @@
<?php
namespace Websmid\Muller\WsMullerModule\Module\Helper;
use Configuration;
use HelperForm;
use Tools;
trait ConfigForm
{
protected $config_form = false;
public array $translatables = [];
/**
* @return string
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
public function getContent(): string
{
if ((Tools::isSubmit($this->name . 'submitBtn'))) {
$this->postProcess();
}
$this->context->smarty->assign('module_dir', $this->_path);
$output = $this->context->smarty->fetch($this->local_path.'views/templates/admin/index.tpl');;
return $output.$this->renderForm();
}
/**
* @return string
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
protected function renderForm(): string
{
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$helper->module = $this;
$helper->name_controller = $this->name;
$helper->default_form_language = $this->context->language->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);
$helper->identifier = $this->identifier;
$helper->submit_action = $this->name.'submitBtn';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)
.'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->token = Tools::getValue('token');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
);
return $helper->generateForm($this->getConfigForm());
}
/**
* @return array
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
protected function getConfigFormValues(): array
{
$data = [];
foreach(self::$config as $key => $value) {
$data[$key] = Configuration::get($key);
}
return $data;
}
/**
* @return void
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
protected function postProcess(): void
{
$form_values = $this->getConfigFormValues();
foreach (array_keys($form_values) as $key) {
if (Tools::isSubmit($key)) {
Configuration::updateValue($key, Tools::getValue($key));
}
}
}
/**
* @return array[]
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
protected function getConfigForm(): array
{
return array(
'api' => array(
'form' => array(
'legend' => array(
'title' => $this->trans('Settings', [], 'Modules.PsModule.Module'),
'icon' => 'icon-cogs',
),
'input' => array(
/////
/////
/////
),
'submit' => array(
'title' => $this->trans('Save', [], 'Modules.PsModule.Module'),
),
),
),
);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace Websmid\Muller\WsMullerModule\Module\Helper;
use Configuration;
trait Install
{
/**
* @return bool
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
public function install()
{
if (!parent::install()) {
return false;
}
foreach(self::$hooks as $hook) {
if (!$this->registerHook($hook)) {
return false;
}
}
foreach(self::$config as $key => $value) {
if (!Configuration::updateValue($key, $value)) {
return false;
}
}
return true;
}
/**
* @return bool
* @author George van Engers <george@dewebsmid.nl>
* @since 05-04-2025
*/
public function uninstall()
{
if (!parent::uninstall()) {
return false;
}
// hooks are auto-unregistered by PrestaShop
foreach(self::$config as $key => $value) {
if (!Configuration::deleteByName($key)) {
return false;
}
}
return true;
}
}

34
psmodule/src/index.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2024 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2024 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2024 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

34
psmodule/views/index.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2024 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File