User Tools

Site Tools


widget_management

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
widget_management [2023/01/29 17:40] – created wtkadminwidget_management [2023/08/07 21:13] (current) – [Defaulting Widgets to User Dashboard] wtkadmin
Line 54: Line 54:
 When a dashboard needs to be edited by a user, simply copy the WidgetGroup and fill the wtkWidgetGroup_X_Widget.UserUID value with the wtkUsers.UID value.  Then the user will be able to add, delete and re-prioritize widgets for their own dashboard. When a dashboard needs to be edited by a user, simply copy the WidgetGroup and fill the wtkWidgetGroup_X_Widget.UserUID value with the wtkUsers.UID value.  Then the user will be able to add, delete and re-prioritize widgets for their own dashboard.
  
-===== Defauling Widgets to User Dashboard =====+===== Defaulting Widgets to User Dashboard =====
  
 The logic used to determine if a widget set is copied to a user is as follows: The logic used to determine if a widget set is copied to a user is as follows:
  
-If user already has at least one personal widget then skip. +  * If user already has at least one personal widget then skip. 
-Otherwise check to see if there is a Widget Group with a Staff Role that matches the wtkUsers.StaffRole.  If so, copy that WidgetGroup regardless of SecurityLevel. +  Otherwise check to see if there is a Widget Group with a Staff Role that matches the wtkUsers.StaffRole.  If so, copy that WidgetGroup regardless of SecurityLevel. 
-If there is not a matching StaffRole WiddgetGroup, then check to see if there is a matching SecurityLevel.  If so, copy that WidgetGroup.+  If there is not a matching StaffRole WiddgetGroup, then check to see if there is a matching SecurityLevel.  If so, copy that WidgetGroup.
  
 The "copy" process copies the `wtkWidgetGroup_X_Widget` data for the associated wtkWidgetGroup with NULL UserUID values making the new set contain the wtkUsers.UID in the wtkWidgetGroup_X_Widget.UserUID value. The "copy" process copies the `wtkWidgetGroup_X_Widget` data for the associated wtkWidgetGroup with NULL UserUID values making the new set contain the wtkUsers.UID in the wtkWidgetGroup_X_Widget.UserUID value.
 +
 +===== Use Widgets to Update Data and Refresh Widget =====
 +
 +In the WTK Admin website if you have the Widget "Link to Page" and make that page "Use Modal Window", you can easily allow editing of data and have it update the widget upon saving.
 +
 +The **/wtk/widgets.php** page automatically passes `wtkWidgets`.`UID` to the **wtkModal** JS function which is passed as **id** parameter.  The PHP page you have it call will automatically store that value in the $gloId global variable.
 +
 +In your PHP page have the update buttons defined as follows:
 +
 +<code PHP>
 +$pgBtns = wtkModalUpdateBtns('../wtk/lib/Save','widgetRefresh');
 +</code>
 +
 +Make certain your PHP has the form defined as:
 +
 +<code PHP>
 +<form id="FwidgetRefresh" method="POST">
 +</code>
 +
 +Also in your PHP add this code to put the `wtkWidgets`.`UID` into a hidden field.
 +
 +<code PHP>
 +$pgHtm .= wtkFormHidden('WidgetUID', $gloId);
 +</code>
 +
 +
 +The "widgetRefresh" is then sent back via the **modalSave** JS function.  That retrieves the hidden WidgetUID value and passes it back via an AJAX call to **/wtk/widgets.php**.  Normally widgets.php returns several widgets but when called this way it receives the UID and returns only the specific Widget requested, updating it on the dashboard.
widget_management.1675014038.txt.gz · Last modified: 2023/01/29 17:40 by wtkadmin