ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestExportFilename Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilTestExportFilename:

Public Member Functions

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

Protected Attributes

 $test
 
 $timestamp = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $test.

40  {
41  $this->test = $test;
42  $this->timestamp = time();
43  }

Member Function Documentation

◆ getPathname()

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

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

References $additional, getTimestamp(), and IL_INST_ID.

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

◆ getTimestamp()

ilTestExportFilename::getTimestamp ( )
Returns
int

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

References $timestamp.

Referenced by getPathname().

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

Field Documentation

◆ $test

ilTestExportFilename::$test
protected

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

Referenced by __construct().

◆ $timestamp

ilTestExportFilename::$timestamp = 0
protected

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

Referenced by getTimestamp().


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