ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
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 }
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 90 of file class.ilTermsOfServiceFileSystemDocument.php.

91 {
92 return true;
93 }

◆ getContent()

◆ getIso2LanguageCode()

◆ getLanguageAdapter()

ilTermsOfServiceFileSystemDocument::getLanguageAdapter ( )
Returns
ilLanguage

Definition at line 121 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 137 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 98 of file class.ilTermsOfServiceFileSystemDocument.php.

99 {
100 $this->source_files = array(
101 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
102 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
103 implode('/', array('.', 'Customizing', 'clients', CLIENT_ID, 'agreement', 'agreement_en.html')) => 'en',
104 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getLangKey() . '.html')) => $this->getLanguageAdapter()->getLangKey(),
105 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_' . $this->getLanguageAdapter()->getDefaultLanguage() . '.html')) => $this->getLanguageAdapter()->getDefaultLanguage(),
106 implode('/', array('.', 'Customizing', 'global', 'agreement', 'agreement_en.html')) => 'en'
107 );
108 }

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

114 {
115 $this->lng = $lng;
116 }

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

130 {
131 $this->source_files = $source_directories;
132 }

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: