[2] | 1 | <?php |
---|
| 2 | /***************************************************************************\ |
---|
| 3 | * eGroupWare - Contacts Center * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * Written by: * |
---|
| 6 | * - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> * |
---|
| 7 | * sponsored by Thyamad - http://www.thyamad.com |
---|
| 8 | * ------------------------------------------------------------------------- * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 10 | * under the terms of the GNU General Public License as published by the * |
---|
| 11 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 12 | * option) any later version. * |
---|
| 13 | \***************************************************************************/ |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | class ui_preferences |
---|
| 17 | { |
---|
| 18 | var $public_functions = array( |
---|
| 19 | 'index' => true, |
---|
| 20 | 'set_preferences' => true, |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | function translate($handle) |
---|
| 24 | { |
---|
| 25 | $vars = $GLOBALS['phpgw']->template->get_undefined($handle); |
---|
| 26 | foreach($vars as $name => $value) |
---|
| 27 | { |
---|
| 28 | if (ereg('^lang_', $name) !== false) |
---|
| 29 | { |
---|
| 30 | $GLOBALS['phpgw']->template->set_var($name, lang(str_replace('_',' ',substr($name, 5)))); |
---|
| 31 | } |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | function set_preferences() |
---|
| 36 | { |
---|
| 37 | if ($_POST['save']) |
---|
| 38 | { |
---|
| 39 | $GLOBALS['phpgw']->preferences->read(); |
---|
[3707] | 40 | |
---|
[2] | 41 | $GLOBALS['phpgw']->preferences->delete('contactcenter', 'personCardEmail'); |
---|
| 42 | $GLOBALS['phpgw']->preferences->delete('contactcenter', 'personCardPhone'); |
---|
[3707] | 43 | |
---|
[2] | 44 | $GLOBALS['phpgw']->preferences->delete('contactcenter', 'displayConnector'); |
---|
| 45 | $GLOBALS['phpgw']->preferences->delete('contactcenter', 'displayConnectorDefault'); |
---|
| 46 | |
---|
[3707] | 47 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'personCardEmail', $_POST['personCardEmail']); |
---|
| 48 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'personCardPhone', $_POST['personCardPhone']); |
---|
[2] | 49 | |
---|
| 50 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'displayConnectorDefault', '1'); |
---|
| 51 | |
---|
| 52 | if($_POST['displayConnector']) |
---|
| 53 | { |
---|
| 54 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'displayConnector', '1'); |
---|
| 55 | } |
---|
| 56 | else |
---|
| 57 | { |
---|
| 58 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'displayConnector', '0'); |
---|
| 59 | } |
---|
| 60 | |
---|
[1600] | 61 | if($_POST['empNum']) |
---|
| 62 | { |
---|
| 63 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'empNum', '1'); |
---|
| 64 | } |
---|
| 65 | else |
---|
| 66 | { |
---|
| 67 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'empNum', '0'); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | if($_POST['cell']) |
---|
| 71 | { |
---|
| 72 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'cell', '1'); |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'cell', '0'); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | if($_POST['department']) |
---|
| 80 | { |
---|
| 81 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'department', '1'); |
---|
| 82 | } |
---|
| 83 | else |
---|
| 84 | { |
---|
| 85 | $GLOBALS['phpgw']->preferences->add('contactcenter', 'department', '0'); |
---|
| 86 | } |
---|
[3707] | 87 | |
---|
[2] | 88 | $GLOBALS['phpgw']->preferences->save_repository(); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php')); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | function get_preferences() |
---|
| 95 | { |
---|
| 96 | $prefs = $GLOBALS['phpgw']->preferences->read(); |
---|
| 97 | |
---|
| 98 | if (!$prefs['contactcenter']['displayConnectorDefault'] and !$prefs['contactcenter']['displayConnector']) |
---|
| 99 | { |
---|
| 100 | $prefs['contactcenter']['displayConnector'] = true; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | return $prefs['contactcenter']; |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | ?> |
---|