ILIAS  release_8 Revision v8.24
ilGlossaryDefinition Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 __construct (int $a_id=0)
 
 read ()
 
 setId (int $a_id)
 
 getId ()
 
 getType ()
 
 setTermId (int $a_term_id)
 
 getTermId ()
 
 setShortText (string $a_text)
 
 getShortText ()
 
 setNr (int $a_nr)
 
 getNr ()
 
 assignPageObject (ilGlossaryDefPage $a_page_object)
 
 getPageObject ()
 
 getTitle ()
 
 setTitle (string $a_title)
 
 getDescription ()
 
 setDescription (string $a_description)
 
 setShortTextDirty (bool $a_val)
 
 getShortTextDirty ()
 
 create (bool $a_upload=false, bool $a_omit_page_creation=false)
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 update ()
 
 shortenShortText (string $text)
 Shorten short text. More...
 
 updateShortText ()
 
 exportXML (ilXmlWriter $a_xml_writer, int $a_inst)
 
 exportXMLMetaData (ilXmlWriter $a_xml_writer)
 
 modifyExportIdentifier (string $a_tag, string $a_param, string $a_value)
 
 exportXMLDefinition (ilXmlWriter $a_xml_writer, int $a_inst=0)
 export page objects meta data to xml More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 MDUpdateListener (string $a_element)
 Meta data update listener. More...
 

Static Public Member Functions

static getDefinitionList (int $a_term_id)
 
static _lookupTermId (int $a_def_id)
 Looks up term id for a definition id. More...
 
static setShortTextsDirty (int $a_glo_id)
 Set all short texts of glossary dirty (e.g. More...
 
static setShortTextsDirtyGlobally ()
 Set short texts dirty (for all glossaries) More...
 

Data Fields

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
int $id = 0
 
int $term_id = 0
 
int $glo_id = 0
 
ilGlossaryDefPage $page_object
 
string $short_text = ""
 
int $nr = 0
 
bool $short_text_dirty = false
 

Protected Attributes

array $files_contained = []
 
array $mobs_contained = []
 
string $description = ""
 
string $title = ""
 
ilDBInterface $db
 
ilObjUser $user
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilGlossaryDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryDefinition::__construct ( int  $a_id = 0)

Definition at line 40 of file class.ilGlossaryDefinition.php.

42 {
43 global $DIC;
44
45 $this->db = $DIC->database();
46 $this->user = $DIC->user();
47 $lng = $DIC->language();
48 $tpl = $DIC["tpl"];
49
50 $this->lng = $lng;
51 $this->tpl = $tpl;
52
53 $this->id = $a_id;
54 if ($a_id != 0) {
55 $this->read();
56 }
57 }
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28

References $DIC, $lng, $tpl, ILIAS\Repository\lng(), read(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupTermId()

static ilGlossaryDefinition::_lookupTermId ( int  $a_def_id)
static

Looks up term id for a definition id.

Parameters
int$a_def_iddefinition id

Definition at line 549 of file class.ilGlossaryDefinition.php.

549 : int
550 {
551 global $DIC;
552
553 $ilDB = $DIC->database();
554
555 $q = "SELECT * FROM glossary_definition WHERE id = " .
556 $ilDB->quote($a_def_id, "integer");
557 $def_set = $ilDB->query($q);
558 $def_rec = $ilDB->fetchAssoc($def_set);
559
560 return $def_rec["term_id"];
561 }

References $DIC, and $ilDB.

Referenced by ilTermUsagesTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilLMContentSearch\performSearch(), and ilGlossaryDefPageGUI\postOutputProcessing().

+ Here is the caller graph for this function:

◆ assignPageObject()

ilGlossaryDefinition::assignPageObject ( ilGlossaryDefPage  $a_page_object)

Definition at line 121 of file class.ilGlossaryDefinition.php.

121 : void
122 {
123 $this->page_object = $a_page_object;
124 }

◆ create()

ilGlossaryDefinition::create ( bool  $a_upload = false,
bool  $a_omit_page_creation = false 
)

Definition at line 160 of file class.ilGlossaryDefinition.php.

163 : void {
165
166 $term = new ilGlossaryTerm($this->getTermId());
167
168 $this->setId($ilDB->nextId("glossary_definition"));
169
170 $ilAtomQuery = $ilDB->buildAtomQuery();
171 $ilAtomQuery->addTableLock('glossary_definition');
172
173 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
174
175 // get maximum definition number
176 $q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = " .
177 $ilDB->quote($this->getTermId(), "integer");
178 $max_set = $ilDB->query($q);
179 $max_rec = $ilDB->fetchAssoc($max_set);
180 $max = (int) $max_rec["max_nr"];
181
182 // insert new definition record
183 $ilDB->manipulate("INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)" .
184 " VALUES (" .
185 $ilDB->quote($this->getId(), "integer") . "," .
186 $ilDB->quote($this->getTermId(), "integer") . "," .
187 $ilDB->quote($this->getShortText(), "text") . ", " .
188 $ilDB->quote(($max + 1), "integer") . ", " .
189 $ilDB->quote($this->getShortTextDirty(), "integer") .
190 ")");
191 });
192
193 $ilAtomQuery->run();
194
195 // get number
196 $q = "SELECT nr FROM glossary_definition WHERE id = " .
197 $ilDB->quote($this->id, "integer");
198 $def_set = $ilDB->query($q);
199 $def_rec = $ilDB->fetchAssoc($def_set);
200 $this->setNr($def_rec["nr"]);
201
202 // meta data will be created by
203 // import parser
204 if (!$a_upload) {
205 $this->createMetaData();
206 }
207
208 if (!$a_omit_page_creation) {
209 $this->page_object = new ilGlossaryDefPage();
210 $this->page_object->setId($this->getId());
211 $this->page_object->setParentId($term->getGlossaryId());
212 $this->page_object->create(false);
213 }
214 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

Definition at line 467 of file class.ilGlossaryDefinition.php.

467 : void
468 {
471 $md_creator = new ilMDCreator($glo_id, $this->getId(), $this->getType());
472 $md_creator->setTitle($this->getTitle());
473 $md_creator->setTitleLanguage($lang);
474 $md_creator->setDescription($this->getDescription());
475 $md_creator->setDescriptionLanguage($lang);
476 $md_creator->setKeywordLanguage($lang);
477 $md_creator->setLanguage($lang);
478 $md_creator->create();
479 }
static _lookLanguage(int $term_id)
lookup term language
static _lookGlossaryID(int $term_id)
get glossary id form term id
$lang
Definition: xapiexit.php:26

References $lang, ilGlossaryTerm\_lookGlossaryID(), ilGlossaryTerm\_lookLanguage(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ delete()

ilGlossaryDefinition::delete ( )

Definition at line 216 of file class.ilGlossaryDefinition.php.

216 : void
217 {
219
220 $ilAtomQuery = $ilDB->buildAtomQuery();
221 $ilAtomQuery->addTableLock("glossary_definition");
222
223 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
224
225 // be sure to get the right number
226 $q = "SELECT * FROM glossary_definition WHERE id = " .
227 $ilDB->quote($this->id, "integer");
228 $def_set = $ilDB->query($q);
229 $def_rec = $ilDB->fetchAssoc($def_set);
230 $this->setNr($def_rec["nr"]);
231
232 // update numbers of other definitions
233 $ilDB->manipulate("UPDATE glossary_definition SET " .
234 " nr = nr - 1 " .
235 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
236 " AND nr > " . $ilDB->quote($this->getNr(), "integer"));
237
238 // delete current definition
239 $ilDB->manipulate("DELETE FROM glossary_definition " .
240 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
241 });
242 $ilAtomQuery->run();
243
244 // delete page and meta data
245 $this->page_object->delete();
246
247 // delete meta data
248 $this->deleteMetaData();
249 }

References $ilDB.

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

Definition at line 498 of file class.ilGlossaryDefinition.php.

498 : void
499 {
500 // Delete meta data
502 $md = new ilMD($glo_id, $this->getId(), $this->getType());
503 $md->deleteAll();
504 }

References ilGlossaryTerm\_lookGlossaryID(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ exportXML()

ilGlossaryDefinition::exportXML ( ilXmlWriter  $a_xml_writer,
int  $a_inst 
)

Definition at line 413 of file class.ilGlossaryDefinition.php.

416 : void {
417 $attrs = array();
418 $a_xml_writer->xmlStartTag("Definition", $attrs);
419
420 $this->exportXMLMetaData($a_xml_writer);
421 $this->exportXMLDefinition($a_xml_writer, $a_inst);
422
423 $a_xml_writer->xmlEndTag("Definition");
424 }
exportXMLDefinition(ilXmlWriter $a_xml_writer, int $a_inst=0)
export page objects meta data to xml
exportXMLMetaData(ilXmlWriter $a_xml_writer)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

◆ exportXMLDefinition()

ilGlossaryDefinition::exportXMLDefinition ( ilXmlWriter  $a_xml_writer,
int  $a_inst = 0 
)

export page objects meta data to xml

Definition at line 452 of file class.ilGlossaryDefinition.php.

455 : void {
456 $this->page_object->buildDom();
457 $this->page_object->insertInstIntoIDs($a_inst);
458 $this->mobs_contained = $this->page_object->collectMediaObjects(false);
459 $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
460 $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
461 $xml = str_replace("&", "&", $xml);
462 $a_xml_writer->appendXML($xml);
463
464 $this->page_object->freeDom();
465 }
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
appendXML(string $a_str)
append xml string to document
$xml
Definition: metadata.php:351

◆ exportXMLMetaData()

ilGlossaryDefinition::exportXMLMetaData ( ilXmlWriter  $a_xml_writer)

Definition at line 427 of file class.ilGlossaryDefinition.php.

429 : void {
431 $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
432 $md2xml->setExportMode(true);
433 $md2xml->startExport();
434 $a_xml_writer->appendXML($md2xml->getXML());
435 }

◆ getDefinitionList()

static ilGlossaryDefinition::getDefinitionList ( int  $a_term_id)
static

Definition at line 392 of file class.ilGlossaryDefinition.php.

392 : array
393 {
394 global $DIC;
395
396 $ilDB = $DIC->database();
397
398 $defs = array();
399 $q = "SELECT * FROM glossary_definition WHERE term_id = " .
400 $ilDB->quote($a_term_id, "integer") .
401 " ORDER BY nr";
402 $def_set = $ilDB->query($q);
403 while ($def_rec = $ilDB->fetchAssoc($def_set)) {
404 $defs[] = array("term_id" => $def_rec["term_id"],
405 "page_id" => (int) ($def_rec["page_id"] ?? 0), "id" => $def_rec["id"],
406 "short_text" => strip_tags($def_rec["short_text"], "<br>"),
407 "nr" => $def_rec["nr"],
408 "short_text_dirty" => $def_rec["short_text_dirty"]);
409 }
410 return $defs;
411 }

References $DIC, and $ilDB.

Referenced by ilSoapGLOStructureReader\_parseStructure(), ilGlossaryTerm\delete(), ILIAS\Glossary\Export\GlossaryHtmlExport\exportHTMLGlossaryTerms(), ilPresentationListTableGUI\fillRow(), ilTermListTableGUI\fillRow(), ilTermQuickListTableGUI\fillRow(), ilGlossaryTermGUI\getInternalLinks(), ilGlossaryExporter\getXmlExportTailDependencies(), ilGlossaryTermGUI\listDefinitions(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getDescription()

ilGlossaryDefinition::getDescription ( )

Definition at line 141 of file class.ilGlossaryDefinition.php.

141 : string
142 {
143 return $this->description;
144 }

References $description.

◆ getId()

ilGlossaryDefinition::getId ( )

Definition at line 81 of file class.ilGlossaryDefinition.php.

81 : int
82 {
83 return $this->id;
84 }

References $id.

◆ getNr()

ilGlossaryDefinition::getNr ( )

Definition at line 116 of file class.ilGlossaryDefinition.php.

116 : int
117 {
118 return $this->nr;
119 }

References $nr.

◆ getPageObject()

ilGlossaryDefinition::getPageObject ( )

Definition at line 126 of file class.ilGlossaryDefinition.php.

127 {
128 return $this->page_object;
129 }

References $page_object.

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

Definition at line 106 of file class.ilGlossaryDefinition.php.

106 : string
107 {
108 return $this->short_text;
109 }

References $short_text.

◆ getShortTextDirty()

ilGlossaryDefinition::getShortTextDirty ( )

Definition at line 156 of file class.ilGlossaryDefinition.php.

156 : bool
157 {
159 }

References $short_text_dirty.

◆ getTermId()

ilGlossaryDefinition::getTermId ( )

Definition at line 96 of file class.ilGlossaryDefinition.php.

96 : int
97 {
98 return $this->term_id;
99 }

References $term_id.

◆ getTitle()

ilGlossaryDefinition::getTitle ( )

Definition at line 131 of file class.ilGlossaryDefinition.php.

131 : string
132 {
133 return $this->title;
134 }

References $title.

◆ getType()

ilGlossaryDefinition::getType ( )

Definition at line 86 of file class.ilGlossaryDefinition.php.

86 : string
87 {
88 return "gdf";
89 }

◆ MDUpdateListener()

ilGlossaryDefinition::MDUpdateListener ( string  $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Even if this is not stored to db, it should be stored to the object e.g. for during import parsing

Definition at line 518 of file class.ilGlossaryDefinition.php.

518 : bool
519 {
520 switch ($a_element) {
521 case 'General':
522
523 // Update Title and description
525 $md = new ilMD($glo_id, $this->getId(), $this->getType());
526 $md_gen = $md->getGeneral();
527
528 //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
529 $this->setTitle($md_gen->getTitle());
530
531 foreach ($md_gen->getDescriptionIds() as $id) {
532 $md_des = $md_gen->getDescription($id);
533 //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
534 $this->setDescription($md_des->getDescription());
535 break;
536 }
537
538 break;
539
540 default:
541 }
542 return true;
543 }
setDescription(string $a_description)

References $id, ilGlossaryTerm\_lookGlossaryID(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ modifyExportIdentifier()

ilGlossaryDefinition::modifyExportIdentifier ( string  $a_tag,
string  $a_param,
string  $a_value 
)

Definition at line 437 of file class.ilGlossaryDefinition.php.

441 : string {
442 if ($a_tag == "Identifier" && $a_param == "Entry") {
443 $a_value = "il_" . IL_INST_ID . "_gdf_" . $this->getId();
444 }
445
446 return $a_value;
447 }
const IL_INST_ID
Definition: constants.php:40

References ILIAS\Survey\Mode\getId(), and IL_INST_ID.

+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

Definition at line 287 of file class.ilGlossaryDefinition.php.

287 : void
288 {
290
291 $ilAtomQuery = $ilDB->buildAtomQuery();
292 $ilAtomQuery->addTableLock('glossary_definition');
293
294 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
295
296 // be sure to get the right number
297 $q = "SELECT * FROM glossary_definition WHERE id = " .
298 $ilDB->quote($this->id, "integer");
299 $def_set = $ilDB->query($q);
300 $def_rec = $ilDB->fetchAssoc($def_set);
301 $this->setNr($def_rec["nr"]);
302
303 // get max number
304 $q = "SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = " .
305 $ilDB->quote($this->getTermId(), "integer");
306 $max_set = $ilDB->query($q);
307 $max_rec = $ilDB->fetchAssoc($max_set);
308
309 if ($this->getNr() >= $max_rec["max_nr"]) {
310 return;
311 }
312
313 // update numbers of other definitions
314 $ilDB->manipulate("UPDATE glossary_definition SET " .
315 " nr = nr - 1 " .
316 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
317 " AND nr = " . $ilDB->quote(($this->getNr() + 1), "integer"));
318
319 // delete current definition
320 $ilDB->manipulate("UPDATE glossary_definition SET " .
321 " nr = nr + 1 " .
322 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
323 " AND id = " . $ilDB->quote($this->getId(), "integer"));
324 });
325
326 $ilAtomQuery->run();
327 }

References $ilDB.

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

Definition at line 252 of file class.ilGlossaryDefinition.php.

252 : void
253 {
255
256 $ilAtomQuery = $ilDB->buildAtomQuery();
257 $ilAtomQuery->addTableLock('glossary_definition');
258
259 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
260
261 // be sure to get the right number
262 $q = "SELECT * FROM glossary_definition WHERE id = " .
263 $ilDB->quote($this->id, "integer");
264 $def_set = $ilDB->query($q);
265 $def_rec = $ilDB->fetchAssoc($def_set);
266 $this->setNr($def_rec["nr"]);
267
268 if ($this->getNr() < 2) {
269 return;
270 }
271
272 // update numbers of other definitions
273 $ilDB->manipulate("UPDATE glossary_definition SET " .
274 " nr = nr + 1 " .
275 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
276 " AND nr = " . $ilDB->quote(($this->getNr() - 1), "integer"));
277
278 // delete current definition
279 $ilDB->manipulate("UPDATE glossary_definition SET " .
280 " nr = nr - 1 " .
281 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
282 " AND id = " . $ilDB->quote($this->getId(), "integer"));
283 });
284 $ilAtomQuery->run();
285 }
manipulate(string $query)
Run a (write) Query on the database.

References $ilDB.

◆ read()

ilGlossaryDefinition::read ( )

Definition at line 59 of file class.ilGlossaryDefinition.php.

59 : void
60 {
62
63 $q = "SELECT * FROM glossary_definition WHERE id = " .
64 $ilDB->quote($this->id, "integer");
65 $def_set = $ilDB->query($q);
66 $def_rec = $ilDB->fetchAssoc($def_set);
67
68 $this->setTermId((int) $def_rec["term_id"]);
69 $this->setShortText((string) $def_rec["short_text"]);
70 $this->setNr((int) $def_rec["nr"]);
71 $this->setShortTextDirty((bool) $def_rec["short_text_dirty"]);
72
73 $this->page_object = new ilGlossaryDefPage($this->id);
74 }

References $db, $ilDB, setNr(), setShortText(), setShortTextDirty(), and setTermId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilGlossaryDefinition::setDescription ( string  $a_description)

Definition at line 146 of file class.ilGlossaryDefinition.php.

146 : void
147 {
148 $this->description = $a_description;
149 }

◆ setId()

ilGlossaryDefinition::setId ( int  $a_id)

Definition at line 76 of file class.ilGlossaryDefinition.php.

76 : void
77 {
78 $this->id = $a_id;
79 }

◆ setNr()

ilGlossaryDefinition::setNr ( int  $a_nr)

Definition at line 111 of file class.ilGlossaryDefinition.php.

111 : void
112 {
113 $this->nr = $a_nr;
114 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText ( string  $a_text)

Definition at line 101 of file class.ilGlossaryDefinition.php.

101 : void
102 {
103 $this->short_text = $this->shortenShortText($a_text);
104 }
shortenShortText(string $text)
Shorten short text.

References shortenShortText().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShortTextDirty()

ilGlossaryDefinition::setShortTextDirty ( bool  $a_val)

Definition at line 151 of file class.ilGlossaryDefinition.php.

151 : void
152 {
153 $this->short_text_dirty = $a_val;
154 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty ( int  $a_glo_id)
static

Set all short texts of glossary dirty (e.g.

if length is changed in settings)

Definition at line 567 of file class.ilGlossaryDefinition.php.

567 : void
568 {
569 global $DIC;
570
571 $ilDB = $DIC->database();
572
573 $term_ids = ilGlossaryTerm::getTermsOfGlossary($a_glo_id);
574
575 foreach ($term_ids as $term_id) {
576 $ilDB->manipulate(
577 "UPDATE glossary_definition SET " .
578 " short_text_dirty = " . $ilDB->quote(1, "integer") .
579 " WHERE term_id = " . $ilDB->quote($term_id, "integer")
580 );
581 }
582 }
static getTermsOfGlossary(int $a_glo_id)

References $DIC, $ilDB, and ilGlossaryTerm\getTermsOfGlossary().

Referenced by ilObjGlossaryGUI\saveProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShortTextsDirtyGlobally()

static ilGlossaryDefinition::setShortTextsDirtyGlobally ( )
static

Set short texts dirty (for all glossaries)

Definition at line 587 of file class.ilGlossaryDefinition.php.

587 : void
588 {
589 global $DIC;
590
591 $ilDB = $DIC->database();
592
593 $ilDB->manipulate(
594 "UPDATE glossary_definition SET " .
595 " short_text_dirty = " . $ilDB->quote(1, "integer")
596 );
597 }

References $DIC, and $ilDB.

Referenced by ilObjAdvancedEditingGUI\initGeneralPageSettingsForm().

+ Here is the caller graph for this function:

◆ setTermId()

ilGlossaryDefinition::setTermId ( int  $a_term_id)

Definition at line 91 of file class.ilGlossaryDefinition.php.

91 : void
92 {
93 $this->term_id = $a_term_id;
94 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilGlossaryDefinition::setTitle ( string  $a_title)

Definition at line 136 of file class.ilGlossaryDefinition.php.

136 : void
137 {
138 $this->title = $a_title;
139 }

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText ( string  $text)

Shorten short text.

Definition at line 346 of file class.ilGlossaryDefinition.php.

346 : string
347 {
348 $a_length = 196;
349
350 if ($this->getTermId() > 0) {
353 if ($snippet_length > 0) {
354 $a_length = $snippet_length;
355 }
356 }
357
358 $text = str_replace("<br/>", "<br>", $text);
359 $text = strip_tags($text, "<br>");
360 $offset = 0;
361 if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]"))) {
362 $offset = 5;
363 }
364 $short = ilStr::shortenTextExtended($text, $a_length - 16 + $offset, true);
365
366 // make short text longer, if tex end tag is missing
367 $ltexs = strrpos($short, "[tex]");
368 $ltexe = strrpos($short, "[/tex]");
369 if ($ltexs > $ltexe) {
370 $ltexe = strpos($text, "[/tex]", $ltexs);
371 if ($ltexe > 0) {
372 $text = ilStr::shortenTextExtended($text, $ltexe + 6, true);
373 }
374 }
375
376 $short = ilStr::shortenTextExtended($text, $a_length, true);
377
378 return $short;
379 }
static lookupSnippetLength(int $a_id)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)

References ilGlossaryTerm\_lookGlossaryID(), ilObjGlossary\lookupSnippetLength(), and ilStr\shortenTextExtended().

Referenced by setShortText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilGlossaryDefinition::update ( )

Definition at line 329 of file class.ilGlossaryDefinition.php.

329 : void
330 {
332
333 $this->updateMetaData();
334
335 $ilDB->manipulate("UPDATE glossary_definition SET " .
336 " term_id = " . $ilDB->quote($this->getTermId(), "integer") . ", " .
337 " nr = " . $ilDB->quote($this->getNr(), "integer") . ", " .
338 " short_text = " . $ilDB->quote($this->getShortText(), "text") . ", " .
339 " short_text_dirty = " . $ilDB->quote($this->getShortTextDirty(), "integer") . " " .
340 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
341 }

References $ilDB.

◆ updateMetaData()

ilGlossaryDefinition::updateMetaData ( )

Definition at line 481 of file class.ilGlossaryDefinition.php.

481 : void
482 {
484 $md = new ilMD($glo_id, $this->getId(), $this->getType());
485 $md_gen = $md->getGeneral();
486 $md_gen->setTitle($this->getTitle());
487
488 // sets first description (maybe not appropriate)
489 $md_des_ids = $md_gen->getDescriptionIds();
490 if (count($md_des_ids) > 0) {
491 $md_des = $md_gen->getDescription($md_des_ids[0]);
492 $md_des->setDescription($this->getDescription());
493 $md_des->update();
494 }
495 $md_gen->update();
496 }

References ilGlossaryTerm\_lookGlossaryID(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ updateShortText()

ilGlossaryDefinition::updateShortText ( )

Definition at line 381 of file class.ilGlossaryDefinition.php.

381 : void
382 {
383 $this->page_object->buildDom();
384 $text = $this->page_object->getFirstParagraphText();
385 $short = $this->shortenShortText($text);
386
387 $this->setShortText($short);
388 $this->setShortTextDirty(false);
389 $this->update();
390 }

Field Documentation

◆ $db

ilDBInterface ilGlossaryDefinition::$db
protected

Definition at line 28 of file class.ilGlossaryDefinition.php.

Referenced by read().

◆ $description

string ilGlossaryDefinition::$description = ""
protected

Definition at line 26 of file class.ilGlossaryDefinition.php.

Referenced by getDescription().

◆ $files_contained

array ilGlossaryDefinition::$files_contained = []
protected

Definition at line 24 of file class.ilGlossaryDefinition.php.

◆ $glo_id

int ilGlossaryDefinition::$glo_id = 0

Definition at line 34 of file class.ilGlossaryDefinition.php.

◆ $id

int ilGlossaryDefinition::$id = 0

Definition at line 32 of file class.ilGlossaryDefinition.php.

Referenced by getId().

◆ $lng

ilLanguage ilGlossaryDefinition::$lng

Definition at line 30 of file class.ilGlossaryDefinition.php.

Referenced by __construct().

◆ $mobs_contained

array ilGlossaryDefinition::$mobs_contained = []
protected

Definition at line 25 of file class.ilGlossaryDefinition.php.

◆ $nr

int ilGlossaryDefinition::$nr = 0

Definition at line 37 of file class.ilGlossaryDefinition.php.

Referenced by getNr().

◆ $page_object

ilGlossaryDefPage ilGlossaryDefinition::$page_object

Definition at line 35 of file class.ilGlossaryDefinition.php.

Referenced by getPageObject().

◆ $short_text

string ilGlossaryDefinition::$short_text = ""

Definition at line 36 of file class.ilGlossaryDefinition.php.

Referenced by getShortText().

◆ $short_text_dirty

bool ilGlossaryDefinition::$short_text_dirty = false

Definition at line 38 of file class.ilGlossaryDefinition.php.

Referenced by getShortTextDirty().

◆ $term_id

int ilGlossaryDefinition::$term_id = 0

Definition at line 33 of file class.ilGlossaryDefinition.php.

Referenced by getTermId().

◆ $title

string ilGlossaryDefinition::$title = ""
protected

Definition at line 27 of file class.ilGlossaryDefinition.php.

Referenced by getTitle().

◆ $tpl

ilGlobalTemplateInterface ilGlossaryDefinition::$tpl

Definition at line 31 of file class.ilGlossaryDefinition.php.

Referenced by __construct().

◆ $user

ilObjUser ilGlossaryDefinition::$user
protected

Definition at line 29 of file class.ilGlossaryDefinition.php.


The documentation for this class was generated from the following file: