1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6 * TableGUI class for auto link glossaries
7 *
8 * @author Alex Killing <alex.killing@gmx.de>
9 */
10class ilGlossaryAutoLinkTableGUI extends ilTable2GUI
11{
12    /**
13     * @var ilObjGlossary
14     */
15    protected $glossary;
16
17    /**
18     * @var ilCtrl
19     */
20    protected $ctrl;
21
22    /**
23     * @var ilLanguage
24     */
25    protected $lng;
26
27
28    /**
29     * Constructor
30     */
31    public function __construct(ilObjGlossary $a_glossary, $a_parent_obj, $a_parent_cmd)
32    {
33        global $DIC;
34
35        $this->glossary = $a_glossary;
36        $this->id = "glo_glo";
37        $this->lng = $DIC->language();
38        $this->ctrl = $DIC->ctrl();
39
40        parent::__construct($a_parent_obj, $a_parent_cmd);
41        $data = array();
42        foreach ($a_glossary->getAutoGlossaries() as $glo_id) {
43            $data[] = array("glo_id" => $glo_id, "title" => ilObject::_lookupTitle($glo_id));
44        }
45        $this->setData($data);
46        $this->setTitle($this->lng->txt("cont_auto_glossaries"));
47
48        $this->addColumn($this->lng->txt("title"), "title");
49        $this->addColumn($this->lng->txt("actions"));
50
51        $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
52        $this->setRowTemplate("tpl.glo_glossary_auto_link_row.html", "Modules/Glossary");
53
54        //		$this->addMultiCommand("", $lng->txt(""));
55//		$this->addCommandButton("", $lng->txt(""));
56    }
57
58    /**
59     * Fill table row
60     */
61    protected function fillRow($a_set)
62    {
63        $this->ctrl->setParameter($this->parent_obj, "glo_id", $a_set["glo_id"]);
64        $this->tpl->setCurrentBlock("cmd");
65        $this->tpl->setVariable("CMD_HREF", $this->ctrl->getLinkTarget($this->parent_obj, "removeGlossary"));
66        $this->tpl->setVariable("CMD_TXT", $this->lng->txt("remove"));
67        $this->tpl->parseCurrentBlock();
68        $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($a_set["glo_id"]));
69    }
70}
71