ILIAS  release_4-4 Revision
ilGlossaryDefinition Class Reference

Class ilGlossaryDefinition. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 ilGlossaryDefinition ($a_id=0)
 Constructor 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)
 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 642 of file class.ilGlossaryDefinition.php.

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

643  {
644  global $ilDB;
645 
646  $q = "SELECT * FROM glossary_definition WHERE id = ".
647  $ilDB->quote($a_def_id, "integer");
648  $def_set = $ilDB->query($q);
649  $def_rec = $ilDB->fetchAssoc($def_set);
650 
651  return $def_rec["term_id"];
652  }
+ 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)

Create definition.

Parameters
booleanupload true/false

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

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

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  $this->page_object = new ilGlossaryDefPage();
232  $this->page_object->setId($this->getId());
233  $this->page_object->setParentId($term->getGlossaryId());
234  $this->page_object->create();
235  }
Class ilGlossaryTerm.
const LOCK_WRITE
Definition: class.ilDB.php:30
Glossary definition page object.
createMetaData()
create meta data entry
getShortTextDirty()
Get short text dirty.
+ Here is the call graph for this function:

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

create meta data entry

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

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

Referenced by create().

535  {
536  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
537 
538  global $ilUser;
539 
542  $md_creator = new ilMDCreator($glo_id,$this->getId(),$this->getType());
543  $md_creator->setTitle($this->getTitle());
544  $md_creator->setTitleLanguage($lang);
545  $md_creator->setDescription($this->getDescription());
546  $md_creator->setDescriptionLanguage($lang);
547  $md_creator->setKeywordLanguage($lang);
548  $md_creator->setLanguage($lang);
549 //echo "-".$this->getTitle()."-"; exit;
550  $md_creator->create();
551 
552  return true;
553  }
_lookLanguage($term_id)
lookup term language
getTitle()
get title of content object
global $ilUser
Definition: imgupload.php:15
_lookGlossaryID($term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilGlossaryDefinition::delete ( )

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

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

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

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

delete meta data entry

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

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

Referenced by delete().

584  {
585  // Delete meta data
586  include_once('Services/MetaData/classes/class.ilMD.php');
588  $md = new ilMD($glo_id, $this->getId(), $this->getType());
589  $md->deleteAll();
590  }
_lookGlossaryID($term_id)
get glossary id form term id
+ 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 468 of file class.ilGlossaryDefinition.php.

References exportXMLDefinition(), and exportXMLMetaData().

469  {
470  $attrs = array();
471  $a_xml_writer->xmlStartTag("Definition", $attrs);
472 
473  $this->exportXMLMetaData($a_xml_writer);
474  $this->exportXMLDefinition($a_xml_writer, $a_inst);
475 
476  $a_xml_writer->xmlEndTag("Definition");
477  }
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)
+ 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 516 of file class.ilGlossaryDefinition.php.

References ilPCFileList\collectFileItems().

Referenced by exportXML().

517  {
518 
519  $this->page_object->buildDom();
520  $this->page_object->insertInstIntoIDs($a_inst);
521  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
522  include_once("./Services/COPage/classes/class.ilPCFileList.php");
523  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
524  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
525  $xml = str_replace("&","&", $xml);
526  $a_xml_writer->appendXML($xml);
527 
528  $this->page_object->freeDom();
529  }
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
+ 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 486 of file class.ilGlossaryDefinition.php.

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

Referenced by exportXML().

487  {
489  include_once("Services/MetaData/classes/class.ilMD2XML.php");
490  $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
491  $md2xml->setExportMode(true);
492  $md2xml->startExport();
493  $a_xml_writer->appendXML($md2xml->getXML());
494  }
_lookGlossaryID($term_id)
get glossary id form term id
+ 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 445 of file class.ilGlossaryDefinition.php.

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

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

Referenced by createMetaData(), and updateMetaData().

146  {
147  return $this->description;
148  }
+ 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().

73  {
74  return $this->id;
75  }
+ 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().

108  {
109  return $this->nr;
110  }
+ Here is the caller graph for this function:

◆ getPageObject()

& ilGlossaryDefinition::getPageObject ( )

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

References $page_object.

118  {
119  return $this->page_object;
120  }

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

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

References $short_text.

◆ 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.

Referenced by createMetaData(), and updateMetaData().

128  {
129  return $this->title;
130  }
+ Here is the caller graph for this function:

◆ getType()

ilGlossaryDefinition::getType ( )

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

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

78  {
79  return "gdf";
80  }
+ Here is the caller graph for this function:

◆ ilGlossaryDefinition()

ilGlossaryDefinition::ilGlossaryDefinition (   $a_id = 0)

Constructor public.

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

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

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  }
redirection script todo: (a better solution should control the processing via a xml file) ...
read()
read data of content object
+ 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 606 of file class.ilGlossaryDefinition.php.

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

607  {
608  include_once 'Services/MetaData/classes/class.ilMD.php';
609 
610  switch($a_element)
611  {
612  case 'General':
613 
614  // Update Title and description
616  $md =& new ilMD($glo_id, $this->getId(), $this->getType());
617  $md_gen = $md->getGeneral();
618 
619  //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
620  $this->setTitle($md_gen->getTitle());
621 
622  foreach($md_gen->getDescriptionIds() as $id)
623  {
624  $md_des = $md_gen->getDescription($id);
625  //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
626  $this->setDescription($md_des->getDescription());
627  break;
628  }
629 
630  break;
631 
632  default:
633  }
634  return true;
635  }
setDescription($a_description)
Set description.
setTitle($a_title)
set title of content object
_lookGlossaryID($term_id)
get glossary id form term id
+ Here is the call graph for this function:

◆ modifyExportIdentifier()

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

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

References getId().

500  {
501  if ($a_tag == "Identifier" && $a_param == "Entry")
502  {
503  $a_value = "il_".IL_INST_ID."_gdf_".$this->getId();
504  }
505 
506  return $a_value;
507  }
+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

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

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

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

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

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

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

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

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

Referenced by ilGlossaryDefinition().

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.
Glossary definition page object.
+ 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.

Referenced by MDUpdateListener().

156  {
157  $this->description = $a_description;
158  }
+ Here is the caller graph for this function:

◆ setId()

ilGlossaryDefinition::setId (   $a_id)

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

Referenced by create().

68  {
69  $this->id = $a_id;
70  }
+ Here is the caller graph for this function:

◆ setNr()

ilGlossaryDefinition::setNr (   $a_nr)

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

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

103  {
104  $this->nr = $a_nr;
105  }
+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText (   $a_text)

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

References shortenShortText().

Referenced by read(), and updateShortText().

93  {
94  $this->short_text = $this->shortenShortText($a_text);
95  }
shortenShortText($text)
Shorten short text.
+ 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.

Referenced by read(), and updateShortText().

166  {
167  $this->short_text_dirty = $a_val;
168  }
+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty (   $a_glo_id)
static

Set short texts dirty.

Parameters

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

References ilGlossaryTerm\getTermsOfGlossary().

Referenced by ilObjGlossaryGUI\saveProperties().

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

Referenced by read().

83  {
84  $this->term_id = $a_term_id;
85  }
+ 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.

Referenced by MDUpdateListener().

136  {
137  $this->title = $a_title;
138  }
+ Here is the caller graph for this function:

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText (   $text)

Shorten short text.

Parameters

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

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

Referenced by setShortText(), and updateShortText().

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

◆ update()

ilGlossaryDefinition::update ( )

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

References updateMetaData().

Referenced by updateShortText().

370  {
371  global $ilDB;
372 
373  $this->updateMetaData();
374 
375  $ilDB->manipulate("UPDATE glossary_definition SET ".
376  " term_id = ".$ilDB->quote($this->getTermId(), "integer").", ".
377  " nr = ".$ilDB->quote($this->getNr(), "integer").", ".
378  " short_text = ".$ilDB->quote($this->getShortText(), "text").", ".
379  " short_text_dirty = ".$ilDB->quote($this->getShortTextDirty(), "integer")." ".
380  " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
381  }
updateMetaData()
update meta data entry
+ 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 558 of file class.ilGlossaryDefinition.php.

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

Referenced by update().

559  {
560  include_once("Services/MetaData/classes/class.ilMD.php");
561  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
562  include_once("Services/MetaData/classes/class.ilMDDescription.php");
563 
565  $md =& new ilMD($glo_id, $this->getId(), $this->getType());
566  $md_gen =& $md->getGeneral();
567  $md_gen->setTitle($this->getTitle());
568 
569  // sets first description (maybe not appropriate)
570  $md_des_ids =& $md_gen->getDescriptionIds();
571  if (count($md_des_ids) > 0)
572  {
573  $md_des =& $md_gen->getDescription($md_des_ids[0]);
574  $md_des->setDescription($this->getDescription());
575  $md_des->update();
576  }
577  $md_gen->update();
578  }
getTitle()
get title of content object
_lookGlossaryID($term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateShortText()

ilGlossaryDefinition::updateShortText ( )

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

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

431  {
432  $this->page_object->buildDom();
433  $text = $this->page_object->getFirstParagraphText();
434 
435  $short = $this->shortenShortText($text);
436 
437  $this->setShortText($short);
438  $this->setShortTextDirty(false);
439  $this->update();
440  }
setShortTextDirty($a_val)
Set short text dirty.
shortenShortText($text)
Shorten short text.
+ Here is the call graph for this function:

Field Documentation

◆ $glo_id

ilGlossaryDefinition::$glo_id

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

◆ $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().

◆ $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: