[Show/Hide Right Column]

Display or test the value of a tracker item field
Print

Plugin TrackerItemField

This Wiki Plugin is one of several that works with the trackers feature (since version 2.0).

This plugin allows you to display or to test the value of a field of a tracker item. Limitation: the field must be a simple value (not computed, not item list). The tracker item can be specified by its ID with the itemId plugin param. If it is not specified, if the url has a param itemId, the value of itemId will be used. If after this test is not set and if the user tracker feature is set on, the user item of the user will be selected.

For example, you have a user tracker with a field containing the phone number of the user, you can use this plugin with the fieldId=>phone_field_id to display in the page the phone number of the user looking at the page

{TRACKERITEMFIELD(fieldId=1) /}

Another example, you want to add a link in a page to a page where a user can fill his user tracker only if the user has no user tracker. You can use this plugin with the fieldId that is the user selector field.

{TRACKERITEMFIELD(fieldId=1, test=1)}Welcome new member, please visit ((this_page)) to fill up your information{TRACKERITEMFIELD}
A field can be tested against a value
{TRACKERITEMFIELD(fieldId=1, test=1, value=toto)}Yes your name is toto{TRACKERITEMFIELD}

If you want to do the same thing with a tracker that is not the user tracker but has only one item per user and has a field user selector/1, you can specify the tracker ID like this

{TRACKERITEMFIELD(trackerId=1, fieldId=1) /}
{TRACKERITEMFIELD(trackerId=1, fieldId=1, test=1)}Please fill out your review{TRACKERITEMFIELD}

It is also possible to test the status of the user item. For instance if you want to display something only if the item is pending or closed

{TRACKERITEMFIELD(status=pc)}Sorry, your survey is been processed{TRACKERITEMFIELD}

It is also possible to test if all the fields of as item are not empty

{TRACKERITEMFIELD(trackerId=1, fields=)}Thank you your form is filled up{TRACKERITEMFIELD}

It is also possible to test an alternative

{TRACKERITEMFIELD(fieldId=1, test=1)}OK{ELSE}NOT OK{TRACKERITEMFIELD}

It is possible to have multi-lever of ELSE

{TRACKERITEMFIELD(fieldId=1, test=1)}OK{ELSE}{TRACKERITEMFIELD(fieldId=2, test=2)}super ok{ELSE}NOT OK{TRACKERITEMFIELD}{TRACKERITEMFIELD}
Note the order the other test with always be in the ELSE part

Syntax

Example:

{TRACKERITEMFIELD(trackerId=1,itemId=1,fieldId=1, test=1,fields=1:2,value=1)}Text{ELSE}Text{TRACKERITEMFIELD}

Options

Name Type Meaning Optional or mandatory Version
itemId Numeric The id of the item that is used. If the param is not specified, the user tracker item for the current user will be selected optional
trackerId Numeric the Id of the tracker. the item that will be used will be the user item(the tracker must have a user selector with a param 1, and the tracker must have only one item per user) optional
fieldId Numeric The id of the field displayed or tested. The perms are checked according the item status optional
value text value of the field optional
test 1 or 0 If 1, the value field must not be empty if the value parameter is empty or the value must be the same, otherwise the Text is displayed optional
status o or p or c or op or oc or pc or opc test the status of the item (the test is done even if the user has no view perm) optional
fields fieldId separated with : or empty test if a list of fields or all the fields are empty optional

Security

  • The field must not be hidden
  • To test or display a field, you must have the tiki_p_view_trackers (or tiki_p_view_trackers_pending or tiki_p_view_trackers_closed depending on the status of your item
  • the status can be test without permission

Optimisation

If this plugin is called many times on the same page with the same itemId, some sqls queries will be remembered between each call


Contributors to this page: lindon2331 points  , sylvie4333 points  , Scot Wilcoxon680 points  , mlpvolt1895 points  , Marc Laporte5511 points  , Jürgen Heckes471 points  and gcosilveira3 points  .
Page last modified on Saturday 17 July, 2010 04:17:19 UTC by lindon2331 points .

Find by Page Name

Exact match

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki documentation and should correspond to development keywords (bug reports and feature requests):