ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilObjStudyProgrammeCollection.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 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
24 
34 
39  public function __construct(array $data = array()) {
40  parent::__construct($data);
41  }
42 
50  public function offsetSet($index, $newval) {
51  if(!$this->typeCheck($newval)) {
52  throw new ilException("You cannot add other types than ilObjStudyProgramme-Objects to ilObjStudyProgrammeCollections.");
53  }
54 
55  parent::offsetSet($index, $newval);
56  }
57 
64  public function append($value) {
65  if(!$this->typeCheck($value)) {
66  throw new ilException("You cannot add other types than ilObjStudyProgramme-Objects to ilObjStudyProgrammeCollections.");
67  }
68 
69  parent::append($value);
70  }
71 
78  protected function typeCheck($value) {
79  if($value instanceof ilObjStudyProgramme) {
80  return true;
81  }
82  return false;
83  }
84 }
Base class for ILIAS Exception handling.
__construct(array $data=array())
Initialize the ProgrammeCollection.
Handles collections of ilObjStudyProgramme-Objects The class extends the ArrayObject class...
offsetSet($index, $newval)
Sets the value at the specified index to newval.
$data
typeCheck($value)
Check the type of the given value against ilObjStudyProgramme.
Class ilObjStudyProgramme.
append($value)
Append ilObjStudyProgramme to the collection.