ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilDclPropertyFormGUI Class Reference

Class ilDclPropertyFormGUI @ilCtrl_Calls ilDclPropertyFormGUI: ilFormPropertyDispatchGUI. More...

+ Inheritance diagram for ilDclPropertyFormGUI:
+ Collaboration diagram for ilDclPropertyFormGUI:

Public Member Functions

 keepTempFileUpload (string $a_hash, string $a_field, string $a_tmp_name, string $a_name, string $a_type, ?string $a_index=null, ?string $a_sub_index=null)
 Expose method for save confirmation. More...
 
 cleanupTempFiles (string $hash)
 Cleanup temp-files. More...
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Static Public Member Functions

static getTempFilename (string $a_hash, string $a_field, string $a_name, string $a_type, ?string $a_index=null, ?string $a_sub_index=null)
 
static rebuildTempFileByHash (string $hash)
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
 checkForRequiredField ()
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Detailed Description

Member Function Documentation

◆ cleanupTempFiles()

ilDclPropertyFormGUI::cleanupTempFiles ( string  $hash)

Cleanup temp-files.

Definition at line 128 of file class.ilDclPropertyFormGUI.php.

128 : void
129 {
130 $files = glob(ilFileUtils::getDataDir() . "/temp/" . session_id() . "~~" . $hash . "~~*");
131
132 foreach ($files as $file) {
133 if (file_exists($file)) {
134 unlink($file);
135 }
136 }
137 }
static getDataDir()
get data directory (outside webspace)

References $files, and ilFileUtils\getDataDir().

+ Here is the call graph for this function:

◆ getTempFilename()

static ilDclPropertyFormGUI::getTempFilename ( string  $a_hash,
string  $a_field,
string  $a_name,
string  $a_type,
?string  $a_index = null,
?string  $a_sub_index = null 
)
static

Definition at line 44 of file class.ilDclPropertyFormGUI.php.

51 : string {
52 $a_name = ilFileUtils::getASCIIFilename($a_name);
53
54 $tmp_file_name = implode(
55 "~~",
56 [
57 session_id(),
58 $a_hash,
59 $a_field,
60 $a_index,
61 $a_sub_index,
62 str_replace("/", "~~", $a_type),
63 str_replace("~~", "_", $a_name),
64 ]
65 );
66
67 // make sure temp directory exists
68 $temp_path = ilFileUtils::getDataDir() . "/temp/";
69
70 return $temp_path . $tmp_file_name;
71 }
static getASCIIFilename(string $a_filename)

Referenced by ilDclFileRecordFieldModel\handleFileUpload().

+ Here is the caller graph for this function:

◆ keepTempFileUpload()

ilDclPropertyFormGUI::keepTempFileUpload ( string  $a_hash,
string  $a_field,
string  $a_tmp_name,
string  $a_name,
string  $a_type,
?string  $a_index = null,
?string  $a_sub_index = null 
)

Expose method for save confirmation.

Definition at line 32 of file class.ilDclPropertyFormGUI.php.

40 : void {
41 $this->keepFileUpload($a_hash, $a_field, $a_tmp_name, $a_name, $a_type, $a_index, $a_sub_index);
42 }

◆ rebuildTempFileByHash()

static ilDclPropertyFormGUI::rebuildTempFileByHash ( string  $hash)
static
Exceptions
ilDclException

Definition at line 77 of file class.ilDclPropertyFormGUI.php.

77 : void
78 {
79 $temp_path = ilFileUtils::getDataDir() . "/temp";
80 if (is_dir($temp_path)) {
81 $temp_files = glob($temp_path . "/" . session_id() . "~~" . $hash . "~~*");
82 if (is_array($temp_files)) {
83 foreach ($temp_files as $full_file) {
84 $file = explode("~~", basename($full_file));
85 $field = $file[2];
86 $idx = $file[3];
87 $idx2 = $file[4];
88 $type = $file[5] . "/" . $file[6];
89 $name = $file[7];
90
91 if ($idx2 != "") {
92 if (!($_FILES[$field]["tmp_name"][$idx][$idx2] ?? false)) {
93 $_FILES[$field]["tmp_name"][$idx][$idx2] = $full_file;
94 $_FILES[$field]["name"][$idx][$idx2] = $name;
95 $_FILES[$field]["type"][$idx][$idx2] = $type;
96 $_FILES[$field]["error"][$idx][$idx2] = 0;
97 $_FILES[$field]["size"][$idx][$idx2] = filesize($full_file);
98 }
99 } else {
100 if ($idx != "") {
101 if (!($_FILES[$field]["tmp_name"][$idx] ?? false)) {
102 $_FILES[$field]["tmp_name"][$idx] = $full_file;
103 $_FILES[$field]["name"][$idx] = $name;
104 $_FILES[$field]["type"][$idx] = $type;
105 $_FILES[$field]["error"][$idx] = 0;
106 $_FILES[$field]["size"][$idx] = filesize($full_file);
107 }
108 } else {
109 if (!($_FILES[$field]["tmp_name"] ?? false)) {
110 $_FILES[$field]["tmp_name"] = $full_file;
111 $_FILES[$field]["name"] = $name;
112 $_FILES[$field]["type"] = $type;
113 $_FILES[$field]["error"] = 0;
114 $_FILES[$field]["size"] = filesize($full_file);
115 }
116 }
117 }
118 }
119 }
120 } else {
121 throw new ilDclException('temp dir path "' . $temp_path . '" is not a directory');
122 }
123 }

References ilFileUtils\getDataDir().

Referenced by ilDclRecordEditGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: