ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestExportFilename Class Reference
+ Collaboration diagram for ilTestExportFilename:

Public Member Functions

 __construct (ilObjTest $test)
 
 getTimestamp ()
 
 getPathname ($extension, $additional='')
 

Protected Attributes

 $test
 
 $timestamp = 0
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilTestExportFilename.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestExportFilename::__construct ( ilObjTest  $test)
Parameters
ilObjTest$test

Definition at line 26 of file class.ilTestExportFilename.php.

References $test, and time.

27  {
28  $this->test = $test;
29  $this->timestamp = time();
30  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Member Function Documentation

◆ getPathname()

ilTestExportFilename::getPathname (   $extension,
  $additional = '' 
)
Parameters
string$extension
string$additional
Returns
string
Exceptions
ilException

Definition at line 46 of file class.ilTestExportFilename.php.

References $additional, and getTimestamp().

47  {
48  if (!is_string($extension) || !strlen($extension)) {
49  throw new ilException('Missing file extension! Please pass a file extension of type string.');
50  } elseif (substr_count($extension, '.') > 1 || (strpos($extension, '.') !== false && strpos($extension, '.') !== 0)) {
51  throw new ilException('Please use at most one dot in your file extension.');
52  } elseif (strpos($extension, '.') === 0) {
53  $extension = substr($extension, 1);
54  }
55 
56  if (!is_string($additional)) {
57  } elseif (strlen($additional)) {
58  if (strpos($additional, '__') === 0) {
59  throw new ilException('The additional file part may not contain __ at the beginning!');
60  }
61 
62  $additional = '__' . $additional . '_';
63  } else {
64  $additional = '_';
65  }
66 
67  return $this->test->getExportDirectory() . DIRECTORY_SEPARATOR . $this->getTimestamp() . '__' . IL_INST_ID . '__' . $this->test->getType() . $additional . $this->test->getId() . '.' . $extension;
68  }
$additional
Definition: goto.php:50
+ Here is the call graph for this function:

◆ getTimestamp()

ilTestExportFilename::getTimestamp ( )
Returns
int

Definition at line 35 of file class.ilTestExportFilename.php.

References $timestamp.

Referenced by getPathname().

+ Here is the caller graph for this function:

Field Documentation

◆ $test

ilTestExportFilename::$test
protected

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

Referenced by __construct().

◆ $timestamp

ilTestExportFilename::$timestamp = 0
protected

Definition at line 21 of file class.ilTestExportFilename.php.

Referenced by getTimestamp().


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