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

Public Member Functions

 __construct (ilLanguage $lng)
 
 determine ()
 
 exists ()
 {
Returns
bool
} More...
 
 setLanguageAdapter ($lng)
 
 getLanguageAdapter ()
 
 setSourceFiles ($source_directories)
 
 getSourceFiles ()
 
 hasContent ()
 
 getContent ()
 
 getSource ()
 
 getSourceType ()
 
 getIso2LanguageCode ()
 
 hasContent ()
 
 exists ()
 
 getContent ()
 
 getSource ()
 
 getSourceType ()
 
 getIso2LanguageCode ()
 
 determine ()
 Called from client to initiate the content determination. More...
 

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.

55 {
56 foreach ($this->getSourceFiles() as $file => $iso2_language_code) {
57 if (is_file($file) && is_readable($file)) {
58 $this->content = '';
59
60 $content = file_get_contents($file);
61 if (strip_tags($content) === $content) {
62 $lines = file($file);
63 foreach ($lines as $line) {
64 $this->content .= nl2br(trim($line));
65 }
66 } else {
67 $this->content = $content;
68 }
69
70 $this->source = $file;
71 $this->has_content = (bool) strlen($this->content);
72 $this->iso2_language_code = $iso2_language_code;
73 return;
74 }
75 }
76
77 require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceNoSignableDocumentFoundException.php';
78 throw new ilTermsOfServiceNoSignableDocumentFoundException('Could not find any terms of service document for the passed language object');
79 }
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exists()

ilTermsOfServiceFileSystemDocument::exists ( )

{

Returns
bool
}

Implements ilTermsOfServiceSignableDocument.

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

85 {
86 return true;
87 }

◆ getContent()

◆ getIso2LanguageCode()

◆ getLanguageAdapter()

ilTermsOfServiceFileSystemDocument::getLanguageAdapter ( )
Returns
ilLanguage

Definition at line 115 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 131 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 92 of file class.ilTermsOfServiceFileSystemDocument.php.

93 {
94 $this->source_files = array(
95 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
96 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
97 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_en.html')) => 'en',
98 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
99 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
100 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_en.html')) => 'en'
101 );
102 }

References getLanguageAdapter().

Referenced by __construct().

+ 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 107 of file class.ilTermsOfServiceFileSystemDocument.php.

108 {
109 $this->lng = $lng;
110 }

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 123 of file class.ilTermsOfServiceFileSystemDocument.php.

124 {
125 $this->source_files = $source_directories;
126 }

Field Documentation

◆ $content

ilTermsOfServiceFileSystemDocument::$content = ''
protected

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

Referenced by determine(), and 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: