ILIAS
Release_4_1_x_branch Revision 61804
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilFileDataChat.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2009 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
32
require_once(
"classes/class.ilFileData.php"
);
33
34
class
ilFileDataChat
extends
ilFileData
35
{
36
var
$chat_obj
;
37
43
var
$chat_path
;
44
52
public
function
__construct
(&
$chat_obj
)
53
{
54
55
parent::ilFileData
();
56
57
$this->chat_obj =&
$chat_obj
;
58
$this->chat_path =
parent::getPath
().
"/chat"
;
59
60
if
(!$this->
__checkPath
())
61
{
62
$this->
__createDirectory
($this->chat_path);
63
}
64
$this->
__deleteOld
();
65
66
if
(@is_dir($this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
]))
67
{
68
ilUtil::delDir
($this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
]);
69
}
70
$this->
__createDirectory
($this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
]);
71
}
72
73
public
function
addFile
(
$filename
,
$data
)
74
{
75
$fp = @fopen($this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
].
"/"
.
$filename
,
"w+"
);
76
77
fwrite($fp,
$data
);
78
fclose($fp);
79
80
return
$this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
];
81
}
82
83
public
function
zip
()
84
{
85
ilUtil::zip
($this->chat_path.
"/chatrooms_"
.
$_SESSION
[
"AccountId"
],
86
$this->chat_path.
"/ilias_chat.zip"
);
87
88
return
$this->chat_path.
"/ilias_chat.zip"
;
89
}
90
91
public
function
getChatPath
()
92
{
93
return
$this->chat_path
;
94
}
95
96
// DESTUCTOR CALLED BY PEAR BASE CLASS
97
public
function
_ilFileDataChat
()
98
{
99
ilUtil::delDir
($this->chat_path);
100
}
101
102
private
function
__checkPath
()
103
{
104
if
(!file_exists($this->
getChatPath
()))
105
{
106
return
false
;
107
}
108
return
true
;
109
}
110
111
private
function
__createDirectory
($a_path)
112
{
113
return
ilUtil::makeDir
($a_path);
114
}
115
116
private
function
__deleteOld
()
117
{
118
if
(is_dir($this->
getChatPath
()))
119
{
120
$dp = opendir($this->
getChatPath
());
121
while
((
$file
= readdir($dp)) !==
false
)
122
{
123
if
(
$file
!=
'.'
and
$file
!=
'..'
)
124
{
125
if
(filectime($this->
getChatPath
().
"/"
.
$file
) < (time() - 60*60*24))
126
{
127
ilUtil::delDir
($this->
getChatPath
().
"/"
.
$file
);
128
}
129
}
130
}
131
closedir($dp);
132
}
133
}
134
}
135
?>
Modules
Chat
classes
class.ilFileDataChat.php
Generated on Thu Apr 21 2016 19:02:28 for ILIAS by
1.8.1.2 (using
Doxyfile
)