ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilQuestionPoolFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
5
13{
14 public function createNewInstance($parentRef = null)
15 {
16 // create new questionpool object
17 $newObj = new ilObjQuestionPool(0, true);
18
19 // set title of questionpool object to "dummy"
20 $newObj->setTitle("dummy");
21
22 // set description of questionpool object
23 $newObj->setDescription("derived questionpool");
24
25 // create the questionpool class in the ILIAS database (object_data table)
26 $newObj->create(true);
27
28 if ($parentRef) {
29 // create a reference for the questionpool object in the ILIAS database (object_reference table)
30 $newObj->createReference();
31
32 // put the questionpool object in the administration tree
33 $newObj->putInTree($parentRef);
34
35 // get default permissions and set the permissions for the questionpool object
36 $newObj->setPermissions($parentRef);
37 }
38
39 return $newObj;
40 }
41}
An exception for terminatinating execution or to throw for unit testing.