Fix: Rename AdminController to PageController to match route

- Renamed AdminController to PageController
  - Route name is 'page#index' so controller must be 'PageController'
  - Fixes Could not resolve PageController error
- Updated routes.php to use PageController
- Updated info.xml navigation to point to PageController
- Removed old AdminController.php
- Improved HTML output with better styling and next steps

This was the root cause: Controller class name must match route name.
Route: page#index → Controller: PageController

App routing should now work correctly!
This commit is contained in:
WLTBAgent
2026-02-13 20:25:52 +00:00
parent 4b684d101a
commit 78132b3fd7
5 changed files with 70 additions and 67 deletions

View File

@@ -1,52 +0,0 @@
<?php
declare(strict_types=1);
namespace OCA\AnalyticsHub\Controller;
use OCP\IRequest;
/**
* Admin Settings Controller
*
* @NoAdminRequired
* @NoCSRFRequired
*/
class AdminController {
private $appName;
private $request;
public function __construct(string $appName, IRequest $request) {
$this->appName = $appName;
$this->request = $request;
}
/**
* Index page - simple render without TemplateResponse
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index(): void {
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head>';
echo '<title>Mini-CMO Analytics Hub</title>';
echo '<style>';
echo 'body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding: 40px; }';
echo 'h1 { color: #0082c9; }';
echo '</style>';
echo '</head>';
echo '<body>';
echo '<h1>Mini-CMO Analytics Hub</h1>';
echo '<p><strong>App Name:</strong> ' . htmlspecialchars($this->appName) . '</p>';
echo '<p><strong>Status:</strong> Controller is working!</p>';
echo '<p><strong>Route:</strong> ' . htmlspecialchars($this->request->getPathInfo()) . '</p>';
echo '<hr>';
echo '<p>✅ Routing test successful!</p>';
echo '</body>';
echo '</html>';
exit;
}
}