ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFSStorageExercise Class Reference
+ Inheritance diagram for ilFSStorageExercise:
+ Collaboration diagram for ilFSStorageExercise:

Public Member Functions

 __construct ($a_container_id=0, $a_ass_id=0)
 Constructor.
 init ()
 Append ass_<ass_id> to path (assignment id)
 getAbsoluteSubmissionPath ()
 Get submission path.
 getTempPath ()
 Get submission path.
 getFeedbackPath ($a_user_id)
 Get feedback path.
 getGlobalFeedbackPath ()
 getMultiFeedbackUploadPath ($a_user_id)
 Get multi feedback upload path (each uploader handled in a separate path)
 getPeerReviewUploadPath ($a_peer_id, $a_giver_id)
 Get pear review upload path (each peer handled in a separate path)
 deletePeerReviewUploads ()
 Remove all uploads.
 create ()
 Create directory.
 getFiles ()
 Get assignment files.
 deliverFile ($a_http_post_file, $user_id, $is_unziped=false)
 store delivered file in filesystem
 getFeedbackFiles ($a_user_id)
 Get number of feedback files.
 countFeedbackFiles ($a_user_id)
 Count number of feedback files for a user.
 getAssignmentFilePath ($a_file)
 Get path for assignment file.
 getFeedbackFilePath ($a_user_id, $a_file)
 Get path for feedback file.
 uploadAssignmentFiles ($a_files)
 Upload assignment files (e.g.
- Public Member Functions inherited from ilFileSystemStorage
 __construct ($a_storage_type, $a_path_conversion, $a_container_id)
 Constructor.
 getContainerId ()
 getAbsolutePath ()
 Get absolute path of storage directory.
 writeToFile ($a_data, $a_absolute_path)
 Write data to file.
 deleteFile ($a_abs_name)
 Delete file.
 deleteDirectory ($a_abs_name)
 Delete directory.
 delete ()
 Delete complete directory.
 copyFile ($a_from, $a_to)
 Copy files.
 appendToPath ($a_appendix)
 getStorageType ()
 getPath ()
 Get path.
 __construct ($a_storage_type, $a_path_conversion, $a_container_id)
 Constructor.
 getAbsolutePath ()
 Get absolute path of storage directory.
 getShortPath ()
 rename ($from, $to)

Protected Member Functions

 getPathPostfix ()
 Implementation of abstract method.
 getPathPrefix ()
 Implementation of abstract method.

Additional Inherited Members

- Static Public Member Functions inherited from ilFileSystemStorage
static _createPathFromId ($a_container_id, $a_name)
 Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.
 _copyDirectory ($a_source, $a_target)
 Copy directory and all contents.
static _createPathFromId ($a_container_id, $a_name)
 Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.
- Data Fields inherited from ilFileSystemStorage
const STORAGE_WEB = 1
const STORAGE_DATA = 2
const STORAGE_SECURED = 3
const FACTOR = 100
const MAX_EXPONENT = 3
const SECURED_DIRECTORY = "sec"
- Protected Attributes inherited from ilFileSystemStorage
 $path

Detailed Description

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

ilFSStorageExercise::__construct (   $a_container_id = 0,
  $a_ass_id = 0 
)

Constructor.

Parameters
intexercise id

Definition at line 39 of file class.ilFSStorageExercise.php.

{
$this->ass_id = $a_ass_id;
parent::__construct(self::STORAGE_DATA,true,$a_container_id);
}

Member Function Documentation

ilFSStorageExercise::countFeedbackFiles (   $a_user_id)

Count number of feedback files for a user.

Definition at line 321 of file class.ilFSStorageExercise.php.

References getFeedbackFiles().

{
$fbf = $this->getFeedbackFiles($a_user_id);
return count($fbf);
}

+ Here is the call graph for this function:

ilFSStorageExercise::create ( )

Create directory.

public

Reimplemented from ilFileSystemStorage.

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

References ilUtil\makeDirParents().

Referenced by ilExAssignmentPeerReviewTableGUI\__construct(), ilExAssignment\cloneAssignmentsOfExercise(), deliverFile(), ilObjExerciseGUI\executeCommand(), ilExerciseXMLParser\ilExerciseXMLParser(), and ilExerciseDataSet\importRecord().

{
if(!file_exists($this->submission_path))
{
ilUtil::makeDirParents($this->submission_path);
}
if(!file_exists($this->tmp_path))
{
ilUtil::makeDirParents($this->tmp_path);
}
if(!file_exists($this->feedb_path))
{
ilUtil::makeDirParents($this->feedb_path);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFSStorageExercise::deletePeerReviewUploads ( )

Remove all uploads.

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

References ilFileSystemStorage\deleteDirectory().

{
$this->deleteDirectory($this->peer_review_upload_path);
}

+ Here is the call graph for this function:

ilFSStorageExercise::deliverFile (   $a_http_post_file,
  $user_id,
  $is_unziped = false 
)

store delivered file in filesystem

Parameters
arrayHTTP_POST_FILES
numericdatabase id of the user who delivered the file public
Returns
mixed Returns a result array with filename and mime type of the saved file, otherwise false

Definition at line 231 of file class.ilFSStorageExercise.php.

References $filename, $result, create(), getAbsoluteSubmissionPath(), ilObjMediaObject\getMimeType(), ilUtil\makeDir(), ilUtil\moveUploadedFile(), and ilFileSystemStorage\rename().

{
$this->create();
// TODO:
// CHECK UPLOAD LIMIT
//
$result = false;
if(isset($a_http_post_file) && $a_http_post_file['size'])
{
$filename = $a_http_post_file['name'];
// replace whitespaces with underscores
$filename = preg_replace("/\s/", "_", $filename);
// remove all special characters
$filename = preg_replace("/[^_a-zA-Z0-9\.]/", "", $filename);
if(!is_dir($savepath = $this->getAbsoluteSubmissionPath()))
{
ilUtil::makeDir($savepath);
}
$savepath .= '/' .$user_id;
if(!is_dir($savepath))
{
ilUtil::makeDir($savepath);
}
// CHECK IF FILE PATH EXISTS
if (!is_dir($savepath))
{
require_once "./Services/Utilities/classes/class.ilUtil.php";
#ilUtil::makeDirParents($savepath);
ilUtil::makeDir($savepath);
}
$now = getdate();
$prefix = sprintf("%04d%02d%02d%02d%02d%02d", $now["year"], $now["mon"], $now["mday"], $now["hours"],
$now["minutes"], $now["seconds"]);
if (!$is_unziped)
{
//move_uploaded_file($a_http_post_file["tmp_name"], $savepath . $prefix . "_" . $filename);
ilUtil::moveUploadedFile($a_http_post_file["tmp_name"], $a_http_post_file["name"],
$savepath . "/" . $prefix . "_" . $filename);
}
else
{
rename($a_http_post_file['tmp_name'],
$savepath . "/" . $prefix . "_" . $filename);
}
require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
if (is_file($savepath . "/" . $prefix . "_" . $filename))
{
$result = array(
"filename" => $prefix . "_" . $filename,
"fullname" => $savepath . "/" . $prefix . "_" . $filename,
"mimetype" => ilObjMediaObject::getMimeType($savepath . "/" . $prefix . "_" . $filename)
);
}
}
return $result;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getAbsoluteSubmissionPath ( )

Get submission path.

Definition at line 95 of file class.ilFSStorageExercise.php.

Referenced by deliverFile().

{
return $this->submission_path;
}

+ Here is the caller graph for this function:

ilFSStorageExercise::getAssignmentFilePath (   $a_file)

Get path for assignment file.

Definition at line 330 of file class.ilFSStorageExercise.php.

References ilFileSystemStorage\getAbsolutePath().

{
return $this->getAbsolutePath()."/".$a_file;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getFeedbackFilePath (   $a_user_id,
  $a_file 
)

Get path for feedback file.

Definition at line 338 of file class.ilFSStorageExercise.php.

References getFeedbackPath().

{
$dir = $this->getFeedbackPath($a_user_id);
return $dir."/".$a_file;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getFeedbackFiles (   $a_user_id)

Get number of feedback files.

Definition at line 298 of file class.ilFSStorageExercise.php.

References $file, and getFeedbackPath().

Referenced by countFeedbackFiles().

{
$files = array();
$dir = $this->getFeedbackPath($a_user_id);
if (@is_dir($dir))
{
$dp = opendir($dir);
while($file = readdir($dp))
{
if(!is_dir($this->path.'/'.$file) && substr($file, 0, 1) != ".")
{
$files[] = $file;
}
}
}
return $files;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFSStorageExercise::getFeedbackPath (   $a_user_id)

Get feedback path.

Definition at line 111 of file class.ilFSStorageExercise.php.

References ilFileSystemStorage\$path, and ilUtil\makeDirParents().

Referenced by getFeedbackFilePath(), and getFeedbackFiles().

{
$path = $this->feedb_path."/".$a_user_id;
if(!file_exists($path))
{
}
return $path;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFSStorageExercise::getFiles ( )

Get assignment files.

Definition at line 194 of file class.ilFSStorageExercise.php.

References $file, ilFormat\formatDate(), and ilUtil\sortArray().

{
$files = array();
if (!is_dir($this->path))
{
return $files;
}
$dp = opendir($this->path);
while($file = readdir($dp))
{
if(!is_dir($this->path.'/'.$file))
{
$files[] = array(
'name' => $file,
'size' => filesize($this->path.'/'.$file),
'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s',filectime($this->path.'/'.$file))),
'fullpath' => $this->path.'/'.$file);
}
}
closedir($dp);
$files = ilUtil::sortArray($files, "name", "asc");
return $files;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getGlobalFeedbackPath ( )

Definition at line 121 of file class.ilFSStorageExercise.php.

References ilFileSystemStorage\$path, and ilUtil\makeDirParents().

{
$path = $this->feedb_path."/0";
if(!file_exists($path))
{
}
return $path;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getMultiFeedbackUploadPath (   $a_user_id)

Get multi feedback upload path (each uploader handled in a separate path)

Definition at line 135 of file class.ilFSStorageExercise.php.

References ilFileSystemStorage\$path, and ilUtil\makeDirParents().

{
$path = $this->multi_feedback_upload_path."/".$a_user_id;
if(!file_exists($path))
{
}
return $path;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getPathPostfix ( )
protected

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 76 of file class.ilFSStorageExercise.php.

{
return 'exc';
}
ilFSStorageExercise::getPathPrefix ( )
protected

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 87 of file class.ilFSStorageExercise.php.

{
return 'ilExercise';
}
ilFSStorageExercise::getPeerReviewUploadPath (   $a_peer_id,
  $a_giver_id 
)

Get pear review upload path (each peer handled in a separate path)

Definition at line 149 of file class.ilFSStorageExercise.php.

References ilFileSystemStorage\$path, and ilUtil\makeDirParents().

{
$path = $this->peer_review_upload_path."/".$a_peer_id."/".$a_giver_id;
if(!file_exists($path))
{
}
return $path;
}

+ Here is the call graph for this function:

ilFSStorageExercise::getTempPath ( )

Get submission path.

Definition at line 103 of file class.ilFSStorageExercise.php.

{
return $this->tmp_path;
}
ilFSStorageExercise::init ( )

Append ass_<ass_id> to path (assignment id)

Reimplemented from ilFileSystemStorage.

Definition at line 48 of file class.ilFSStorageExercise.php.

{
if (parent::init())
{
if ($this->ass_id > 0)
{
$this->submission_path = $this->path."/subm_".$this->ass_id;
$this->tmp_path = $this->path."/tmp_".$this->ass_id;
$this->feedb_path = $this->path."/feedb_".$this->ass_id;
$this->multi_feedback_upload_path = $this->path."/mfb_up_".$this->ass_id;
$this->peer_review_upload_path = $this->path."/peer_up_".$this->ass_id;
$this->path.= "/ass_".$this->ass_id;
}
}
else
{
return false;
}
return true;
}
ilFSStorageExercise::uploadAssignmentFiles (   $a_files)

Upload assignment files (e.g.

from assignment creation form)

Definition at line 348 of file class.ilFSStorageExercise.php.

References $size, and ilUtil\moveUploadedFile().

{
if (is_array($a_files["name"]))
{
foreach ($a_files["name"] as $k => $name)
{
if ($name != "")
{
$type = $a_files["type"][$k];
$tmp_name = $a_files["tmp_name"][$k];
$size = $a_files["size"][$k];
basename($name),
$this->path.DIRECTORY_SEPARATOR.basename($name),
false);
}
}
}
}

+ Here is the call graph for this function:


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