ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilDidacticTemplateCopier.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10
class
ilDidacticTemplateCopier
11
{
12
private
$tpl_id
= 0;
13
private
$new_tpl_id
= 0;
14
19
public
function
__construct
($a_tpl_id)
20
{
21
$this->tpl_id = $a_tpl_id;
22
}
23
28
public
static
function
appendCopyInfo
($a_orig_title)
29
{
30
global
$ilDB
;
31
32
$query
=
'SELECT title FROM didactic_tpl_settings '
.
33
'WHERE title = '
. $ilDB->quote($a_orig_title,
'text'
);
34
$res
= $ilDB->query(
$query
);
35
$num = 0;
36
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
37
++$num;
38
}
39
if
(!$num) {
40
return
$a_orig_title;
41
}
42
if
($num == 1) {
43
return
$a_orig_title .
' '
.
$GLOBALS
[
'lng'
]->txt(
'copy_of_suffix'
);
44
}
45
return
$a_orig_title .
' '
. sprintf(
$GLOBALS
[
'lng'
]->txt(
'copy_n_of_suffix'
), $num);
46
}
47
48
53
public
function
getTemplateId
()
54
{
55
return
$this->tpl_id
;
56
}
57
62
public
function
getNewTemplateId
()
63
{
64
return
$this->new_tpl_id
;
65
}
66
72
public
function
start
()
73
{
74
$orig
=
new
ilDidacticTemplateSetting
($this->
getTemplateId
());
75
$copy = clone
$orig
;
76
$copy->save();
77
$this->new_tpl_id = $copy->getId();
78
79
include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php'
;
80
foreach
(
ilDidacticTemplateActionFactory::getActionsByTemplateId
($this->
getTemplateId
()) as
$action
) {
81
$action->setTemplateId($this->
getNewTemplateId
());
82
$new
= clone
$action
;
83
$new
->save();
84
}
85
86
$trans = $orig->getTranslationObject();
87
$copy_trans = $trans->copy($this->new_tpl_id);
88
$copy_trans->addLanguage($trans->getDefaultLanguage(), $copy->getTitle(), $copy->getDescription(),
true
,
true
);
89
$copy_trans->save();
90
}
91
}
$new
$new
Definition:
generate-ph5p-patch.php:11
$action
$action
Definition:
consentAdmin.php:126
ilDidacticTemplateSetting
Definition:
class.ilDidacticTemplateSetting.php:10
ilDidacticTemplateCopier\__construct
__construct($a_tpl_id)
Constructor.
Definition:
class.ilDidacticTemplateCopier.php:19
$GLOBALS
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Definition:
generate-standalone.php:18
ilDidacticTemplateCopier\$new_tpl_id
$new_tpl_id
Definition:
class.ilDidacticTemplateCopier.php:13
ilDidacticTemplateCopier\getNewTemplateId
getNewTemplateId()
Get new template id.
Definition:
class.ilDidacticTemplateCopier.php:62
$orig
$orig
Definition:
generate-ph5p-patch.php:10
ilDidacticTemplateCopier\getTemplateId
getTemplateId()
Get template id.
Definition:
class.ilDidacticTemplateCopier.php:53
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilDidacticTemplateCopier\$tpl_id
$tpl_id
Definition:
class.ilDidacticTemplateCopier.php:12
ilDidacticTemplateCopier\appendCopyInfo
static appendCopyInfo($a_orig_title)
Definition:
class.ilDidacticTemplateCopier.php:28
$query
$query
Definition:
proxy_ylocal.php:13
ilDidacticTemplateCopier
Copy a didactic template and all subitems.
Definition:
class.ilDidacticTemplateCopier.php:10
ilDidacticTemplateCopier\start
start()
Start copy.
Definition:
class.ilDidacticTemplateCopier.php:72
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilDidacticTemplateActionFactory\getActionsByTemplateId
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
Definition:
class.ilDidacticTemplateActionFactory.php:65
Services
DidacticTemplate
classes
class.ilDidacticTemplateCopier.php
Generated on Sat Jan 18 2025 19:01:31 for ILIAS by
1.8.13 (using
Doxyfile
)