ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLMEditShortTitlesGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6{
10 protected $ctrl;
11
15 protected $lm;
16
20 protected $lm_gui;
21
25 protected $tpl;
26
30 protected $lng;
31
37 public function __construct(ilObjLearningModuleGUI $a_lm_gui)
38 {
39 global $DIC;
40
41 $this->ctrl = $DIC->ctrl();
42 $this->lm = $a_lm_gui->object;
43 $this->lm_gui = $a_lm_gui;
44 $this->tpl = $DIC["tpl"];
45 $this->lng = $DIC->language();
46
47 $this->lang = ($_GET["transl"] == "")
48 ? "-"
49 : $_GET["transl"];
50 }
51
55 public function executeCommand()
56 {
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd("listShortTitles");
59
60 switch ($next_class) {
61 default:
62 if (in_array($cmd, array("listShortTitles", "save"))) {
63 $this->$cmd();
64 }
65 }
66 }
67
71 public function listShortTitles()
72 {
73 ilUtil::sendInfo($this->lng->txt("cont_short_title_info"));
74 $ml_head = ilObjContentObjectGUI::getMultiLangHeader($this->lm->getId(), $this->lm_gui, "short_titles");
75 $tab = new ilLMEditShortTitlesTableGUI($this, "listShortTitles", $this->lm, $this->lang);
76 $this->tpl->setContent($ml_head . $tab->getHTML());
77 }
78
82 public function save()
83 {
84 if (is_array($_POST["short_title"])) {
85 foreach ($_POST["short_title"] as $id => $title) {
86 if (ilLMObject::_lookupContObjID($id) == $this->lm->getId()) {
87 ilLMObject::writeShortTitle($id, ilUtil::stripSlashes($title), $this->lang);
88 }
89 }
90 }
91 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
92 $this->ctrl->redirect($this, "listShortTitles");
93 }
94}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
__construct(ilObjLearningModuleGUI $a_lm_gui)
Learning module.
TableGUI class for lm short titles.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static writeShortTitle($a_id, $a_short_title, $a_lang="-")
Write short title.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
Class ilLearningModuleGUI.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$DIC
Definition: xapitoken.php:46