ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBadgeDefinitionProcessor Class Reference
+ Inheritance diagram for ilBadgeDefinitionProcessor:
+ Collaboration diagram for ilBadgeDefinitionProcessor:

Public Member Functions

 __construct (\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

ilDBInterface $db
 
string $component_id
 
bool $has_badges = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilBadgeDefinitionProcessor::__construct ( \ilDBInterface  $db)

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

References $db.

28  {
29  $this->db = $db;
30  }

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 38 of file class.ilBadgeDefinitionProcessor.php.

38  : void
39  {
40  $this->has_badges = false;
41  $this->component_id = null;
42  }

◆ 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 50 of file class.ilBadgeDefinitionProcessor.php.

References ilBadgeHandler\updateFromXML().

50  : void
51  {
52  if ($name === "module" || $name === "service") {
53  $this->component_id = $attributes["id"] ?? null;
54  return;
55  }
56 
57  if ($name !== 'badges') {
58  return;
59  }
60 
61  if ($this->component_id === null) {
62  throw new \RuntimeException(
63  "Found $name-tag outside of module or service."
64  );
65  }
66 
67  ilBadgeHandler::updateFromXML($this->component_id);
68  $this->has_badges = true;
69  }
$attributes
Definition: metadata.php:248
static updateFromXML(string $a_component_id)
Import component definition.
if($format !==null) $name
Definition: metadata.php:247
+ 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 44 of file class.ilBadgeDefinitionProcessor.php.

44  : void
45  {
46  $this->has_badges = false;
47  $this->component_id = null;
48  }

◆ endTag()

ilBadgeDefinitionProcessor::endTag ( string  $name)

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

Implements ilComponentDefinitionProcessor.

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

71  : void
72  {
73  if ($name === "module" || $name === "service") {
74  $this->component_id = null;
75  }
76  }
if($format !==null) $name
Definition: metadata.php:247

◆ 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 32 of file class.ilBadgeDefinitionProcessor.php.

References ilBadgeHandler\getInstance().

32  : void
33  {
35  $bh->setComponents(null);
36  }
+ Here is the call graph for this function:

Field Documentation

◆ $component_id

string ilBadgeDefinitionProcessor::$component_id
protected

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

◆ $db

ilDBInterface ilBadgeDefinitionProcessor::$db
protected

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

Referenced by __construct().

◆ $has_badges

bool ilBadgeDefinitionProcessor::$has_badges = false
protected

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


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