ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDidacticTemplateSetting Class Reference
+ Collaboration diagram for ilDidacticTemplateSetting:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 getId ()
 Get id. More...
 
 enable ($a_status)
 Set enabled status. More...
 
 isEnabled ()
 Check if template is enabled. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 getPresentationTitle ($a_lng="")
 
 getDescription ()
 Get description. More...
 
 getPresentationDescription ($a_lng="")
 
 setDescription ($a_description)
 Set description. More...
 
 setInfo ($a_info)
 Set installation info text. More...
 
 getInfo ()
 Get installation info text. More...
 
 setType ($a_type)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setAssignments (array $a_ass)
 Set assignments. More...
 
 getAssignments ()
 Get object assignemnts. More...
 
 addAssignment ($a_obj_type)
 Add one assignment obj type. More...
 
 getEffectiveFrom ()
 
 setEffectiveFrom ($effective_from)
 
 isAutoGenerated ()
 
 isExclusive ()
 
 setExclusive ($exclusive)
 
 getTranslations ()
 get all translations from this object More...
 
 delete ()
 Delete settings. More...
 
 save ()
 Save settings. More...
 
 update ()
 Update settings ilDB $ilDB. More...
 
 toXml (ilXmlWriter $writer)
 Export. More...
 
 __clone ()
 Implemented clone method. More...
 
 getTranslationObject ()
 
 isEffective ($a_node_id)
 

Data Fields

const TYPE_CREATION = 1
 

Protected Member Functions

 setId ($a_id)
 Set id. More...
 
 getPresentation ($a_value, $a_lng)
 
 saveEffectiveNodes ()
 
 deleteEffectiveNodes ()
 
 readEffectiveNodes ()
 
 read ()
 read settings from db More...
 

Private Member Functions

 setAutoGenerated ($auto_generated)
 DO NOT CHANGE THIS VALUE. More...
 
 saveAssignments ()
 Save assignments in DB. More...
 
 saveAssignment ($a_obj_type)
 Add one object assignment ilDB $ilDB. More...
 
 deleteAssignments ()
 Delete assignments ilDB $ilDB. More...
 

Private Attributes

 $id = 0
 
 $enabled = false
 
 $title = ''
 
 $description = ''
 
 $info = ''
 
 $type = self::TYPE_CREATION
 
 $assignments = array()
 
 $effective_from = array()
 
 $auto_generated = false
 
 $exclusive = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSetting::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

Definition at line 31 of file class.ilDidacticTemplateSetting.php.

References read(), and setId().

32  {
33  $this->setId($a_id);
34  $this->read();
35  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateSetting::__clone ( )

Implemented clone method.

Definition at line 634 of file class.ilDidacticTemplateSetting.php.

References ilDidacticTemplateCopier\appendCopyInfo(), enable(), getTitle(), setAutoGenerated(), setId(), and setTitle().

635  {
636  $this->setId(0);
637  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
639  $this->enable(false);
640  $this->setAutoGenerated(false);
641  }
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
enable($a_status)
Set enabled status.
+ Here is the call graph for this function:

◆ addAssignment()

ilDidacticTemplateSetting::addAssignment (   $a_obj_type)

Add one assignment obj type.

Parameters
string$a_obj_type

Definition at line 201 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

202  {
203  $this->assignments[] = $a_obj_type;
204  }
+ Here is the caller graph for this function:

◆ delete()

ilDidacticTemplateSetting::delete ( )

Delete settings.

Definition at line 308 of file class.ilDidacticTemplateSetting.php.

References $action, $DIC, $ilDB, $query, ilDidacticTemplateObjSettings\deleteByTemplateId(), deleteEffectiveNodes(), ilDidacticTemplateActionFactory\getActionsByTemplateId(), getId(), getTranslationObject(), and isAutoGenerated().

309  {
310  global $DIC;
311 
312  $ilDB = $DIC['ilDB'];
313 
314  if ($this->isAutoGenerated()) {
315  return false;
316  }
317 
318  // Delete settings
319  $query = 'DELETE FROM didactic_tpl_settings ' .
320  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
321  $ilDB->manipulate($query);
322 
323  // Delete obj assignments
324  $query = 'DELETE FROM didactic_tpl_sa ' .
325  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
326  $ilDB->manipulate($query);
327 
328  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
330  $action->delete();
331  }
332 
333  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
335 
336  $this->getTranslationObject()->delete();
337  $this->deleteEffectiveNodes();
338  return true;
339  }
$action
global $DIC
Definition: saml.php:7
static deleteByTemplateId($a_tpl_id)
Delete by template id ilDB $ilDB.
$query
global $ilDB
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
+ Here is the call graph for this function:

◆ deleteAssignments()

ilDidacticTemplateSetting::deleteAssignments ( )
private

Delete assignments ilDB $ilDB.

Returns
bool

Definition at line 470 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, getId(), and isAutoGenerated().

Referenced by update().

471  {
472  global $DIC;
473 
474  $ilDB = $DIC['ilDB'];
475 
476  if ($this->isAutoGenerated()) {
477  return false;
478  }
479 
480  $query = 'DELETE FROM didactic_tpl_sa ' .
481  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
482  $ilDB->manipulate($query);
483  return true;
484  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteEffectiveNodes()

ilDidacticTemplateSetting::deleteEffectiveNodes ( )
protected

Definition at line 436 of file class.ilDidacticTemplateSetting.php.

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

Referenced by delete(), and update().

437  {
438  global $DIC;
439 
440  $ilDB = $DIC['ilDB'];
441 
442  $query = 'DELETE FROM didactic_tpl_en ' .
443  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
444  $ilDB->manipulate($query);
445  return true;
446  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enable()

ilDidacticTemplateSetting::enable (   $a_status)

Set enabled status.

Parameters
bool$a_status

Definition at line 59 of file class.ilDidacticTemplateSetting.php.

Referenced by __clone(), and read().

60  {
61  $this->enabled = $a_status;
62  }
+ Here is the caller graph for this function:

◆ getAssignments()

ilDidacticTemplateSetting::getAssignments ( )

Get object assignemnts.

Returns
array

Definition at line 192 of file class.ilDidacticTemplateSetting.php.

References $assignments.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), saveAssignments(), and toXml().

193  {
194  return (array) $this->assignments;
195  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDidacticTemplateSetting::getDescription ( )

Get description.

Returns
string

Definition at line 112 of file class.ilDidacticTemplateSetting.php.

References $description.

Referenced by getPresentationDescription(), getTranslations(), save(), toXml(), and update().

+ Here is the caller graph for this function:

◆ getEffectiveFrom()

ilDidacticTemplateSetting::getEffectiveFrom ( )
Returns
int[]

Definition at line 209 of file class.ilDidacticTemplateSetting.php.

References $effective_from.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), isEffective(), saveEffectiveNodes(), and toXml().

+ Here is the caller graph for this function:

◆ getId()

ilDidacticTemplateSetting::getId ( )

◆ getInfo()

ilDidacticTemplateSetting::getInfo ( )

Get installation info text.

Returns
string

Definition at line 156 of file class.ilDidacticTemplateSetting.php.

References $info.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), toXml(), and update().

+ Here is the caller graph for this function:

◆ getPresentation()

ilDidacticTemplateSetting::getPresentation (   $a_value,
  $a_lng 
)
protected

Definition at line 283 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilUser, $lang, and getTranslationObject().

Referenced by getPresentationDescription(), and getPresentationTitle().

284  {
285  $lang = $this->getTranslationObject()->getLanguages();
286 
287  if (!$lang) {
288  return "";
289  }
290 
291  if (!$a_lng) {
292  global $DIC;
293 
294  $ilUser = $DIC['ilUser'];
295  $a_lng = $ilUser->getCurrentLanguage();
296  }
297 
298  if (isset($lang[$a_lng][$a_value])) {
299  return $lang[$a_lng][$a_value] ;
300  } else {
301  return $lang[$a_lng][$this->getTranslationObject()->getDefaultLanguage()];
302  }
303  }
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentationDescription()

ilDidacticTemplateSetting::getPresentationDescription (   $a_lng = "")
Parameters
string$a_lng
Returns
string

Definition at line 121 of file class.ilDidacticTemplateSetting.php.

References $DIC, $lng, getDescription(), getPresentation(), and isAutoGenerated().

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

122  {
123  if ($this->isAutoGenerated()) {
124  global $DIC;
125 
126  $lng = $DIC['lng'];
127  return $lng->txt($this->getDescription());
128  }
129 
130  $desc = $this->getPresentation('description', $a_lng);
131  return $desc ? $desc : $this->getDescription();
132  }
global $DIC
Definition: saml.php:7
$lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentationTitle()

ilDidacticTemplateSetting::getPresentationTitle (   $a_lng = "")
Parameters
string$a_lng
Returns
string

Definition at line 95 of file class.ilDidacticTemplateSetting.php.

