FOSSology  4.4.0
Open Source License Compliance by Open Source Software
admin-monk-revision.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 namespace Fossology\Monk;
9 
14 use Symfony\Component\HttpFoundation\Request;
15 use Symfony\Component\HttpFoundation\Response;
16 
17 
19 {
20  const NAME = 'admin_monk_revision';
21 
22  function __construct()
23  {
24  parent::__construct(self::NAME, array(
25  self::TITLE => _("Manage Monk Revision"),
26  self::MENU_LIST => "Admin::Agent::Monk",
27  self::PERMISSION => Auth::PERM_ADMIN
28  ));
29  }
30 
35  protected function handle(Request $request)
36  {
38  $agentDao = $this->getObject('dao.agent');
40  $monk = $agentDao->getCurrentAgentRef('monk');
41  $rev = $request->get('rev');
42  if ($rev==$monk->getAgentRevision() && $agentDao->renewCurrentAgent('monk')) {
43  $text = _("You have renewed the monk revision.");
44  return $this->render('include/base.html.twig', $this->mergeWithDefault(array('message'=>$text)));
45  }
46  $vars['content'] = '<a href="?mod=admin_monk_revision&rev='.$monk->getAgentRevision().'">'._('Renew monk revision').'</a>';
47  return $this->render('include/base.html.twig', $this->mergeWithDefault($vars));
48  }
49 }
50 
51 register_plugin(new AdminMonkRevision());
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
render($templateName, $vars=null, $headers=null)