ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $mids[] = $part->getMID();
96 }
97 return $mids;
98 }
99
103 public function getOwnId()
104 {
105 foreach ($this->getParticipants() as $part) {
106 if ($part->isSelf()) {
107 return $part->getMID();
108 }
109 }
110 return 0;
111 }
112
113
120 public function getId()
121 {
122 return $this->id;
123 }
124
125
132 private function read()
133 {
134 $this->title = $this->json_obj->community->name;
135 $this->description = $this->json_obj->community->description;
136 $this->id = $this->json_obj->community->cid;
137
138 foreach ($this->json_obj->participants as $participant) {
139 include_once('./Services/WebServices/ECS/classes/class.ilECSParticipant.php');
140 $this->participants[] = new ilECSParticipant($participant, $this->getId());
141 }
142 }
143}
An exception for terminatinating execution or to throw for unit testing.
getDescription()
getDescription
getParticipants()
get participants
__construct($json_obj)
Constructor.
read()
Read community entries and participants.
getMids()
Get array of mids of all participants.
getOwnId()
Get own mid of community.