ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilECSCourseMappingRule Class Reference

Description of class. More...

+ Collaboration diagram for ilECSCourseMappingRule:

Public Member Functions

 __construct ($a_rid=0)
 Constructor. More...
 
 doMapping ($course, $parent_ref)
 Do mapping. More...
 
 matches ($course)
 Check if rule matches. More...
 
 setRuleId ($a_rule_id)
 
 getRuleId ()
 
 setServerId ($a_server_id)
 
 getServerId ()
 
 setMid ($a_mid)
 
 getMid ()
 
 setAttribute ($a_att)
 
 getAttribute ()
 
 setRefId ($a_ref_id)
 
 getRefId ()
 
 enableFilter ($a_status)
 
 isFilterEnabled ()
 
 setFilter ($a_filter)
 
 getFilter ()
 
 getFilterElements ()
 
 enableSubdirCreation ($a_stat)
 
 isSubdirCreationEnabled ()
 
 setSubDirectoryType ($a_type)
 
 getSubDirectoryType ()
 
 setDirectory ($a_dir)
 
 getDirectory ()
 
 delete ()
 
 save ()
 Save a new rule type $ilDB. More...
 
 update ()
 Update mapping rule type $ilDB. More...
 

Static Public Member Functions

static lookupLastExistingAttribute ($a_sid, $a_mid, $a_ref_id)
 Lookup existing attributes. More...
 
static getRuleRefIds ($a_sid, $a_mid)
 
static getRulesOfRefId ($a_sid, $a_mid, $a_ref_id)
 Get all rule of ref_id type $ilDB. More...
 
static hasRules ($a_sid, $a_mid, $a_ref_id)
 
static isMatching ($course, $a_sid, $a_mid, $a_ref_id)
 Check if rule matches. More...
 
static doMappings ($course, $a_sid, $a_mid, $a_ref_id)
 
static getInstanceByAttribute ($a_sid, $a_mid, $a_ref_id, $a_att)
 Get rule instance by attribute type $ilDB. More...
 

Data Fields

const SUBDIR_ATTRIBUTE_NAME = 1
 
const SUBDIR_VALUE = 2
 

Protected Member Functions

 createCategory ($a_title, $a_parent_ref)
 Create attribute category. More...
 
 read ()
 Read db entries. More...
 
 parseFilter ()
 Parse filter. More...
 

Private Attributes

 $rid
 
 $sid
 
 $mid
 
 $attribute
 
 $ref_id
 
 $is_filter = false
 
 $filter
 
 $filter_elements = []
 
 $create_subdir = true
 
 $subdir_type = self::SUBDIR_VALUE
 
 $directory = ''
 
 $logger = null
 

Detailed Description

Description of class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 10 of file class.ilECSCourseMappingRule.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSCourseMappingRule::__construct (   $a_rid = 0)

Constructor.

Parameters
int$a_rid

Definition at line 36 of file class.ilECSCourseMappingRule.php.

References $GLOBALS, and read().

37  {
38  $this->logger = $GLOBALS['DIC']->logger()->wsrv();
39  $this->rid = $a_rid;
40  $this->read();
41  }
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

Member Function Documentation

◆ createCategory()

ilECSCourseMappingRule::createCategory (   $a_title,
  $a_parent_ref 
)
protected

Create attribute category.

Returns
int $ref_id;

Definition at line 263 of file class.ilECSCourseMappingRule.php.

References $GLOBALS.

Referenced by doMapping().

264  {
265  // Create category
266  include_once './Modules/Category/classes/class.ilObjCategory.php';
267  $cat = new ilObjCategory();
268  $cat->setOwner(SYSTEM_USER_ID);
269  $cat->setTitle($a_title);
270  $cat->create();
271  $cat->createReference();
272  $cat->putInTree($a_parent_ref);
273  $cat->setPermissions($a_parent_ref);
274  $cat->deleteTranslation($GLOBALS['DIC']['lng']->getDefaultLanguage());
275  $cat->addTranslation(
276  $a_title,
277  $cat->getLongDescription(),
278  $GLOBALS['DIC']['lng']->getDefaultLanguage(),
279  1
280  );
281  return $cat->getRefId();
282  }
Class ilObjCategory.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the caller graph for this function:

