Keyword management |
Keywords will have two different functions: to provide a way to customize internal elements such as the types of follow-ups and contacts, and to allow authors to attach keywords on cases, clients, organisations and authors.
The difference between "system" and "user" keywords is that "system" keywords usually have a special treatement/code and storage in the database, where as "user" keywords are stored in associative tables (ex: lcm_keyword_case, lcm_keyword_client, etc.).
System keywords, in short, use an existent system to allow the system to be custmized by administrators.
lcm_keyword_group
lcm_keyword
Question: Should there be an ac_admin on the keyword to allow the admin to delete a keyword? This concerns mostly system keywords. The admin can add new system keywords, but should not be allowed to delete the default keywords (ex: contact->e-mail, followup->*, etc.). To restrict admins from deleting keywords currently in use should limit this problem.
I was never good at giving names to functions.. :-)
get_keyword_group($name or $id)
Returns a named array with the expected associated SQL query, but might also cache the data.
get_keywords_in_group($name)
Returns an array with a list of keywords who are part of the given group.
get_kwg_all($type = 'all,system,user')
Returns an array with a list of keyword groups. The type refers to the application of the keyword group: system defined, user defined or both.
get_kwg_for($type = 'case,client,org,author', $author = true)
Returns an array with a list of keyword groups which can apply to the provided type.
get_kw_attached($type = 'case,client,org,author', $id)
Returns an array with a list of keywords which are attached to the provided id of type. For example, to list keywords attached to a given case, the function will be called as $list = get_keywords('case', $id_case);
When it is installed or upgrade, LCM will create a list of default system keywords which will not be modifiable. The admin user will be able to add keywords in the created keyword groups, but not to remove them.
Follow-ups:
Strange fact: Since every follow-up has only one keyword "follow-up" attached, the value is stored inside the follow-up row itself, not in an associative keyword-followup table.
Contact Type:
Same as with the follow-ups, the ID of contact type keywords is stored in the lcm_contact table itself.
LCM will also create "user" keyword groups that the administrator will be able to deactivate.
Type of case:
The creation of the default keyword groups is automatic and triggered by the installation or upgrade systems.
See: inc_keywords_default.php
Hiding system keywords: If administrators do not wish to use some keywords of the system kwg, they can "hide" individual keywords by removing their ac_author.
[varchar] : We create a unique index on this field since it can be used as a key.
[1] For example, "Follow-up types" and "contact types" are system keyword groups).
[2] If recommended, the author is reminded to attach a keyword, but it is not mandatory.
[3] For example: In keyword group ’follow-ups’, the suggested default value should be ’consultation’.
[4] If Y, the admin will be allowed to modify the ’title’ and ’description’ — maybe other elements, we will see..
[5] If N, only administrators can associate they keyword to elements.