22 define(
"TITLE_POPUPLICENSE", _(
"Show Reference License"));
30 function __construct()
32 $this->Name =
"popup-license";
33 $this->Title = TITLE_POPUPLICENSE;
37 parent::__construct();
40 $this->licenseDao = $container->get(
'dao.license');
45 if ($this->
State != PLUGIN_STATE_READY) {
50 $groupId = $_SESSION[Auth::GROUP_ID];
51 if (empty($licenseShortname) && empty($licenseId)) {
55 $license = $this->licenseDao->getLicenseById($licenseId, $groupId);
57 $license = $this->licenseDao->getLicenseByShortName($licenseShortname,
60 if ($license === null) {
63 $this->vars[
'shortName'] = $license->getShortName();
64 $this->vars[
'fullName'] = $license->getFullName();
65 $parent = $this->licenseDao->getLicenseParentById($license->getId());
66 if ($parent !== null) {
67 $this->vars[
'parentId'] = $parent->getId();
68 $this->vars[
'parentShortName'] = $parent->getShortName();
70 $licenseUrl = $license->getUrl();
71 if (strtolower($licenseUrl) ==
'none') {
74 $this->vars[
'url'] = $licenseUrl;
75 $this->vars[
'text'] = $license->getText();
76 $this->vars[
'risk'] = $license->getRisk() ?: 0;
77 return $this->
render(
'popup_license.html.twig');
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
This is the Plugin class. All plugins should:
render($templateName, $vars=null)