 |
 |
 |
 |

Global And User Settings
Any multi-user software is not complete unless it has two critical components. Global Settings and User Level Settings. These two components allow you to set settings that affect all users and to also allow each individual user to customize their own settings to their liking to a certain level. One of the best things about VConsole is that it already comes with both of these components built in and it allows you as a developer to add additional property tabs with your own customized fields. Read on for more details on how this works.
Global Settings
The Global Settings area can be accessed by clicking on the "Main Menu" and selecting "Global Settings". (Note, you have to be a member of a super group in order to access this area of the software.) This module is simply a propertiesmanager module that consists of several properties tabs which contain several fields that allow you to set a variety of global settings. These settings affect ALL USERS. Here is a list of the built in property tabs for this module:
- General Settings - This tab allows you to set general settings for all users such as Session Timeout, Navigation Button Size, and Image Validation. (NOTE: If you change navigation button size, you will have to update all the images in the vconsole/skins/vsource/buttons/ folder to be the correct size that you set)
- Email Settings - This tab allows you to set settings that pertain to email including allowing you to use an external SMTP server for mail delivery and allowing you to enable or disable DNS lookups when validation email addresses. The settings here affect the behavior of the check_email(), check_email_domain(), send_email(), and send_stationary() built in php functions.
- Documents - (Only shown if you are licensed for document management) This tab allows you to set settings that affect the way the Document Management module behaves including allowing you to set the default document thumbnail width and height.
- Google™ Analytics - This tab allows you to set your Analytics Web Property ID (UA #) that allows you to track usage of the software using Google™ Analytics.
- Google™ Maps - This tab allows you to control the behavior of the record GEO location features of VConsole. These features use the Google Maps interface to show and allow you to update location data for all your records.
In addition to these property tabs, you can also add your own developer defined property tabs with your own customized fields. In order to do this, just modify the vconsole/modules/globalsettings/user_defined_settings.php file. Adding tabs and fields in this file works the same as any other propertiesmanager module file. (See the propertiesmanager for details on what all the settings are). Also, the file is commented with a sample so you should be able to add your tabs and fields without any problems. You can even add sub tabs to each of your main tabs just like you would in any normal propertiesmanger file. Once you have added your property tabs and fields, you will want to save the values that were input by the user somewhere. We recommend storing all Global Settings in the vc_console-params MySQL table. When you store name / value pairs in this table, they will be available in the $PARAMS global PHP array. In order to save your values, you will have to modify the vconsole/modules/globalsettings/user_defined_settings_save.php file. This file is called when the user clicks on save and your validated user input will be available in the $data array. Simply save your data however you like and you are done. Here is a sample of both files so that you can get a better understanding of how this works.
This sample defines a new tab called "My Global Tab" with a simple text field. The input value is stored in the vc_console-params table which allows us to set the default value for the field to $PARAMS['globalfield'] (globalfield is the name of the sample field below) so that our value is remembered every time this module is called.
<?php
global $GLOB, $OUT, $DATA, $PARAMS, $DBS, $pm;
array_push($pm,
array(
'tab' => "My Global Tab",
'instructions' => "",
'fields' => array(
array(
'type' => "text",
'name' => "globalfield",
'label' => "Test Global Field",
'labelpos' => "before",
'pack' => "nextrow",
'fieldspan' => 1,
'fielddata' => array(
'default' => $PARAMS[ 'globalfield'],
'attributes' => array(
'size' => 50,
),
),
'validate' => array(
'required' => true
),
),
),
)
);
?>
<?php
global $GLOB, $OUT, $DATA, $PARAMS, $DBS, $data;
db_query( "DELETE FROM `vc_console-params` WHERE `name` = 'globalfield'", $dbr);
db_query( "INSERT INTO `vc_console-params` SET
`name` = 'globalfield', `value` = " . db_quote($data[ 'globalfield']), $dbr);
?>
Individual User Settings
The individual user settings area can be accessed by clicking on the "Main Menu" and selecting "Customize Your Settings". Every user has access to this area of the software. This module is simply a propertiesmanager module that consists of several properties tabs which contain several fields that allow you to set a variety of user level settings. These settings affect each individual user separately and each user can have different settings. Here is a list of built in property tabs for this module:
- Toolbar - This tab allows each user to customize the behavior of the main toolbar. They can set the toolbar to text mode, icon mode, or both text and icon mode. Try each setting to see how the change affects the main toolbar interface.
In addition to these property tabs, you can also add your own developer defined property tabs with your own customized fields. In order to do this, just modify the vconsole/modules/usersettings/user_defined_settings.php file. Adding tabs and fields in this file works the same as any other propertiesmanager module file. (See the propertiesmanager for details on what all the settings are). Also, the file is commented with a sample so you should be able to add your tabs and fields without any problems. You can even add sub tabs to each of your main tabs just like you would in any normal propertiesmanger file. Once you have added your property tabs and fields, you will want to save the values that were input by the user somewhere. We recommend storing all User Level Settings in the vc_logins-params MySQL table. When you store name / value pairs in this table, they will be available in the $PARAMS global PHP array and each individual user can have different settings. If a field in the vc_logins-params table is named the same as a field in the vc_console-params table, then the value in the vc_logins-params table will take priority. In order to save your values, you will have to modify the vconsole/modules/usersettings/user_defined_settings_save.php file. This file is called when the user clicks on save and your validated user input will be available in the $data array. Simply save your data however you like and you are done. Here is a sample of both files so that you can get a better understanding of how this works.
This sample defines a new tab called "My User Tab" with a simple text field. The input value is stored in the vc_logins-params table which allows us to set the default value for the field to $PARAMS['userfield'] (userfield is the name of the sample field below) so that our value is remembered every time this module is called.
<?php
global $GLOB, $OUT, $DATA, $PARAMS, $DBS, $pm;
array_push($pm,
array(
'tab' => "My User Tab",
'instructions' => "",
'fields' => array(
array(
'type' => "text",
'name' => "userfield",
'label' => "User Test Field",
'labelpos' => "before",
'pack' => "nextrow",
'fieldspan' => 1,
'fielddata' => array(
'default' => $PARAMS[ 'userfield'],
'attributes' => array(
'size' => 50,
),
),
'validate' => array(
'required' => true
),
),
),
)
);
?>
<?php
global $GLOB, $OUT, $DATA, $PARAMS, $DBS, $data;
db_query( "DELETE FROM `vc_logins-params` WHERE
`name` = 'userfield' AND
`login` = " . db_quote($GLOB[ 'login'][ 'id']), $dbr);
db_query( "INSERT INTO `vc_logins-params` SET
`login` = " . db_quote($GLOB[ 'login'][ 'id']) . ",
`name` = 'userfield',
`value` = " . db_quote($data[ 'userfield']), $dbr);
?>
NEXT: Creating And Managing Permissions
COMMENTS There are no comments at this time.
|
|
 |
 |
 |
|