ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
$DIC
;
31
32
$ilDB
= $DIC[
'ilDB'
];
33
34
$query
=
'SELECT title FROM didactic_tpl_settings '
.
35
'WHERE title = '
.
$ilDB
->quote($a_orig_title,
'text'
);
36
$res
=
$ilDB
->query(
$query
);
37
$num = 0;
38
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
39
++$num;
40
}
41
if
(!$num) {
42
return
$a_orig_title;
43
}
44
if
($num == 1) {
45
return
$a_orig_title .
' '
.
$GLOBALS
[
'DIC'
][
'lng'
]->txt(
'copy_of_suffix'
);
46
}
47
return
$a_orig_title .
' '
. sprintf(
$GLOBALS
[
'DIC'
][
'lng'
]->txt(
'copy_n_of_suffix'
), $num);
48
}
49
50
55
public
function
getTemplateId
()
56
{
57
return
$this->tpl_id
;
58
}
59
64
public
function
getNewTemplateId
()
65
{
66
return
$this->new_tpl_id
;
67
}
68
74
public
function
start
()
75
{
76
$orig =
new
ilDidacticTemplateSetting
($this->
getTemplateId
());
77
$copy = clone $orig;
78
$copy->save();
79
$this->new_tpl_id = $copy->getId();
80
81
include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php'
;
82
foreach
(
ilDidacticTemplateActionFactory::getActionsByTemplateId
($this->
getTemplateId
()) as
$action
) {
83
$action->setTemplateId($this->
getNewTemplateId
());
84
$new = clone
$action
;
85
$new->save();
86
}
87
88
$trans = $orig->getTranslationObject();
89
$copy_trans = $trans->copy($this->new_tpl_id);
90
$copy_trans->addLanguage($trans->getDefaultLanguage(), $copy->getTitle(), $copy->getDescription(),
true
,
true
);
91
$copy_trans->save();
92
}
93
}
$action
$action
Definition:
consentAdmin.php:140
$DIC
global $DIC
Definition:
saml.php:7
ilDidacticTemplateSetting
Definition:
class.ilDidacticTemplateSetting.php:10
ilDidacticTemplateCopier\__construct
__construct($a_tpl_id)
Constructor.
Definition:
class.ilDidacticTemplateCopier.php:19
ilDidacticTemplateCopier\$new_tpl_id
$new_tpl_id
Definition:
class.ilDidacticTemplateCopier.php:13
ilDidacticTemplateCopier\getNewTemplateId
getNewTemplateId()
Get new template id.
Definition:
class.ilDidacticTemplateCopier.php:64
ilDidacticTemplateCopier\getTemplateId
getTemplateId()
Get template id.
Definition:
class.ilDidacticTemplateCopier.php:55
$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:74
$row
$row
Definition:
migrateto20.php:360
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$GLOBALS
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Definition:
module.tag.xmp.php:702
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 Thu Jan 16 2025 19:02:21 for ILIAS by
1.8.13 (using
Doxyfile
)