ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 @global ilDB $ilDB. More...
 
 delete ()
 Delete pattern @global 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

Reimplemented in ilDidacticTemplateExcludeFilterPattern, and ilDidacticTemplateIncludeFilterPattern.

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

33 {
34 $this->setPatternId($a_pattern_id);
35 if ($this->getPatternId()) {
36 $this->read();
37 }
38 }

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateFilterPattern::__clone ( )

Magic clone method.

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

232 {
233 $this->setParentId(0);
234 $this->setPatternId(0);
235 }

References setParentId(), and setPatternId().

+ Here is the call graph for this function:

◆ delete()

ilDidacticTemplateFilterPattern::delete ( )

Delete pattern @global ilDB $ilDB.

Returns
bool

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

217 {
218 global $DIC;
219
220 $ilDB = $DIC['ilDB'];
221
222 $query = 'DELETE FROM didactic_tpl_fp ' .
223 'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
224 $ilDB->manipulate($query);
225 return true;
226 }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

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

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

144 {
145 return $this->pattern;
146 }

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

+ 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 242 of file class.ilDidacticTemplateFilterPattern.php.

243 {
244 global $DIC;
245
246 $ilDB = $DIC['ilDB'];
247
248 $query = 'SELECT * FROM didactic_tpl_fp ' .
249 'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
250 $res = $ilDB->query($query);
251 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
252 $this->setPatternType($row->pattern_type);
253 $this->setPatternSubType($row->pattern_sub_type);
254 $this->setPattern($row->pattern);
255 }
256 }
foreach($_POST as $key=> $value) $res

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDidacticTemplateFilterPattern::save ( )

Create new pattern @global ilDB $ilDB.

Returns
int

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

192 {
193 global $DIC;
194
195 $ilDB = $DIC['ilDB'];
196
197 $this->setPatternId($ilDB->nextId('didactic_tpl_fp'));
198 $query = 'INSERT INTO didactic_tpl_fp (pattern_id,pattern_type,pattern_sub_type,pattern,parent_id,parent_type) ' .
199 'VALUES ( ' .
200 $ilDB->quote($this->getPatternId(), 'integer') . ', ' .
201 $ilDB->quote($this->getPatterType(), 'integer') . ', ' .
202 $ilDB->quote($this->getPatternSubType(), 'integer') . ', ' .
203 $ilDB->quote($this->getPattern(), 'text') . ', ' .
204 $ilDB->quote($this->getParentId(), 'integer') . ', ' .
205 $ilDB->quote($this->getParentType(), 'text') . ' ' .
206 ')';
207 $ilDB->manipulate($query);
208 return $this->getPatternId();
209 }

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

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

63 {
64 $this->parent_id = $a_id;
65 }

Referenced by __clone().

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

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

References $a_type.

◆ setPattern()

ilDidacticTemplateFilterPattern::setPattern (   $a_pattern)

Set pattern.

Parameters
string$a_pattern

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

135 {
136 $this->pattern = $a_pattern;
137 }

Referenced by read().

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

45 {
46 $this->pattern_id = $a_id;
47 }

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

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

117 {
118 $this->pattern_sub_type = $a_subtype;
119 }

Referenced by read().

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

99 {
100 $this->pattern_type = $a_type;
101 }

References $a_type.

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

+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateFilterPattern::toXml ( ilXmlWriter  $writer)
abstract

Get xml representation of pattern.

Parameters
ilXmlWriter$writer
Returns
void

Reimplemented in ilDidacticTemplateExcludeFilterPattern, and ilDidacticTemplateIncludeFilterPattern.

◆ update()

ilDidacticTemplateFilterPattern::update ( )

Update pattern definition.

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

169 {
170 global $DIC;
171
172 $ilDB = $DIC['ilDB'];
173
174 $query = 'UPDATE didactic_tpl_fp ' .
175 'SET ' .
176 'pattern_type = ' . $ilDB->quote($this->getPatterType(), 'integer') . ', ' .
177 'pattern_sub_type = ' . $ilDB->quote($this->getPatternSubType(), 'integer') . ' ' .
178 'pattern = ' . $ilDB->quote($this->getPattern(), 'text') . ' ' .
179 'parent_id = ' . $ilDB->quote($this->getParentId(), 'integer') . ', ' .
180 'parent_type = ' . $ilDB->quote($this->getParentType(), 'text') . ', ' .
181 'WHERE pattern_id = ' . $ilDB->quote($this->getPatternId(), 'integer');
182 $res = $ilDB->manipulate($query);
183 return;
184 }

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

+ Here is the call graph for this function:

◆ valid()

ilDidacticTemplateFilterPattern::valid (   $a_source)
abstract

Check if pattern matches.

Parameters
mixed
Returns
bool

Reimplemented in ilDidacticTemplateExcludeFilterPattern, and ilDidacticTemplateIncludeFilterPattern.

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


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