20 private $type = self::TYPE_CREATION;
61 $this->enabled = $a_status;
79 $this->title = $a_title;
105 return $tit ? $tit : $this->
getTitle();
140 $this->description = $a_description;
149 $this->
info = $a_info;
185 $this->assignments = (array) $a_ass;
203 $this->assignments[] = $a_obj_type;
265 $lang = $trans->getLanguages();
267 foreach (
$lang as $k => $v) {
268 if ($v[
'lang_default']) {
274 if (!isset(
$lang[0])) {
277 $lang[0][
'lang_code'] = $trans->getDefaultLanguage();
295 $a_lng =
$ilUser->getCurrentLanguage();
298 if (isset(
$lang[$a_lng][$a_value])) {
299 return $lang[$a_lng][$a_value] ;
308 public function delete()
312 $ilDB = $DIC[
'ilDB'];
319 $query =
'DELETE FROM didactic_tpl_settings ' .
320 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
324 $query =
'DELETE FROM didactic_tpl_sa ' .
325 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
328 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
333 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
348 $ilDB = $DIC[
'ilDB'];
350 $this->
setId(
$ilDB->nextId(
'didactic_tpl_settings'));
352 $query =
'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type,auto_generated,exclusive_tpl) ' .
354 $ilDB->quote($this->
getId(),
'integer') .
', ' .
364 $ilDB->manipulate($query);
396 $ilDB = $DIC[
'ilDB'];
402 $query =
'INSERT INTO didactic_tpl_sa (id,obj_type) ' .
404 $ilDB->quote($this->
getId(),
'integer') .
', ' .
405 $ilDB->quote($a_obj_type,
'text') .
417 $ilDB = $DIC[
'ilDB'];
425 $ilDB->quote($this->
getId(),
'integer') .
', ' .
426 $ilDB->quote($node,
'integer') .
430 $query =
'INSERT INTO didactic_tpl_en (id,node) ' .
431 'VALUES ' . implode(
', ',
$values);
440 $ilDB = $DIC[
'ilDB'];
442 $query =
'DELETE FROM didactic_tpl_en ' .
443 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
452 $ilDB = $DIC[
'ilDB'];
453 $effective_nodes = array();
455 $query =
'SELECT * FROM didactic_tpl_en ' .
456 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
459 $effective_nodes[] =
$row->node;
474 $ilDB = $DIC[
'ilDB'];
480 $query =
'DELETE FROM didactic_tpl_sa ' .
481 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
495 $ilDB = $DIC[
'ilDB'];
497 $query =
'UPDATE didactic_tpl_settings ' .
499 'enabled = ' .
$ilDB->quote($this->
isEnabled(),
'integer') .
', ' .
500 'title = ' .
$ilDB->quote($this->
getTitle(),
'text') .
', ' .
502 'info = ' .
$ilDB->quote($this->
getInfo(),
'text') .
', ' .
503 'type = ' .
$ilDB->quote($this->
getType(),
'integer') .
', ' .
504 'exclusive_tpl = ' .
$ilDB->quote((
int) $this->
isExclusive(),
'integer') .
' ' .
505 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
524 $ilDB = $DIC[
'ilDB'];
526 if (!$this->
getId()) {
533 $query =
'SELECT * FROM didactic_tpl_settings dtpl ' .
534 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
549 $query =
'SELECT * FROM didactic_tpl_sa ' .
550 'WHERE id = ' .
$ilDB->quote($this->
getId(),
'integer');
572 case self::TYPE_CREATION:
584 if (strlen($this->
getInfo())) {
587 $info_lines = (array) explode(
"\n", $this->
getInfo());
588 foreach ($info_lines as
$info) {
589 $trimmed_info = trim($info);
590 if (strlen($trimmed_info)) {
591 $writer->
xmlElement(
'p', array(), $trimmed_info);
615 $writer->
xmlElement(
'assignment', array(), $assignment);
621 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
623 $action->toXml($writer);
637 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
648 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
660 $tree = $DIC[
'tree'];
667 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="")
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.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
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)