ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
mocks.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
12require_once("Services/Tracking/classes/class.ilLPStatus.php");
13
17require_once("Modules/StudyProgramme/classes/interfaces/interface.ilStudyProgrammeLeaf.php");
18require_once("Services/Object/classes/class.ilObject2.php");
19
21{
22 public function __construct($a_id = 0, $a_call_by_reference = true)
23 {
24 parent::__construct($a_id, $a_call_by_reference);
25 if ($a_id == 0) {
26 parent::create();
27 }
28 }
29
30 // from ilObject2
31 public function initType()
32 {
33 $this->type = "crsr";
34 }
35
36 // from ilStudyProgrammeLeaf
37 /*public function getParentId() {
38 global $tree;
39 if (!$tree->isInTree($this->getRefId())) {
40 return null;
41 }
42
43 $nd = $tree->getParentNodeData($this->getRefId());
44 return $nd["obj_id"];
45 }*/
46
47 // Mark this leaf as completed for a user.
48 public function markCompletedFor($a_user_id) {
49 global $ilAppEventHandler;
50
51 $ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
52 "obj_id" => $this->getId(),
53 "usr_id" => $a_user_id,
55 "percentage" => 100
56 ));
57 }
58}
59
63require_once("Modules/StudyProgramme/classes/class.ilObjectFactoryWrapper.php");
64
66{
67 public function getInstanceByRefId($a_ref_id, $stop_on_error = true)
68 {
69 if (ilObject::_lookupType($a_ref_id, true) == "mock") {
70 return new ilStudyProgrammeLeafMock($a_ref_id);
71 }
72 return ilObjectFactoryWrapper::getInstanceByRefId($a_ref_id, $stop_on_error);
73 }
74}
75
80{
81 public $events;
82
83 public function __construct()
84 {
85 $this->events = array();
86 }
87
88 public function raise($a_component, $a_event, $a_parameters)
89 {
90 $this->events[] = array( "component" => $a_component
91 , "event" => $a_event
92 , "parameters" => $a_parameters
93 );
94 }
95}
Mock for ilAppEventHandler.
Definition: mocks.php:80
const LP_STATUS_COMPLETED_NUM
Class ilObject2 This is an intermediate progress of ilObject class.
Mock for object factory.
Definition: mocks.php:66
getInstanceByRefId($a_ref_id, $stop_on_error=true)
Definition: mocks.php:67
Class ilObjectFactoryWrapper.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
static _lookupType($a_id, $a_reference=false)
lookup object type
Mock classes for tests.
Definition: mocks.php:21
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
Definition: mocks.php:22
markCompletedFor($a_user_id)
Definition: mocks.php:48
The interface a class has to fullfill if it should be used as leaf in a program.
getId()
Get the ILIAS object id of the leaf.