8 namespace Fossology\UI\Page;
13 use Symfony\Component\HttpFoundation\Request;
14 use Symfony\Component\HttpFoundation\Response;
18 const NAME =
"admin_obligation_to_json";
20 function __construct()
22 parent::__construct(self::NAME, array(
23 self::TITLE =>
"Admin Obligation JSON Export",
24 self::MENU_LIST =>
"Admin::Obligation Admin::JSON Export",
25 self::REQUIRES_LOGIN =>
true,
34 protected function handle(Request $request)
36 $confirmed = $request->get(
'confirmed',
false);
37 $referer = $request->headers->get(
'referer');
38 $fileName =
"fossology-obligations-export-" . date(
"YMj-Gis") .
'.json';
41 $downloadUrl =
"?mod=" . self::NAME .
"&rf=" . $request->get(
'rf') .
"&confirmed=true";
45 $obligationCsvExport = new \Fossology\Lib\Application\ObligationCsvExport($this->
getObject(
'db.manager'));
46 $content = $obligationCsvExport->createCsv(intval($request->get(
'rf')),
true);
51 register_plugin(
new AdminObligationToJSON());
Contains the constants and helpers for authentication of user.
static getDownloadConfirmationResponse($downloadUrl, $fileName, $referer)
static getDownloadResponse($content, $fileName, $contentType='text/csv')