History: PluginTrackerItemField
Source of version: 35
Copy to clipboard
! Plugin TrackerItemField This ((Wiki Plugin)) is one of several that works with the ((trackers)) feature (since version 2.0). See also ((PluginTrackerIf)) and ((PluginTrackerToggle)) 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 {CODE(wrap=1)} {TRACKERITEMFIELD(fieldId=1) /} {CODE} 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. {CODE(wrap=1)} {TRACKERITEMFIELD(fieldId=1, test=1)}Welcome new member, please visit ((this_page)) to fill up your information{TRACKERITEMFIELD} {CODE} A field can be tested against a value {CODE(wrap=1)} {TRACKERITEMFIELD(fieldId=1, test=1, value=toto)}Yes your name is toto{TRACKERITEMFIELD} {CODE} See ((Tracker Field Type)) for values to match for special fields such as checkboxes. 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 {CODE(wrap=1)} {TRACKERITEMFIELD(trackerId=1, fieldId=1) /} {TRACKERITEMFIELD(trackerId=1, fieldId=1, test=1)}Please fill out your review{TRACKERITEMFIELD} {CODE} 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 {CODE(wrap=1)} {TRACKERITEMFIELD(status=pc)}Sorry, your survey is been processed{TRACKERITEMFIELD} {CODE} It is also possible to test if all the fields of as item are not empty {CODE(wrap=1)} {TRACKERITEMFIELD(trackerId=1, fields=)}Thank you your form is filled up{TRACKERITEMFIELD} {CODE} It is also possible to test an alternative {CODE(wrap=1)} {TRACKERITEMFIELD(fieldId=1, test=1)}OK{ELSE}NOT OK{TRACKERITEMFIELD} {CODE} It is possible to have multi-lever of ELSE {CODE(wrap=1)} {TRACKERITEMFIELD(fieldId=1, test=1)}OK{ELSE}{TRACKERITEMFIELD(fieldId=2, test=2)}super ok{ELSE}NOT OK{TRACKERITEMFIELD}{TRACKERITEMFIELD} {CODE} Note the order the other test with always be in the ELSE part !!Syntax Example: {CODE(wrap=1)} {TRACKERITEMFIELD(trackerId=1,itemId=1,fieldId=1, test=1,fields=1:2,value=1)}Text{ELSE}Text{TRACKERITEMFIELD} {CODE} !!Options {FANCYTABLE(head=__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 | {FANCYTABLE} !!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 -=alias=- * (alias(Mod trackeritemfield))