11 define(
"TITLE_POPUPLICENSE", _(
"Show Reference License"));
21 $this->Name =
"popup-license";
22 $this->Title = TITLE_POPUPLICENSE;
26 parent::__construct();
29 $this->licenseDao = $container->get(
'dao.license');
34 if ($this->
State != PLUGIN_STATE_READY) {
39 $groupId = $_SESSION[Auth::GROUP_ID];
40 if (empty($licenseShortname) && empty($licenseId)) {
44 $license = $this->licenseDao->getLicenseById($licenseId, $groupId);
46 $license = $this->licenseDao->getLicenseByShortName($licenseShortname,
49 if ($license ===
null) {
52 $this->vars[
'shortName'] = $license->getShortName();
53 $this->vars[
'spdxId'] = $license->getSpdxId();
54 $this->vars[
'fullName'] = $license->getFullName();
55 $parent = $this->licenseDao->getLicenseParentById($license->getId());
56 if ($parent !==
null) {
57 $this->vars[
'parentId'] = $parent->getId();
58 $this->vars[
'parentShortName'] = $parent->getShortName();
60 $licenseUrl = $license->getUrl();
61 if (strtolower($licenseUrl) ==
'none') {
64 $this->vars[
'url'] = $licenseUrl;
65 $this->vars[
'text'] = $license->getText();
66 $this->vars[
'risk'] = $license->getRisk() ?: 0;
67 return $this->
render(
'popup_license.html.twig');
This is the Plugin class. All plugins should:
render($templateName, $vars=null)
Contains the constants and helpers for authentication of user.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.