The topic and article system is the most extensive and actively used feature of Midgard. Topic records form a hierarchical tree structure in which articles can be stored. Article records can for example represent normal articles or documents, parts of them, calendar entries, news items or organizational units.
The topic records form a tree hierarchy in the Midgard database. Each topic tree is started from a root topic whose up field is zero. The first level of the tree is formed by topis whose up fields point to the root topic, second level of topics with up fields pointing to records in the first level, and so on. One can traverse a tree branch from a given topic $topic to the root topic using the following code:
<ul> <?php for ($t = mgd_get_topic($topic); $t; $t = mgd_get_topic($t->up) ) ?> <li>&(t.name);</li> <?php endfor; ?> </ul>
The article records are the leaves of the topic tree. Each article record is linked to a topic by the topic field. There is no way to list all the articles in a database. Instead you can access the articles in a given topic or in the entire subtree starting from the topic.
A topic record contains information about a topic, its owner and its parent.
Fields of a topic record
The id of the topic record.
The id of the parent topic. A zero value in this field indicates that the topic is a toplevel topic.
The name of the topic record.
A freeform information field.
The group id of the owner of the topic.
An integer value that can be used for sorting.
A description of the topic.
Date and time of the last revision of the topic record.
Date and time the topic record was created.
The id of the person that last revised the topic.
The id of the person that created the topic record.
The number of revisions made on the record.
A field that can be used to store executable code in.
The id of the sitegroup the record belongs to.
This section describes the content of topic objects. Most object parameters map directly to the record fields described above.
The functions listed within the object definition are the object methods that are available for the object. Usage information about those methods can be found in Object Methods.
Class topic { var $N; # Only with mgd_list_XXX functions. var $id; var $up; var $name; var $extra; var $owner; var $score; var $description; var $revised; var $created; var $revisor; var $creator; var $revision; var $code; var $sitegroup; function fetch(); # Only with mgd_list_XXX functions. function create(); function update(); function delete(); function createattachment(); function updateattachment(); function deleteattachment(); function getattachment(); function listattahcments(); function openattachment(); function serveattachement(); function listparameters(); function parameter(); function searchparameters(); function getsitegroup(); function setsitegroup(); }