74 $this->enabled = $a_status;
92 $this->title = $a_title;
118 return $tit ? $tit : $this->
getTitle();
153 $this->description = $a_description;
162 $this->
info = $a_info;
180 $this->type = $a_type;
212 $this->assignments = (array) $a_ass;
230 $this->assignments[] = $a_obj_type;
285 $this->icon_ide = $icon_identifier;
302 $lang = $trans->getLanguages();
304 foreach (
$lang as $k => $v) {
305 if ($v[
'lang_default']) {
311 if (!isset(
$lang[0])) {
314 $lang[0][
'lang_code'] = $trans->getDefaultLanguage();
332 $a_lng =
$ilUser->getCurrentLanguage();
335 if (isset(
$lang[$a_lng][$a_value])) {
336 return $lang[$a_lng][$a_value] ;
345 public function delete()
356 $query =
'DELETE FROM didactic_tpl_settings ' .
357 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
361 $query =
'DELETE FROM didactic_tpl_sa ' .
362 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
365 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
370 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
388 $this->
setId(
$ilDB->nextId(
'didactic_tpl_settings'));
390 $query =
'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl,icon_ide) ' .
392 $ilDB->quote($this->
getId(),
'integer') .
', ' .
441 $query =
'INSERT INTO didactic_tpl_sa (id,obj_type) ' .
443 $ilDB->quote($this->
getId(),
'integer') .
', ' .
444 $ilDB->quote($a_obj_type,
'text') .
464 $ilDB->quote($this->
getId(),
'integer') .
', ' .
465 $ilDB->quote($node,
'integer') .
469 $query =
'INSERT INTO didactic_tpl_en (id,node) ' .
470 'VALUES ' . implode(
', ', $values);
481 $query =
'DELETE FROM didactic_tpl_en ' .
482 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
492 $effective_nodes = array();
494 $query =
'SELECT * FROM didactic_tpl_en ' .
495 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
498 $effective_nodes[] = $row->node;
519 $query =
'DELETE FROM didactic_tpl_sa ' .
520 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
536 $query =
'UPDATE didactic_tpl_settings ' .
538 'enabled = ' .
$ilDB->quote($this->
isEnabled(),
'integer') .
', ' .
539 'title = ' .
$ilDB->quote($this->
getTitle(),
'text') .
', ' .
541 'info = ' .
$ilDB->quote($this->
getInfo(),
'text') .
', ' .
542 'type = ' .
$ilDB->quote($this->
getType(),
'integer') .
', ' .
543 'exclusive_tpl = ' .
$ilDB->quote((
int) $this->
isExclusive(),
'integer') .
', ' .
545 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
566 if (!$this->
getId()) {
573 $query =
'SELECT * FROM didactic_tpl_settings dtpl ' .
574 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
578 $this->
enable($row->enabled);
590 $query =
'SELECT * FROM didactic_tpl_sa ' .
591 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
625 if (strlen($this->
getInfo())) {
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);
656 $writer->
xmlElement(
'assignment', array(), $assignment);
662 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
664 $action->toXml($writer);
678 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
690 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
702 $tree =
$DIC[
'tree'];
709 if ($tree->isGrandChild($node, $a_node_id)) {
An exception for terminatinating execution or to throw for unit testing.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static appendCopyInfo($a_orig_title)
Icon handler for didactic template custom icons.
static deleteByTemplateId($a_tpl_id)
Delete by template id @global ilDB $ilDB.
saveAssignment($a_obj_type)
Add one object assignment @global ilDB $ilDB.
setEffectiveFrom($effective_from)
setTitle($a_title)
Set title.
getPresentationTitle($a_lng="")
enable($a_status)
Set enabled status.
getPresentation($a_value, $a_lng)
setDescription($a_description)
Set description.
addAssignment($a_obj_type)
Add one assignment obj type.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
__construct($a_id=0)
Constructor.
getDescription()
Get description.
saveAssignments()
Save assignments in DB.
getTranslations()
get all translations from this object
hasIconSupport(ilObjectDefinition $definition)
getAssignments()
Get object assignemnts.
setIconIdentifier(string $icon_identifier)
getInfo()
Get installation info text.
setAssignments(array $a_ass)
Set assignments.
isEnabled()
Check if template is enabled.
read()
read settings from db
setType($a_type)
Set type.
deleteAssignments()
Delete assignments @global ilDB $ilDB.
getPresentationDescription($a_lng="")
toXml(ilXmlWriter $writer)
Export.
__clone()
Implemented clone method.
update()
Update settings @global ilDB $ilDB.
setInfo($a_info)
Set installation info text.
static getInstance($a_obj_id, $a_type)
Get instance.
parses the objects.xml it handles the xml-description of all ilias objects
isContainer($a_obj_name)
Check if object type is container ('crs','fold','grp' ...)
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.
foreach($_POST as $key=> $value) $res