ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceFileSystemDocument Class Reference
+ Inheritance diagram for ilTermsOfServiceFileSystemDocument:
+ Collaboration diagram for ilTermsOfServiceFileSystemDocument:

Public Member Functions

 __construct (ilLanguage $lng)
 
 determine ()
 
 setLanguageAdapter ($lng)
 
 getLanguageAdapter ()
 
 setSourceFiles ($source_directories)
 
 getSourceFiles ()
 
 hasContent ()
 
 getContent ()
 
 getSource ()
 
 getSourceType ()
 
 getIso2LanguageCode ()
 

Protected Member Functions

 initSourceFiles ()
 

Protected Attributes

 $lng
 
 $has_content = false
 
 $content = ''
 
 $iso2_language_code = ''
 
 $source = ''
 
 $source_files = array()
 

Additional Inherited Members

- Data Fields inherited from ilTermsOfServiceSignableDocument
const SRC_TYPE_FILE_SYSTEM_PATH = 0
 
const SRC_TYPE_OBJECT = 1
 

Detailed Description

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

Definition at line 10 of file class.ilTermsOfServiceFileSystemDocument.php.

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceFileSystemDocument::__construct ( ilLanguage  $lng)
Parameters
ilLanguage$lng

Definition at line 45 of file class.ilTermsOfServiceFileSystemDocument.php.

References initSourceFiles(), and setLanguageAdapter().

+ Here is the call graph for this function:

Member Function Documentation

◆ determine()

ilTermsOfServiceFileSystemDocument::determine ( )
Exceptions
ilTermsOfServiceNoSignableDocumentFoundException

Implements ilTermsOfServiceSignableDocument.

Definition at line 54 of file class.ilTermsOfServiceFileSystemDocument.php.

References $file, $iso2_language_code, and getSourceFiles().

Referenced by ilTermsOfServiceFileSystemDocumentTest\testClientDocumentCouldBeRetrievedByCurrentLanguage(), ilTermsOfServiceFileSystemDocumentTest\testClientDocumentCouldBeRetrievedByDefaultLanguage(), ilTermsOfServiceFileSystemDocumentTest\testClientDocumentCouldBeRetrievedByEnglishLanguage(), ilTermsOfServiceFileSystemDocumentTest\testGlobalDocumentCouldBeRetrievedByCurrentLanguage(), ilTermsOfServiceFileSystemDocumentTest\testGlobalDocumentCouldBeRetrievedByDefaultLanguage(), and ilTermsOfServiceFileSystemDocumentTest\testGlobalDocumentCouldBeRetrievedByEnglishLanguage().

55  {
56  foreach($this->getSourceFiles() as $file => $iso2_language_code)
57  {
58  if(is_file($file) && is_readable($file))
59  {
60  $lines = file($file);
61  $this->content = '';
62  foreach($lines as $line)
63  {
64  $this->content .= trim(nl2br($line));
65  }
66  $this->source = $file;
67  $this->has_content = (bool)strlen($this->content);
68  $this->iso2_language_code = $iso2_language_code;
69  return;
70  }
71  }
72 
73  require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceNoSignableDocumentFoundException.php';
74  throw new ilTermsOfServiceNoSignableDocumentFoundException('Could not find any terms of service document for the passed language object');
75  }
print $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContent()

◆ getIso2LanguageCode()

◆ getLanguageAdapter()

ilTermsOfServiceFileSystemDocument::getLanguageAdapter ( )
Returns
ilLanguage

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

References $lng.

Referenced by initSourceFiles().

+ Here is the caller graph for this function:

◆ getSource()

◆ getSourceFiles()

ilTermsOfServiceFileSystemDocument::getSourceFiles ( )
Returns
array

Definition at line 119 of file class.ilTermsOfServiceFileSystemDocument.php.

References $source_files.

Referenced by determine().

+ Here is the caller graph for this function:

◆ getSourceType()

◆ hasContent()

◆ initSourceFiles()

ilTermsOfServiceFileSystemDocument::initSourceFiles ( )
protected

Definition at line 80 of file class.ilTermsOfServiceFileSystemDocument.php.

References getLanguageAdapter().

Referenced by __construct().

81  {
82  $this->source_files = array(
83  implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
84  implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
85  implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_en.html')) => 'en',
86  implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
87  implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
88  implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_en.html')) => 'en'
89  );
90  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLanguageAdapter()

ilTermsOfServiceFileSystemDocument::setLanguageAdapter (   $lng)
Parameters
ilLanguage$lng

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

References $lng.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSourceFiles()

ilTermsOfServiceFileSystemDocument::setSourceFiles (   $source_directories)
Parameters
array$source_directories

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

112  {
113  $this->source_files = $source_directories;
114  }

Field Documentation

◆ $content

ilTermsOfServiceFileSystemDocument::$content = ''
protected

Definition at line 25 of file class.ilTermsOfServiceFileSystemDocument.php.

Referenced by getContent().

◆ $has_content

ilTermsOfServiceFileSystemDocument::$has_content = false
protected

Definition at line 20 of file class.ilTermsOfServiceFileSystemDocument.php.

Referenced by hasContent().

◆ $iso2_language_code

ilTermsOfServiceFileSystemDocument::$iso2_language_code = ''
protected

Definition at line 30 of file class.ilTermsOfServiceFileSystemDocument.php.

Referenced by determine(), and getIso2LanguageCode().

◆ $lng

ilTermsOfServiceFileSystemDocument::$lng
protected

◆ $source

ilTermsOfServiceFileSystemDocument::$source = ''
protected

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

Referenced by getSource().

◆ $source_files

ilTermsOfServiceFileSystemDocument::$source_files = array()
protected

Definition at line 40 of file class.ilTermsOfServiceFileSystemDocument.php.

Referenced by getSourceFiles().


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