ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 @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
 

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.

32 {
33 $this->setId($a_id);
34 $this->read();
35 }

References read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateSetting::__clone ( )

Implemented clone method.

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

640 {
641 $this->setId(0);
642 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
644 $this->enable(false);
645 $this->setAutoGenerated(false);
646 }
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 199 of file class.ilDidacticTemplateSetting.php.

200 {
201 $this->assignments[] = $a_obj_type;
202 }

Referenced by read().

+ Here is the caller graph for this function:

◆ delete()

ilDidacticTemplateSetting::delete ( )

Delete settings.

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

313 {
314 global $ilDB;
315
316 if($this->isAutoGenerated())
317 {
318 return false;
319 }
320
321 // Delete settings
322 $query = 'DELETE FROM didactic_tpl_settings '.
323 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
324 $ilDB->manipulate($query);
325
326 // Delete obj assignments
327 $query = 'DELETE FROM didactic_tpl_sa '.
328 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
329 $ilDB->manipulate($query);
330
331 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
333 {
334 $action->delete();
335 }
336
337 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
339
340 $this->getTranslationObject()->delete();
341 $this->deleteEffectiveNodes();
342 return true;
343 }
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static deleteByTemplateId($a_tpl_id)
Delete by template id @global ilDB $ilDB.
global $ilDB

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

+ Here is the call graph for this function:

◆ deleteAssignments()

ilDidacticTemplateSetting::deleteAssignments ( )
private

Delete assignments @global ilDB $ilDB.

Returns
bool

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

471 {
472 global $ilDB;
473
474 if($this->isAutoGenerated())
475 {
476 return false;
477 }
478
479 $query = 'DELETE FROM didactic_tpl_sa '.
480 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
481 $ilDB->manipulate($query);
482 return true;
483 }

References $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 439 of file class.ilDidacticTemplateSetting.php.

440 {
441 global $ilDB;
442
443 $query = 'DELETE FROM didactic_tpl_en '.
444 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
445 $ilDB->manipulate($query);
446 return true;
447 }

References $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 59 of file class.ilDidacticTemplateSetting.php.

