ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
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(DB_FETCHMODE_OBJECT))
37 {
38 ++$num;
39 }
40 if(!$num)
41 {
42 return $a_orig_title;
43 }
44 if($num == 1)
45 {
46 return $a_orig_title.' '.$GLOBALS['lng']->txt('copy_of_suffix');
47 }
48 return $a_orig_title. ' '.sprintf($GLOBALS['lng']->txt('copy_n_of_suffix'),$num);
49 }
50
51
56 public function getTemplateId()
57 {
58 return $this->tpl_id;
59 }
60
65 public function getNewTemplateId()
66 {
67 return $this->new_tpl_id;
68 }
69
75 public function start()
76 {
77 $orig = new ilDidacticTemplateSetting($this->getTemplateId());
78 $copy = clone $orig;
79 $copy->save();
80 $this->new_tpl_id = $copy->getId();
81
82 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
84 {
85 $action->setTemplateId($this->getNewTemplateId());
86 $new = clone $action;
87 $new->save();
88 }
89
90
91 }
92}
93?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
Copy a didactic template and all subitems.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilDB