ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSCommunity.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 {
34  protected $json_obj = null;
35  protected $title = '';
36  protected $description = '';
37  protected $id = 0;
38 
39  protected $participants = array();
40  protected $position = 0;
41 
49  public function __construct($json_obj)
50  {
51  $this->json_obj = $json_obj;
52  $this->read();
53  }
54 
61  public function getTitle()
62  {
63  return $this->title;
64  }
65 
72  public function getDescription()
73  {
74  return $this->description;
75  }
76 
83  public function getParticipants()
84  {
85  return $this->participants ? $this->participants : array();
86  }
87 
91  public function getMids()
92  {
93  $mids = array();
94  foreach($this->getParticipants() as $part)
95  {
96  $mids[] = $part->getMID();
97  }
98  return $mids;
99  }
100 
104  public function getOwnId()
105  {
106  foreach($this->getParticipants() as $part)
107  {
108  if($part->isSelf())
109  {
110  return $part->getMID();
111  }
112  }
113  return 0;
114  }
115 
116 
123  public function getId()
124  {
125  return $this->id;
126  }
127 
128 
135  private function read()
136  {
137  $this->title = $this->json_obj->community->name;
138  $this->description = $this->json_obj->community->description;
139  $this->id = $this->json_obj->community->cid;
140 
141  foreach($this->json_obj->participants as $participant)
142  {
143  include_once('./Services/WebServices/ECS/classes/class.ilECSParticipant.php');
144  $this->participants[] = new ilECSParticipant($participant,$this->getId());
145  }
146  }
147 }
148 
149 
150 ?>