1 | <?php |
||
2 | |||
3 | /* For licensing terms, see /license.txt */ |
||
4 | |||
5 | use ChamiloSession as Session; |
||
6 | use Chamilo\CoreBundle\Component\Utils\ActionIcon; |
||
7 | |||
8 | /** |
||
9 | * Main script for the documents tool. |
||
10 | * |
||
11 | * This script allows the user to manage files and directories on a remote http server. |
||
12 | * |
||
13 | * The user can : - upload a file |
||
14 | * |
||
15 | * The script respects the strategical split between process and display, so the first |
||
16 | * part is only processing code (init, process, display preparation) and the second |
||
17 | * part is only display (HTML) |
||
18 | */ |
||
19 | require_once __DIR__.'/../inc/global.inc.php'; |
||
20 | |||
21 | $_course = api_get_course_info(); |
||
22 | |||
23 | api_protect_course_script(true); |
||
24 | |||
25 | $htmlHeadXtra[] = "<script> |
||
26 | function check_unzip() { |
||
27 | if (document.upload.unzip.checked) { |
||
28 | document.upload.if_exists[0].disabled=true; |
||
29 | document.upload.if_exists[1].checked=true; |
||
30 | document.upload.if_exists[2].disabled=true; |
||
31 | } else { |
||
32 | document.upload.if_exists[0].checked=true; |
||
33 | document.upload.if_exists[0].disabled=false; |
||
34 | document.upload.if_exists[2].disabled=false; |
||
35 | } |
||
36 | } |
||
37 | </script>"; |
||
38 | |||
39 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
||
40 | if (!$is_allowed_to_edit) { |
||
41 | api_not_allowed(true); |
||
42 | } |
||
43 | |||
44 | //what's the current path? |
||
45 | $path = '/'; |
||
46 | if (isset($_REQUEST['curdirpath'])) { |
||
47 | $path = $_REQUEST['curdirpath']; |
||
48 | } |
||
49 | |||
50 | $toolFromSession = Session::read('my_tool'); |
||
51 | |||
52 | // set calling tool |
||
53 | if (isset($_REQUEST['tool'])) { |
||
54 | $my_tool = $_REQUEST['tool']; |
||
55 | Session::write('my_tool', $_REQUEST['tool']); |
||
56 | } elseif (!empty($toolFromSession)) { |
||
57 | $my_tool = $toolFromSession; |
||
58 | } else { |
||
59 | $my_tool = 'document'; |
||
60 | Session::write('my_tool', $my_tool); |
||
61 | } |
||
62 | |||
63 | Event::event_access_tool(TOOL_UPLOAD); |
||
0 ignored issues
–
show
|
|||
64 | |||
65 | /** |
||
66 | * Just display the form needed to upload a SCORM and give its settings. |
||
67 | */ |
||
68 | $nameTools = get_lang('File upload'); |
||
69 | $interbreadcrumb[] = [ |
||
70 | 'url' => api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=list&'.api_get_cidreq(), |
||
71 | 'name' => get_lang('Learning path'), |
||
72 | ]; |
||
73 | |||
74 | Display::display_header($nameTools, 'Path'); |
||
75 | |||
76 | $content_origins = [ |
||
77 | //'--'.get_lang('Generic SCORM').'--', |
||
78 | //'--'.get_lang('Other').'--', |
||
79 | 'Accent', |
||
80 | 'Accenture', |
||
81 | 'ADLNet', |
||
82 | 'Articulate', |
||
83 | 'ATutor', |
||
84 | 'Blackboard', |
||
85 | 'Calfat', |
||
86 | 'Captivate', |
||
87 | 'Chamilo', |
||
88 | 'Chamilo 2', |
||
89 | 'Claroline', |
||
90 | 'Commest', |
||
91 | 'Coursebuilder', |
||
92 | 'Docent', |
||
93 | 'Dokeos', |
||
94 | 'Dreamweaver', |
||
95 | 'Easyquiz', |
||
96 | 'e-doceo', |
||
97 | 'ENI Editions', |
||
98 | 'Explio', |
||
99 | 'Flash', |
||
100 | 'HTML', |
||
101 | 'HotPotatoes', |
||
102 | 'Hyperoffice', |
||
103 | 'Ingenatic', |
||
104 | 'Instruxion', |
||
105 | 'iProgress', |
||
106 | 'Kumullus', |
||
107 | 'Lectora', |
||
108 | 'Microsoft', |
||
109 | 'Onlineformapro', |
||
110 | 'Opikanoba', |
||
111 | 'Plantyn', |
||
112 | 'Saba', |
||
113 | 'Skillsoft', |
||
114 | 'Speechi', |
||
115 | 'Thomson-NETg', |
||
116 | 'U&I Learning', |
||
117 | 'Udutu', |
||
118 | 'WebCT', |
||
119 | ]; |
||
120 | |||
121 | echo Display::toolbarAction('lp', [ |
||
122 | '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'">'. |
||
123 | Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to learning paths')).'</a>', |
||
124 | ]); |
||
125 | |||
126 | $form = new FormValidator( |
||
127 | 'upload', |
||
128 | 'POST', |
||
129 | api_get_path(WEB_CODE_PATH).'upload/upload.php?'.api_get_cidreq(), |
||
130 | '', |
||
131 | [ |
||
132 | 'id' => 'upload_form', |
||
133 | 'enctype' => 'multipart/form-data', |
||
134 | ] |
||
135 | ); |
||
136 | $form->addHeader($nameTools); |
||
137 | $form->addLabel(null, Display::return_icon('scorm_logo.jpg', null, ['style' => 'width:230px;height:100px'])); |
||
138 | $form->addElement('hidden', 'curdirpath', $path); |
||
139 | $form->addElement('hidden', 'tool', $my_tool); |
||
140 | $form->addElement('file', 'user_file', get_lang('SCORM or AICC file to upload')); |
||
141 | $form->addProgress(); |
||
142 | $form->addRule('user_file', get_lang('Required field'), 'required'); |
||
143 | |||
144 | if ('true' == api_get_setting('search_enabled')) { |
||
145 | $form->addElement('checkbox', 'index_document', '', get_lang('Index document text?')); |
||
146 | $specific_fields = get_specific_field_list(); |
||
147 | foreach ($specific_fields as $specific_field) { |
||
148 | $form->addElement('text', $specific_field['code'], $specific_field['name'].' : '); |
||
149 | } |
||
150 | } |
||
151 | |||
152 | if (api_is_platform_admin()) { |
||
153 | $form->addElement('checkbox', 'use_max_score', null, get_lang('Use default maximum score of 100')); |
||
154 | } |
||
155 | |||
156 | if ('true' === api_get_setting('lp.allow_htaccess_import_from_scorm')) { |
||
157 | $form->addElement('checkbox', 'allow_htaccess', null, get_lang('Allow htaccess in the SCORM import')); |
||
158 | } |
||
159 | |||
160 | $form->addButtonUpload(get_lang('Upload')); |
||
161 | |||
162 | // the default values for the form |
||
163 | $defaults = ['index_document' => 'checked="checked"', 'use_max_score' => 1]; |
||
164 | $form->setDefaults($defaults); |
||
165 | echo Display::return_message( |
||
166 | Display::tag('strong', get_lang('SCORM Authoring tools supported')).': '.implode(', ', $content_origins), |
||
167 | 'normal', |
||
168 | false |
||
169 | ); |
||
170 | $form->display(); |
||
171 | |||
172 | Display::display_footer(); |
||
173 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.