Skip to content

How User Trackers work on TikiWiki

romoxi edited this page Sep 10, 2020 · 6 revisions

Unfortunately the I found no description how the tracker stuff is managed in the database.

By study some code, take a look at the tabels in the DB and a little bit trial and error I found out:

In the DB are the following tables:

tiki_trackers

  • trackerId (unique ID)
  • name (some name for the tracker)
  • description (some description)
  • descriptionParsed
  • created
  • lastModif
  • items (number of item in the tracker)

tiki_tracker_fields

  • fieldId (unique ID)
  • trackerId (ID from tiki_trackers)
  • name (some name for the field - is displayed in the form where you manage the trackers)
  • permName (permanent fieldname - should not be changed)
  • and a lot of more (not interesting for understanding the concept)

tiki_tracker_items

  • itemId (unique ID)
  • trackerId
  • created
  • createdBy
  • status
  • lastModif
  • lastModifBy

tiki_tracker_item_fields

  • itemId (from tiki_trackers_items)
  • fieldId (the fieldId from tiki_trackers_fields)
  • value (here comes the stuff you want to store)

tiki_tracker_item_attachments

dont know anything about

tiki_tracker_item_filed_logs

dont know anything about

tiki_tracker_options

dont know anything about

Inserting a new Item in a Tracker

First you have to kown the right trackerId. Insert a new record in tiki_tracker_items. The Field itemId is auto increment by the database. Read the last_insert_id.

Get the fieldId from tiki_tracker_fields for the field you want to save a value.

Insert a new record in tiki_tracker_item_fields with the fieldId, the last_insert_id and the value you want to save.