init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\IRequest;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var INavigationManager
|
||||
*/
|
||||
protected $navigationManager;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param INavigationManager $navigationManager
|
||||
*/
|
||||
public function __construct($appName, IRequest $request, INavigationManager $navigationManager)
|
||||
{
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->navigationManager = $navigationManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function apps(): JSONResponse
|
||||
{
|
||||
$apps = $this->navigationManager->getAll();
|
||||
|
||||
$data = [
|
||||
'apps' => $apps,
|
||||
];
|
||||
|
||||
return new JSONResponse($apps);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user