20 private $type = self::TYPE_CREATION;
61 $this->enabled = $a_status;
79 $this->title = $a_title;
103 return $tit ? $tit : $this->
getTitle();
136 $this->description = $a_description;
145 $this->info = $a_info;
181 $this->assignments = (
array) $a_ass;
199 $this->assignments[] = $a_obj_type;
261 $lang = $trans->getLanguages();
263 foreach (
$lang as $k => $v) {
264 if ($v[
'lang_default']) {
270 if (!isset(
$lang[0])) {
273 $lang[0][
'lang_code'] = $trans->getDefaultLanguage();
289 $a_lng = $ilUser->getCurrentLanguage();
292 if (isset(
$lang[$a_lng][$a_value])) {
293 return $lang[$a_lng][$a_value] ;
302 public function delete()
311 $query =
'DELETE FROM didactic_tpl_settings ' .
312 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
313 $ilDB->manipulate(
$query);
316 $query =
'DELETE FROM didactic_tpl_sa ' .
317 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
318 $ilDB->manipulate(
$query);
320 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
325 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
340 $this->
setId($ilDB->nextId(
'didactic_tpl_settings'));
342 $query =
'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl) ' .
344 $ilDB->quote($this->
getId(),
'integer') .
', ' .
345 $ilDB->quote($this->
isEnabled(),
'integer') .
', ' .
346 $ilDB->quote($this->
getTitle(),
'text') .
', ' .
348 $ilDB->quote($this->
getInfo(),
'text') .
', ' .
349 $ilDB->quote($this->
getType(),
'integer') .
', ' .
351 $ilDB->quote((
int) $this->
isExclusive(),
'integer') .
354 $ilDB->manipulate($query);
390 $query =
'INSERT INTO didactic_tpl_sa (id,obj_type) ' .
392 $ilDB->quote($this->
getId(),
'integer') .
', ' .
393 $ilDB->quote($a_obj_type,
'text') .
395 $ilDB->manipulate(
$query);
411 $ilDB->quote($this->
getId(),
'integer') .
', ' .
412 $ilDB->quote($node,
'integer') .
416 $query =
'INSERT INTO didactic_tpl_en (id,node) ' .
417 'VALUES ' . implode(
', ', $values);
419 $ilDB->manipulate(
$query);
426 $query =
'DELETE FROM didactic_tpl_en ' .
427 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
428 $ilDB->manipulate(
$query);
435 $effective_nodes =
array();
437 $query =
'SELECT * FROM didactic_tpl_en ' .
438 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
441 $effective_nodes[] =
$row->node;
460 $query =
'DELETE FROM didactic_tpl_sa ' .
461 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
462 $ilDB->manipulate(
$query);
475 $query =
'UPDATE didactic_tpl_settings ' .
477 'enabled = ' . $ilDB->quote($this->
isEnabled(),
'integer') .
', ' .
478 'title = ' . $ilDB->quote($this->
getTitle(),
'text') .
', ' .
479 'description = ' . $ilDB->quote($this->
getDescription(),
'text') .
', ' .
480 'info = ' . $ilDB->quote($this->
getInfo(),
'text') .
', ' .
481 'type = ' . $ilDB->quote($this->
getType(),
'integer') .
', ' .
482 'exclusive_tpl = ' . $ilDB->quote((
int) $this->
isExclusive(),
'integer') .
' ' .
483 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
484 $ilDB->manipulate(
$query);
502 if (!$this->
getId()) {
509 $query =
'SELECT * FROM didactic_tpl_settings dtpl ' .
510 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
525 $query =
'SELECT * FROM didactic_tpl_sa ' .
526 'WHERE id = ' . $ilDB->quote($this->
getId(),
'integer');
546 case self::TYPE_CREATION:
558 if (strlen($this->
getInfo())) {
562 foreach ($info_lines as
$info) {
563 $trimmed_info = trim($info);
564 if (strlen($trimmed_info)) {
578 $writer->
xmlStartTag(
'effectiveFrom',
array(
'nic_id'=> $ilSetting->get(
'inst_id')));
595 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
597 $action->toXml($writer);
611 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
622 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
639 if ($tree->isGrandChild($node, $a_node_id)) {
static getInstance($a_obj_id, $a_type)
Get instance.
setInfo($a_info)
Set installation info text.
setType($a_type)
Set type.
isEnabled()
Check if template is enabled.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
getDescription()
Get description.
getAssignments()
Get object assignemnts.
setTitle($a_title)
Set title.
saveAssignments()
Save assignments in DB.
getPresentation($a_value, $a_lng)
xmlEndTag($tag)
Writes an endtag.
addAssignment($a_obj_type)
Add one assignment obj type.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
foreach($_POST as $key=> $value) $res
update()
Update settings ilDB $ilDB.
setAssignments(array $a_ass)
Set assignments.
static deleteByTemplateId($a_tpl_id)
Delete by template id ilDB $ilDB.
read()
read settings from db
getPresentationDescription($a_lng="")
static appendCopyInfo($a_orig_title)
__construct($a_id=0)
Constructor.
getPresentationTitle($a_lng="")
Create styles array
The data for the language used.
toXml(ilXmlWriter $writer)
Export.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
enable($a_status)
Set enabled status.
saveAssignment($a_obj_type)
Add one object assignment ilDB $ilDB.
__clone()
Implemented clone method.
deleteAssignments()
Delete assignments ilDB $ilDB.
getInfo()
Get installation info text.
getTranslations()
get all translations from this object
setDescription($a_description)
Set description.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
setEffectiveFrom($effective_from)