ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFileDataGroup Class Reference
+ Inheritance diagram for ilFileDataGroup:
+ Collaboration diagram for ilFileDataGroup:

Public Member Functions

 ilFileDataGroup ($group_obj)
 Constructor call base constructors checks if directory is writable and sets the optional obj_id. More...
 
 createImportFile ($a_tmp_name, $a_name)
 
 unpackImportFile ()
 
 validateImportFile ()
 
 getImportFile ()
 
 getExportFile ($a_rel_name)
 
 getExportFiles ()
 
 deleteFile ($a_rel_name)
 
 deleteDirectory ($a_rel_dir)
 
 _deleteAll ($a_obj_id)
 
 addGroupDirectory ()
 
 addImportDirectory ()
 
 addDirectory ($a_rel_name)
 
 writeToFile ($a_data, $a_rel_name)
 
 zipFile ($a_rel_name, $a_zip_name)
 
 getGroupPath ()
 get exercise path public More...
 
 __checkPath ()
 
 __checkReadWrite ()
 check if directory is writable overwritten method from base class private More...
 
 __initDirectory ()
 init directory overwritten method public More...
 
- Public Member Functions inherited from ilFileData
 ilFileData ()
 Constructor class bas constructor and read path of directory from ilias.ini setup an mail object public. More...
 
 checkPath ($a_path)
 check if path exists and is writable More...
 
 getPath ()
 get Path public More...
 
- Public Member Functions inherited from ilFile
 ilFile ()
 Constructor get ilias object public. More...
 
 deleteTrailingSlash ($a_path)
 delete trailing slash of path variables More...
 

Data Fields

 $group_path
 
 $group_obj = null
 
- Data Fields inherited from ilFile
 $path
 
 $ilias
 

Detailed Description

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

Member Function Documentation

◆ __checkPath()

ilFileDataGroup::__checkPath ( )

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

References __checkReadWrite(), and getGroupPath().

Referenced by ilFileDataGroup().

226  {
227  if(!@file_exists($this->getGroupPath()))
228  {
229  return false;
230  }
231 
232  $this->__checkReadWrite();
233 
234  return true;
235  }
__checkReadWrite()
check if directory is writable overwritten method from base class private
getGroupPath()
get exercise path public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __checkReadWrite()

ilFileDataGroup::__checkReadWrite ( )

check if directory is writable overwritten method from base class private

Returns
bool

Definition at line 243 of file class.ilFileDataGroup.php.

Referenced by __checkPath().

244  {
245  if(is_writable($this->group_path) && is_readable($this->group_path))
246  {
247  return true;
248  }
249  else
250  {
251  $this->ilias->raiseError("Group directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
252  }
253  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the caller graph for this function:

◆ __initDirectory()

ilFileDataGroup::__initDirectory ( )

init directory overwritten method public

Returns
string path

Definition at line 260 of file class.ilFileDataGroup.php.

References ilFileData\getPath(), GROUP_PATH, and ilUtil\makeDir().

Referenced by ilFileDataGroup().

261  {
262  if(is_writable($this->getPath()))
263  {
264  ilUtil::makeDir($this->getPath().'/'.GROUP_PATH);
265  $this->group_path = $this->getPath().'/'.GROUP_PATH;
266 
267  return true;
268  }
269  return false;
270  }
getPath()
get Path public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
const GROUP_PATH
This class handles all operations of export files for the group object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAll()

ilFileDataGroup::_deleteAll (   $a_obj_id)

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

References ilUtil\delDir(), and GROUP_PATH.

153  {
154  ilUtil::delDir(CLIENT_DATA_DIR.'/'.GROUP_PATH.'/grp_'.$a_obj_id);
155 
156  return true;
157  }
const GROUP_PATH
This class handles all operations of export files for the group object.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ addDirectory()

ilFileDataGroup::addDirectory (   $a_rel_name)

Definition at line 182 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\makeDir().

183  {
184  if(@file_exists($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
185  {
186  return false;
187  }
188  ilUtil::makeDir($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name);
189 
190  return true;
191  }
getGroupPath()
get exercise path public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ addGroupDirectory()

ilFileDataGroup::addGroupDirectory ( )

Definition at line 159 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\makeDir().

160  {
161  if(@file_exists($this->getGroupPath().'/grp_'.$this->group_obj->getId()))
162  {
163  return false;
164  }
165  ilUtil::makeDir($this->getGroupPath().'/grp_'.$this->group_obj->getId());
166 
167  return true;
168  }
getGroupPath()
get exercise path public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ addImportDirectory()

ilFileDataGroup::addImportDirectory ( )

Definition at line 170 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\makeDir().

171  {
172  if(@file_exists($this->getGroupPath().'/import'))
173  {
174  return false;
175  }
176  ilUtil::makeDir($this->getGroupPath().'/import');
177 
178  return true;
179  }
getGroupPath()
get exercise path public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ createImportFile()

ilFileDataGroup::createImportFile (   $a_tmp_name,
  $a_name 
)

Definition at line 54 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\moveUploadedFile().

55  {
56  ilUtil::moveUploadedFile($a_tmp_name,
57  $a_name,
58  $this->getGroupPath().'/import/'.$a_name);
59  $this->import_file_info = pathinfo($this->getGroupPath().'/import/'.$a_name);
60 
61  }
getGroupPath()
get exercise path public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:

◆ deleteDirectory()

ilFileDataGroup::deleteDirectory (   $a_rel_dir)

Definition at line 140 of file class.ilFileDataGroup.php.

References ilUtil\delDir(), and getGroupPath().

141  {
142  if(!@file_exists($abs = $this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_dir))
143  {
144  return false;
145  }
146  ilUtil::delDir($abs);
147 
148  return true;
149  }
getGroupPath()
get exercise path public
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ deleteFile()

ilFileDataGroup::deleteFile (   $a_rel_name)

Definition at line 129 of file class.ilFileDataGroup.php.

130  {
131  if(@file_exists($abs = $this->group_path.'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
132  {
133  @unlink($abs);
134 
135  return true;
136  }
137  return false;
138  }

◆ getExportFile()

ilFileDataGroup::getExportFile (   $a_rel_name)

Definition at line 93 of file class.ilFileDataGroup.php.

94  {
95  if(@file_exists($abs = $this->group_path.'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
96  {
97  return $abs;
98  }
99  return false;
100  }

◆ getExportFiles()

ilFileDataGroup::getExportFiles ( )

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

References ilFile\$path, and getGroupPath().

103  {
104  $path = $this->getGroupPath().'/grp_'.$this->group_obj->getId();
105 
106 
107  if(!@file_exists($path) or !is_readable($path))
108  {
109  return array();
110  }
111  $dp = dir($path);
112 
113  // Get file
114  while($entry = $dp->read())
115  {
116  if ($entry != "." and
117  $entry != ".." and
118  substr($entry, -4) == ".zip" and
119  ereg("^[0-9]{10}_{2}[0-9]+_{2}(grp_)*[0-9]+\.zip\$", $entry))
120  {
121  $files[$entry] = array("file" => $entry,
122  "size" => filesize($path."/".$entry),
123  'type' => "XML");
124  }
125  }
126  return $files ? $files : array();
127  }
getGroupPath()
get exercise path public
+ Here is the call graph for this function:

◆ getGroupPath()

ilFileDataGroup::getGroupPath ( )

get exercise path public

Returns
string path

Definition at line 218 of file class.ilFileDataGroup.php.

References $group_path.

Referenced by __checkPath(), addDirectory(), addGroupDirectory(), addImportDirectory(), createImportFile(), deleteDirectory(), getExportFiles(), getImportFile(), unpackImportFile(), validateImportFile(), writeToFile(), and zipFile().

219  {
220  return $this->group_path;
221  }
+ Here is the caller graph for this function:

◆ getImportFile()

ilFileDataGroup::getImportFile ( )

Definition at line 83 of file class.ilFileDataGroup.php.

References getGroupPath().

84  {
85  return $this->getGroupPath().'/import'
86  .'/'.basename($this->import_file_info['basename'],'.zip')
87  .'/'.basename($this->import_file_info['basename'],'.zip').'.xml';
88  }
getGroupPath()
get exercise path public
+ Here is the call graph for this function:

◆ ilFileDataGroup()

ilFileDataGroup::ilFileDataGroup (   $group_obj)

Constructor call base constructors checks if directory is writable and sets the optional obj_id.

Parameters
integeregerobj_id public

Definition at line 34 of file class.ilFileDataGroup.php.

References $group_obj, ilFile\$ilias, __checkPath(), __initDirectory(), and GROUP_PATH.

35  {
36  global $ilias;
37 
38  parent::ilFileData();
39 
40  $this->ilias =& $ilias;
41  $this->group_path = parent::getPath()."/".GROUP_PATH;
42  $this->group_obj =& $group_obj;
43 
44  // IF DIRECTORY ISN'T CREATED CREATE IT
45  if(!$this->__checkPath())
46  {
47  $this->__initDirectory();
48  }
49  // Check import dir
50  #$this->__checkImportPath();
51  }
__initDirectory()
init directory overwritten method public
redirection script todo: (a better solution should control the processing via a xml file) ...
const GROUP_PATH
This class handles all operations of export files for the group object.
+ Here is the call graph for this function:

◆ unpackImportFile()

ilFileDataGroup::unpackImportFile ( )

Definition at line 63 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\unzip().

64  {
65  return ilUtil::unzip($this->getGroupPath().'/import/'.$this->import_file_info['basename']);
66  }
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
getGroupPath()
get exercise path public
+ Here is the call graph for this function:

◆ validateImportFile()

ilFileDataGroup::validateImportFile ( )

Definition at line 68 of file class.ilFileDataGroup.php.

References getGroupPath().

69  {
70  if(!is_dir($this->getGroupPath().'/import/'.basename($this->import_file_info['basename'],'.zip')))
71  {
72  return false;
73  }
74  if(!file_exists($this->getGroupPath().'/import'.
75  '/'.basename($this->import_file_info['basename'],'.zip').
76  '/'.basename($this->import_file_info['basename'],'.zip').'.xml'))
77  {
78  return false;
79  }
80  return true;
81  }
getGroupPath()
get exercise path public
+ Here is the call graph for this function:

◆ writeToFile()

ilFileDataGroup::writeToFile (   $a_data,
  $a_rel_name 
)

Definition at line 193 of file class.ilFileDataGroup.php.

References getGroupPath().

194  {
195  if(!$fp = @fopen($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name,'w+'))
196  {
197  die("Cannot open file: ".$this->getGroupPath().'/'.$a_rel_name);
198  }
199  @fwrite($fp,$a_data);
200 
201  return true;
202  }
getGroupPath()
get exercise path public
+ Here is the call graph for this function:

◆ zipFile()

ilFileDataGroup::zipFile (   $a_rel_name,
  $a_zip_name 
)

Definition at line 204 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\zip().

205  {
206  ilUtil::zip($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name,
207  $this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_zip_name);
208 
209  return true;
210  }
getGroupPath()
get exercise path public
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
+ Here is the call graph for this function:

Field Documentation

◆ $group_obj

ilFileDataGroup::$group_obj = null

Definition at line 25 of file class.ilFileDataGroup.php.

Referenced by ilFileDataGroup().

◆ $group_path

ilFileDataGroup::$group_path

Definition at line 23 of file class.ilFileDataGroup.php.

Referenced by getGroupPath().


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