60 {
61 $this->enabled = $a_status;
62 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ getAssignments()

ilDidacticTemplateSetting::getAssignments ( )

Get object assignemnts.

Returns
array

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

References $assignments.

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

+ Here is the caller graph for this function:

◆ getDescription()

ilDidacticTemplateSetting::getDescription ( )

Get description.

Returns
string

Definition at line 111 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 207 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 154 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 285 of file class.ilDidacticTemplateSetting.php.

286 {
287 $lang = $this->getTranslationObject()->getLanguages();
288
289 if(!$lang)
290 {
291 return "";
292 }
293
294 if(!$a_lng)
295 {
296 global $ilUser;
297 $a_lng = $ilUser->getCurrentLanguage();
298 }
299
300 if(isset($lang[$a_lng][$a_value]))
301 {
302 return $lang[$a_lng][$a_value] ;
303 }
304 else{
305 return $lang[$a_lng][$this->getTranslationObject()->getDefaultLanguage()];
306 }
307 }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$ilUser
Definition: imgupload.php:18

References $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 120 of file class.ilDidacticTemplateSetting.php.

121 {
122 if($this->isAutoGenerated())
123 {
124 global $lng;
125 return $lng->txt($this->getDescription());
126 }
127
128 $desc = $this->getPresentation('description', $a_lng);
129 return $desc ? $desc : $this->getDescription();
130 }
global $lng
Definition: privfeed.php:17

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

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

96 {
97 if($this->isAutoGenerated())
98 {
99 global $lng;
100 return $lng->txt($this->getTitle());
101 }
102
103 $tit = $this->getPresentation('title', $a_lng);
104 return $tit ? $tit : $this->getTitle();
105 }

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

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate().

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

652 {
653 include_once("./Services/Multilingualism/classes/class.ilMultilingualism.php");
654 return ilMultilingualism::getInstance($this->getId(), "dtpl");
655 }
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 260 of file class.ilDidacticTemplateSetting.php.

261 {
262 $trans = $this->getTranslationObject();
263 $lang = $trans->getLanguages();
264
265 foreach($lang as $k => $v)
266 {
267 if($v['lang_default'])
268 {
269 $lang[0] = $lang[$k];
270 }
271
272 }
273
274 // fallback if translation object is empty
275 if(!isset($lang[0]))
276 {
277 $lang[0]['title'] = $this->getTitle();
278 $lang[0]['description'] = $this->getDescription();
279 $lang[0]['lang_code'] = $trans->getDefaultLanguage();
280 }
281
282 return $lang;
283 }

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

662 {
663 global $tree;
664
665 if(!count($this->getEffectiveFrom()) || in_array($a_node_id, $this->getEffectiveFrom()))
666 {
667 return true;
668 }
669
670 foreach ($this->getEffectiveFrom() as $node)
671 {
672 if($tree->isGrandChild($node, $a_node_id))
673 {
674 return true;
675 }
676 }
677
678 return false;
679 }

References getEffectiveFrom().

+ 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 241 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 517 of file class.ilDidacticTemplateSetting.php.

518 {
519 global $ilDB;
520
521 if(!$this->getId())
522 {
523 return false;
524 }
525
529 $query = 'SELECT * FROM didactic_tpl_settings dtpl '.
530 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
531 $res = $ilDB->query($query);
532 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
533 {
534 $this->setType($row->type);
535 $this->enable($row->enabled);
536 $this->setTitle($row->title);
537 $this->setDescription($row->description);
538 $this->setInfo($row->info);
539 $this->setAutoGenerated((bool) $row->auto_generated);
540 $this->setExclusive((bool) $row->exclusive_tpl);
541 }
542
546 $query = 'SELECT * FROM didactic_tpl_sa '.
547 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
548 $res = $ilDB->query($query);
549 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
550 {
551 $this->addAssignment($row->obj_type);
552 }
553
554 $this->readEffectiveNodes();
555
556 return true;
557 }
setDescription($a_description)
Set description.
addAssignment($a_obj_type)
Add one assignment obj type.
setInfo($a_info)
Set installation info text.

References $ilDB, $query, $res, $row, addAssignment(), enable(), ilDBConstants\FETCHMODE_OBJECT, getId(), readEffectiveNodes(), setAutoGenerated(), setDescription(), setExclusive(), 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 449 of file class.ilDidacticTemplateSetting.php.

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

References $ilDB, $query, $res, $row, 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 348 of file class.ilDidacticTemplateSetting.php.

349 {
350 global $ilDB;
351
352 $this->setId($ilDB->nextId('didactic_tpl_settings'));
353
354 $query = 'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl) '.
355 'VALUES( '.
356 $ilDB->quote($this->getId(),'integer').', '.
357 $ilDB->quote($this->isEnabled(),'integer').', '.
358 $ilDB->quote($this->getTitle(),'text').', '.
359 $ilDB->quote($this->getDescription(),'text').', '.
360 $ilDB->quote($this->getInfo(),'text').', '.
361 $ilDB->quote($this->getType(),'integer').', '.
362 $ilDB->quote((int)$this->isAutoGenerated(),'integer').', '.
363 $ilDB->quote((int)$this->isExclusive(),'integer').
364 ')';
365
366 $ilDB->manipulate($query);
367
368 $this->saveAssignments();
369
370 return true;
371 }
getInfo()
Get installation info text.
isEnabled()
Check if template is enabled.

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

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

397 {
398 global $ilDB;
399
400 if($this->isAutoGenerated())
401 {
402 return;
403 }
404
405 $query = 'INSERT INTO didactic_tpl_sa (id,obj_type) '.
406 'VALUES( '.
407 $ilDB->quote($this->getId(),'integer').', '.
408 $ilDB->quote($a_obj_type,'text').
409 ')';
410 $ilDB->manipulate($query);
411 }

References $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 377 of file class.ilDidacticTemplateSetting.php.

378 {
379 if($this->isAutoGenerated())
380 {
381 return false;
382 }
383
384 foreach($this->getAssignments() as $ass)
385 {
386 $this->saveAssignment($ass);
387 }
388 return true;
389 }
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 416 of file class.ilDidacticTemplateSetting.php.

417 {
418 global $ilDB;
419
420 if(!count($this->getEffectiveFrom()))
421 {
422 return;
423 }
424
425 foreach($this->getEffectiveFrom() as $node)
426 {
427 $values[] = '( '.
428 $ilDB->quote($this->getId(),'integer').', '.
429 $ilDB->quote($node,'integer').
430 ')';
431 }
432
433 $query = 'INSERT INTO didactic_tpl_en (id,node) '.
434 'VALUES ' . implode(', ' , $values);
435
436 $ilDB->manipulate($query);
437 }

References $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 181 of file class.ilDidacticTemplateSetting.php.

182 {
183 $this->assignments = (array) $a_ass;
184 }

◆ setAutoGenerated()

ilDidacticTemplateSetting::setAutoGenerated (   $auto_generated)
private

DO NOT CHANGE THIS VALUE.

Parameters
bool$auto_generated

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

234 {
235 $this->auto_generated = $auto_generated;
236 }

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

137 {
138 $this->description = $a_description;
139 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEffectiveFrom()

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

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

216 {
217 $this->effective_from = $effective_from;
218 }

References $effective_from.

Referenced by readEffectiveNodes().

+ Here is the caller graph for this function:

◆ setExclusive()

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

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

250 {
251 $this->exclusive = $exclusive;
252 }

References $exclusive.

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

42 {
43 $this->id = $a_id;
44 }

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

146 {
147 $this->info = $a_info;
148 }

Referenced by read().

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

78 {
79 $this->title = $a_title;
80 }

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

164 {
165 $this->type = $a_type;
166 }
$a_type
Definition: workflow.php:93

References $a_type.

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

565 {
566 global $ilSetting;
567 switch($this->getType())
568 {
570 $type = 'creation';
571 break;
572 }
573
574 $writer->xmlStartTag('didacticTemplate',array('type' => $type));
575 $writer->xmlElement('title',array(),$this->getTitle());
576 $writer->xmlElement('description', array(), $this->getDescription());
577
578 $writer = $this->getTranslationObject()->toXml($writer);
579
580 // info text with p-tags
581 if(strlen($this->getInfo()))
582 {
583 $writer->xmlStartTag('info');
584
585 $info_lines = (array) explode("\n",$this->getInfo());
586 foreach($info_lines as $info)
587 {
588 $trimmed_info = trim($info);
589 if(strlen($trimmed_info))
590 {
591 $writer->xmlElement('p', array(), $trimmed_info);
592 }
593 }
594
595 $writer->xmlEndTag('info');
596 }
597
598 if($this->isExclusive())
599 {
600 $writer->xmlElement("exclusive");
601 }
602
603
604 if(count($this->getEffectiveFrom()) > 0)
605 {
606 $writer->xmlStartTag('effectiveFrom', array('nic_id'=> $ilSetting->get('inst_id')));
607
608 foreach($this->getEffectiveFrom() as $node)
609 {
610 $writer->xmlElement('node', array(), $node);
611 }
612 $writer->xmlEndTag('effectiveFrom');
613 }
614
615 // Assignments
616 $writer->xmlStartTag('assignments');
617 foreach($this->getAssignments() as $assignment)
618 {
619 $writer->xmlElement('assignment', array(), $assignment);
620 }
621 $writer->xmlEndTag('assignments');
622
623
624 $writer->xmlStartTag('actions');
625 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
627 {
628 $action->toXml($writer);
629 }
630 $writer->xmlEndTag('actions');
631 $writer->xmlEndTag('didacticTemplate');
632
633 return $writer;
634 }
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
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

References $ilSetting, $info, $type, ilDidacticTemplateActionFactory\getActionsByTemplateId(), getAssignments(), getDescription(), getEffectiveFrom(), 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 490 of file class.ilDidacticTemplateSetting.php.

491 {
492 global $ilDB;
493
494 $query = 'UPDATE didactic_tpl_settings '.
495 'SET '.
496 'enabled = '.$ilDB->quote($this->isEnabled(),'integer').', '.
497 'title = '.$ilDB->quote($this->getTitle(),'text').', '.
498 'description = '.$ilDB->quote($this->getDescription(),'text').', '.
499 'info = '.$ilDB->quote($this->getInfo(),'text').', '.
500 'type = '.$ilDB->quote($this->getType(),'integer').', '.
501 'exclusive_tpl = '.$ilDB->quote((int)$this->isExclusive(),'integer').' '.
502 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
503 $ilDB->manipulate($query);
504 $this->deleteAssignments();
505 $this->saveAssignments();
506
507 $this->deleteEffectiveNodes();
508 $this->saveEffectiveNodes();
509
510 return true;
511 }
deleteAssignments()
Delete assignments @global ilDB $ilDB.

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

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