ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileSystemGUI Class Reference

File System Explorer GUI class. More...

+ Collaboration diagram for ilFileSystemGUI:

Public Member Functions

 ilFileSystemGUI ($a_main_directory)
 setAllowDirectories ($a_val)
 Set allow directories.
 getAllowDirectories ()
 Get allow directories.
 setPostDirPath ($a_val)
 Set post dir path.
 getPostDirPath ()
 Get post dir path.
 setTableId ($a_val)
 Set table id.
 getTableId ()
 Get table id.
 setTitle ($a_val)
 Set title.
 getTitle ()
 Get title.
 setUseUploadDirectory ($a_val)
 Set use upload directory.
 getUseUploadDirectory ()
 Get use upload directory.
 getLastPerformedCommand ()
 Get performed command.
executeCommand ()
 execute command
 addCommand (&$a_obj, $a_func, $a_name, $a_single=true, $a_allow_dir=false)
 Add command.
 clearCommands ()
 Clear commands.
 labelFile ($a_file, $a_label)
 label a file
 activateLabels ($a_act, $a_label_header)
 activate file labels
extCommand ($a_nr)
 call external command
 setAllowDirectoryCreation ($a_val)
 Set allowed directory creation.
 getAllowDirectoryCreation ()
 Get allowed directory creation.
 setAllowFileCreation ($a_val)
 Set allowed file creation.
 getAllowFileCreation ()
 Get allowed file creation.
 listFiles ()
 list files
 renameFileForm ()
 list files
 renameFile ()
 rename a file
 cancelRename ()
 cancel renaming a file
 createDirectory ()
 create directory
 uploadFile ()
 upload file
 confirmDeleteFile ()
 Confirm file deletion.
 deleteFile ()
 delete object file
 unzipFile ()
 delete object file
 downloadFile ()
 delete object file
 getTabs (&$tabs_gui)
 get tabs

Data Fields

 $ctrl

Protected Member Functions

 setPerformedCommand ($command, $pars="")
 Set performed command.

Protected Attributes

 $use_upload_directory = false

Detailed Description

File System Explorer GUI class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilFileSystemGUI.php 55970 2014-12-04 13:26:01Z akill

Definition at line 12 of file class.ilFileSystemGUI.php.

Member Function Documentation

ilFileSystemGUI::activateLabels (   $a_act,
  $a_label_header 
)

activate file labels

Definition at line 258 of file class.ilFileSystemGUI.php.

Referenced by ilObjFileBasedLMGUI\executeCommand(), and ilObjMediaObjectGUI\executeCommand().

{
$this->label_enable = $a_act;
$this->label_header = $a_label_header;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::addCommand ( $a_obj,
  $a_func,
  $a_name,
  $a_single = true,
  $a_allow_dir = false 
)

Add command.

Definition at line 225 of file class.ilFileSystemGUI.php.

{
$i = count($this->commands);
$this->commands[$i]["object"] =& $a_obj;
$this->commands[$i]["method"] = $a_func;
$this->commands[$i]["name"] = $a_name;
$this->commands[$i]["single"] = $a_single;
$this->commands[$i]["allow_dir"] = $a_allow_dir;
//$this->commands[] = $arr;
}
ilFileSystemGUI::cancelRename ( )

cancel renaming a file

Definition at line 551 of file class.ilFileSystemGUI.php.

{
$this->ctrl->redirect($this, "listFiles");
}
ilFileSystemGUI::clearCommands ( )

Clear commands.

Definition at line 242 of file class.ilFileSystemGUI.php.

{
$this->commands = array();
}
ilFileSystemGUI::confirmDeleteFile ( )

Confirm file deletion.

Definition at line 664 of file class.ilFileSystemGUI.php.

References $_POST, $ilCtrl, $lng, $tpl, and ilUtil\sendFailure().

{
global $ilCtrl, $tpl, $lng;
if (!is_array($_POST["file"]) || count($_POST["file"]) == 0)
{
ilUtil::sendFailure($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "listFile");
}
else
{
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($ilCtrl->getFormAction($this));
$cgui->setHeaderText($lng->txt("info_delete_sure"));
$cgui->setCancel($lng->txt("cancel"), "listFiles");
$cgui->setConfirm($lng->txt("delete"), "deleteFile");
foreach ($_POST["file"] as $i)
{
$cgui->addItem("file[]", $i, $i);
}
$tpl->setContent($cgui->getHTML());
}
}

+ Here is the call graph for this function:

ilFileSystemGUI::createDirectory ( )

create directory

Definition at line 559 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $lng, ilUtil\makeDir(), ilUtil\sendFailure(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

{
global $lng;
// determine directory
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$new_dir = str_replace(".", "", ilUtil::stripSlashes($_POST["new_dir"]));
$new_dir = str_replace("/", "", $new_dir);
if (!empty($new_dir))
{
ilUtil::makeDir($cur_dir."/".$new_dir);
if (is_dir($cur_dir."/".$new_dir))
{
ilUtil::sendSuccess($lng->txt("cont_dir_created"), true);
$this->setPerformedCommand("create_dir", array("name" => $new_dir));
}
}
else
{
ilUtil::sendFailure($lng->txt("cont_enter_a_dir_name"), true);
}
$this->ctrl->saveParameter($this, "cdir");
$this->ctrl->redirect($this, "listFiles");
}

+ Here is the call graph for this function:

ilFileSystemGUI::deleteFile ( )

delete object file

Definition at line 694 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $file, $lng, ilUtil\delDir(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

{
global $lng;
if (!isset($_POST["file"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
foreach ($_POST["file"] as $post_file)
{
if (ilUtil::stripSlashes($post_file) == "..")
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
break;
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$file = $cur_dir."/".ilUtil::stripSlashes($post_file);
if (@is_file($file))
{
unlink($file);
}
if (@is_dir($file))
{
$is_dir = true;
}
}
$this->ctrl->saveParameter($this, "cdir");
if ($is_dir)
{
ilUtil::sendSuccess($lng->txt("cont_dir_deleted"), true);
$this->setPerformedCommand("delete_dir",
array("name" => ilUtil::stripSlashes($post_file)));
}
else
{
ilUtil::sendSuccess($lng->txt("cont_file_deleted"), true);
$this->setPerformedCommand("delete_file",
array("name" => ilUtil::stripSlashes($post_file)));
}
$this->ctrl->redirect($this, "listFiles");
}

+ Here is the call graph for this function:

ilFileSystemGUI::downloadFile ( )

delete object file

Definition at line 834 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $file, $valid, ilUtil\deliverFile(), exit, ilUtil\getDir(), and ilUtil\stripSlashes().

{
if (!isset($_POST["file"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
if (count($_POST["file"]) > 1)
{
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$file = $cur_dir."/".$_POST["file"][0];
// validate against files of current directory
$valid = false;
foreach(ilUtil::getDir($cur_dir) as $entry)
{
if($entry["type"] == "file" &&
$cur_dir."/".$entry["entry"] == $file)
{
$valid = true;
break;
}
}
if (@is_file($file) && !(@is_dir($file)) && $valid)
{
}
else
{
$this->ctrl->saveParameter($this, "cdir");
$this->ctrl->redirect($this, "listFiles");
}
}

+ Here is the call graph for this function:

& ilFileSystemGUI::executeCommand ( )

execute command

Definition at line 198 of file class.ilFileSystemGUI.php.

References $cmd, $ret, and extCommand().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd("listFiles");
switch($next_class)
{
default:
if (substr($cmd, 0, 11) == "extCommand_")
{
$ret =& $this->extCommand(substr($cmd, 11, strlen($cmd) - 11));
}
else
{
$ret =& $this->$cmd();
}
break;
}
return $ret;
}

+ Here is the call graph for this function:

& ilFileSystemGUI::extCommand (   $a_nr)

call external command

Definition at line 267 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $file, and ilUtil\stripSlashes().

Referenced by executeCommand().

{
if (isset($_POST["file"]))
{
// remove ".." items
foreach ($_POST["file"] as $k => $v)
{
if ($_POST["file"][$k] == "..")
{
unset($_POST["file"][$k]);
}
}
}
// check if at least one item is select
else
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
// check if only one item is select, if command does not allow multiple selection
if (count($_POST["file"]) > 1 && $this->commands[$a_nr]["single"])
{
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
// collect files and
$files = array();
foreach ($_POST["file"] as $k => $v)
{
$file = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir."/".ilUtil::stripSlashes($_POST["file"][$k])
: $this->main_dir."/".ilUtil::stripSlashes($_POST["file"][$k]);
// check wether selected item is a directory
if (@is_dir($file) && !$this->commands[$a_nr]["allow_dir"])
{
$this->ilias->raiseError($this->lng->txt("select_a_file"),$this->ilias->error_obj->MESSAGE);
}
$file = (!empty($cur_subdir))
? $cur_subdir."/".ilUtil::stripSlashes($_POST["file"][$k])
: ilUtil::stripSlashes($_POST["file"][$k]);
$files[] = $file;
}
if ($this->commands[$a_nr]["single"])
{
$files = $files[0];
}
$obj =& $this->commands[$a_nr]["object"];
$method = $this->commands[$a_nr]["method"];
return $obj->$method($files);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileSystemGUI::getAllowDirectories ( )

Get allow directories.

Returns
boolean allow directories

Definition at line 82 of file class.ilFileSystemGUI.php.

Referenced by listFiles(), and unzipFile().

{
return $this->allow_directories;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getAllowDirectoryCreation ( )

Get allowed directory creation.

Definition at line 335 of file class.ilFileSystemGUI.php.

Referenced by listFiles().

{
return $this->directory_creation;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getAllowFileCreation ( )

Get allowed file creation.

Definition at line 351 of file class.ilFileSystemGUI.php.

Referenced by listFiles().

{
return $this->file_creation;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getLastPerformedCommand ( )

Get performed command.

Returns
array command array

Definition at line 188 of file class.ilFileSystemGUI.php.

References $_SESSION, and $ret.

{
$ret = $_SESSION["fsys"]["lastcomm"];
$_SESSION["fsys"]["lastcomm"] = "none";
return $ret;
}
ilFileSystemGUI::getPostDirPath ( )

Get post dir path.

Returns
boolean post dir path

Definition at line 102 of file class.ilFileSystemGUI.php.

Referenced by listFiles().

{
return $this->post_dir_path;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getTableId ( )

Get table id.

Returns
string table id

Definition at line 122 of file class.ilFileSystemGUI.php.

Referenced by listFiles().

{
return $this->table_id;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getTabs ( $tabs_gui)

get tabs

Definition at line 879 of file class.ilFileSystemGUI.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->setParameter($this, "resetoffset", 1);
$tabs_gui->addTarget("cont_list_files",
$this->ctrl->getLinkTarget($this, "listFiles"), "listFiles",
get_class($this));
$ilCtrl->setParameter($this, "resetoffset", "");
}
ilFileSystemGUI::getTitle ( )

Get title.

Returns
string title

Definition at line 142 of file class.ilFileSystemGUI.php.

Referenced by listFiles().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::getUseUploadDirectory ( )

Get use upload directory.

Returns
bool use upload directory

Definition at line 162 of file class.ilFileSystemGUI.php.

References $use_upload_directory.

Referenced by listFiles().

+ Here is the caller graph for this function:

ilFileSystemGUI::ilFileSystemGUI (   $a_main_directory)

Definition at line 18 of file class.ilFileSystemGUI.php.

References $ilCtrl, $lng, $tpl, setAllowDirectories(), setAllowDirectoryCreation(), and setAllowFileCreation().

{
global $lng, $ilCtrl, $tpl, $ilias;
$this->ctrl =& $ilCtrl;
$this->lng =& $lng;
$this->ilias =& $ilias;
$this->tpl =& $tpl;
$this->main_dir = $a_main_directory;
$this->post_dir_path = false;
$this->commands = array(
0 => array(
"object" => $this,
"method" => "downloadFile",
"name" => $lng->txt("download"),
"int" => true
),
1 => array(
"object" => $this,
"method" => "confirmDeleteFile",
"name" => $lng->txt("delete"),
"allow_dir" => true,
"int" => true
),
2 => array(
"object" => $this,
"method" => "unzipFile",
"name" => $lng->txt("unzip"),
"int" => true
),
3 => array(
"object" => $this,
"method" => "renameFileForm",
"name" => $lng->txt("rename"),
"allow_dir" => true,
"int" => true
),
);
$this->file_labels = array();
$this->label_enable = false;
$this->ctrl->saveParameter($this, "cdir");
$lng->loadLanguageModule("content");
$this->setAllowDirectories(true);
$this->setAllowFileCreation(true);
//echo "<br>main_dir:".$this->main_dir.":";
}

+ Here is the call graph for this function:

ilFileSystemGUI::labelFile (   $a_file,
  $a_label 
)

label a file

Definition at line 250 of file class.ilFileSystemGUI.php.

{
$this->file_labels[$a_file][] = $a_label;
}
ilFileSystemGUI::listFiles ( )

list files

Definition at line 359 of file class.ilFileSystemGUI.php.

References $_GET, $file, $ilCtrl, $lng, $options, $si, ilUploadFiles\_getUploadDirectory(), ilUploadFiles\_getUploadFiles(), getAllowDirectories(), getAllowDirectoryCreation(), getAllowFileCreation(), getPostDirPath(), getTableId(), getTitle(), getUseUploadDirectory(), ilTextInputGUI\setMaxLength(), ilFileInputGUI\setSize(), and ilUtil\stripSlashes().

{
global $ilToolbar, $lng, $ilCtrl;
// determine directory
// FIXME: I have to call stripSlashes here twice, because I could not
// determine where the second layer of slashes is added to the
// URL Parameter
$new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["newdir"]));
if($new_subdir == "..")
{
$cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
}
else
{
if (!empty($new_subdir))
{
if (!empty($cur_subdir))
{
$cur_subdir = $cur_subdir."/".$new_subdir;
}
else
{
$cur_subdir = $new_subdir;
}
}
}
$cur_subdir = str_replace("..", "", $cur_subdir);
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$this->ctrl->setParameter($this, "cdir", $cur_subdir);
// toolbar for adding files/directories
$ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
include_once("./Services/Form/classes/class.ilTextInputGUI.php");
{
$ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), "new_dir");
$ti->setMaxLength(80);
$ti->setSize(10);
$ilToolbar->addInputItem($ti, true);
$ilToolbar->addFormButton($lng->txt("create"), "createDirectory");
$ilToolbar->addSeparator();
}
include_once("./Services/Form/classes/class.ilFileInputGUI.php");
if ($this->getAllowFileCreation())
{
$fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file");
$fi->setSize(10);
$ilToolbar->addInputItem($fi, true);
$ilToolbar->addFormButton($lng->txt("upload"), "uploadFile");
}
include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
{
$ilToolbar->addSeparator();
$options[""] = $lng->txt("cont_select_from_upload_dir");
foreach($files as $file)
{
$file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
}
include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
$si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
$si->setOptions($options);
$ilToolbar->addInputItem($si, true);
$ilToolbar->addFormButton($lng->txt("copy"), "uploadFile");
}
// load files templates
include_once("./Services/FileSystem/classes/class.ilFileSystemTableGUI.php");
$fs_table = new ilFileSystemTableGUI($this, "listFiles", $cur_dir, $cur_subdir,
$this->label_enable, $this->file_labels, $this->label_header, $this->commands,
$this->getPostDirPath(), $this->getTableId());
if ($this->getTitle() != "")
{
$fs_table->setTitle($this->getTitle());
}
if ($_GET["resetoffset"] == 1)
{
$fs_table->resetOffset();
}
$this->tpl->setContent($fs_table->getHTML());
}

+ Here is the call graph for this function:

ilFileSystemGUI::renameFile ( )

rename a file

Definition at line 514 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $lng, ilUtil\renameExecutables(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

{
global $lng;
$new_name = str_replace("..", "", ilUtil::stripSlashes($_POST["new_name"]));
$new_name = str_replace("/", "", $new_name);
if ($new_name == "")
{
$this->ilias->raiseError($this->lng->txt("enter_new_name"),$this->ilias->error_obj->MESSAGE);
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir."/"
: $this->main_dir."/";
rename($dir.ilUtil::stripSlashes($_GET["old_name"]), $dir.$new_name);
ilUtil::renameExecutables($this->main_dir);
if (@is_dir($dir.$new_name))
{
ilUtil::sendSuccess($lng->txt("cont_dir_renamed"), true);
$this->setPerformedCommand("rename_dir", array("old_name" => $_GET["old_name"],
"new_name" => $new_name));
}
else
{
ilUtil::sendSuccess($lng->txt("cont_file_renamed"), true);
$this->setPerformedCommand("rename_file", array("old_name" => $_GET["old_name"],
"new_name" => $new_name));
}
$this->ctrl->redirect($this, "listFiles");
}

+ Here is the call graph for this function:

ilFileSystemGUI::renameFileForm ( )

list files

Definition at line 458 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $file, $ilCtrl, $lng, ilTextInputGUI\setMaxLength(), and ilUtil\stripSlashes().

{
global $lng, $ilCtrl;
if (!isset($_POST["file"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
if (count($_POST["file"]) > 1)
{
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
}
if (ilUtil::stripSlashes($_POST["file"][0]) == ".." )
{
$this->ilias->raiseError($this->lng->txt("select_a_file"),$this->ilias->error_obj->MESSAGE);
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$file = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir."/".ilUtil::stripSlashes($_POST["file"][0])
: $this->main_dir."/".ilUtil::stripSlashes($_POST["file"][0]);
$this->ctrl->setParameter($this, "old_name", ilUtil::stripSlashes($_POST["file"][0]));
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
// file/dir name
$ti = new ilTextInputGUI($this->lng->txt("name"), "new_name");
$ti->setMaxLength(200);
$ti->setSize(40);
$ti->setValue(ilUtil::stripSlashes($_POST["file"][0]));
$form->addItem($ti);
// save and cancel commands
$form->addCommandButton("renameFile", $lng->txt("rename"));
$form->addCommandButton("cancelRename", $lng->txt("cancel"));
$form->setFormAction($ilCtrl->getFormAction($this, "renameFile"));
if (@is_dir($file))
{
$form->setTitle($this->lng->txt("cont_rename_dir"));
}
else
{
$form->setTitle($this->lng->txt("rename_file"));
}
$this->tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilFileSystemGUI::setAllowDirectories (   $a_val)

Set allow directories.

Parameters
booleanallow directories

Definition at line 72 of file class.ilFileSystemGUI.php.

Referenced by ilFileSystemGUI().

{
$this->allow_directories = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setAllowDirectoryCreation (   $a_val)

Set allowed directory creation.

Definition at line 327 of file class.ilFileSystemGUI.php.

Referenced by ilFileSystemGUI().

{
$this->directory_creation = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setAllowFileCreation (   $a_val)

Set allowed file creation.

Definition at line 343 of file class.ilFileSystemGUI.php.

Referenced by ilFileSystemGUI().

{
$this->file_creation = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setPerformedCommand (   $command,
  $pars = "" 
)
protected

Set performed command.

Parameters
stringcommand
arrayparameter array

Definition at line 173 of file class.ilFileSystemGUI.php.

References $_SESSION.

Referenced by createDirectory(), deleteFile(), renameFile(), unzipFile(), and uploadFile().

{
if (!is_array($pars))
{
$pars = array();
}
$_SESSION["fsys"]["lastcomm"] = array_merge(
array("cmd" => $command), $pars);
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setPostDirPath (   $a_val)

Set post dir path.

Parameters
booleanpost dir path

Definition at line 92 of file class.ilFileSystemGUI.php.

Referenced by ilObjMediaPoolGUI\executeCommand().

{
$this->post_dir_path = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setTableId (   $a_val)

Set table id.

Parameters
stringtable id

Definition at line 112 of file class.ilFileSystemGUI.php.

Referenced by ilObjExerciseGUI\executeCommand().

{
$this->table_id = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setTitle (   $a_val)

Set title.

Parameters
stringtitle

Definition at line 132 of file class.ilFileSystemGUI.php.

Referenced by ilObjExerciseGUI\executeCommand().

{
$this->title = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::setUseUploadDirectory (   $a_val)

Set use upload directory.

Parameters
bool$a_valuse upload directory

Definition at line 152 of file class.ilFileSystemGUI.php.

Referenced by ilObjSAHSLearningModuleGUI\executeCommand().

{
$this->use_upload_directory = $a_val;
}

+ Here is the caller graph for this function:

ilFileSystemGUI::unzipFile ( )

delete object file

Definition at line 748 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $file, $lng, $path, getAllowDirectories(), ilUtil\getDir(), ilFileUtils\recursive_dirscan(), ilUtil\renameExecutables(), ilUtil\sendSuccess(), setPerformedCommand(), ilUtil\stripSlashes(), and ilUtil\unzip().

{
global $lng;
if (isset($_GET["upfile"]))
{
$file = basename($_GET["upfile"]);
}
else
{
if (!isset($_POST["file"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
if (count($_POST["file"]) > 1)
{
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
}
$file = basename($_POST["file"][0]);
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$file = $cur_dir."/".ilUtil::stripSlashes($file);
if (@is_file($file))
{
$cur_files = array_keys(ilUtil::getDir($cur_dir));
if ($this->getAllowDirectories())
{
}
else
{
ilUtil::unzip($file, true, true);
}
$new_files = array_keys(ilUtil::getDir($cur_dir));
$diff = array_diff($new_files, $cur_files);
if(sizeof($diff))
{
if ($this->getAllowDirectories())
{
include_once("./Services/Utilities/classes/class.ilFileUtils.php");
$new_files = array();
foreach($diff as $new_item)
{
if(is_dir($cur_dir."/".$new_item))
{
ilFileUtils::recursive_dirscan($cur_dir."/".$new_item, $new_files);
}
}
if(is_array($new_files["path"]))
{
foreach($new_files["path"] as $idx => $path)
{
$path = substr($path, strlen($this->main_dir)+1);
$diff[] = $path.$new_files["file"][$idx];
}
}
}
$this->setPerformedCommand("unzip_file",
array("name" => substr($file, strlen($this->main_dir)+1),
"added" => $diff));
}
}
ilUtil::renameExecutables($this->main_dir);
$this->ctrl->saveParameter($this, "cdir");
ilUtil::sendSuccess($lng->txt("cont_file_unzipped"), true);
$this->ctrl->redirect($this, "listFiles");
}

+ Here is the call graph for this function:

ilFileSystemGUI::uploadFile ( )

upload file

Definition at line 592 of file class.ilFileSystemGUI.php.

References $_GET, $_POST, $lng, ilUploadFiles\_checkUploadFile(), ilUploadFiles\_copyUploadFile(), ilLinkButton\getInstance(), ilMimeTypeUtil\getMimeType(), if, ilUtil\renameExecutables(), ilUtil\sendFailure(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

{
global $lng;
// determine directory
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = (!empty($cur_subdir))
? $this->main_dir."/".$cur_subdir
: $this->main_dir;
$tgt_file = null;
if (is_file($_FILES["new_file"]["tmp_name"]))
{
$tgt_file = $cur_dir."/".ilUtil::stripSlashes($_FILES["new_file"]["name"]);
move_uploaded_file($_FILES["new_file"]["tmp_name"], $tgt_file);
}
elseif ($_POST["uploaded_file"])
{
include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
// check if the file is in the ftp directory and readable
if (ilUploadFiles::_checkUploadFile($_POST["uploaded_file"]))
{
$tgt_file = $cur_dir."/".ilUtil::stripSlashes($_POST["uploaded_file"]);
// copy uploaded file to data directory
ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $tgt_file);
}
}
else if (trim($_FILES["new_file"]["name"]) == "")
{
ilUtil::sendFailure($lng->txt("cont_enter_a_file"), true);
}
if($tgt_file && is_file($tgt_file))
{
$unzip = null;
// extract zip?
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
if(ilMimeTypeUtil::getMimeType($tgt_file) == "application/zip")
{
$this->ctrl->setParameter($this, "upfile", basename($tgt_file));
$url = $this->ctrl->getLinkTarget($this, "unzipFile");
$this->ctrl->setParameter($this, "upfile", "");
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
$unzip->setCaption("unzip");
$unzip->setUrl($url);
$unzip = " ".$unzip->render();
}
ilUtil::sendSuccess($lng->txt("cont_file_created").$unzip, true);
$this->setPerformedCommand("create_file",
array("name" => substr($tgt_file, strlen($this->main_dir)+1)));
}
$this->ctrl->saveParameter($this, "cdir");
ilUtil::renameExecutables($this->main_dir);
$this->ctrl->redirect($this, "listFiles");
}

+ Here is the call graph for this function:

Field Documentation

ilFileSystemGUI::$ctrl

Definition at line 14 of file class.ilFileSystemGUI.php.

ilFileSystemGUI::$use_upload_directory = false
protected

Definition at line 16 of file class.ilFileSystemGUI.php.

Referenced by getUseUploadDirectory().


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