ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUserAgreement.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
33 {
39  var $ilias;
40 
41 
46  function ilUserAgreement()
47  {
48  global $ilias;
49 
50  $this->ilias = &$ilias;
51  }
52 
58  function _getText()
59  {
60  global $lng, $ilias, $ilLog;
61 
62 
63  // 1st try: client specific / user language agreement
64  $agreement = "./Customizing/clients/".CLIENT_ID."/agreement/".
65  "agreement_".$lng->lang_key.".html";
66 
67  // 2nd try: client specific / default language
68  if (!file_exists($agreement))
69  {
70  $agreement = "./Customizing/clients/".CLIENT_ID."/agreement/".
71  "agreement_".$lng->lang_default.".html";
72  }
73 
74  // 3rd try: client specific / english
75  if (!file_exists($agreement))
76  {
77  $agreement = "./Customizing/clients/".CLIENT_ID."/agreement/".
78  "agreement_en.html";
79  }
80 
81  // 4th try: global / user language
82  if (!file_exists($agreement))
83  {
84  $agreement = "./Customizing/global/agreement/".
85  "agreement_".$lng->lang_key.".html";
86  }
87 
88  // 5th try: global / default language
89  if (!file_exists($agreement))
90  {
91  $agreement = "./Customizing/global/agreement/".
92  "agreement_".$lng->lang_default.".html";
93  }
94 
95  // last try: global / english
96  if (!file_exists($agreement))
97  {
98  $ilLog->write("view_usr_agreement.php: Agreement file "."agreement_".$lng->lang_default.".html"." has not been found (system language).");
99  $agreement = "./Customizing/global/agreement/".
100  "agreement_en.html";
101  }
102 
103  if (file_exists($agreement))
104  {
105  if ($content = file($agreement))
106  {
107  foreach ($content as $key => $val)
108  {
109  $text .= trim(nl2br($val));
110  }
111  return $text;
112  }
113  }
114 
115  return "<br />".$lng->txt("no_agreement_description")."<br /><br />";
116  }
117 }
118 ?>