References $DIC, $lng, getPresentation(), getTitle(), and isAutoGenerated().

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

96  {
97  if ($this->isAutoGenerated()) {
98  global $DIC;
99 
100  $lng = $DIC['lng'];
101  return $lng->txt($this->getTitle());
102  }
103 
104  $tit = $this->getPresentation('title', $a_lng);
105  return $tit ? $tit : $this->getTitle();
106  }
global $DIC
Definition: saml.php:7
$lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilDidacticTemplateSetting::getTitle ( )

Get title.

Returns
string

Definition at line 86 of file class.ilDidacticTemplateSetting.php.

References $title.

Referenced by __clone(), getPresentationTitle(), getTranslations(), save(), toXml(), and update().

+ Here is the caller graph for this function:

◆ getTranslationObject()

ilDidacticTemplateSetting::getTranslationObject ( )
Returns
ilMultilingualism

Definition at line 646 of file class.ilDidacticTemplateSetting.php.

References getId(), and ilMultilingualism\getInstance().

Referenced by delete(), getPresentation(), getTranslations(), and toXml().

647  {
648  include_once("./Services/Multilingualism/classes/class.ilMultilingualism.php");
649  return ilMultilingualism::getInstance($this->getId(), "dtpl");
650  }
static getInstance($a_obj_id, $a_type)
Get instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTranslations()

ilDidacticTemplateSetting::getTranslations ( )

get all translations from this object

public

Returns
array

Definition at line 262 of file class.ilDidacticTemplateSetting.php.

References $lang, getDescription(), getTitle(), and getTranslationObject().

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

263  {
264  $trans = $this->getTranslationObject();
265  $lang = $trans->getLanguages();
266 
267  foreach ($lang as $k => $v) {
268  if ($v['lang_default']) {
269  $lang[0] = $lang[$k];
270  }
271  }
272 
273  // fallback if translation object is empty
274  if (!isset($lang[0])) {
275  $lang[0]['title'] = $this->getTitle();
276  $lang[0]['description'] = $this->getDescription();
277  $lang[0]['lang_code'] = $trans->getDefaultLanguage();
278  }
279 
280  return $lang;
281  }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilDidacticTemplateSetting::getType ( )

Get type.

Returns
int

Definition at line 174 of file class.ilDidacticTemplateSetting.php.

References $type.

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

+ Here is the caller graph for this function:

◆ isAutoGenerated()

ilDidacticTemplateSetting::isAutoGenerated ( )

◆ isEffective()

ilDidacticTemplateSetting::isEffective (   $a_node_id)
Parameters
int$a_node_id
Returns
bool

Definition at line 656 of file class.ilDidacticTemplateSetting.php.

References $DIC, $tree, and getEffectiveFrom().

657  {
658  global $DIC;
659 
660  $tree = $DIC['tree'];
661 
662  if (!count($this->getEffectiveFrom()) || in_array($a_node_id, $this->getEffectiveFrom())) {
663  return true;
664  }
665 
666  foreach ($this->getEffectiveFrom() as $node) {
667  if ($tree->isGrandChild($node, $a_node_id)) {
668  return true;
669  }
670  }
671 
672  return false;
673  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

◆ isEnabled()

ilDidacticTemplateSetting::isEnabled ( )

Check if template is enabled.

Returns
bool

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

References $enabled.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), and update().

+ Here is the caller graph for this function:

◆ isExclusive()

ilDidacticTemplateSetting::isExclusive ( )
Returns
boolean

Definition at line 243 of file class.ilDidacticTemplateSetting.php.

References $exclusive.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), toXml(), and update().

+ Here is the caller graph for this function:

◆ read()

ilDidacticTemplateSetting::read ( )
protected

read settings from db

Returns
bool

Read settings

Read assigned objects

Definition at line 520 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, $res, $row, addAssignment(), enable(), ilDBConstants\FETCHMODE_OBJECT, getId(), readEffectiveNodes(), setAutoGenerated(), setDescription(), setExclusive(), setInfo(), setTitle(), and setType().

Referenced by __construct().