◆ delete()

ilECSCourseMappingRule::delete ( )

Definition at line 447 of file class.ilECSCourseMappingRule.php.

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

448  {
449  global $DIC;
450 
451  $ilDB = $DIC['ilDB'];
452 
453  $query = 'DELETE from ecs_cmap_rule ' .
454  'WHERE rid = ' . $ilDB->quote($this->getRuleId(), 'integer');
455  $ilDB->manipulate($query);
456  return true;
457  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

◆ doMapping()

ilECSCourseMappingRule::doMapping (   $course,
  $parent_ref 
)

Do mapping.

Parameters
type$course
type$parent_ref

Definition at line 229 of file class.ilECSCourseMappingRule.php.

References $DIC, $tree, $values, createCategory(), getAttribute(), ilECSMappingUtils\getCourseValueByMappingAttribute(), and isSubdirCreationEnabled().

230  {
231  global $DIC;
232 
233  $tree = $DIC['tree'];
234 
235  if (!$this->isSubdirCreationEnabled()) {
236  return array();
237  }
238  include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
240 
241  $childs = $tree->getChildsByType($parent_ref, 'cat');
242  foreach ($values as $value) {
243  $found = false;
244  foreach ((array) $childs as $child) {
245  // category already created
246  if (strcmp($child['title'], $value) === 0) {
247  $found = true;
248  $category_references[] = $child['child'];
249  break;
250  }
251  }
252  if (!$found) {
253  $category_references[] = $this->createCategory($value, $parent_ref);
254  }
255  }
256  return (array) $category_references;
257  }
createCategory($a_title, $a_parent_ref)
Create attribute category.
global $DIC
Definition: saml.php:7
static getCourseValueByMappingAttribute($course, $a_field)
Get course value by mapping.
$values
+ Here is the call graph for this function:

◆ doMappings()

static ilECSCourseMappingRule::doMappings (   $course,
  $a_sid,
  $a_mid,
  $a_ref_id 
)
static
Parameters
type$course
type$a_sid
type$a_mid
type$a_ref_id
Returns
array

Definition at line 185 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, $res, $row, $rule, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCourseCreationHandler\doAttributeMapping().

186  {
187  global $DIC;
188 
189  $ilDB = $DIC['ilDB'];
190 
191  $query = 'SELECT rid FROM ecs_cmap_rule ' .
192  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
193  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
194  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer') . ' ' .
195  'ORDER BY rid';
196  $res = $ilDB->query($query);
197 
198  $level = 1;
199  $last_level_category = array();
200  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
201  $rule = new ilECSCourseMappingRule($row->rid);
202  if ($level == 1) {
203  $last_level_category[] = $rule->getRefId();
204  }
205 
206  $found_new_level = false;
207  $new_level_cats = array();
208  foreach ((array) $last_level_category as $cat_ref_id) {
209  $refs = $rule->doMapping($course, $cat_ref_id);
210  foreach ($refs as $new_ref_id) {
211  $found_new_level = true;
212  $new_level_cats[] = $new_ref_id;
213  }
214  }
215  if ($found_new_level) {
216  $last_level_category = $new_level_cats;
217  }
218  $level++;
219  }
220 
221  return (array) $last_level_category;
222  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$rule
Definition: showstats.php:43
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ enableFilter()

ilECSCourseMappingRule::enableFilter (   $a_status)

Definition at line 392 of file class.ilECSCourseMappingRule.php.

Referenced by read().

393  {
394  $this->is_filter = $a_status;
395  }
+ Here is the caller graph for this function:

◆ enableSubdirCreation()

ilECSCourseMappingRule::enableSubdirCreation (   $a_stat)

Definition at line 417 of file class.ilECSCourseMappingRule.php.

Referenced by read().

418  {
419  $this->create_subdir = $a_stat;
420  }
+ Here is the caller graph for this function:

◆ getAttribute()

ilECSCourseMappingRule::getAttribute ( )

Definition at line 377 of file class.ilECSCourseMappingRule.php.

References $attribute.

Referenced by doMapping(), matches(), save(), and update().

+ Here is the caller graph for this function:

◆ getDirectory()

ilECSCourseMappingRule::getDirectory ( )

Definition at line 442 of file class.ilECSCourseMappingRule.php.

References $directory.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getFilter()

ilECSCourseMappingRule::getFilter ( )

Definition at line 407 of file class.ilECSCourseMappingRule.php.

References $filter.

Referenced by parseFilter(), save(), and update().

+ Here is the caller graph for this function:

◆ getFilterElements()

ilECSCourseMappingRule::getFilterElements ( )

Definition at line 412 of file class.ilECSCourseMappingRule.php.

References $filter_elements.

Referenced by matches().

413  {
414  return (array) $this->filter_elements;
415  }
+ Here is the caller graph for this function:

◆ getInstanceByAttribute()

static ilECSCourseMappingRule::getInstanceByAttribute (   $a_sid,
  $a_mid,
  $a_ref_id,
  $a_att 
)
static

Get rule instance by attribute type $ilDB.

Parameters
type$a_sid
type$a_mid
type$a_ref_id
type$a_att
Returns

Definition at line 323 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSMappingSettingsGUI\cInitMappingForm(), and ilECSMappingSettingsGUI\cSaveOverview().

324  {
325  global $DIC;
326 
327  $ilDB = $DIC['ilDB'];
328 
329  $query = 'SELECT rid FROM ecs_cmap_rule ' .
330  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
331  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
332  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer') . ' ' .
333  'AND attribute = ' . $ilDB->quote($a_att, 'text');
334 
335  $res = $ilDB->query($query);
336  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
337  return new ilECSCourseMappingRule($row->rid);
338  }
339  return new ilECSCourseMappingRule();
340  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getMid()

ilECSCourseMappingRule::getMid ( )

Definition at line 367 of file class.ilECSCourseMappingRule.php.

References $mid.

Referenced by save().

368  {
369  return $this->mid;
370  }
+ Here is the caller graph for this function:

◆ getRefId()

ilECSCourseMappingRule::getRefId ( )

Definition at line 387 of file class.ilECSCourseMappingRule.php.

References $ref_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getRuleId()

ilECSCourseMappingRule::getRuleId ( )

Definition at line 347 of file class.ilECSCourseMappingRule.php.

References $rid.

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

348  {
349  return $this->rid;
350  }
+ Here is the caller graph for this function:

◆ getRuleRefIds()

static ilECSCourseMappingRule::getRuleRefIds (   $a_sid,
  $a_mid 
)
static
Parameters
type$a_sid
type$a_mid

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

References $DIC, $GLOBALS, $ilDB, $query, $ref_id, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCourseCreationHandler\doAttributeMapping(), and ilECSNodeMappingLocalExplorer\initMappings().

74  {
75  global $DIC;
76 
77  $ilDB = $DIC['ilDB'];
78 
79  $query = 'SELECT DISTINCT(ref_id) ref_id, rid FROM ecs_cmap_rule ' .
80  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
81  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
82  'GROUP BY ref_id' . ' ' .
83  'ORDER BY rid';
84 
85  $res = $ilDB->query($query);
86  $ref_ids = array();
87  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
88  $ref_ids[] = $row->ref_id;
89  }
90  // check if ref_ids are in tree
91  $checked_ref_ids = [];
92  foreach ($ref_ids as $ref_id) {
93  if (
94  $GLOBALS['DIC']->repositoryTree()->isInTree($ref_id)) {
95  $checked_ref_ids[] = $ref_id;
96  }
97  }
98  return $checked_ref_ids;
99  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the caller graph for this function:

◆ getRulesOfRefId()

static ilECSCourseMappingRule::getRulesOfRefId (   $a_sid,
  $a_mid,
  $a_ref_id 
)
static

Get all rule of ref_id type $ilDB.

Parameters
type$a_sid
type$a_mid
type$a_ref_id
Returns
int[]

Definition at line 109 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSMappingSettingsGUI\cDeleteRulesOfNode().

110  {
111  global $DIC;
112 
113  $ilDB = $DIC['ilDB'];
114 
115  $query = 'SELECT rid FROM ecs_cmap_rule ' .
116  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
117  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
118  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer');
119  $res = $ilDB->query($query);
120  $rids = array();
121  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
122  $rids = $row->rid;
123  }
124  return (array) $rids;
125  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getServerId()

ilECSCourseMappingRule::getServerId ( )

Definition at line 357 of file class.ilECSCourseMappingRule.php.

References $sid.

Referenced by save().

358  {
359  return $this->sid;
360  }
+ Here is the caller graph for this function:

◆ getSubDirectoryType()

ilECSCourseMappingRule::getSubDirectoryType ( )

Definition at line 432 of file class.ilECSCourseMappingRule.php.

Referenced by save(), and update().

433  {
434  return self::SUBDIR_VALUE;
435  }
+ Here is the caller graph for this function:

◆ hasRules()

static ilECSCourseMappingRule::hasRules (   $a_sid,
  $a_mid,
  $a_ref_id 
)
static

Definition at line 127 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, and $res.

Referenced by ilECSMappingSettingsGUI\cInitMappingForm().

128  {
129  global $DIC;
130 
131  $ilDB = $DIC['ilDB'];
132 
133  $query = 'SELECT ref_id FROM ecs_cmap_rule ' .
134  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
135  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
136  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer');
137  $res = $ilDB->query($query);
138  return $res->numRows() ? true : false;
139  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ isFilterEnabled()

ilECSCourseMappingRule::isFilterEnabled ( )

Definition at line 397 of file class.ilECSCourseMappingRule.php.

References $is_filter.

Referenced by matches(), save(), and update().

+ Here is the caller graph for this function:

◆ isMatching()

static ilECSCourseMappingRule::isMatching (   $course,
  $a_sid,
  $a_mid,
  $a_ref_id 
)
static

Check if rule matches.

Parameters
type$course
type$a_start_rule_id
Returns
string 0 if not matches; otherwise rule_id_index
See also
matches

Definition at line 147 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, $res, $row, $rule, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCourseCreationHandler\doAttributeMapping().

148  {
149  global $DIC;
150 
151  $ilDB = $DIC['ilDB'];
152 
153  $query = 'SELECT rid FROM ecs_cmap_rule ' .
154  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
155  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
156  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer') . ' ' .
157  'ORDER BY rid';
158  $res = $ilDB->query($query);
159 
160  $does_match = false;
161  $sortable_index = '';
162  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163  $rule = new ilECSCourseMappingRule($row->rid);
164  $matches = $rule->matches($course);
165  if ($matches == -1) {
166  return '0';
167  }
168  $does_match = true;
169  $sortable_index .= str_pad($matches, 4, '0', STR_PAD_LEFT);
170  }
171  if ($does_match) {
172  return $sortable_index;
173  }
174  return "0";
175  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$rule
Definition: showstats.php:43
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ isSubdirCreationEnabled()

ilECSCourseMappingRule::isSubdirCreationEnabled ( )

Definition at line 422 of file class.ilECSCourseMappingRule.php.

References $create_subdir.

Referenced by doMapping(), save(), and update().

+ Here is the caller graph for this function:

◆ lookupLastExistingAttribute()

static ilECSCourseMappingRule::lookupLastExistingAttribute (   $a_sid,
  $a_mid,
  $a_ref_id 
)
static

Lookup existing attributes.

Parameters
type$a_attributes
Returns
array

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

References $attributes, $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSMappingSettingsGUI\cInitOverview().

49  {
50  global $DIC;
51 
52  $ilDB = $DIC['ilDB'];
53 
54  $query = 'SELECT attribute FROM ecs_cmap_rule ' .
55  'WHERE sid = ' . $ilDB->quote($a_sid, 'integer') . ' ' .
56  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
57  'AND ref_id = ' . $ilDB->quote($a_ref_id, 'integer') . ' ' .
58  'ORDER BY rid ';
59  $res = $ilDB->query($query);
60 
61  $attributes = array();
62  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
63  $attributes = $row->attribute;
64  }
65  return $attributes;
66  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
$row
global $ilDB
+ Here is the caller graph for this function:

◆ matches()

ilECSCourseMappingRule::matches (   $course)

Check if rule matches.

Parameters
type$course
Returns
int -1 does not match, 0 matches with disabled filter, >0 matches xth index in course attribute value.

Definition at line 290 of file class.ilECSCourseMappingRule.php.

References $index, $values, getAttribute(), ilECSMappingUtils\getCourseValueByMappingAttribute(), getFilterElements(), and isFilterEnabled().

291  {
292  if ($this->isFilterEnabled()) {
293  include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
295  $this->logger->dump($values);
296  $index = 0;
297  foreach ($values as $value) {
298  $index++;
299  foreach ($this->getFilterElements() as $filter_element) {
300  $this->logger->debug('Comparing ' . $value . ' with ' . $filter_element);
301  if (strcmp(trim($value), trim($filter_element)) === 0) {
302  $this->logger->debug($value . ' matches ' . $filter_element);
303  $this->logger->debug('Found index: ' . $index);
304  return $index;
305  }
306  }
307  }
308  return -1;
309  }
310  return 0;
311  }
static getCourseValueByMappingAttribute($course, $a_field)
Get course value by mapping.
$index
Definition: metadata.php:60
$values
+ Here is the call graph for this function:

◆ parseFilter()

ilECSCourseMappingRule::parseFilter ( )
protected

Parse filter.

Definition at line 545 of file class.ilECSCourseMappingRule.php.

References $filter, $filter_elements, and getFilter().

Referenced by read().

546  {
547  $filter = $this->getFilter();
548  //$this->logger->debug('Original filter: ' . $filter);
549 
550  $escaped_filter = str_replace('\,', '#:#', $filter);
551  //$this->logger->debug('Escaped filter: ' . $escaped_filter);
552 
553  $filter_elements = explode(',', $escaped_filter);
554  foreach ((array) $filter_elements as $filter_element) {
555  $replaced = str_replace('#:#', ',', $filter_element);
556  if (strlen(trim($replaced))) {
557  $this->filter_elements[] = $replaced;
558  }
559  }
560  //$this->logger->dump($this->filter_elements);
561  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilECSCourseMappingRule::read ( )
protected

Read db entries.

Definition at line 515 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, $res, $row, enableFilter(), enableSubdirCreation(), ilDBConstants\FETCHMODE_OBJECT, getRuleId(), parseFilter(), setAttribute(), setDirectory(), setFilter(), setMid(), setRefId(), setServerId(), and setSubDirectoryType().

Referenced by __construct().

516  {
517  global $DIC;
518 
519  $ilDB = $DIC['ilDB'];
520 
521  if (!$this->getRuleId()) {
522  return true;
523  }
524  $query = 'SELECT * from ecs_cmap_rule ' . ' ' .
525  'WHERE rid = ' . $ilDB->quote($this->getRuleId(), 'integer');
526  $res = $ilDB->query($query);
527  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
528  $this->setServerId($row->sid);
529  $this->setMid($row->mid);
530  $this->setRefId($row->ref_id);
531  $this->setAttribute($row->attribute);
532  $this->enableFilter($row->is_filter);
533  $this->setFilter($row->filter);
534  $this->enableSubdirCreation($row->create_subdir);
535  $this->setSubDirectoryType($row->subdir_type);
536  $this->setDirectory($row->directory);
537  }
538 
539  $this->parseFilter();
540  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilECSCourseMappingRule::save ( )

Save a new rule type $ilDB.

Returns
boolean

Definition at line 464 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, getAttribute(), getDirectory(), getFilter(), getMid(), getRefId(), getRuleId(), getServerId(), getSubDirectoryType(), isFilterEnabled(), isSubdirCreationEnabled(), and setRuleId().

465  {
466  global $DIC;
467 
468  $ilDB = $DIC['ilDB'];
469 
470  $this->setRuleId($ilDB->nextId('ecs_cmap_rule'));
471  $query = 'INSERT INTO ecs_cmap_rule ' .
472  '(rid,sid,mid,attribute,ref_id,is_filter,filter,create_subdir,subdir_type,directory) ' .
473  'VALUES (' .
474  $ilDB->quote($this->getRuleId(), 'integer') . ', ' .
475  $ilDB->quote($this->getServerId(), 'integer') . ', ' .
476  $ilDB->quote($this->getMid(), 'integer') . ', ' .
477  $ilDB->quote($this->getAttribute(), 'text') . ', ' .
478  $ilDB->quote($this->getRefId(), 'integer') . ', ' .
479  $ilDB->quote($this->isFilterEnabled(), 'integer') . ', ' .
480  $ilDB->quote($this->getFilter(), 'text') . ', ' .
481  $ilDB->quote($this->isSubdirCreationEnabled(), 'integer') . ', ' .
482  $ilDB->quote($this->getSubDirectoryType(), 'integer') . ', ' .
483  $ilDB->quote($this->getDirectory(), 'text') . ' ' .
484  ')';
485  $ilDB->manipulate($query);
486  return $this->getRuleId();
487  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

◆ setAttribute()

ilECSCourseMappingRule::setAttribute (   $a_att)

Definition at line 372 of file class.ilECSCourseMappingRule.php.

Referenced by read().

373  {
374  $this->attribute = $a_att;
375  }
+ Here is the caller graph for this function:

◆ setDirectory()

ilECSCourseMappingRule::setDirectory (   $a_dir)

Definition at line 437 of file class.ilECSCourseMappingRule.php.

Referenced by read().

438  {
439  $this->directory = $a_dir;
440  }
+ Here is the caller graph for this function:

◆ setFilter()

ilECSCourseMappingRule::setFilter (   $a_filter)

Definition at line 402 of file class.ilECSCourseMappingRule.php.

Referenced by read().

403  {
404  $this->filter = $a_filter;
405  }
+ Here is the caller graph for this function:

◆ setMid()

ilECSCourseMappingRule::setMid (   $a_mid)

Definition at line 362 of file class.ilECSCourseMappingRule.php.

Referenced by read().

363  {
364  $this->mid = $a_mid;
365  }
+ Here is the caller graph for this function:

◆ setRefId()

ilECSCourseMappingRule::setRefId (   $a_ref_id)

Definition at line 382 of file class.ilECSCourseMappingRule.php.

Referenced by read().

383  {
384  $this->ref_id = $a_ref_id;
385  }
+ Here is the caller graph for this function:

◆ setRuleId()

ilECSCourseMappingRule::setRuleId (   $a_rule_id)

Definition at line 342 of file class.ilECSCourseMappingRule.php.

Referenced by save().

343  {
344  $this->rid = $a_rule_id;
345  }
+ Here is the caller graph for this function:

◆ setServerId()

ilECSCourseMappingRule::setServerId (   $a_server_id)

Definition at line 352 of file class.ilECSCourseMappingRule.php.

Referenced by read().

353  {
354  $this->sid = $a_server_id;
355  }
+ Here is the caller graph for this function:

◆ setSubDirectoryType()

ilECSCourseMappingRule::setSubDirectoryType (   $a_type)

Definition at line 427 of file class.ilECSCourseMappingRule.php.

References $a_type.

Referenced by read().

428  {
429  $this->subdir_type = $a_type;
430  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ update()

ilECSCourseMappingRule::update ( )

Update mapping rule type $ilDB.

Definition at line 493 of file class.ilECSCourseMappingRule.php.

References $DIC, $ilDB, $query, getAttribute(), getDirectory(), getFilter(), getRefId(), getRuleId(), getSubDirectoryType(), isFilterEnabled(), and isSubdirCreationEnabled().

494  {
495  global $DIC;
496 
497  $ilDB = $DIC['ilDB'];
498 
499  $query = 'UPDATE ecs_cmap_rule ' . ' ' .
500  'SET ' .
501  'attribute = ' . $ilDB->quote($this->getAttribute(), 'text') . ', ' .
502  'ref_id = ' . $ilDB->quote($this->getRefId(), 'integer') . ', ' .
503  'is_filter = ' . $ilDB->quote($this->isFilterEnabled(), 'integer') . ', ' .
504  'filter = ' . $ilDB->quote($this->getFilter(), 'text') . ', ' .
505  'create_subdir = ' . $ilDB->quote($this->isSubdirCreationEnabled(), 'integer') . ', ' .
506  'subdir_type = ' . $ilDB->quote($this->getSubDirectoryType(), 'integer') . ', ' .
507  'directory = ' . $ilDB->quote($this->getDirectory(), 'text') . ' ' .
508  'WHERE rid = ' . $ilDB->quote($this->getRuleId(), 'integer');
509  $ilDB->manipulate($query);
510  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $attribute

ilECSCourseMappingRule::$attribute
private

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

Referenced by getAttribute().

◆ $create_subdir

ilECSCourseMappingRule::$create_subdir = true
private

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

Referenced by isSubdirCreationEnabled().

◆ $directory

ilECSCourseMappingRule::$directory = ''
private

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

Referenced by getDirectory().

◆ $filter

ilECSCourseMappingRule::$filter
private

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

Referenced by getFilter(), and parseFilter().

◆ $filter_elements

ilECSCourseMappingRule::$filter_elements = []
private

Definition at line 22 of file class.ilECSCourseMappingRule.php.

Referenced by getFilterElements(), and parseFilter().

◆ $is_filter

ilECSCourseMappingRule::$is_filter = false
private

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

Referenced by isFilterEnabled().

◆ $logger

ilECSCourseMappingRule::$logger = null
private

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

◆ $mid

ilECSCourseMappingRule::$mid
private

Definition at line 17 of file class.ilECSCourseMappingRule.php.

Referenced by getMid().

◆ $ref_id

ilECSCourseMappingRule::$ref_id
private

Definition at line 19 of file class.ilECSCourseMappingRule.php.

Referenced by getRefId(), and getRuleRefIds().

◆ $rid

ilECSCourseMappingRule::$rid
private

Definition at line 15 of file class.ilECSCourseMappingRule.php.

Referenced by getRuleId().

◆ $sid

ilECSCourseMappingRule::$sid
private

Definition at line 16 of file class.ilECSCourseMappingRule.php.

Referenced by getServerId().

◆ $subdir_type

ilECSCourseMappingRule::$subdir_type = self::SUBDIR_VALUE
private

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

◆ SUBDIR_ATTRIBUTE_NAME

const ilECSCourseMappingRule::SUBDIR_ATTRIBUTE_NAME = 1

Definition at line 12 of file class.ilECSCourseMappingRule.php.

◆ SUBDIR_VALUE

const ilECSCourseMappingRule::SUBDIR_VALUE = 2

Definition at line 13 of file class.ilECSCourseMappingRule.php.


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