27 parent::__construct($a_title, $a_postvar);
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];
81 $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
82 $suffix = $filename_arr[
"extension"];
83 $mimetype = $_FILES[$this->
getPostVar()][
"type"];
84 $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
85 $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
93 case UPLOAD_ERR_INI_SIZE:
94 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
98 case UPLOAD_ERR_FORM_SIZE:
99 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
103 case UPLOAD_ERR_PARTIAL:
104 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
108 case UPLOAD_ERR_NO_FILE:
113 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
119 case UPLOAD_ERR_NO_TMP_DIR:
120 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
124 case UPLOAD_ERR_CANT_WRITE:
125 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
129 case UPLOAD_ERR_EXTENSION:
130 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
137 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"" &&
140 if (!in_array(strtolower($suffix), $this->
getSuffixes()))
142 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
148 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"")
151 if ($vir[0] ==
false)
153 $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
163 $this->
setAlert($lng->txt(
"msg_input_is_required"));
170 if (strlen($val) == 0 || strlen(
$_POST[$this->
getPostVar()][
'flash_param_value'][$idx]) == 0)
172 $this->
setAlert($lng->txt(
"msg_input_is_required"));
189 $this->applet = $a_applet;
209 $this->applet_path_web = $a_path;
239 $this->width = $a_width;
259 $this->height = $a_height;
279 $this->parameters = $a_parameters;
290 $this->parameters[$name] = $value;
300 unset($this->parameters[$name]);
308 $this->parameters =
array();
318 $template =
new ilTemplate(
"tpl.prop_flashfile.html",
true,
true,
"Services/Form");
328 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
329 $template->setCurrentBlock(
"applet_param_input");
330 $template->setVariable(
"TEXT_NAME", $lng->txt(
"name"));
331 $template->setVariable(
"TEXT_VALUE", $lng->txt(
"value"));
332 $template->setVariable(
"PARAM_INDEX", $index);
333 $template->setVariable(
"POST_VAR_P", $this->
getPostVar());
336 $template->setVariable(
"TEXT_DELETE_PARAM", $lng->txt(
"delete_parameter"));
337 $template->parseCurrentBlock();
340 $template->setCurrentBlock(
"applet_parameter");
341 $template->setVariable(
"PARAM_VALUE", join(
$params,
"&"));
342 $template->parseCurrentBlock();
343 $template->setCurrentBlock(
"flash_vars");
344 $template->setVariable(
"PARAM_VALUE", join(
$params,
"&"));
345 $template->parseCurrentBlock();
347 $template->setCurrentBlock(
"applet");
348 $template->setVariable(
"TEXT_ADD_PARAM", $lng->txt(
"add_parameter"));
349 $template->setVariable(
"APPLET_WIDTH", $this->
getWidth());
350 $template->setVariable(
"APPLET_HEIGHT", $this->
getHeight());
351 $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
352 $template->setVariable(
"FILENAME", $this->
getApplet());
353 $template->setVariable(
"TEXT_WIDTH", $lng->txt(
"width"));
354 $template->setVariable(
"TEXT_HEIGHT", $lng->txt(
"height"));
355 $template->setVariable(
"APPLET_FILE", $this->
getApplet());
357 if ($this->
getWidth()) $template->setVariable(
"VALUE_WIDTH",
"value=\"" . $this->
getWidth() .
"\"");
358 if ($this->
getHeight()) $template->setVariable(
"VALUE_HEIGHT",
"value=\"" . $this->
getHeight() .
"\"");
359 $template->setVariable(
"ID", $this->
getFieldId());
360 $template->setVariable(
"TXT_DELETE_EXISTING",
361 $lng->txt(
"delete_existing_file"));
362 $template->parseCurrentBlock();
365 $js_tpl =
new ilTemplate(
'tpl.flashAddParam.js',
true,
true,
'Services/Form');
366 $js_tpl->setVariable(
"TEXT_NAME", $lng->txt(
"name"));
367 $js_tpl->setVariable(
"TEXT_VALUE", $lng->txt(
"value"));
368 $js_tpl->setVariable(
"POST_VAR", $this->
getPostVar());
369 $js_tpl->setVariable(
"TEXT_DELETE_PARAM", $lng->txt(
"delete_parameter"));
370 $js_tpl->setVariable(
"TEXT_CONFIRM_DELETE_PARAMETER", $lng->txt(
"confirm_delete_parameter"));
372 $template->setVariable(
"POST_VAR", $this->
getPostVar());
373 $template->setVariable(
"ID", $this->
getFieldId());
374 $template->setVariable(
"TXT_MAX_SIZE", $lng->txt(
"file_notice").
" ".$this->
getMaxFileSizeString());
375 $template->setVariable(
"JAVASCRIPT_FLASH", $js_tpl->get());
377 $a_tpl->setCurrentBlock(
"prop_generic");
378 $a_tpl->setVariable(
"PROP_GENERIC", $template->get());
379 $a_tpl->parseCurrentBlock();
382 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
static initConnectionWithAnimation()
Init YUI Connection module.