ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDidacticTemplateSetting Class Reference
+ Collaboration diagram for ilDidacticTemplateSetting:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 getIconHandler ()
 
 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...
 
 hasIconSupport (ilObjectDefinition $definition)
 
 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)
 
 setIconIdentifier (string $icon_identifier)
 
 getIconIdentifier ()
 
 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
 
 $icon_ide = ''
 
 $iconHandler = null
 

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 35 of file class.ilDidacticTemplateSetting.php.

References read(), and setId().

36  {
37  $this->setId($a_id);
38  $this->read();
39  $this->iconHandler = new ilDidacticTemplateIconHandler($this);
40  }
Icon handler for didactic template custom icons.
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateSetting::__clone ( )

Implemented clone method.

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

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

676  {
677  $this->setId(0);
678  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
680  $this->enable(false);
681  $this->setAutoGenerated(false);
682  $this->iconHandler = new ilDidacticTemplateIconHandler($this);
683  }
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
Icon handler for didactic template custom icons.
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 228 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

229  {
230  $this->assignments[] = $a_obj_type;
231  }
+ Here is the caller graph for this function:

◆ delete()

ilDidacticTemplateSetting::delete ( )

Delete settings.

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

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

Referenced by ilDidacticTemplateImport\parseActions().

346  {
347  global $DIC;
348 
349  $ilDB = $DIC['ilDB'];
350 
351  if ($this->isAutoGenerated()) {
352  return false;
353  }
354 
355  // Delete settings
356  $query = 'DELETE FROM didactic_tpl_settings ' .
357  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
358  $ilDB->manipulate($query);
359 
360  // Delete obj assignments
361  $query = 'DELETE FROM didactic_tpl_sa ' .
362  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
363  $ilDB->manipulate($query);
364 
365  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
366  foreach (ilDidacticTemplateActionFactory::getActionsByTemplateId($this->getId()) as $action) {
367  $action->delete();
368  }
369 
370  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
372 
373  $this->getTranslationObject()->delete();
374  $this->deleteEffectiveNodes();
375  $this->getIconHandler()->delete();
376  return true;
377  }
static deleteByTemplateId($a_tpl_id)
Delete by template id ilDB $ilDB.
global $DIC
Definition: goto.php:24
$query
global $ilDB
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAssignments()

ilDidacticTemplateSetting::deleteAssignments ( )
private

Delete assignments ilDB $ilDB.

Returns
bool

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

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

Referenced by update().

510  {
511  global $DIC;
512 
513  $ilDB = $DIC['ilDB'];
514 
515  if ($this->isAutoGenerated()) {
516  return false;
517  }
518 
519  $query = 'DELETE FROM didactic_tpl_sa ' .
520  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
521  $ilDB->manipulate($query);
522  return true;
523  }
global $DIC
Definition: goto.php:24
$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 475 of file class.ilDidacticTemplateSetting.php.

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

Referenced by delete(), and update().

476  {
477  global $DIC;
478 
479  $ilDB = $DIC['ilDB'];
480 
481  $query = 'DELETE FROM didactic_tpl_en ' .
482  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
483  $ilDB->manipulate($query);
484  return true;
485  }
global $DIC
Definition: goto.php:24
$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 72 of file class.ilDidacticTemplateSetting.php.

Referenced by __clone(), and read().

73  {
74  $this->enabled = $a_status;
75  }
+ Here is the caller graph for this function:

◆ getAssignments()

ilDidacticTemplateSetting::getAssignments ( )

Get object assignemnts.

Returns
array

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

References $assignments.

Referenced by ilDidacticTemplateImport\canUseIcons(), hasIconSupport(), ilDidacticTemplateSettingsGUI\initEditTemplate(), ilDidacticTemplateSettingsTableFilter\isFiltered(), saveAssignments(), and toXml().

