35 public function __construct($a_parent_obj, $a_parent_cmd, $a_tax_node)
39 $this->glossary = $a_parent_obj->object;
40 $this->
setId(
"glotl" . $this->glossary->getId());
41 $this->tax_node = $a_tax_node;
43 $this->lng = $DIC->language();
44 $this->ctrl = $DIC->ctrl();
46 $this->selectable_cols = array();
52 foreach ($this->adv_fields as
$f) {
53 $this->selectable_cols[
"md_" . $f[
"id"]] = array(
60 $this->selectable_cols[
"language"] = array(
61 "txt" => $this->lng->txt(
"language"),
63 $this->selectable_cols[
"usage"] = array(
64 "txt" => $this->lng->txt(
"cont_usage"),
70 $this->
setTitle($this->lng->txt(
"cont_terms"));
78 foreach ($this->adv_cols_order as
$c) {
80 $this->
addColumn($this->lng->txt(
"cont_term"),
"term");
82 if (in_array(
"md_" . $c[
"id"], $this->selected_cols)) {
83 $this->
addColumn($c[
"text"],
"md_" . $c[
"id"]);
88 foreach (array(
"language",
"usage") as $c) {
89 if (in_array($c, $this->selected_cols)) {
90 $this->
addColumn($this->selectable_cols[$c][
"txt"]);
96 $this->
addColumn($this->lng->txt(
"cont_definitions"));
99 $this->
addColumn($this->lng->txt(
"obj_glo"));
105 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
106 $this->
setRowTemplate(
"tpl.term_tbl_row.html",
"Modules/Glossary");
110 $this->
addMultiCommand(
"referenceTerms", $this->lng->txt(
"glo_reference"));
111 $this->
addMultiCommand(
"confirmTermDeletion", $this->lng->txt(
"delete"));
117 $this->
setData($this->glossary->getTermList(
118 $this->filter[
"term"],
120 $this->filter[
"definition"],
139 $this->glossary->getVirtualMode(),
140 array(
"level",
"subtree")
153 return $this->selectable_cols;
163 if (substr($a_field, 0, 3) ==
"md_") {
164 $md_id = (int) substr($a_field, 3);
179 $ti->setMaxLength(64);
181 $ti->setSubmitFormOnEnter(
true);
183 $ti->readFromSession();
184 $this->filter[
"term"] = $ti->getValue();
187 if ($this->glossary->supportsLongTextQuery()) {
188 $ti =
new ilTextInputGUI($this->lng->txt(
"cont_definition"),
"defintion");
189 $ti->setMaxLength(64);
191 $ti->setSubmitFormOnEnter(
true);
193 $ti->readFromSession();
194 $this->filter[
"definition"] = $ti->getValue();
204 $this->ctrl->setParameterByClass(
"ilobjglossarygui",
"term_id", $term[
"id"]);
205 $this->ctrl->setParameterByClass(
"ilglossarytermgui",
"term_id", $term[
"id"]);
206 $this->ctrl->setParameterByClass(
"ilglossarydefpagegui",
"term_id", $term[
"id"]);
211 if ($this->term_perm->checkPermission(
"write", $term[
"id"]) ||
212 $this->term_perm->checkPermission(
"edit_content", $term[
"id"])) {
216 $list->addItem($this->lng->txt(
"cont_edit_term"),
"", $this->ctrl->getLinkTargetByClass(
"ilglossarytermgui",
"editTerm"));
217 if (count($defs) > 1) {
218 $list->addItem($this->lng->txt(
"cont_edit_definitions"),
"", $this->ctrl->getLinkTargetByClass(
"ilglossarytermgui",
"listDefinitions"));
219 } elseif (count($defs) == 1) {
220 $this->ctrl->setParameterByClass(
"ilglossarydefpagegui",
"def", $defs[0][
"id"]);
221 $list->addItem($this->lng->txt(
"cont_edit_definition"),
"", $this->ctrl->getLinkTargetByClass(array(
"ilglossarytermgui",
222 "iltermdefinitioneditorgui",
223 "ilglossarydefpagegui"),
"edit"));
225 $list->addItem($this->lng->txt(
"cont_add_definition"),
"", $this->ctrl->getLinkTargetByClass(
"ilobjglossarygui",
"addDefinition"));
226 $this->ctrl->setParameterByClass(
"ilglossarydefpagegui",
"def",
"");
228 $list->setId(
"act_term_" . $term[
"id"]);
229 $list->setListTitle($this->lng->txt(
"actions"));
230 $this->tpl->setVariable(
"ACTIONS", $list->getHTML());
235 for ($j = 0; $j < count($defs); $j++) {
240 $this->tpl->setCurrentBlock(
"definition");
241 $short_str = $def[
"short_text"];
243 if ($def[
"short_text_dirty"]) {
246 $def_obj->updateShortText();
247 $short_str = $def_obj->getShortText();
252 $ltexs = strrpos($short_str,
"[tex]");
253 $ltexe = strrpos($short_str,
"[/tex]");
254 if ($ltexs > $ltexe) {
257 $short_str = $page->getFirstParagraphText();
258 $short_str = strip_tags($short_str,
"<br>");
259 $ltexe = strpos($short_str,
"[/tex]", $ltexs);
266 $this->tpl->setVariable(
"DEF_SHORT", $short_str);
267 $this->tpl->parseCurrentBlock();
269 $this->tpl->setCurrentBlock(
"definition_row");
270 $this->tpl->parseCurrentBlock();
273 $this->tpl->setCurrentBlock(
"check_col");
274 $this->tpl->setVariable(
"CHECKBOX_ID", $term[
"id"]);
275 $this->tpl->parseCurrentBlock();
277 $this->ctrl->setParameter($this->parent_obj,
"term_id", $term[
"id"]);
283 if ($nr_usage > 0 && $this->glossary->getId() == $term[
"glo_id"]) {
284 $this->tpl->setCurrentBlock(
"link_usage");
285 $this->ctrl->setParameterByClass(
"ilglossarytermgui",
"term_id", $term[
"id"]);
287 $this->tpl->setVariable(
289 $this->ctrl->getLinkTargetByClass(
"ilglossarytermgui",
"listUsages")
291 $this->ctrl->setParameterByClass(
"ilglossarytermgui",
"term_id",
"");
292 $this->tpl->parseCurrentBlock();
294 $this->tpl->setCurrentBlock(
"usage");
296 $this->tpl->parseCurrentBlock();
298 $this->tpl->setCurrentBlock(
"td_usage");
299 $this->tpl->parseCurrentBlock();
304 $this->tpl->setCurrentBlock(
"glossary");
306 $this->tpl->parseCurrentBlock();
311 $this->tpl->setCurrentBlock(
"td_lang");
312 $this->tpl->setVariable(
"TEXT_LANGUAGE", $this->lng->txt(
"meta_l_" . $term[
"language"]));
313 $this->tpl->parseCurrentBlock();
317 foreach ($this->adv_cols_order as
$c) {
319 $this->tpl->setCurrentBlock(
"td");
320 $this->tpl->setVariable(
"TD_VAL", $term[
"term"]);
321 $this->tpl->parseCurrentBlock();
323 if (in_array(
"md_" . $c[
"id"], $this->selected_cols)) {
324 $id = (int) $c[
"id"];
327 if (isset($term[
"md_" . $id .
"_presentation"])) {
328 $pb = $term[
"md_" . $id .
"_presentation"]->getHTML();
334 $this->tpl->setCurrentBlock(
"td");
335 $this->tpl->setVariable(
"TD_VAL", $val);
336 $this->tpl->parseCurrentBlock();
static hasReferences($a_glossary_id)
Check if a glossary uses references.
static getInstance()
Get instance.
static getDefinitionList($a_term_id)
static
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
static getNumberOfUsages($a_term_id)
Get number of usages.
showGlossaryColumn()
Show glossary column.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static _lookupTitle($a_id)
lookup object title
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
numericOrdering($a_field)
Should this field be sorted numeric?
addMultiCommand($a_cmd, $a_text)
Add Command button.
getSelectedColumns()
Get selected columns.
Glossary definition page object.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilGlossaryDefinition.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd, $a_tax_node)
Constructor.
static getInstance()
Singleton: get instance.
__construct(Container $dic, ilPlugin $plugin)
fillRow($term)
Fill table row.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
getSelectableColumns()
Get selectable columns.
setEnableTitle($a_enabletitle)
Set Enable Title.