ILIAS  release_7 Revision v7.30-3-g800a261c036
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 @global 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 @global ilDB $ilDB. More...
 
 deleteAssignments ()
 Delete assignments @global 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.

36 {
37 $this->setId($a_id);
38 $this->read();
39 $this->iconHandler = new ilDidacticTemplateIconHandler($this);
40 }
Icon handler for didactic template custom icons.

References read(), and setId().

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

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 }
enable($a_status)
Set enabled status.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.

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

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

229 {
230 $this->assignments[] = $a_obj_type;
231 }

Referenced by read().

+ Here is the caller graph for this function:

◆ delete()

ilDidacticTemplateSetting::delete ( )

Delete settings.

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

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';
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 getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static deleteByTemplateId($a_tpl_id)
Delete by template id @global ilDB $ilDB.
global $DIC
Definition: goto.php:24
$query
global $ilDB

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

Referenced by ilDidacticTemplateImport\parseActions().

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

◆ deleteAssignments()

ilDidacticTemplateSetting::deleteAssignments ( )
private

Delete assignments @global ilDB $ilDB.

Returns
bool

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

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 }

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

Referenced by update().

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

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 }

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

Referenced by delete(), and update().

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

73 {
74 $this->enabled = $a_status;
75 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ getAssignments()

ilDidacticTemplateSetting::getAssignments ( )

◆ 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()

◆ getIconIdentifier()

ilDidacticTemplateSetting::getIconIdentifier ( )

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

288 : string
289 {
290 return $this->icon_ide;
291 }

References $icon_ide.

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

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

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 }
$ilUser
Definition: imgupload.php:18
$lang
Definition: xapiexit.php:8

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

Referenced by getPresentationDescription(), and getPresentationTitle().

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

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

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

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

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

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 }

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

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

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

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.

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

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

+ 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

@access public

Returns
array

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

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 }

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

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

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

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

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

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 }

References $DIC, and getEffectiveFrom().

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

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 }
setDescription($a_description)
Set description.
addAssignment($a_obj_type)
Add one assignment obj type.
setInfo($a_info)
Set installation info text.
foreach($_POST as $key=> $value) $res

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

Referenced by __construct().

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

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 }

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

Referenced by read().

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

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 }
getInfo()
Get installation info text.
isEnabled()
Check if template is enabled.

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

+ Here is the call graph for this function:

◆ saveAssignment()

ilDidacticTemplateSetting::saveAssignment (   $a_obj_type)
private

Add one object assignment @global ilDB $ilDB.

Parameters
string$a_obj_type

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

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 }

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

Referenced by saveAssignments().

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

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 @global ilDB $ilDB.

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

Referenced by save(), and update().

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

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 }

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

Referenced by update().

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

263 {
264 $this->auto_generated = $auto_generated;
265 }

References $auto_generated.

Referenced by __clone(), and read().

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

152 {
153 $this->description = $a_description;
154 }

Referenced by read().

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

245 {
246 $this->effective_from = $effective_from;
247 }

References $effective_from.

Referenced by readEffectiveNodes().

+ Here is the caller graph for this function:

◆ setExclusive()

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

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

279 {
280 $this->exclusive = $exclusive;
281 }

References $exclusive.

Referenced by read().

+ Here is the caller graph for this function:

◆ setIconIdentifier()

ilDidacticTemplateSetting::setIconIdentifier ( string  $icon_identifier)

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

284 {
285 $this->icon_ide = $icon_identifier;
286 }

Referenced by read().

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

55 {
56 $this->id = $a_id;
57 }

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

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

161 {
162 $this->info = $a_info;
163 }
info()
Definition: info.php:2

References info().

Referenced by read().

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

91 {
92 $this->title = $a_title;
93 }

Referenced by __clone(), and read().

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

179 {
180 $this->type = $a_type;
181 }

Referenced by read().

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

608 {
609 global $DIC;
610
611 $ilSetting = $DIC['ilSetting'];
612 switch ($this->getType()) {
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';
664 $action->toXml($writer);
665 }
666 $writer->xmlEndTag('actions');
667 $writer->xmlEndTag('didacticTemplate');
668
669 return $writer;
670 }
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
global $ilSetting
Definition: privfeed.php:17

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

+ Here is the call graph for this function:

◆ update()

ilDidacticTemplateSetting::update ( )

Update settings @global ilDB $ilDB.

Returns
bool

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

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 }
deleteAssignments()
Delete assignments @global ilDB $ilDB.

References $DIC, $ilDB, $query, deleteAssignments(), deleteEffectiveNodes(), getDescription(), getIconIdentifier(), getId(), getInfo(), getTitle(), getType(), isEnabled(), isExclusive(), saveAssignments(), saveEffectiveNodes(), and ilDBConstants\T_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: