ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

27 {
28 $this->test = $test;
29 $this->timestamp = time();
30 }

References $test.

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.

47 {
48 if(!is_string($extension) || !strlen($extension))
49 {
50 throw new ilException('Missing file extension! Please pass a file extension of type string.');
51 }
52 else if(substr_count($extension, '.') > 1 || (strpos($extension, '.') !== false && strpos($extension, '.') !== 0))
53 {
54 throw new ilException('Please use at most one dot in your file extension.');
55 }
56 else if(strpos($extension, '.') === 0)
57 {
58 $extension = substr($extension, 1);
59 }
60
61 if(!is_string($additional))
62 {
63
64 }
65 else if(strlen($additional))
66 {
67 if(strpos($additional, '__') === 0)
68 {
69 throw new ilException('The additional file part may not contain __ at the beginning!');
70 }
71
72 $additional = '__' . $additional . '_';
73 }
74 else
75 {
76 $additional = '_';
77 }
78
79 return $this->test->getExportDirectory() . DIRECTORY_SEPARATOR . $this->getTimestamp() . '__' . IL_INST_ID . '__' . $this->test->getType() . $additional . $this->test->getId() . '.' . $extension;
80 }
Base class for ILIAS Exception handling.
$additional
Definition: goto.php:89

References $additional, and getTimestamp().

+ 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: