ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 hasContent ()
 
 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 {
58 if(is_file($file) && is_readable($file))
59 {
60 $this->content = '';
61
62 $content = file_get_contents($file);
63 if(strip_tags($content) === $content)
64 {
65 $lines = file($file);
66 foreach($lines as $line)
67 {
68 $this->content .= nl2br(trim($line));
69 }
70 }
71 else
72 {
73 $this->content = $content;
74 }
75
76 $this->source = $file;
77 $this->has_content = (bool)strlen($this->content);
78 $this->iso2_language_code = $iso2_language_code;
79 return;
80 }
81 }
82
83 require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceNoSignableDocumentFoundException.php';
84 throw new ilTermsOfServiceNoSignableDocumentFoundException('Could not find any terms of service document for the passed language object');
85 }
print $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:

◆ getContent()

◆ getIso2LanguageCode()

◆ getLanguageAdapter()

ilTermsOfServiceFileSystemDocument::getLanguageAdapter ( )
Returns
ilLanguage

Definition at line 113 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 129 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 90 of file class.ilTermsOfServiceFileSystemDocument.php.

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

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

106 {
107 $this->lng = $lng;
108 }

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

122 {
123 $this->source_files = $source_directories;
124 }

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: