ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 26 of file class.ilTestExportFilename.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $test.

42  {
43  $this->test = $test;
44  $this->timestamp = time();
45  }

Member Function Documentation

◆ getPathname()

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

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

References getTimestamp(), and IL_INST_ID.

61  : string
62  {
63  if (!is_string($extension) || !strlen($extension)) {
64  throw new ilException('Missing file extension! Please pass a file extension of type string.');
65  } elseif (substr_count($extension, '.') > 1 || (strpos($extension, '.') !== false && strpos($extension, '.') !== 0)) {
66  throw new ilException('Please use at most one dot in your file extension.');
67  } elseif (strpos($extension, '.') === 0) {
68  $extension = substr($extension, 1);
69  }
70 
71  if (!is_string($additional)) {
72  } elseif (strlen($additional)) {
73  if (strpos($additional, '__') === 0) {
74  throw new ilException('The additional file part may not contain __ at the beginning!');
75  }
76 
77  $additional = '__' . $additional . '_';
78  } else {
79  $additional = '_';
80  }
81 
82  return $this->test->getExportDirectory() . DIRECTORY_SEPARATOR . $this->getTimestamp() . '__' . IL_INST_ID . '__' . $this->test->getType() . $additional . $this->test->getId() . '.' . $extension;
83  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:

◆ getTimestamp()

ilTestExportFilename::getTimestamp ( )
Returns
int

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

References $timestamp.

Referenced by getPathname().

50  : int
51  {
52  return $this->timestamp;
53  }
+ Here is the caller graph for this function:

Field Documentation

◆ $test

ilTestExportFilename::$test
protected

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

Referenced by __construct().

◆ $timestamp

ilTestExportFilename::$timestamp = 0
protected

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

Referenced by getTimestamp().


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