ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 25 of file class.ilDidacticTemplateFilterPattern.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateFilterPattern::__construct ( int  $a_pattern_id = 0)

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

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

45  {
46  global $DIC;
47 
48  $this->db = $DIC->database();
49  $this->logger = $DIC->logger()->otpl();
50 
51  $this->setPatternId($a_pattern_id);
52  if ($this->getPatternId()) {
53  $this->read();
54  }
55  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateFilterPattern::__clone ( )

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

References setParentId(), and setPatternId().

+ Here is the call graph for this function:

◆ delete()

ilDidacticTemplateFilterPattern::delete ( )

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

References getPatternId().

169  : void
170  {
171  $query = 'DELETE FROM didactic_tpl_fp ' .
172  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
173  $this->db->manipulate($query);
174  }
+ Here is the call graph for this function:

◆ getParentId()

ilDidacticTemplateFilterPattern::getParentId ( )

Definition at line 72 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 82 of file class.ilDidacticTemplateFilterPattern.php.

References $parent_type.

Referenced by save(), and update().

82  : string
83  {
84  return $this->parent_type;
85  }
+ Here is the caller graph for this function:

◆ getPattern()

ilDidacticTemplateFilterPattern::getPattern ( )

◆ getPatternId()

ilDidacticTemplateFilterPattern::getPatternId ( )

Definition at line 62 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 92 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 186 of file class.ilDidacticTemplateFilterPattern.php.

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

Referenced by __construct().

186  : void
187  {
188  $query = 'SELECT * FROM didactic_tpl_fp ' .
189  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
190  $res = $this->db->query($query);
191  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
192  $this->setPatternType((int) $row->pattern_type);
193  $this->setPatternSubType((int) $row->pattern_sub_type);
194  $this->setPattern($row->pattern);
195  }
196  }
$res
Definition: ltiservices.php:66
+ 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 152 of file class.ilDidacticTemplateFilterPattern.php.

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

152  : int
153  {
154  $this->setPatternId($this->db->nextId('didactic_tpl_fp'));
155  $query = 'INSERT INTO didactic_tpl_fp (pattern_id,pattern_type,pattern_sub_type,pattern,parent_id,parent_type) ' .
156  'VALUES ( ' .
157  $this->db->quote($this->getPatternId(), 'integer') . ', ' .
158  $this->db->quote($this->getPatternType(), 'integer') . ', ' .
159  $this->db->quote($this->getPatternSubType(), 'integer') . ', ' .
160  $this->db->quote($this->getPattern(), 'text') . ', ' .
161  $this->db->quote($this->getParentId(), 'integer') . ', ' .
162  $this->db->quote($this->getParentType(), 'text') . ' ' .
163  ')';
164  $this->db->manipulate($query);
165 
166  return $this->getPatternId();
167  }
+ Here is the call graph for this function:

◆ setParentId()

ilDidacticTemplateFilterPattern::setParentId ( int  $a_id)

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

Referenced by __clone().

67  : void
68  {
69  $this->parent_id = $a_id;
70  }
+ Here is the caller graph for this function:

◆ setParentType()

ilDidacticTemplateFilterPattern::setParentType ( string  $a_type)

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

77  : void
78  {
79  $this->parent_type = $a_type;
80  }

◆ setPattern()

ilDidacticTemplateFilterPattern::setPattern ( string  $a_pattern)

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

Referenced by read().

107  : void
108  {
109  $this->pattern = $a_pattern;
110  }
+ Here is the caller graph for this function:

◆ setPatternId()

ilDidacticTemplateFilterPattern::setPatternId ( int  $a_id)

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

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

57  : void
58  {
59  $this->pattern_id = $a_id;
60  }
+ Here is the caller graph for this function:

◆ setPatternSubType()

ilDidacticTemplateFilterPattern::setPatternSubType ( int  $a_subtype)

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

Referenced by read().

97  : void
98  {
99  $this->pattern_sub_type = $a_subtype;
100  }
+ Here is the caller graph for this function:

◆ setPatternType()

ilDidacticTemplateFilterPattern::setPatternType ( int  $a_type)

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

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

87  : void
88  {
89  $this->pattern_type = $a_type;
90  }
+ 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 134 of file class.ilDidacticTemplateFilterPattern.php.

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

134  : void
135  {
136  $query = 'UPDATE didactic_tpl_fp ' .
137  'SET ' .
138  'pattern_type = ' . $this->db->quote($this->getPatternType(), 'integer') . ', ' .
139  'pattern_sub_type = ' . $this->db->quote($this->getPatternSubType(), 'integer') . ' ' .
140  'pattern = ' . $this->db->quote($this->getPattern(), 'text') . ' ' .
141  'parent_id = ' . $this->db->quote($this->getParentId(), 'integer') . ', ' .
142  'parent_type = ' . $this->db->quote($this->getParentType(), 'text') . ', ' .
143  'WHERE pattern_id = ' . $this->db->quote($this->getPatternId(), 'integer');
144  $res = $this->db->manipulate($query);
145  }
$res
Definition: ltiservices.php:66
+ 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 41 of file class.ilDidacticTemplateFilterPattern.php.

◆ $logger

ilLogger ilDidacticTemplateFilterPattern::$logger
protected

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

◆ $parent_id

int ilDidacticTemplateFilterPattern::$parent_id = 0
private

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

Referenced by getParentId().

◆ $parent_type

string ilDidacticTemplateFilterPattern::$parent_type = ''
private

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

Referenced by getParentType().

◆ $pattern

string ilDidacticTemplateFilterPattern::$pattern = ''
private

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

Referenced by getPattern().

◆ $pattern_id

int ilDidacticTemplateFilterPattern::$pattern_id = 0
private

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

Referenced by getPatternId().

◆ $pattern_sub_type

int ilDidacticTemplateFilterPattern::$pattern_sub_type = 0
private

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

Referenced by getPatternSubType().

◆ $pattern_type

int ilDidacticTemplateFilterPattern::$pattern_type = 0
private

Definition at line 38 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: