ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilGlossaryDefinition Class Reference

Class ilGlossaryDefinition. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 ilGlossaryDefinition ($a_id=0)
 Constructor @access public. More...
 
 read ()
 read data of content object More...
 
 setId ($a_id)
 
 getId ()
 
 getType ()
 
 setTermId ($a_term_id)
 
 getTermId ()
 
 setShortText ($a_text)
 
 getShortText ()
 
 setNr ($a_nr)
 
 getNr ()
 
 assignPageObject (&$a_page_object)
 
getPageObject ()
 
 getTitle ()
 get title of content object More...
 
 setTitle ($a_title)
 set title of content object More...
 
 getDescription ()
 Get description. More...
 
 setDescription ($a_description)
 Set description. More...
 
 setShortTextDirty ($a_val)
 Set short text dirty. More...
 
 getShortTextDirty ()
 Get short text dirty. More...
 
 create ($a_upload=false, $a_omit_page_creation=false)
 Create definition. More...
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 update ()
 
 shortenShortText ($text)
 Shorten short text. More...
 
 updateShortText ()
 
 getDefinitionList ($a_term_id)
 static More...
 
 exportXML (&$a_xml_writer, $a_inst)
 export xml More...
 
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd) More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 exportXMLDefinition (&$a_xml_writer, $a_inst=0)
 export page objects meta data to xml (see ilias_co.dtd) More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 _lookupTermId ($a_def_id)
 Looks up term id for a definition id. More...
 

Static Public Member Functions

static setShortTextsDirty ($a_glo_id)
 Set short texts dirty. More...
 

Data Fields

 $ilias
 
 $lng
 
 $tpl
 
 $id
 
 $term_id
 
 $glo_id
 
 $page_object
 
 $short_text
 
 $nr
 
 $short_text_dirty = false
 

Detailed Description

Class ilGlossaryDefinition.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _lookupTermId()

ilGlossaryDefinition::_lookupTermId (   $a_def_id)

Looks up term id for a definition id.

Parameters
int$a_def_iddefinition id

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

646 {
647 global $ilDB;
648
649 $q = "SELECT * FROM glossary_definition WHERE id = ".
650 $ilDB->quote($a_def_id, "integer");
651 $def_set = $ilDB->query($q);
652 $def_rec = $ilDB->fetchAssoc($def_set);
653
654 return $def_rec["term_id"];
655 }
global $ilDB

References $ilDB.

Referenced by ilObjMediaObjectAccess\checkAccessGlossaryTerm(), ilTermUsagesTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilObjMediaObject\getParentObjectIdForUsage(), and ilLMContentSearch\performSearch().

+ Here is the caller graph for this function:

◆ assignPageObject()

ilGlossaryDefinition::assignPageObject ( $a_page_object)

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

113 {
114 $this->page_object =& $a_page_object;
115 }

◆ create()

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

Create definition.

Parameters
booleanupload true/false

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

185 {
186 global $ilDB;
187
188 $term =& new ilGlossaryTerm($this->getTermId());
189
190 $this->setId($ilDB->nextId("glossary_definition"));
191
192 // lock glossary_definition table
193 $ilDB->lockTables(
194 array(
195 0 => array('name' => 'glossary_definition', 'type' => ilDB::LOCK_WRITE)));
196
197 // get maximum definition number
198 $q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = ".
199 $ilDB->quote($this->getTermId(), "integer");
200 $max_set = $ilDB->query($q);
201 $max_rec = $ilDB->fetchAssoc($max_set);
202 $max = (int) $max_rec["max_nr"];
203
204 // insert new definition record
205 $ilDB->manipulate("INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)".
206 " VALUES (".
207 $ilDB->quote($this->getId(), "integer").",".
208 $ilDB->quote($this->getTermId(), "integer").",".
209 $ilDB->quote($this->getShortText(), "text").", ".
210 $ilDB->quote(($max + 1), "integer").", ".
211 $ilDB->quote($this->getShortTextDirty(), "integer").
212 ")");
213
214 // unlock glossary definition table
215 $ilDB->unlockTables();
216
217 // get number
218 $q = "SELECT nr FROM glossary_definition WHERE id = ".
219 $ilDB->quote($this->id, "integer");
220 $def_set = $ilDB->query($q);
221 $def_rec = $ilDB->fetchAssoc($def_set);
222 $this->setNr($def_rec["nr"]);
223
224 // meta data will be created by
225 // import parser
226 if (!$a_upload)
227 {
228 $this->createMetaData();
229 }
230
231 if (!$a_omit_page_creation)
232 {
233 $this->page_object = new ilGlossaryDefPage();
234 $this->page_object->setId($this->getId());
235 $this->page_object->setParentId($term->getGlossaryId());
236 $this->page_object->create();
237 }
238 }
const LOCK_WRITE
Definition: class.ilDB.php:30
Glossary definition page object.
createMetaData()
create meta data entry
getShortTextDirty()
Get short text dirty.
Class ilGlossaryTerm.

References $ilDB, createMetaData(), getId(), getShortText(), getShortTextDirty(), getTermId(), ilDB\LOCK_WRITE, setId(), and setNr().

+ Here is the call graph for this function:

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

create meta data entry

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

538 {
539 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
540
541 global $ilUser;
542
545 $md_creator = new ilMDCreator($glo_id,$this->getId(),$this->getType());
546 $md_creator->setTitle($this->getTitle());
547 $md_creator->setTitleLanguage($lang);
548 $md_creator->setDescription($this->getDescription());
549 $md_creator->setDescriptionLanguage($lang);
550 $md_creator->setKeywordLanguage($lang);
551 $md_creator->setLanguage($lang);
552//echo "-".$this->getTitle()."-"; exit;
553 $md_creator->create();
554
555 return true;
556 }
getTitle()
get title of content object
static _lookGlossaryID($term_id)
get glossary id form term id
static _lookLanguage($term_id)
lookup term language
global $ilUser
Definition: imgupload.php:15

References $glo_id, $ilUser, $lang, ilGlossaryTerm\_lookGlossaryID(), ilGlossaryTerm\_lookLanguage(), getDescription(), getId(), getTermId(), getTitle(), and getType().

Referenced by create().

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

◆ delete()

ilGlossaryDefinition::delete ( )

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

241 {
242 global $ilDB;
243
244 // lock glossary_definition table
245 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
246 $ilDB->lockTables(
247 array(
248 0 => array('name' => 'glossary_definition', 'type' => ilDB::LOCK_WRITE)));
249
250
251 // be sure to get the right number
252 $q = "SELECT * FROM glossary_definition WHERE id = ".
253 $ilDB->quote($this->id, "integer");
254 $def_set = $ilDB->query($q);
255 $def_rec = $ilDB->fetchAssoc($def_set);
256 $this->setNr($def_rec["nr"]);
257
258 // update numbers of other definitions
259 $ilDB->manipulate("UPDATE glossary_definition SET ".
260 " nr = nr - 1 ".
261 " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
262 " AND nr > ".$ilDB->quote($this->getNr(), "integer"));
263
264 // delete current definition
265 $ilDB->manipulate("DELETE FROM glossary_definition ".
266 " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
267
268 // unlock glossary_definition table
269 $ilDB->unlockTables();
270
271 // delete page and meta data
272 $this->page_object->delete();
273
274 // delete meta data
275 $this->deleteMetaData();
276/*
277 $nested = new ilNestedSetXML();
278 $nested->init($this->getId(), $this->getType());
279 $nested->deleteAllDBData();
280*/
281 }
deleteMetaData()
delete meta data entry

References $ilDB, deleteMetaData(), ilDB\LOCK_WRITE, and setNr().

+ Here is the call graph for this function:

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

delete meta data entry

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

587 {
588 // Delete meta data
589 include_once('Services/MetaData/classes/class.ilMD.php');
591 $md = new ilMD($glo_id, $this->getId(), $this->getType());
592 $md->deleteAll();
593 }

References $glo_id, ilGlossaryTerm\_lookGlossaryID(), getId(), getTermId(), and getType().

Referenced by delete().

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

◆ exportXML()

ilGlossaryDefinition::exportXML ( $a_xml_writer,
  $a_inst 
)

export xml

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

472 {
473 $attrs = array();
474 $a_xml_writer->xmlStartTag("Definition", $attrs);
475
476 $this->exportXMLMetaData($a_xml_writer);
477 $this->exportXMLDefinition($a_xml_writer, $a_inst);
478
479 $a_xml_writer->xmlEndTag("Definition");
480 }
exportXMLDefinition(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)

References exportXMLDefinition(), and exportXMLMetaData().

+ Here is the call graph for this function:

◆ exportXMLDefinition()

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

export page objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

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

520 {
521
522 $this->page_object->buildDom();
523 $this->page_object->insertInstIntoIDs($a_inst);
524 $this->mobs_contained = $this->page_object->collectMediaObjects(false);
525 include_once("./Services/COPage/classes/class.ilPCFileList.php");
526 $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
527 $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
528 $xml = str_replace("&","&", $xml);
529 $a_xml_writer->appendXML($xml);
530
531 $this->page_object->freeDom();
532 }
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.

References ilPCFileList\collectFileItems().

Referenced by exportXML().

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

◆ exportXMLMetaData()

ilGlossaryDefinition::exportXMLMetaData ( $a_xml_writer)

export content objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

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

490 {
492 include_once("Services/MetaData/classes/class.ilMD2XML.php");
493 $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
494 $md2xml->setExportMode(true);
495 $md2xml->startExport();
496 $a_xml_writer->appendXML($md2xml->getXML());
497 }

References $glo_id, ilGlossaryTerm\_lookGlossaryID(), getId(), getTermId(), and getType().

Referenced by exportXML().

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

◆ getDefinitionList()

ilGlossaryDefinition::getDefinitionList (   $a_term_id)

static

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

449 {
450 global $ilDB;
451
452 $defs = array();
453 $q = "SELECT * FROM glossary_definition WHERE term_id = ".
454 $ilDB->quote($a_term_id, "integer").
455 " ORDER BY nr";
456 $def_set = $ilDB->query($q);
457 while ($def_rec = $ilDB->fetchAssoc($def_set))
458 {
459 $defs[] = array("term_id" => $def_rec["term_id"],
460 "page_id" => $def_rec["page_id"], "id" => $def_rec["id"],
461 "short_text" => strip_tags($def_rec["short_text"], "<br>"),
462 "nr" => $def_rec["nr"],
463 "short_text_dirty" => $def_rec["short_text_dirty"]);
464 }
465 return $defs;
466 }

References $ilDB.

Referenced by ilGlossaryTerm\_copyTerm(), ilSoapGLOStructureReader\_parseStructure(), ilGlossaryTerm\delete(), ilObjGlossary\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilSCORM2004Asset\exportHTMLPageObjects(), ilGlossaryTerm\exportXML(), ilObjGlossary\exportXML(), ilPresentationListTableGUI\fillRow(), ilTermListTableGUI\fillRow(), ilTermQuickListTableGUI\fillRow(), ilGlossaryTermGUI\getInternalLinks(), ilGlossaryExporter\getXmlExportTailDependencies(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryTermGUI\output(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getDescription()

ilGlossaryDefinition::getDescription ( )

Get description.

Returns
string description

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

146 {
147 return $this->description;
148 }

Referenced by createMetaData(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getId()

ilGlossaryDefinition::getId ( )

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

References $id.

Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), modifyExportIdentifier(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getNr()

ilGlossaryDefinition::getNr ( )

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

References $nr.

Referenced by moveDown(), and moveUp().

+ Here is the caller graph for this function:

◆ getPageObject()

& ilGlossaryDefinition::getPageObject ( )

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

References $page_object.

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

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

References $short_text.

Referenced by create().

+ Here is the caller graph for this function:

◆ getShortTextDirty()

ilGlossaryDefinition::getShortTextDirty ( )

Get short text dirty.

Returns
boolean short text dirty

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

References $short_text_dirty.

Referenced by create().

+ Here is the caller graph for this function:

◆ getTermId()

ilGlossaryDefinition::getTermId ( )

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

References $term_id.

Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), moveDown(), shortenShortText(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getTitle()

ilGlossaryDefinition::getTitle ( )

get title of content object

Returns
string title

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

128 {
129 return $this->title;
130 }

Referenced by createMetaData(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getType()

ilGlossaryDefinition::getType ( )

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

78 {
79 return "gdf";
80 }

Referenced by createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), and updateMetaData().

+ Here is the caller graph for this function:

◆ ilGlossaryDefinition()

ilGlossaryDefinition::ilGlossaryDefinition (   $a_id = 0)

Constructor @access public.

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

33 {
34 global $lng, $ilias, $tpl;
35
36 $this->lng =& $lng;
37 $this->ilias =& $ilias;
38 $this->tpl =& $tpl;
39
40 $this->id = $a_id;
41 if ($a_id != 0)
42 {
43 $this->read();
44 }
45 }
read()
read data of content object
redirection script todo: (a better solution should control the processing via a xml file)

References $ilias, $lng, $tpl, and read().

+ Here is the call graph for this function:

◆ MDUpdateListener()

ilGlossaryDefinition::MDUpdateListener (   $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

Parameters
string$a_element

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

610 {
611 include_once 'Services/MetaData/classes/class.ilMD.php';
612
613 switch($a_element)
614 {
615 case 'General':
616
617 // Update Title and description
619 $md =& new ilMD($glo_id, $this->getId(), $this->getType());
620 $md_gen = $md->getGeneral();
621
622 //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
623 $this->setTitle($md_gen->getTitle());
624
625 foreach($md_gen->getDescriptionIds() as $id)
626 {
627 $md_des = $md_gen->getDescription($id);
628 //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
629 $this->setDescription($md_des->getDescription());
630 break;
631 }
632
633 break;
634
635 default:
636 }
637 return true;
638 }
setDescription($a_description)
Set description.
setTitle($a_title)
set title of content object

References $glo_id, $id, ilGlossaryTerm\_lookGlossaryID(), getId(), getTermId(), getType(), setDescription(), and setTitle().

+ Here is the call graph for this function:

◆ modifyExportIdentifier()

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

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

503 {
504 if ($a_tag == "Identifier" && $a_param == "Entry")
505 {
506 $a_value = "il_".IL_INST_ID."_gdf_".$this->getId();
507 }
508
509 return $a_value;
510 }

References getId().

+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

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

326 {
327 global $ilDB;
328
329 // lock glossary_definition table
330 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
331 $ilDB->lockTables(
332 array(
333 0 => array('name' => 'glossary_definition', 'type' => ilDB::LOCK_WRITE)));
334
335 // be sure to get the right number
336 $q = "SELECT * FROM glossary_definition WHERE id = ".
337 $ilDB->quote($this->id, "integer");
338 $def_set = $ilDB->query($q);
339 $def_rec = $ilDB->fetchAssoc($def_set);
340 $this->setNr($def_rec["nr"]);
341
342 // get max number
343 $q = "SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = ".
344 $ilDB->quote($this->getTermId(), "integer");
345 $max_set = $ilDB->query($q);
346 $max_rec = $ilDB->fetchAssoc($max_set);
347
348 if ($this->getNr() >= $max_rec["max_nr"])
349 {
350 $ilDB->unlockTables();
351 return;
352 }
353
354 // update numbers of other definitions
355 $ilDB->manipulate("UPDATE glossary_definition SET ".
356 " nr = nr - 1 ".
357 " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
358 " AND nr = ".$ilDB->quote(($this->getNr() + 1), "integer"));
359
360 // delete current definition
361 $ilDB->manipulate("UPDATE glossary_definition SET ".
362 " nr = nr + 1 ".
363 " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
364 " AND id = ".$ilDB->quote($this->getId(), "integer"));
365
366 // unlock glossary_definition table
367 $ilDB->unlockTables();
368
369 }

References $ilDB, getNr(), getTermId(), ilDB\LOCK_WRITE, and setNr().

+ Here is the call graph for this function:

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

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

285 {
286 global $ilDB;
287
288 // lock glossary_definition table
289 #ilDB::_lockTables(array('glossary_definition' => 'WRITE'));
290 $ilDB->lockTables(
291 array(
292 0 => array('name' => 'glossary_definition', 'type' => ilDB::LOCK_WRITE)));
293
294
295 // be sure to get the right number
296 $q = "SELECT * FROM glossary_definition WHERE id = ".
297 $ilDB->quote($this->id, "integer");
298 $def_set = $ilDB->query($q);
299 $def_rec = $ilDB->fetchAssoc($def_set);
300 $this->setNr($def_rec["nr"]);
301
302 if ($this->getNr() < 2)
303 {
304 $ilDB->unlockTables();
305 return;
306 }
307
308 // update numbers of other definitions
309 $ilDB->manipulate("UPDATE glossary_definition SET ".
310 " nr = nr + 1 ".
311 " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
312 " AND nr = ".$ilDB->quote(($this->getNr() - 1), "integer"));
313
314 // delete current definition
315 $ilDB->manipulate("UPDATE glossary_definition SET ".
316 " nr = nr - 1 ".
317 " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
318 " AND id = ".$ilDB->quote($this->getId(), "integer"));
319
320 // unlock glossary_definition table
321 $ilDB->unlockTables();
322 }

References $ilDB, getNr(), ilDB\LOCK_WRITE, and setNr().

+ Here is the call graph for this function:

◆ read()

ilGlossaryDefinition::read ( )

read data of content object

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

51 {
52 global $ilDB;
53
54 $q = "SELECT * FROM glossary_definition WHERE id = ".
55 $ilDB->quote($this->id, "integer");
56 $def_set = $ilDB->query($q);
57 $def_rec = $ilDB->fetchAssoc($def_set);
58
59 $this->setTermId($def_rec["term_id"]);
60 $this->setShortText($def_rec["short_text"]);
61 $this->setNr($def_rec["nr"]);
62 $this->setShortTextDirty($def_rec["short_text_dirty"]);
63
64 $this->page_object = new ilGlossaryDefPage($this->id);
65 }
setShortTextDirty($a_val)
Set short text dirty.

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

Referenced by ilGlossaryDefinition().

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

◆ setDescription()

ilGlossaryDefinition::setDescription (   $a_description)

Set description.

Parameters
stringdescription

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

156 {
157 $this->description = $a_description;
158 }

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ setId()

ilGlossaryDefinition::setId (   $a_id)

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

68 {
69 $this->id = $a_id;
70 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setNr()

ilGlossaryDefinition::setNr (   $a_nr)

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

103 {
104 $this->nr = $a_nr;
105 }

Referenced by create(), delete(), moveDown(), moveUp(), and read().

+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText (   $a_text)

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

93 {
94 $this->short_text = $this->shortenShortText($a_text);
95 }
shortenShortText($text)
Shorten short text.

References shortenShortText().

Referenced by read(), and updateShortText().

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

◆ setShortTextDirty()

ilGlossaryDefinition::setShortTextDirty (   $a_val)

Set short text dirty.

Parameters
booleanshort text dirty

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

166 {
167 $this->short_text_dirty = $a_val;
168 }

Referenced by read(), and updateShortText().

+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty (   $a_glo_id)
static

Set short texts dirty.

Parameters

return

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

664 {
665 global $ilDB;
666
667 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
668 $term_ids = ilGlossaryTerm::getTermsOfGlossary($a_glo_id);
669
670 foreach ($term_ids as $term_id)
671 {
672 $ilDB->manipulate("UPDATE glossary_definition SET ".
673 " short_text_dirty = ".$ilDB->quote(1, "integer").
674 " WHERE term_id = ".$ilDB->quote($term_id, "integer")
675 );
676 }
677 }
static getTermsOfGlossary($a_glo_id)
Get terms of glossary.

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

Referenced by ilObjGlossaryGUI\saveProperties().

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

◆ setTermId()

ilGlossaryDefinition::setTermId (   $a_term_id)

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

83 {
84 $this->term_id = $a_term_id;
85 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilGlossaryDefinition::setTitle (   $a_title)

set title of content object

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

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

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText (   $text)

Shorten short text.

Parameters

return

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

393 {
394 $a_length = 196;
395
396 if ($this->getTermId() > 0)
397 {
398 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
399 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
400 $glo_id = ilGlossaryTerm::_lookGlossaryId($this->getTermId());
402 if ($snippet_length > 0)
403 {
404 $a_length = $snippet_length;
405 }
406 }
407
408 $text = str_replace("<br/>", "<br>", $text);
409 $text = strip_tags($text, "<br>");
410 if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]")))
411 {
412 $offset = 5;
413 }
414 $short = ilUtil::shortenText($text, $a_length - 16 + $offset, true);
415
416 // make short text longer, if tex end tag is missing
417 $ltexs = strrpos($short, "[tex]");
418 $ltexe = strrpos($short, "[/tex]");
419 if ($ltexs > $ltexe)
420 {
421 $ltexe = strpos($text, "[/tex]", $ltexs);
422 if ($ltexe > 0)
423 {
424 $short = ilUtil::shortenText($text, $ltexe+6, true);
425 }
426 }
427
428 $short = ilUtil::shortenText($text, $a_length, true);
429
430 return $short;
431 }
static lookupSnippetLength($a_id)
Lookup snippet length.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
$text

References $glo_id, $text, getTermId(), ilObjGlossary\lookupSnippetLength(), and ilUtil\shortenText().

Referenced by setShortText(), and updateShortText().

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

◆ update()

ilGlossaryDefinition::update ( )

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

373 {
374 global $ilDB;
375
376 $this->updateMetaData();
377
378 $ilDB->manipulate("UPDATE glossary_definition SET ".
379 " term_id = ".$ilDB->quote($this->getTermId(), "integer").", ".
380 " nr = ".$ilDB->quote($this->getNr(), "integer").", ".
381 " short_text = ".$ilDB->quote($this->getShortText(), "text").", ".
382 " short_text_dirty = ".$ilDB->quote($this->getShortTextDirty(), "integer")." ".
383 " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
384 }
updateMetaData()
update meta data entry

References $ilDB, and updateMetaData().

Referenced by updateShortText().

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

◆ updateMetaData()

ilGlossaryDefinition::updateMetaData ( )

update meta data entry

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

562 {
563 include_once("Services/MetaData/classes/class.ilMD.php");
564 include_once("Services/MetaData/classes/class.ilMDGeneral.php");
565 include_once("Services/MetaData/classes/class.ilMDDescription.php");
566
568 $md =& new ilMD($glo_id, $this->getId(), $this->getType());
569 $md_gen =& $md->getGeneral();
570 $md_gen->setTitle($this->getTitle());
571
572 // sets first description (maybe not appropriate)
573 $md_des_ids =& $md_gen->getDescriptionIds();
574 if (count($md_des_ids) > 0)
575 {
576 $md_des =& $md_gen->getDescription($md_des_ids[0]);
577 $md_des->setDescription($this->getDescription());
578 $md_des->update();
579 }
580 $md_gen->update();
581 }

References $glo_id, ilGlossaryTerm\_lookGlossaryID(), getDescription(), getId(), getTermId(), getTitle(), and getType().

Referenced by update().

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

◆ updateShortText()

ilGlossaryDefinition::updateShortText ( )

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

434 {
435 $this->page_object->buildDom();
436 $text = $this->page_object->getFirstParagraphText();
437
438 $short = $this->shortenShortText($text);
439
440 $this->setShortText($short);
441 $this->setShortTextDirty(false);
442 $this->update();
443 }

References $text, setShortText(), setShortTextDirty(), shortenShortText(), and update().

+ Here is the call graph for this function:

Field Documentation

◆ $glo_id

ilGlossaryDefinition::$glo_id

◆ $id

ilGlossaryDefinition::$id

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

Referenced by getId(), and MDUpdateListener().

◆ $ilias

ilGlossaryDefinition::$ilias

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

Referenced by ilGlossaryDefinition().

◆ $lng

ilGlossaryDefinition::$lng

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

Referenced by ilGlossaryDefinition().

◆ $nr

ilGlossaryDefinition::$nr

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

Referenced by getNr().

◆ $page_object

ilGlossaryDefinition::$page_object

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

Referenced by getPageObject().

◆ $short_text

ilGlossaryDefinition::$short_text

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

Referenced by getShortText().

◆ $short_text_dirty

ilGlossaryDefinition::$short_text_dirty = false

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

Referenced by getShortTextDirty().

◆ $term_id

ilGlossaryDefinition::$term_id

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

Referenced by getTermId(), and setShortTextsDirty().

◆ $tpl

ilGlossaryDefinition::$tpl

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

Referenced by ilGlossaryDefinition().


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