ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDidacticTemplateFilterPattern Class Reference

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

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

Public Member Functions

 __construct ($a_pattern_id=0)
 Constructor. More...
 
 setPatternId ($a_id)
 set pattern id More...
 
 getPatternId ()
 Get pattern id. More...
 
 setParentId ($a_id)
 Set parent id. More...
 
 getParentId ()
 Get parent id. More...
 
 setParentType ($a_type)
 Set parent type. More...
 
 getParentType ()
 Get parent type. More...
 
 setPatternType ($a_type)
 Set pattern type. More...
 
 getPatterType ()
 Get pattern type. More...
 
 setPatternSubType ($a_subtype)
 Set pattern sub type. More...
 
 getPatternSubType ()
 Get pattern sub type. More...
 
 setPattern ($a_pattern)
 Set pattern. More...
 
 getPattern ()
 Get pattern. More...
 
 valid ($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 ilDB $ilDB. More...
 
 delete ()
 Delete pattern ilDB $ilDB. More...
 
 __clone ()
 Magic clone method. More...
 

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...
 

Private Attributes

 $pattern_id = 0
 
 $parent_id = 0
 
 $parent_type = ''
 
 $pattern_type = 0
 
 $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 (   $a_pattern_id = 0)

Constructor.

Parameters
int$a_pattern_id

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

References getPatternId(), read(), and setPatternId().

33  {
34  $this->setPatternId($a_pattern_id);
35  if ($this->getPatternId()) {
36  $this->read();
37  }
38  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateFilterPattern::__clone ( )

Magic clone method.

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

References setParentId(), and setPatternId().

226  {
227  $this->setParentId(0);
228  $this->setPatternId(0);
229  }
+ Here is the call graph for this function:

◆ delete()

ilDidacticTemplateFilterPattern::delete ( )

Delete pattern ilDB $ilDB.

Returns
bool

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

References $ilDB, $query, and getPatternId().

213  {
214  global $ilDB;
215 
216  $query = 'DELETE FROM didactic_tpl_fp ' .
217  'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
218  $ilDB->manipulate($query);
219  return true;
220  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ getParentId()

ilDidacticTemplateFilterPattern::getParentId ( )

Get parent id.

Returns
int

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

References $parent_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getParentType()

ilDidacticTemplateFilterPattern::getParentType ( )

Get parent type.

Returns
string

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

References $parent_type.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getPattern()

ilDidacticTemplateFilterPattern::getPattern ( )

Get pattern.

Returns
string

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

References toXml(), and valid().

Referenced by save(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilDidacticTemplateIncludeFilterPattern\toXml(), update(), ilDidacticTemplateExcludeFilterPattern\valid(), and ilDidacticTemplateIncludeFilterPattern\valid().

144  {
145  return $this->pattern;
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPatternId()

ilDidacticTemplateFilterPattern::getPatternId ( )

Get pattern id.

Returns
int

Definition at line 53 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()

ilDidacticTemplateFilterPattern::getPatternSubType ( )

◆ getPatterType()

ilDidacticTemplateFilterPattern::getPatterType ( )

Get pattern type.

Returns
int

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

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

Referenced by __construct().

237  {
238  global $ilDB;
239 
240  $query = 'SELECT * FROM didactic_tpl_fp ' .
241  'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
242  $res = $ilDB->query($query);
243  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
244  $this->setPatternType($row->pattern_type);
245  $this->setPatternSubType($row->pattern_sub_type);
246  $this->setPattern($row->pattern);
247  }
248  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
setPatternSubType($a_subtype)
Set pattern sub type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDidacticTemplateFilterPattern::save ( )

Create new pattern ilDB $ilDB.

Returns
int

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

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

190  {
191  global $ilDB;
192 
193  $this->setPatternId($ilDB->nextId('didactic_tpl_fp'));
194  $query = 'INSERT INTO didactic_tpl_fp (pattern_id,pattern_type,pattern_sub_type,pattern,parent_id,parent_type) ' .
195  'VALUES ( ' .
196  $ilDB->quote($this->getPatternId(), 'integer') . ', ' .
197  $ilDB->quote($this->getPatterType(), 'integer') . ', ' .
198  $ilDB->quote($this->getPatternSubType(), 'integer') . ', ' .
199  $ilDB->quote($this->getPattern(), 'text') . ', ' .
200  $ilDB->quote($this->getParentId(), 'integer') . ', ' .
201  $ilDB->quote($this->getParentType(), 'text') . ' ' .
202  ')';
203  $ilDB->manipulate($query);
204  return $this->getPatternId();
205  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ setParentId()

ilDidacticTemplateFilterPattern::setParentId (   $a_id)

Set parent id.

Parameters
int$a_id

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

Referenced by __clone().

63  {
64  $this->parent_id = $a_id;
65  }
+ Here is the caller graph for this function:

◆ setParentType()

ilDidacticTemplateFilterPattern::setParentType (   $a_type)

Set parent type.

Parameters
string$a_type

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

References $a_type.

81  {
82  $this->parent_type = $a_type;
83  }
$a_type
Definition: workflow.php:92

◆ setPattern()

ilDidacticTemplateFilterPattern::setPattern (   $a_pattern)

Set pattern.

Parameters
string$a_pattern

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

Referenced by read().

135  {
136  $this->pattern = $a_pattern;
137  }
+ Here is the caller graph for this function:

◆ setPatternId()

ilDidacticTemplateFilterPattern::setPatternId (   $a_id)

set pattern id

Parameters
int$a_id

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

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

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

◆ setPatternSubType()

ilDidacticTemplateFilterPattern::setPatternSubType (   $a_subtype)

Set pattern sub type.

Parameters
int$a_subtype

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

Referenced by read().

117  {
118  $this->pattern_sub_type = $a_subtype;
119  }
+ Here is the caller graph for this function:

◆ setPatternType()

ilDidacticTemplateFilterPattern::setPatternType (   $a_type)

Set pattern type.

Parameters
int$a_type

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

References $a_type.

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

99  {
100  $this->pattern_type = $a_type;
101  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateFilterPattern::toXml ( ilXmlWriter  $writer)
abstract

Get xml representation of pattern.

Parameters
ilXmlWriter$writer
Returns
void

Referenced by getPattern().

+ Here is the caller graph for this function:

◆ update()

ilDidacticTemplateFilterPattern::update ( )

Update pattern definition.

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

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

169  {
170  global $ilDB;
171 
172  $query = 'UPDATE didactic_tpl_fp ' .
173  'SET ' .
174  'pattern_type = ' . $ilDB->quote($this->getPatterType(), 'integer') . ', ' .
175  'pattern_sub_type = ' . $ilDB->quote($this->getPatternSubType(), 'integer') . ' ' .
176  'pattern = ' . $ilDB->quote($this->getPattern(), 'text') . ' ' .
177  'parent_id = ' . $ilDB->quote($this->getParentId(), 'integer') . ', ' .
178  'parent_type = ' . $ilDB->quote($this->getParentType(), 'text') . ', ' .
179  'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
180  $res = $ilDB->manipulate($query);
181  return void;
182  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ valid()

ilDidacticTemplateFilterPattern::valid (   $a_source)
abstract

Check if pattern matches.

Parameters
mixed
Returns
bool

Referenced by getPattern().

+ Here is the caller graph for this function:

Field Documentation

◆ $parent_id

ilDidacticTemplateFilterPattern::$parent_id = 0
private

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

Referenced by getParentId().

◆ $parent_type

ilDidacticTemplateFilterPattern::$parent_type = ''
private

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

Referenced by getParentType().

◆ $pattern_id

ilDidacticTemplateFilterPattern::$pattern_id = 0
private

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

Referenced by getPatternId().

◆ $pattern_sub_type

ilDidacticTemplateFilterPattern::$pattern_sub_type = 0
private

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

Referenced by getPatternSubType().

◆ $pattern_type

ilDidacticTemplateFilterPattern::$pattern_type = 0
private

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

Referenced by getPatterType().

◆ PATTERN_EXCLUDE

const ilDidacticTemplateFilterPattern::PATTERN_EXCLUDE = 2

◆ PATTERN_INCLUDE

const ilDidacticTemplateFilterPattern::PATTERN_INCLUDE = 1

◆ PATTERN_SUBTYPE_REGEX

const ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX = 1

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