220  {
221  return (array) $this->assignments;
222  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDidacticTemplateSetting::getDescription ( )

Get description.

Returns
string

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

◆ getIconHandler()

ilDidacticTemplateSetting::getIconHandler ( )

◆ getIconIdentifier()

ilDidacticTemplateSetting::getIconIdentifier ( )

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

References $icon_ide.

Referenced by ilDidacticTemplateIconHandler\copy(), save(), and update().

288  : string
289  {
290  return $this->icon_ide;
291  }
+ Here is the caller graph for this function:

◆ getId()

ilDidacticTemplateSetting::getId ( )

◆ getInfo()

ilDidacticTemplateSetting::getInfo ( )

Get installation info text.

Returns
string

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

References $info.

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

+ Here is the caller graph for this function:

◆ getPresentation()

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

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

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

Referenced by getPresentationDescription(), and getPresentationTitle().

321  {
322  $lang = $this->getTranslationObject()->getLanguages();
323 
324  if (!$lang) {
325  return "";
326  }
327 
328  if (!$a_lng) {
329  global $DIC;
330 
331  $ilUser = $DIC['ilUser'];
332  $a_lng = $ilUser->getCurrentLanguage();
333  }
334 
335  if (isset($lang[$a_lng][$a_value])) {
336  return $lang[$a_lng][$a_value] ;
337  } else {
338  return $lang[$a_lng][$this->getTranslationObject()->getDefaultLanguage()];
339  }
340  }
global $DIC
Definition: goto.php:24
$lang
Definition: xapiexit.php:8
$ilUser
Definition: imgupload.php:18
+ 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 134 of file class.ilDidacticTemplateSetting.php.

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), and ilDidacticTemplateSettingsTableFilter\isFiltered().

135  {
136  if ($this->isAutoGenerated()) {
137  global $DIC;
138 
139  $lng = $DIC['lng'];
140  return $lng->txt($this->getDescription());
141  }
142 
143  $desc = $this->getPresentation('description', $a_lng);
144  return $desc ? $desc : $this->getDescription();
145  }
$lng
global $DIC
Definition: goto.php:24
+ 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 108 of file class.ilDidacticTemplateSetting.php.

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), and ilDidacticTemplateSettingsTableFilter\isFiltered().

109  {
110  if ($this->isAutoGenerated()) {
111  global $DIC;
112 
113  $lng = $DIC['lng'];
114  return $lng->txt($this->getTitle());
115  }
116 
117  $tit = $this->getPresentation('title', $a_lng);
118  return $tit ? $tit : $this->getTitle();
119  }
$lng
global $DIC
Definition: goto.php:24
+ 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 99 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 688 of file class.ilDidacticTemplateSetting.php.

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

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

689  {
690  include_once("./Services/Multilingualism/classes/class.ilMultilingualism.php");
691  return ilMultilingualism::getInstance($this->getId(), "dtpl");
692  }
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 299 of file class.ilDidacticTemplateSetting.php.

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

300  {
301  $trans = $this->getTranslationObject();
302  $lang = $trans->getLanguages();
303 
304  foreach ($lang as $k => $v) {
305  if ($v['lang_default']) {
306  $lang[0] = $lang[$k];
307  }
308  }
309 
310  // fallback if translation object is empty
311  if (!isset($lang[0])) {
312  $lang[0]['title'] = $this->getTitle();
313  $lang[0]['description'] = $this->getDescription();
314  $lang[0]['lang_code'] = $trans->getDefaultLanguage();
315  }
316 
317  return $lang;
318  }
$lang
Definition: xapiexit.php:8
+ 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 187 of file class.ilDidacticTemplateSetting.php.

References $type.

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

+ Here is the caller graph for this function:

◆ hasIconSupport()

ilDidacticTemplateSetting::hasIconSupport ( ilObjectDefinition  $definition)
Parameters
ilObjectDefinition$definition
Returns
bool

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

References getAssignments(), and ilObjectDefinition\isContainer().

196  : bool
197  {
198  foreach ($this->getAssignments() as $assignment) {
199  if (!$definition->isContainer($assignment)) {
200  return false;
201  }
202  }
203  return true;
204  }
isContainer($a_obj_name)
Check if object type is container ('crs','fold','grp' ...)
+ Here is the call graph for this function:

◆ isAutoGenerated()

ilDidacticTemplateSetting::isAutoGenerated ( )

◆ isEffective()

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

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

References $DIC, and getEffectiveFrom().

699  {
700  global $DIC;
701 
702  $tree = $DIC['tree'];
703 
704  if (!count($this->getEffectiveFrom()) || in_array($a_node_id, $this->getEffectiveFrom())) {
705  return true;
706  }
707 
708  foreach ($this->getEffectiveFrom() as $node) {
709  if ($tree->isGrandChild($node, $a_node_id)) {
710  return true;
711  }
712  }
713 
714  return false;
715  }
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ isEnabled()

ilDidacticTemplateSetting::isEnabled ( )

Check if template is enabled.

Returns
bool

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

References $enabled.

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

+ Here is the caller graph for this function:

◆ isExclusive()

ilDidacticTemplateSetting::isExclusive ( )
Returns
boolean

Definition at line 270 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 560 of file class.ilDidacticTemplateSetting.php.

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

Referenced by __construct().

561  {
562  global $DIC;
563 
564  $ilDB = $DIC['ilDB'];
565 
566  if (!$this->getId()) {
567  return false;
568  }
569 
573  $query = 'SELECT * FROM didactic_tpl_settings dtpl ' .
574  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
575  $res = $ilDB->query($query);
576  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
577  $this->setType($row->type);
578  $this->enable($row->enabled);
579  $this->setTitle($row->title);
580  $this->setDescription($row->description);
581  $this->setInfo($row->info);
582  $this->setAutoGenerated((bool) $row->auto_generated);
583  $this->setExclusive((bool) $row->exclusive_tpl);
584  $this->setIconIdentifier((string) $row->icon_ide);
585  }
586 
590  $query = 'SELECT * FROM didactic_tpl_sa ' .
591  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
592  $res = $ilDB->query($query);
593  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
594  $this->addAssignment($row->obj_type);
595  }
596 
597  $this->readEffectiveNodes();
598 
599  return true;
600  }
setInfo($a_info)
Set installation info text.
addAssignment($a_obj_type)
Add one assignment obj type.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
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 487 of file class.ilDidacticTemplateSetting.php.

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

Referenced by read().

488  {
489  global $DIC;
490 
491  $ilDB = $DIC['ilDB'];
492  $effective_nodes = array();
493 
494  $query = 'SELECT * FROM didactic_tpl_en ' .
495  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
496  $res = $ilDB->query($query);
497  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
498  $effective_nodes[] = $row->node;
499  }
500 
501  $this->setEffectiveFrom($effective_nodes);
502  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
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 382 of file class.ilDidacticTemplateSetting.php.

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

383  {
384  global $DIC;
385 
386  $ilDB = $DIC['ilDB'];
387 
388  $this->setId($ilDB->nextId('didactic_tpl_settings'));
389 
390  $query = 'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl,icon_ide) ' .
391  'VALUES( ' .
392  $ilDB->quote($this->getId(), 'integer') . ', ' .
393  $ilDB->quote($this->isEnabled(), 'integer') . ', ' .
394  $ilDB->quote($this->getTitle(), 'text') . ', ' .
395  $ilDB->quote($this->getDescription(), 'text') . ', ' .
396  $ilDB->quote($this->getInfo(), 'text') . ', ' .
397  $ilDB->quote($this->getType(), 'integer') . ', ' .
398  $ilDB->quote((int) $this->isAutoGenerated(), 'integer') . ', ' .
399  $ilDB->quote((int) $this->isExclusive(), 'integer') . ', ' .
400  $ilDB->quote((string) $this->getIconIdentifier(), ilDBConstants::T_TEXT) . ' ' .
401  ')';
402 
403  $ilDB->manipulate($query);
404 
405  $this->saveAssignments();
406 
407  return true;
408  }
isEnabled()
Check if template is enabled.
global $DIC
Definition: goto.php:24
$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 431 of file class.ilDidacticTemplateSetting.php.

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

Referenced by saveAssignments().

432  {
433  global $DIC;
434 
435  $ilDB = $DIC['ilDB'];
436 
437  if ($this->isAutoGenerated()) {
438  return;
439  }
440 
441  $query = 'INSERT INTO didactic_tpl_sa (id,obj_type) ' .
442  'VALUES( ' .
443  $ilDB->quote($this->getId(), 'integer') . ', ' .
444  $ilDB->quote($a_obj_type, 'text') .
445  ')';
446  $ilDB->manipulate($query);
447  }
global $DIC
Definition: goto.php:24
$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 414 of file class.ilDidacticTemplateSetting.php.

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

Referenced by save(), and update().

415  {
416  if ($this->isAutoGenerated()) {
417  return false;
418  }
419 
420  foreach ($this->getAssignments() as $ass) {
421  $this->saveAssignment($ass);
422  }
423  return true;
424  }
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 452 of file class.ilDidacticTemplateSetting.php.

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

Referenced by update().

453  {
454  global $DIC;
455 
456  $ilDB = $DIC['ilDB'];
457 
458  if (!count($this->getEffectiveFrom())) {
459  return;
460  }
461 
462  foreach ($this->getEffectiveFrom() as $node) {
463  $values[] = '( ' .
464  $ilDB->quote($this->getId(), 'integer') . ', ' .
465  $ilDB->quote($node, 'integer') .
466  ')';
467  }
468 
469  $query = 'INSERT INTO didactic_tpl_en (id,node) ' .
470  'VALUES ' . implode(', ', $values);
471 
472  $ilDB->manipulate($query);
473  }
global $DIC
Definition: goto.php:24
$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 210 of file class.ilDidacticTemplateSetting.php.

211  {
212  $this->assignments = (array) $a_ass;
213  }

◆ setAutoGenerated()

ilDidacticTemplateSetting::setAutoGenerated (   $auto_generated)
private

DO NOT CHANGE THIS VALUE.

Parameters
bool$auto_generated

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

References $auto_generated.

Referenced by __clone(), and read().

263  {
264  $this->auto_generated = $auto_generated;
265  }
+ Here is the caller graph for this function:

◆ setDescription()

ilDidacticTemplateSetting::setDescription (   $a_description)

Set description.

Parameters
string$a_description

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

Referenced by read().

152  {
153  $this->description = $a_description;
154  }
+ Here is the caller graph for this function:

◆ setEffectiveFrom()

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

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

References $effective_from.

Referenced by readEffectiveNodes().

245  {
246  $this->effective_from = $effective_from;
247  }
+ Here is the caller graph for this function:

◆ setExclusive()

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

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

References $exclusive.

Referenced by read().

279  {
280  $this->exclusive = $exclusive;
281  }
+ Here is the caller graph for this function:

◆ setIconIdentifier()

ilDidacticTemplateSetting::setIconIdentifier ( string  $icon_identifier)

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

Referenced by read().

284  {
285  $this->icon_ide = $icon_identifier;
286  }
+ Here is the caller graph for this function:

◆ setId()

ilDidacticTemplateSetting::setId (   $a_id)
protected

Set id.

Parameters
int$a_id

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

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

55  {
56  $this->id = $a_id;
57  }
+ Here is the caller graph for this function:

◆ setInfo()

ilDidacticTemplateSetting::setInfo (   $a_info)

Set installation info text.

Parameters
string$a_info

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

References info().

Referenced by read().

161  {
162  $this->info = $a_info;
163  }
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 90 of file class.ilDidacticTemplateSetting.php.

Referenced by __clone(), and read().

91  {
92  $this->title = $a_title;
93  }
+ Here is the caller graph for this function:

◆ setType()

ilDidacticTemplateSetting::setType (   $a_type)

Set type.

Parameters
int$a_type

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

Referenced by read().

179  {
180  $this->type = $a_type;
181  }
+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateSetting::toXml ( ilXmlWriter  $writer)

Export.

Parameters
ilXmlWriter$writer
Returns
ilXmlWriter

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

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

608  {
609  global $DIC;
610 
611  $ilSetting = $DIC['ilSetting'];
612  switch ($this->getType()) {
613  case self::TYPE_CREATION:
614  $type = 'creation';
615  break;
616  }
617 
618  $writer->xmlStartTag('didacticTemplate', array('type' => $type));
619  $writer->xmlElement('title', array(), $this->getTitle());
620  $writer->xmlElement('description', array(), $this->getDescription());
621  $writer = $this->getIconHandler()->toXml($writer);
622  $writer = $this->getTranslationObject()->toXml($writer);
623 
624  // info text with p-tags
625  if (strlen($this->getInfo())) {
626  $writer->xmlStartTag('info');
627 
628  $info_lines = (array) explode("\n", $this->getInfo());
629  foreach ($info_lines as $info) {
630  $trimmed_info = trim($info);
631  if (strlen($trimmed_info)) {
632  $writer->xmlElement('p', array(), $trimmed_info);
633  }
634  }
635 
636  $writer->xmlEndTag('info');
637  }
638 
639  if ($this->isExclusive()) {
640  $writer->xmlElement("exclusive");
641  }
642 
643 
644  if (count($this->getEffectiveFrom()) > 0) {
645  $writer->xmlStartTag('effectiveFrom', array('nic_id' => $ilSetting->get('inst_id')));
646 
647  foreach ($this->getEffectiveFrom() as $node) {
648  $writer->xmlElement('node', array(), $node);
649  }
650  $writer->xmlEndTag('effectiveFrom');
651  }
652 
653  // Assignments
654  $writer->xmlStartTag('assignments');
655  foreach ($this->getAssignments() as $assignment) {
656  $writer->xmlElement('assignment', array(), $assignment);
657  }
658  $writer->xmlEndTag('assignments');
659 
660 
661  $writer->xmlStartTag('actions');
662  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
663  foreach (ilDidacticTemplateActionFactory::getActionsByTemplateId($this->getId()) as $action) {
664  $action->toXml($writer);
665  }
666  $writer->xmlEndTag('actions');
667  $writer->xmlEndTag('didacticTemplate');
668 
669  return $writer;
670  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
global $DIC
Definition: goto.php:24
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 530 of file class.ilDidacticTemplateSetting.php.

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

531  {
532  global $DIC;
533 
534  $ilDB = $DIC['ilDB'];
535 
536  $query = 'UPDATE didactic_tpl_settings ' .
537  'SET ' .
538  'enabled = ' . $ilDB->quote($this->isEnabled(), 'integer') . ', ' .
539  'title = ' . $ilDB->quote($this->getTitle(), 'text') . ', ' .
540  'description = ' . $ilDB->quote($this->getDescription(), 'text') . ', ' .
541  'info = ' . $ilDB->quote($this->getInfo(), 'text') . ', ' .
542  'type = ' . $ilDB->quote($this->getType(), 'integer') . ', ' .
543  'exclusive_tpl = ' . $ilDB->quote((int) $this->isExclusive(), 'integer') . ', ' .
544  'icon_ide = ' . $ilDB->quote((string) $this->getIconIdentifier(), ilDBConstants::T_TEXT) . ' ' .
545  'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
546  $ilDB->manipulate($query);
547  $this->deleteAssignments();
548  $this->saveAssignments();
549 
550  $this->deleteEffectiveNodes();
551  $this->saveEffectiveNodes();
552 
553  return true;
554  }
isEnabled()
Check if template is enabled.
global $DIC
Definition: goto.php:24
$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().

◆ $icon_ide

ilDidacticTemplateSetting::$icon_ide = ''
private

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

Referenced by getIconIdentifier().

◆ $iconHandler

ilDidacticTemplateSetting::$iconHandler = null
private

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

Referenced by getIconHandler().

◆ $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: