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') .
 
  411            $ilDB->quote($this->
getId(), 
'integer') . 
', ' .
 
  412            $ilDB->quote($node, 
'integer') .
 
  416        $query = 
'INSERT INTO didactic_tpl_en (id,node) ' .
 
  417            'VALUES ' . implode(
', ', $values);
 
  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');
 
  558        if (strlen($this->
getInfo())) {
 
  561            $info_lines = (array) explode(
"\n", $this->
getInfo());
 
  562            foreach ($info_lines as 
$info) {
 
  563                $trimmed_info = trim(
$info);
 
  564                if (strlen($trimmed_info)) {
 
  565                    $writer->
xmlElement(
'p', array(), $trimmed_info);
 
  589            $writer->
xmlElement(
'assignment', array(), $assignment);
 
  595        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
 
  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)) {
 
An exception for terminatinating execution or to throw for unit testing.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static appendCopyInfo($a_orig_title)
static deleteByTemplateId($a_tpl_id)
Delete by template id @global ilDB $ilDB.
saveAssignment($a_obj_type)
Add one object assignment @global ilDB $ilDB.
setEffectiveFrom($effective_from)
setTitle($a_title)
Set title.
getPresentationTitle($a_lng="")
enable($a_status)
Set enabled status.
getPresentation($a_value, $a_lng)
setDescription($a_description)
Set description.
addAssignment($a_obj_type)
Add one assignment obj type.
setAutoGenerated($auto_generated)
DO NOT CHANGE THIS VALUE.
__construct($a_id=0)
Constructor.
getDescription()
Get description.
saveAssignments()
Save assignments in DB.
getTranslations()
get all translations from this object
getAssignments()
Get object assignemnts.
getInfo()
Get installation info text.
setAssignments(array $a_ass)
Set assignments.
isEnabled()
Check if template is enabled.
read()
read settings from db
setType($a_type)
Set type.
deleteAssignments()
Delete assignments @global ilDB $ilDB.
getPresentationDescription($a_lng="")
toXml(ilXmlWriter $writer)
Export.
__clone()
Implemented clone method.
update()
Update settings @global ilDB $ilDB.
setInfo($a_info)
Set installation info text.
static getInstance($a_obj_id, $a_type)
Get instance.
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
foreach($_POST as $key=> $value) $res