feat: MokoWaaS admin sidebar menu module (like CB's mod_cbadmin)

New module mod_mokowaas_menu renders a dedicated MokoWaaS section
in the admin sidebar at position=menu, ordering=0 (before CB at 1
and Joomla's mod_menu at 2).

Menu items: Dashboard, Helpdesk, Extensions, .htaccess Maker,
Privacy Guard, WAF Log, Feature Plugins

Active state highlighting on current view.
Auto-created on package install with access=Special.
Added to package manifest.

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-06-04 07:05:27 -05:00
parent ade768b94c
commit 69776d9b77
8 changed files with 180 additions and 0 deletions
+66
View File
@@ -55,6 +55,9 @@ class Pkg_MokowaasInstallerScript
// Set up cpanel module on the admin dashboard
$this->setupCpanelModule();
// Set up admin sidebar menu module
$this->setupAdminMenuModule();
// Create Support portal menu item on frontend
$this->setupSupportMenuItem();
@@ -704,6 +707,69 @@ class Pkg_MokowaasInstallerScript
}
}
/**
* Set up the MokoWaaS admin sidebar menu module at position 0.
*/
private function setupAdminMenuModule(): void
{
try
{
$db = Factory::getDbo();
// Enable the module extension
$db->setQuery(
$db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('type') . ' = ' . $db->quote('module'))
->where($db->quoteName('element') . ' = ' . $db->quote('mod_mokowaas_menu'))
)->execute();
// Check if module instance exists
$db->setQuery(
$db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__modules'))
->where($db->quoteName('module') . ' = ' . $db->quote('mod_mokowaas_menu'))
);
if ((int) $db->loadResult() > 0)
{
return;
}
$module = (object) [
'title' => 'MokoWaaS Menu',
'note' => '',
'content' => '',
'ordering' => 0,
'position' => 'menu',
'checked_out' => null,
'checked_out_time' => null,
'publish_up' => null,
'publish_down' => null,
'published' => 1,
'module' => 'mod_mokowaas_menu',
'access' => 3,
'showtitle' => 0,
'params' => '{}',
'client_id' => 1,
'language' => '*',
];
$db->insertObject('#__modules', $module, 'id');
if ((int) $module->id)
{
$db->insertObject('#__modules_menu', (object) ['moduleid' => (int) $module->id, 'menuid' => 0]);
}
}
catch (\Throwable $e)
{
Log::add('Admin menu module setup error: ' . $e->getMessage(), Log::WARNING, 'mokowaas');
}
}
/**
* Create a "Support" menu item on the frontend main menu.
*/