521  {
522  global $DIC;
523 
524  $ilDB = $DIC['ilDB'];
525 
526  if (!$this->getId()) {
527  return false;
528  }
529 
533  $query = 'SELECT * FROM didactic_tpl_settings dtpl ' .
534  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
535  $res = $ilDB->query($query);
536  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
537  $this->setType($row->type);
538  $this->enable($row->enabled);
539  $this->setTitle($row->title);
540  $this->setDescription($row->description);
541  $this->setInfo($row->info);
542  $this->setAutoGenerated((bool) $row->auto_generated);
543  $this->setExclusive((bool) $row->exclusive_tpl);
544  }
545 
549  $query = 'SELECT * FROM didactic_tpl_sa ' .
550  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
551  $res = $ilDB->query($query);
552  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
553  $this->addAssignment($row->obj_type);
554  }
555 
556  $this->readEffectiveNodes();
557 
558  return true;
559  }
setInfo($a_info)
Set installation info text.
global $DIC
Definition: saml.php:7
addAssignment($a_obj_type)
Add one assignment obj type.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
foreach($_POST as $key=> $value) $res
$query
$row
enable($a_status)
Set enabled status.
global $ilDB
setDescription($a_description)
Set description.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readEffectiveNodes()

ilDidacticTemplateSetting::readEffectiveNodes ( )
protected

Definition at line 448 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getId(), and setEffectiveFrom().

Referenced by read().

449  {
450  global $DIC;
451 
452  $ilDB = $DIC['ilDB'];
453  $effective_nodes = array();
454 
455  $query = 'SELECT * FROM didactic_tpl_en ' .
456  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
457  $res = $ilDB->query($query);
458  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
459  $effective_nodes[] = $row->node;
460  }
461 
462  $this->setEffectiveFrom($effective_nodes);
463  }
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()

ilDidacticTemplateSetting::save ( )

Save settings.

Definition at line 344 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, getDescription(), getId(), getInfo(), getTitle(), getType(), isAutoGenerated(), isEnabled(), isExclusive(), saveAssignments(), and setId().

345  {
346  global $DIC;
347 
348  $ilDB = $DIC['ilDB'];
349 
350  $this->setId($ilDB->nextId('didactic_tpl_settings'));
351 
352  $query = 'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl) ' .
353  'VALUES( ' .
354  $ilDB->quote($this->getId(), 'integer') . ', ' .
355  $ilDB->quote($this->isEnabled(), 'integer') . ', ' .
356  $ilDB->quote($this->getTitle(), 'text') . ', ' .
357  $ilDB->quote($this->getDescription(), 'text') . ', ' .
358  $ilDB->quote($this->getInfo(), 'text') . ', ' .
359  $ilDB->quote($this->getType(), 'integer') . ', ' .
360  $ilDB->quote((int) $this->isAutoGenerated(), 'integer') . ', ' .
361  $ilDB->quote((int) $this->isExclusive(), 'integer') .
362  ')';
363 
364  $ilDB->manipulate($query);
365 
366  $this->saveAssignments();
367 
368  return true;
369  }
isEnabled()
Check if template is enabled.
global $DIC
Definition: saml.php:7
$query
global $ilDB
getInfo()
Get installation info text.
+ Here is the call graph for this function:

◆ saveAssignment()

ilDidacticTemplateSetting::saveAssignment (   $a_obj_type)
private

Add one object assignment ilDB $ilDB.

Parameters
string$a_obj_type

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

References $DIC, $ilDB, $query, getId(), and isAutoGenerated().

Referenced by saveAssignments().

393  {
394  global $DIC;
395 
396  $ilDB = $DIC['ilDB'];
397 
398  if ($this->isAutoGenerated()) {
399  return;
400  }
401 
402  $query = 'INSERT INTO didactic_tpl_sa (id,obj_type) ' .
403  'VALUES( ' .
404  $ilDB->quote($this->getId(), 'integer') . ', ' .
405  $ilDB->quote($a_obj_type, 'text') .
406  ')';
407  $ilDB->manipulate($query);
408  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAssignments()

ilDidacticTemplateSetting::saveAssignments ( )
private

Save assignments in DB.

Returns
bool

Definition at line 375 of file class.ilDidacticTemplateSetting.php.

References getAssignments(), isAutoGenerated(), and saveAssignment().

Referenced by save(), and update().

376  {
377  if ($this->isAutoGenerated()) {
378  return false;
379  }
380 
381  foreach ($this->getAssignments() as $ass) {
382  $this->saveAssignment($ass);
383  }
384  return true;
385  }
saveAssignment($a_obj_type)
Add one object assignment ilDB $ilDB.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveEffectiveNodes()

ilDidacticTemplateSetting::saveEffectiveNodes ( )
protected

Definition at line 413 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, $values, getEffectiveFrom(), and getId().

Referenced by update().

414  {
415  global $DIC;
416 
417  $ilDB = $DIC['ilDB'];
418 
419  if (!count($this->getEffectiveFrom())) {
420  return;
421  }
422 
423  foreach ($this->getEffectiveFrom() as $node) {
424  $values[] = '( ' .
425  $ilDB->quote($this->getId(), 'integer') . ', ' .
426  $ilDB->quote($node, 'integer') .
427  ')';
428  }
429 
430  $query = 'INSERT INTO didactic_tpl_en (id,node) ' .
431  'VALUES ' . implode(', ', $values);
432 
433  $ilDB->manipulate($query);
434  }
global $DIC
Definition: saml.php:7
$values
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAssignments()

ilDidacticTemplateSetting::setAssignments ( array  $a_ass)

Set assignments.

Parameters
array$a_ass

Definition at line 183 of file class.ilDidacticTemplateSetting.php.

184  {
185  $this->assignments = (array) $a_ass;
186  }

◆ setAutoGenerated()

ilDidacticTemplateSetting::setAutoGenerated (   $auto_generated)
private

DO NOT CHANGE THIS VALUE.

Parameters
bool$auto_generated

Definition at line 235 of file class.ilDidacticTemplateSetting.php.

References $auto_generated.

Referenced by __clone(), and read().

236  {
237  $this->auto_generated = $auto_generated;
238  }
+ Here is the caller graph for this function:

◆ setDescription()

ilDidacticTemplateSetting::setDescription (   $a_description)

Set description.

Parameters
string$a_description

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

Referenced by read().

139  {
140  $this->description = $a_description;
141  }
+ Here is the caller graph for this function:

◆ setEffectiveFrom()

ilDidacticTemplateSetting::setEffectiveFrom (   $effective_from)
Parameters
int[]$effective_from

Definition at line 217 of file class.ilDidacticTemplateSetting.php.

References $effective_from.

Referenced by readEffectiveNodes().

218  {
219  $this->effective_from = $effective_from;
220  }
+ Here is the caller graph for this function:

◆ setExclusive()

ilDidacticTemplateSetting::setExclusive (   $exclusive)
Parameters
boolean$exclusive

Definition at line 251 of file class.ilDidacticTemplateSetting.php.

References $exclusive.

Referenced by read().

252  {
253  $this->exclusive = $exclusive;
254  }
+ Here is the caller graph for this function:

◆ setId()

ilDidacticTemplateSetting::setId (   $a_id)
protected

Set id.

Parameters
int$a_id

Definition at line 41 of file class.ilDidacticTemplateSetting.php.

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

42  {
43  $this->id = $a_id;
44  }
+ Here is the caller graph for this function:

◆ setInfo()

ilDidacticTemplateSetting::setInfo (   $a_info)

Set installation info text.

Parameters
string$a_info

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

References info().

Referenced by read().

148  {
149  $this->info = $a_info;
150  }
info()
Definition: info.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTitle()

ilDidacticTemplateSetting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

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

Referenced by __clone(), and read().

78  {
79  $this->title = $a_title;
80  }
+ Here is the caller graph for this function:

◆ setType()

ilDidacticTemplateSetting::setType (   $a_type)

Set type.

Parameters
int$a_type

Definition at line 165 of file class.ilDidacticTemplateSetting.php.

References $a_type.

Referenced by read().

166  {
167  $this->type = $a_type;
168  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateSetting::toXml ( ilXmlWriter  $writer)

Export.

Parameters
ilXmlWriter$writer
Returns
ilXmlWriter

Definition at line 566 of file class.ilDidacticTemplateSetting.php.

References $action, $DIC, $ilSetting, $info, $type, ilDidacticTemplateActionFactory\getActionsByTemplateId(), getAssignments(), getDescription(), getEffectiveFrom(), getId(), getInfo(), getTitle(), getTranslationObject(), getType(), isExclusive(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

567  {
568  global $DIC;
569 
570  $ilSetting = $DIC['ilSetting'];
571  switch ($this->getType()) {
572  case self::TYPE_CREATION:
573  $type = 'creation';
574  break;
575  }
576 
577  $writer->xmlStartTag('didacticTemplate', array('type' => $type));
578  $writer->xmlElement('title', array(), $this->getTitle());
579  $writer->xmlElement('description', array(), $this->getDescription());
580 
581  $writer = $this->getTranslationObject()->toXml($writer);
582 
583  // info text with p-tags
584  if (strlen($this->getInfo())) {
585  $writer->xmlStartTag('info');
586 
587  $info_lines = (array) explode("\n", $this->getInfo());
588  foreach ($info_lines as $info) {
589  $trimmed_info = trim($info);
590  if (strlen($trimmed_info)) {
591  $writer->xmlElement('p', array(), $trimmed_info);
592  }
593  }
594 
595  $writer->xmlEndTag('info');
596  }
597 
598  if ($this->isExclusive()) {
599  $writer->xmlElement("exclusive");
600  }
601 
602 
603  if (count($this->getEffectiveFrom()) > 0) {
604  $writer->xmlStartTag('effectiveFrom', array('nic_id' => $ilSetting->get('inst_id')));
605 
606  foreach ($this->getEffectiveFrom() as $node) {
607  $writer->xmlElement('node', array(), $node);
608  }
609  $writer->xmlEndTag('effectiveFrom');
610  }
611 
612  // Assignments
613  $writer->xmlStartTag('assignments');
614  foreach ($this->getAssignments() as $assignment) {
615  $writer->xmlElement('assignment', array(), $assignment);
616  }
617  $writer->xmlEndTag('assignments');
618 
619 
620  $writer->xmlStartTag('actions');
621  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
623  $action->toXml($writer);
624  }
625  $writer->xmlEndTag('actions');
626  $writer->xmlEndTag('didacticTemplate');
627 
628  return $writer;
629  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$action
global $DIC
Definition: saml.php:7
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
global $ilSetting
Definition: privfeed.php:17
getInfo()
Get installation info text.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
+ Here is the call graph for this function:

◆ update()

ilDidacticTemplateSetting::update ( )

Update settings ilDB $ilDB.

Returns
bool

Definition at line 491 of file class.ilDidacticTemplateSetting.php.

References $DIC, $ilDB, $query, deleteAssignments(), deleteEffectiveNodes(), getDescription(), getId(), getInfo(), getTitle(), getType(), isEnabled(), isExclusive(), saveAssignments(), and saveEffectiveNodes().

492  {
493  global $DIC;
494 
495  $ilDB = $DIC['ilDB'];
496 
497  $query = 'UPDATE didactic_tpl_settings ' .
498  'SET ' .
499  'enabled = ' . $ilDB->quote($this->isEnabled(), 'integer') . ', ' .
500  'title = ' . $ilDB->quote($this->getTitle(), 'text') . ', ' .
501  'description = ' . $ilDB->quote($this->getDescription(), 'text') . ', ' .
502  'info = ' . $ilDB->quote($this->getInfo(), 'text') . ', ' .
503  'type = ' . $ilDB->quote($this->getType(), 'integer') . ', ' .
504  'exclusive_tpl = ' . $ilDB->quote((int) $this->isExclusive(), 'integer') . ' ' .
505  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
506  $ilDB->manipulate($query);
507  $this->deleteAssignments();
508  $this->saveAssignments();
509 
510  $this->deleteEffectiveNodes();
511  $this->saveEffectiveNodes();
512 
513  return true;
514  }
isEnabled()
Check if template is enabled.
global $DIC
Definition: saml.php:7
$query
global $ilDB
deleteAssignments()
Delete assignments ilDB $ilDB.
getInfo()
Get installation info text.
+ Here is the call graph for this function:

Field Documentation

◆ $assignments

ilDidacticTemplateSetting::$assignments = array()
private

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

Referenced by getAssignments().

◆ $auto_generated

ilDidacticTemplateSetting::$auto_generated = false
private

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

Referenced by isAutoGenerated(), and setAutoGenerated().

◆ $description

ilDidacticTemplateSetting::$description = ''
private

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

Referenced by getDescription().

◆ $effective_from

ilDidacticTemplateSetting::$effective_from = array()
private

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

Referenced by getEffectiveFrom(), and setEffectiveFrom().

◆ $enabled

ilDidacticTemplateSetting::$enabled = false
private

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

Referenced by isEnabled().

◆ $exclusive

ilDidacticTemplateSetting::$exclusive = false
private

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

Referenced by isExclusive(), and setExclusive().

◆ $id

ilDidacticTemplateSetting::$id = 0
private

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

Referenced by getId().

◆ $info

ilDidacticTemplateSetting::$info = ''
private

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

Referenced by getInfo(), and toXml().

◆ $title

ilDidacticTemplateSetting::$title = ''
private

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

Referenced by getTitle().

◆ $type

ilDidacticTemplateSetting::$type = self::TYPE_CREATION
private

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

Referenced by getType(), and toXml().

◆ TYPE_CREATION

const ilDidacticTemplateSetting::TYPE_CREATION = 1

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