32 $this->parameters = array();
52 if (is_array($a_value))
54 if (array_key_exists(
'width', $a_value)) $this->
setWidth($a_value[
'width']);
55 if (array_key_exists(
'height', $a_value)) $this->
setHeight($a_value[
'height']);
56 if (array_key_exists(
'filename', $a_value)) $this->
setApplet($a_value[
'filename']);
57 if (is_array($a_value[
'flash_param_name']))
59 $this->parameters = array();
60 foreach ($a_value[
'flash_param_name'] as $idx => $val)
62 $this->parameters[$val] = $a_value[
'flash_param_value'][$idx];
78 while (substr($_FILES[$this->
getPostVar()][
"name"],-1) ==
'/')
84 $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
85 $suffix = $filename_arr[
"extension"];
86 $mimetype = $_FILES[$this->
getPostVar()][
"type"];
87 $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
88 $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
96 case UPLOAD_ERR_INI_SIZE:
97 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
101 case UPLOAD_ERR_FORM_SIZE:
102 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
106 case UPLOAD_ERR_PARTIAL:
107 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
111 case UPLOAD_ERR_NO_FILE:
116 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
122 case UPLOAD_ERR_NO_TMP_DIR:
123 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
127 case UPLOAD_ERR_CANT_WRITE:
128 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
132 case UPLOAD_ERR_EXTENSION:
133 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
140 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"" &&
143 if (!in_array(strtolower($suffix), $this->
getSuffixes()))
145 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
151 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"")
154 if ($vir[0] ==
false)
156 $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
166 $this->
setAlert($lng->txt(
"msg_input_is_required"));
173 if (strlen($val) == 0 || strlen(
$_POST[$this->
getPostVar()][
'flash_param_value'][$idx]) == 0)
175 $this->
setAlert($lng->txt(
"msg_input_is_required"));
192 $this->applet = $a_applet;
212 $this->applet_path_web = $a_path;
242 $this->width = $a_width;
262 $this->height = $a_height;
282 $this->parameters = $a_parameters;
293 $this->parameters[
$name] = $value;
303 unset($this->parameters[
$name]);
311 $this->parameters = array();
321 $template =
new ilTemplate(
"tpl.prop_flashfile.html",
true,
true,
"Services/Form");
331 array_push($params, urlencode(
$name) .
"=" . urlencode($value));
332 $template->setCurrentBlock(
"applet_param_input");
333 $template->setVariable(
"TEXT_NAME", $lng->txt(
"name"));
334 $template->setVariable(
"TEXT_VALUE", $lng->txt(
"value"));
335 $template->setVariable(
"PARAM_INDEX", $index);
336 $template->setVariable(
"POST_VAR_P", $this->
getPostVar());
339 $template->setVariable(
"TEXT_DELETE_PARAM", $lng->txt(
"delete_parameter"));
340 $template->parseCurrentBlock();
343 $template->setCurrentBlock(
"applet_parameter");
344 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
345 $template->parseCurrentBlock();
346 $template->setCurrentBlock(
"flash_vars");
347 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
348 $template->parseCurrentBlock();
350 $template->setCurrentBlock(
"applet");
351 $template->setVariable(
"TEXT_ADD_PARAM", $lng->txt(
"add_parameter"));
352 $template->setVariable(
"APPLET_WIDTH", $this->
getWidth());
353 $template->setVariable(
"APPLET_HEIGHT", $this->
getHeight());
354 $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
355 $template->setVariable(
"FILENAME", $this->
getApplet());
356 $template->setVariable(
"TEXT_WIDTH", $lng->txt(
"width"));
357 $template->setVariable(
"TEXT_HEIGHT", $lng->txt(
"height"));
358 $template->setVariable(
"APPLET_FILE", $this->
getApplet());
360 if ($this->
getWidth()) $template->setVariable(
"VALUE_WIDTH",
"value=\"" . $this->
getWidth() .
"\"");
361 if ($this->
getHeight()) $template->setVariable(
"VALUE_HEIGHT",
"value=\"" . $this->
getHeight() .
"\"");
362 $template->setVariable(
"ID", $this->
getFieldId());
363 $template->setVariable(
"TXT_DELETE_EXISTING",
364 $lng->txt(
"delete_existing_file"));
365 $template->parseCurrentBlock();
368 $js_tpl =
new ilTemplate(
'tpl.flashAddParam.js',
true,
true,
'Services/Form');
369 $js_tpl->setVariable(
"TEXT_NAME", $lng->txt(
"name"));
370 $js_tpl->setVariable(
"TEXT_VALUE", $lng->txt(
"value"));
371 $js_tpl->setVariable(
"POST_VAR", $this->
getPostVar());
372 $js_tpl->setVariable(
"TEXT_DELETE_PARAM", $lng->txt(
"delete_parameter"));
373 $js_tpl->setVariable(
"TEXT_CONFIRM_DELETE_PARAMETER", $lng->txt(
"confirm_delete_parameter"));
375 $template->setVariable(
"POST_VAR", $this->
getPostVar());
376 $template->setVariable(
"ID", $this->
getFieldId());
377 $template->setVariable(
"TXT_MAX_SIZE", $lng->txt(
"file_notice").
" ".$this->
getMaxFileSizeString());
378 $template->setVariable(
"JAVASCRIPT_FLASH", $js_tpl->get());
380 $a_tpl->setCurrentBlock(
"prop_generic");
381 $a_tpl->setVariable(
"PROP_GENERIC", $template->get());
382 $a_tpl->parseCurrentBlock();
385 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";