ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBadgeDefinitionProcessor Class Reference
+ Inheritance diagram for ilBadgeDefinitionProcessor:
+ Collaboration diagram for ilBadgeDefinitionProcessor:

Public Member Functions

 __construct (protected ilDBInterface $db)
 
 purge ()
 This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate. More...
 
 beginComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component starts. More...
 
 endComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component ends. More...
 
 beginTag (string $name, array $attributes)
 This is called when a tag starts in the context of the given component. More...
 
 endTag (string $name)
 This is called when a tag ends in the context of the given component. More...
 

Protected Attributes

string $component_id
 
bool $has_badges = false
 

Detailed Description

Definition at line 21 of file class.ilBadgeDefinitionProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

ilBadgeDefinitionProcessor::__construct ( protected ilDBInterface  $db)

Definition at line 26 of file class.ilBadgeDefinitionProcessor.php.

27  {
28  }

Member Function Documentation

◆ beginComponent()

ilBadgeDefinitionProcessor::beginComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component starts.

This is supposed to reset any internal parsing state.

Implements ilComponentDefinitionProcessor.

Definition at line 36 of file class.ilBadgeDefinitionProcessor.php.

References null.

36  : void
37  {
38  $this->has_badges = false;
39  $this->component_id = null;
40  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ beginTag()

ilBadgeDefinitionProcessor::beginTag ( string  $name,
array  $attributes 
)

This is called when a tag starts in the context of the given component.

Parameters
string[]$attributes

Implements ilComponentDefinitionProcessor.

Definition at line 48 of file class.ilBadgeDefinitionProcessor.php.

References null, and ilBadgeHandler\updateFromXML().

48  : void
49  {
50  if ($name === 'module' || $name === 'service') {
51  $this->component_id = $attributes['id'] ?? null;
52  return;
53  }
54 
55  if ($name !== 'badges') {
56  return;
57  }
58 
59  if ($this->component_id === null) {
60  throw new RuntimeException(
61  "Found $name-tag outside of module or service."
62  );
63  }
64 
65  ilBadgeHandler::updateFromXML($this->component_id);
66  $this->has_badges = true;
67  }
static updateFromXML(string $a_component_id)
Import component definition.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ endComponent()

ilBadgeDefinitionProcessor::endComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component ends.

Implements ilComponentDefinitionProcessor.

Definition at line 42 of file class.ilBadgeDefinitionProcessor.php.

References null.

42  : void
43  {
44  $this->has_badges = false;
45  $this->component_id = null;
46  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ endTag()

ilBadgeDefinitionProcessor::endTag ( string  $name)

This is called when a tag ends in the context of the given component.

Implements ilComponentDefinitionProcessor.

Definition at line 69 of file class.ilBadgeDefinitionProcessor.php.

References null.

69  : void
70  {
71  if ($name === 'module' || $name === 'service') {
72  $this->component_id = null;
73  }
74  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ purge()

ilBadgeDefinitionProcessor::purge ( )

This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate.

Implements ilComponentDefinitionProcessor.

Definition at line 30 of file class.ilBadgeDefinitionProcessor.php.

References ilBadgeHandler\getInstance(), and null.

30  : void
31  {
33  $bh->setComponents(null);
34  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

Field Documentation

◆ $component_id

string ilBadgeDefinitionProcessor::$component_id
protected

Definition at line 23 of file class.ilBadgeDefinitionProcessor.php.

◆ $has_badges

bool ilBadgeDefinitionProcessor::$has_badges = false
protected

Definition at line 24 of file class.ilBadgeDefinitionProcessor.php.


The documentation for this class was generated from the following file: