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