ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDidacticTemplateFilterPattern Class Reference

Represents a filter pattern for didactic template actions. More...

+ Inheritance diagram for ilDidacticTemplateFilterPattern:
+ Collaboration diagram for ilDidacticTemplateFilterPattern:

Public Member Functions

 __construct (int $a_pattern_id=0)
 
 setPatternId (int $a_id)
 
 getPatternId ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setParentType (string $a_type)
 
 getParentType ()
 
 setPatternType (int $a_type)
 
 getPatternType ()
 
 setPatternSubType (int $a_subtype)
 
 getPatternSubType ()
 
 setPattern (string $a_pattern)
 
 getPattern ()
 
 valid (string $a_source)
 Check if pattern matches. More...
 
 toXml (ilXmlWriter $writer)
 Get xml representation of pattern. More...
 
 update ()
 Update pattern definition. More...
 
 save ()
 Create new pattern Returns new pattern id. More...
 
 delete ()
 
 __clone ()
 

Data Fields

const PATTERN_INCLUDE = 1
 
const PATTERN_EXCLUDE = 2
 
const PATTERN_SUBTYPE_REGEX = 1
 

Protected Member Functions

 read ()
 Read pattern definition from db. More...
 

Protected Attributes

ilDBInterface $db
 
ilLogger $logger
 

Private Attributes

int $pattern_id = 0
 
int $parent_id = 0
 
string $parent_type = ''
 
string $pattern = ''
 
int $pattern_type = 0
 
int $pattern_sub_type = 0
 

Detailed Description

Represents a filter pattern for didactic template actions.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 11 of file class.ilDidacticTemplateFilterPattern.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateFilterPattern::__construct ( int  $a_pattern_id = 0)

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

References $DIC, getPatternId(), ILIAS\Repository\logger(), read(), and setPatternId().

31  {
32  global $DIC;
33 
34  $this->db = $DIC->database();
35  $this->logger = $DIC->logger()->otpl();
36 
37  $this->setPatternId($a_pattern_id);
38  if ($this->getPatternId()) {
39  $this->read();
40  }
41  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateFilterPattern::__clone ( )

Definition at line 162 of file class.ilDidacticTemplateFilterPattern.php.

References setParentId(), and setPatternId().

+ Here is the call graph for this function:

◆ delete()

ilDidacticTemplateFilterPattern::delete ( )

Definition at line 155 of file class.ilDidacticTemplateFilterPattern.php.

References $query, and getPatternId().

155  : void
156  {
157  $query = 'DELETE FROM didactic_tpl_fp ' .
158  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
159  $this->db->manipulate($query);
160  }
$query
+ Here is the call graph for this function:

◆ getParentId()

ilDidacticTemplateFilterPattern::getParentId ( )

Definition at line 58 of file class.ilDidacticTemplateFilterPattern.php.

References $parent_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getParentType()

ilDidacticTemplateFilterPattern::getParentType ( )

Definition at line 68 of file class.ilDidacticTemplateFilterPattern.php.

References $parent_type.

Referenced by save(), and update().

68  : string
69  {
70  return $this->parent_type;
71  }
+ Here is the caller graph for this function:

◆ getPattern()

ilDidacticTemplateFilterPattern::getPattern ( )

◆ getPatternId()

ilDidacticTemplateFilterPattern::getPatternId ( )

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

References $pattern_id.

Referenced by __construct(), delete(), read(), save(), and update().

+ Here is the caller graph for this function:

◆ getPatternSubType()

◆ getPatternType()

ilDidacticTemplateFilterPattern::getPatternType ( )

Definition at line 78 of file class.ilDidacticTemplateFilterPattern.php.

References $pattern_type.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ read()

ilDidacticTemplateFilterPattern::read ( )
protected

Read pattern definition from db.

Returns
void

Definition at line 172 of file class.ilDidacticTemplateFilterPattern.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, getPatternId(), setPattern(), setPatternSubType(), and setPatternType().

Referenced by __construct().

172  : void
173  {
174  $query = 'SELECT * FROM didactic_tpl_fp ' .
175  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
176  $res = $this->db->query($query);
177  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
178  $this->setPatternType((int) $row->pattern_type);
179  $this->setPatternSubType((int) $row->pattern_sub_type);
180  $this->setPattern($row->pattern);
181  }
182  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDidacticTemplateFilterPattern::save ( )

Create new pattern Returns new pattern id.

Returns
int

Definition at line 138 of file class.ilDidacticTemplateFilterPattern.php.

References $query, getParentId(), getParentType(), getPattern(), getPatternId(), getPatternSubType(), getPatternType(), and setPatternId().

138  : int
139  {
140  $this->setPatternId($this->db->nextId('didactic_tpl_fp'));
141  $query = 'INSERT INTO didactic_tpl_fp (pattern_id,pattern_type,pattern_sub_type,pattern,parent_id,parent_type) ' .
142  'VALUES ( ' .
143  $this->db->quote($this->getPatternId(), 'integer') . ', ' .
144  $this->db->quote($this->getPatternType(), 'integer') . ', ' .
145  $this->db->quote($this->getPatternSubType(), 'integer') . ', ' .
146  $this->db->quote($this->getPattern(), 'text') . ', ' .
147  $this->db->quote($this->getParentId(), 'integer') . ', ' .
148  $this->db->quote($this->getParentType(), 'text') . ' ' .
149  ')';
150  $this->db->manipulate($query);
151 
152  return $this->getPatternId();
153  }
$query
+ Here is the call graph for this function:

◆ setParentId()

ilDidacticTemplateFilterPattern::setParentId ( int  $a_id)

Definition at line 53 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by __clone().

53  : void
54  {
55  $this->parent_id = $a_id;
56  }
+ Here is the caller graph for this function:

◆ setParentType()

ilDidacticTemplateFilterPattern::setParentType ( string  $a_type)

Definition at line 63 of file class.ilDidacticTemplateFilterPattern.php.

63  : void
64  {
65  $this->parent_type = $a_type;
66  }

◆ setPattern()

ilDidacticTemplateFilterPattern::setPattern ( string  $a_pattern)

Definition at line 93 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by read().

93  : void
94  {
95  $this->pattern = $a_pattern;
96  }
+ Here is the caller graph for this function:

◆ setPatternId()

ilDidacticTemplateFilterPattern::setPatternId ( int  $a_id)

Definition at line 43 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by __clone(), __construct(), and save().

43  : void
44  {
45  $this->pattern_id = $a_id;
46  }
+ Here is the caller graph for this function:

◆ setPatternSubType()

ilDidacticTemplateFilterPattern::setPatternSubType ( int  $a_subtype)

Definition at line 83 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by read().

83  : void
84  {
85  $this->pattern_sub_type = $a_subtype;
86  }
+ Here is the caller graph for this function:

◆ setPatternType()

ilDidacticTemplateFilterPattern::setPatternType ( int  $a_type)

Definition at line 73 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by ilDidacticTemplateExcludeFilterPattern\__construct(), ilDidacticTemplateIncludeFilterPattern\__construct(), and read().

73  : void
74  {
75  $this->pattern_type = $a_type;
76  }
+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateFilterPattern::toXml ( ilXmlWriter  $writer)
abstract

Get xml representation of pattern.

Parameters
ilXmlWriter$writer
Returns
string

Referenced by getPattern().

+ Here is the caller graph for this function:

◆ update()

ilDidacticTemplateFilterPattern::update ( )

Update pattern definition.

Definition at line 120 of file class.ilDidacticTemplateFilterPattern.php.

References $query, $res, getParentId(), getParentType(), getPattern(), getPatternId(), getPatternSubType(), and getPatternType().

120  : void
121  {
122  $query = 'UPDATE didactic_tpl_fp ' .
123  'SET ' .
124  'pattern_type = ' . $this->db->quote($this->getPatternType(), 'integer') . ', ' .
125  'pattern_sub_type = ' . $this->db->quote($this->getPatternSubType(), 'integer') . ' ' .
126  'pattern = ' . $this->db->quote($this->getPattern(), 'text') . ' ' .
127  'parent_id = ' . $this->db->quote($this->getParentId(), 'integer') . ', ' .
128  'parent_type = ' . $this->db->quote($this->getParentType(), 'text') . ', ' .
129  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
130  $res = $this->db->manipulate($query);
131  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ valid()

ilDidacticTemplateFilterPattern::valid ( string  $a_source)
abstract

Check if pattern matches.

Parameters
mixed
Returns
bool

Referenced by getPattern().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilDidacticTemplateFilterPattern::$db
protected

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

◆ $logger

ilLogger ilDidacticTemplateFilterPattern::$logger
protected

Definition at line 28 of file class.ilDidacticTemplateFilterPattern.php.

◆ $parent_id

int ilDidacticTemplateFilterPattern::$parent_id = 0
private

Definition at line 20 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by getParentId().

◆ $parent_type

string ilDidacticTemplateFilterPattern::$parent_type = ''
private

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

Referenced by getParentType().

◆ $pattern

string ilDidacticTemplateFilterPattern::$pattern = ''
private

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

Referenced by getPattern().

◆ $pattern_id

int ilDidacticTemplateFilterPattern::$pattern_id = 0
private

Definition at line 18 of file class.ilDidacticTemplateFilterPattern.php.

Referenced by getPatternId().

◆ $pattern_sub_type

int ilDidacticTemplateFilterPattern::$pattern_sub_type = 0
private

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

Referenced by getPatternSubType().

◆ $pattern_type

int ilDidacticTemplateFilterPattern::$pattern_type = 0
private

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

Referenced by getPatternType().

◆ PATTERN_EXCLUDE

const ilDidacticTemplateFilterPattern::PATTERN_EXCLUDE = 2

◆ PATTERN_INCLUDE

const ilDidacticTemplateFilterPattern::PATTERN_INCLUDE = 1

◆ PATTERN_SUBTYPE_REGEX


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