1<?php 2 /* 3 +-----------------------------------------------------------------------------+ 4 | ILIAS open source | 5 +-----------------------------------------------------------------------------+ 6 | Copyright (c) 1998-2001 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 25 /** 26 * factory classs for structure objects 27 * 28 * @author Roland Kuestermann (rku@aifb.uni-karlsruhe.de) 29 * @version $Id: class.ilSoapStructureReader.php,v 1.5 2006/05/23 23:09:06 hschottm Exp $ 30 * 31 * @package ilias 32 */ 33 34class ilSoapStructureObjectFactory 35{ 36 public function getInstanceForObject($object) 37 { 38 $classname = ilSoapStructureObjectFactory::_getClassnameForType($object->getType()); 39 40 if ($classname != null) { 41 switch ($object->getType()) { 42 case "lm": 43 case "glo": 44 return new $classname( 45 $object->getId(), 46 $object->getType(), 47 $object->getTitle(), 48 $object->getLongDescription(), 49 $object->getRefId() 50 ); 51 break; 52 } 53 } 54 return null; 55 } 56 57 public function getInstance($objId, $type, $title, $description, $parentRefId) 58 { 59 $classname = ilSoapStructureObjectFactory::_getClassnameForType($type); 60 if ($classname == null) { 61 return null; 62 } 63 64 return new $classname($objId, $type, $title, $description, $parentRefId); 65 } 66 67 public function _getClassnameForType($type) 68 { 69 switch ($type) { 70 case "lm": 71 include_once "./webservice/soap/classes/class.ilSoapRepositoryStructureObject.php"; 72 return "ilSoapRepositoryStructureObject"; 73 case "st": 74 include_once "./webservice/soap/classes/class.ilSoapLMChapterStructureObject.php"; 75 return "ilSoapLMChapterStructureObject"; 76 case "pg": 77 include_once "./webservice/soap/classes/class.ilSoapLMPageStructureObject.php"; 78 return "ilSoapLMPageStructureObject"; 79 case "glo": 80 include_once "./webservice/soap/classes/class.ilSoapRepositoryStructureObject.php"; 81 return "ilSoapRepositoryStructureObject"; 82 case "git": 83 include_once "./webservice/soap/classes/class.ilSoapGLOTermStructureObject.php"; 84 return "ilSoapGLOTermStructureObject"; 85 case "gdf": 86 include_once "./webservice/soap/classes/class.ilSoapGLOTermDefinitionStructureObject.php"; 87 return "ilSoapGLOTermDefinitionStructureObject"; 88 89 90 } 91 return null; 92 } 93} 94