1
|
|
|
<?php |
2
|
|
|
// This file is part of Moodle - http://moodle.org/ |
3
|
|
|
// |
4
|
|
|
// Moodle is free software: you can redistribute it and/or modify |
5
|
|
|
// it under the terms of the GNU General Public License as published by |
6
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
// (at your option) any later version. |
8
|
|
|
// |
9
|
|
|
// Moodle is distributed in the hope that it will be useful, |
10
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
// GNU General Public License for more details. |
13
|
|
|
// |
14
|
|
|
// You should have received a copy of the GNU General Public License |
15
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The assignsubmission_edulegit menu builder class. |
19
|
|
|
* |
20
|
|
|
* @package assignsubmission_edulegit |
21
|
|
|
* @author Alex Crosby <[email protected]> |
22
|
|
|
* @copyright @2024 EduLegit.com |
23
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
namespace assignsubmission_edulegit; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class edulegit_submission_menu_builder |
30
|
|
|
* |
31
|
|
|
* Builds a menu for EduLegit submissions, providing options to view the submission in various formats. |
32
|
|
|
*/ |
33
|
|
|
class edulegit_submission_menu_builder { |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Builds the action menu for the given EduLegit submission. |
37
|
|
|
* |
38
|
|
|
* @param edulegit_submission_entity $edulegitsubmission The EduLegit submission entity to build the menu for. |
39
|
|
|
* @return \action_menu The built action menu. |
40
|
|
|
*/ |
41
|
|
|
public function build(edulegit_submission_entity $edulegitsubmission): \action_menu { |
|
|
|
|
42
|
|
|
$emptyicon = new \pix_icon('', ''); |
|
|
|
|
43
|
|
|
|
44
|
|
|
$menu = new \action_menu(); |
45
|
|
|
|
46
|
|
|
$title = $edulegitsubmission->title ?: $this->translate('submission'); |
47
|
|
|
$menu->actionicon = $emptyicon; |
48
|
|
|
$menu->actiontext = shorten_text($title, 32); |
|
|
|
|
49
|
|
|
$menu->set_action_label($title); |
50
|
|
|
|
51
|
|
|
$viewurl = $edulegitsubmission->get_view_url(); |
52
|
|
|
if ($viewurl) { |
53
|
|
|
$menu->add( |
54
|
|
|
new \action_menu_link( |
|
|
|
|
55
|
|
|
new \moodle_url($viewurl), |
|
|
|
|
56
|
|
|
$emptyicon, |
57
|
|
|
$this->translate('as_view'), |
58
|
|
|
false |
59
|
|
|
)); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$pdfurl = $edulegitsubmission->get_pdf_url(); |
63
|
|
|
if ($pdfurl) { |
64
|
|
|
$menu->add( |
65
|
|
|
new \action_menu_link( |
66
|
|
|
new \moodle_url($pdfurl), |
67
|
|
|
$emptyicon, |
68
|
|
|
$this->translate('as_pdf'), |
69
|
|
|
false |
70
|
|
|
)); |
71
|
|
|
} |
72
|
|
|
$docxurl = $edulegitsubmission->get_docx_url(); |
73
|
|
|
if ($docxurl) { |
74
|
|
|
$menu->add( |
75
|
|
|
new \action_menu_link( |
76
|
|
|
new \moodle_url($docxurl), |
77
|
|
|
$emptyicon, |
78
|
|
|
$this->translate('as_docx'), |
79
|
|
|
false |
80
|
|
|
)); |
81
|
|
|
} |
82
|
|
|
$htmlurl = $edulegitsubmission->get_html_url(); |
83
|
|
|
if ($htmlurl) { |
84
|
|
|
$menu->add( |
85
|
|
|
new \action_menu_link( |
86
|
|
|
new \moodle_url($htmlurl), |
87
|
|
|
$emptyicon, |
88
|
|
|
$this->translate('as_html'), |
89
|
|
|
false |
90
|
|
|
)); |
91
|
|
|
} |
92
|
|
|
$txturl = $edulegitsubmission->get_txt_url(); |
93
|
|
|
if ($txturl) { |
94
|
|
|
$menu->add( |
95
|
|
|
new \action_menu_link( |
96
|
|
|
new \moodle_url($txturl), |
97
|
|
|
$emptyicon, |
98
|
|
|
$this->translate('as_txt'), |
99
|
|
|
false |
100
|
|
|
)); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return $menu; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Returns a localized string. |
108
|
|
|
* |
109
|
|
|
* @param string $identifier The key identifier for the localized string. |
110
|
|
|
* @return \lang_string|string The localized string. |
|
|
|
|
111
|
|
|
*/ |
112
|
|
|
private function translate(string $identifier) { |
113
|
|
|
return get_string($identifier, 'assignsubmission_edulegit'); |
|
|
|
|
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
} |
117
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths