ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSAuth.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 
33 class ilECSAuth
34 {
35  protected $log;
36  protected $mids = array();
37 
38 
39  public $hash;
40  public $mid;
41  public $eid;
42 
50  public function __construct($a_eid,$a_mid)
51  {
52  global $ilLog;
53 
54  $this->log = $ilLog;
55 
56  $this->eid = (int) $a_eid;
57  $this->mid = (int) $a_mid;
58  $this->init();
59  }
60 
67  public function getHash()
68  {
69  return $this->hash;
70  }
71 
79  public function setSOV($a_sov)
80  {
81  include_once('Date.php');
82 
83  $date = new Date();
84  $date->setDate($a_sov,DATE_FORMAT_UNIXTIME);
85  $this->sov = $date->getDate().'+01:00';
86  }
87 
95  public function setEOV($a_eov)
96  {
97  include_once('Date.php');
98 
99  $date = new Date();
100  $date->setDate($a_eov,DATE_FORMAT_UNIXTIME);
101  $this->eov = $date->getDate().'+01:00';
102  }
103 
110  public function setAbbreviation($a_abr)
111  {
112  $this->abr = (string) $a_abr;
113  }
114 
120  protected function init()
121  {
122  $this->hash = md5(time());
123 
124  try
125  {
126  $this->mids = array();
127 
128  include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
130  foreach($reader->getCommunities() as $com)
131  {
132  foreach($com->getParticipants() as $part)
133  {
134  if($part->isSelf())
135  {
136  $this->mids[] = $part->getMID();
137  $this->log->write('Fetch MID: '.$part->getMID());
138  }
139  }
140  }
141  }
142  catch(ilException $exc)
143  {
144  throw $exc;
145  }
146  }
147 }
148 ?>