16b32285 by Kevin Burton

updated UserManager for home/work contact information; added Sequencer;

1 parent ac96527b
...@@ -3,6 +3,7 @@ namespace Tz\WordPress\Tools\Notifications; ...@@ -3,6 +3,7 @@ namespace Tz\WordPress\Tools\Notifications;
3 3
4 use Tz\Common; 4 use Tz\Common;
5 use Tz\WordPress\Tools; 5 use Tz\WordPress\Tools;
6 use Tz\WordPress\Tools\Sequencer;
6 use Tz\WordPress\CBV; 7 use Tz\WordPress\CBV;
7 use WP_User; 8 use WP_User;
8 use Exception, StdClass; 9 use Exception, StdClass;
...@@ -228,7 +229,10 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), ...@@ -228,7 +229,10 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
228 if(empty($notices)) { 229 if(empty($notices)) {
229 $notices = array(); 230 $notices = array();
230 } 231 }
231 $notices[] = $insert; 232
233 $sequence = Sequencer\generate('NTC');
234
235 $notices[$sequence] = $insert;
232 236
233 237
234 update_user_meta($user->ID,'notices',$notices); 238 update_user_meta($user->ID,'notices',$notices);
......
1 <?php
2 /**
3 * ID Sequencer
4 *
5 * Generates a unique ID, based on a prefix code and a 7 digit zero-filled number in sequencial order
6 *
7 * @package WordPress
8 * @subpackage Sequencer
9 * @author Tenzing Communications Inc.
10 * @link http://www.gotenzing.com
11 */
12
13 namespace Tz\WordPress\Tools\Sequencer;
14 use Tz, Tz\Common, Tz\WordPress\Tools;
15 use Exception;
16
17 call_user_func(function() {
18 Tools\add_actions(__NAMESPACE__ . '\Actions');
19 });
20
21 /**
22 * Generate New ID
23 *
24 * @param (String) Prefix (EVT, NCE, GRP)
25 * @return (String) ID
26 */
27 function generate($prefix = "") {
28 global $wpdb;
29 $row = $wpdb->get_row("SELECT `current`,`end` FROM `".$wpdb->prefix."sequencer` WHERE `prefix`='".$prefix."'");
30
31 if (!empty($row)) {
32
33 $current = (int) $row->current;
34 $end = (int) $row->end;
35 $next = ($current + 1);
36
37 $allowable_length = 7;
38
39 if ($next >= $end) {
40 throw new Exception("The prefix [$prefix] has reached it's limit of: ".$end);
41 } else {
42
43 $length = strlen($next);
44 $zeros = $allowable_length - $length;
45
46 $return = "";
47
48 if ($zeros > 0) {
49 for($i=0; $i < $zeros; $i++) {
50 $return .= "0";
51 }
52 } else {
53 $return = "";
54 }
55
56 $wpdb->query("UPDATE `".$wpdb->prefix."sequencer` SET `current`=$next WHERE `prefix`='$prefix' LIMIT 1");
57
58 return $prefix.$return.$next;
59 }
60
61 } else {
62 $wpdb->query("INSERT INTO `".$wpdb->prefix."sequencer` (`prefix`,`start`,`end`,`current`) VALUES ('$prefix',0,9999999,0)");
63 generate($prefix);
64 }
65
66 }
67
68 /**
69 * Standard Action Class for WordPress
70 *
71 * Checks to see if the table exists in the database, if not, creates it.
72 */
73 class Actions {
74
75 // Does the Sequencer table exist? If not, create it.
76 public static function init() {
77 global $wpdb;
78 $create_table_statement = "
79 CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."sequencer` (
80 `prefix` varchar(3) NOT NULL,
81 `start` int(7) unsigned zerofill NOT NULL DEFAULT '0000000',
82 `end` int(7) unsigned zerofill NOT NULL DEFAULT '9999999',
83 `current` int(7) unsigned zerofill DEFAULT '0000000',
84 `last_used` int(16) NOT NULL DEFAULT '0',
85 PRIMARY KEY (`prefix`),
86 UNIQUE KEY `prefix` (`prefix`)
87 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
88 ";
89 $wpdb->query($create_table_statement);
90 //$wpdb->query("INSERT INTO `wp_sequencer` (`prefix`, `start`, `end`, `current`, `last_used`) VALUES ('EVT', 0000000, 9999999, 0000000, 0),('NTC', 0000000, 9999999, 0000000, 0),('CEH', 0000000, 9999999, 0000000, 0);");
91 }
92
93 }
94
95 ?>
...\ No newline at end of file ...\ No newline at end of file
...@@ -11,6 +11,7 @@ namespace Tz\WordPress\Tools\UserManager; ...@@ -11,6 +11,7 @@ namespace Tz\WordPress\Tools\UserManager;
11 use Tz\Common; 11 use Tz\Common;
12 use Tz\WordPress\Tools; 12 use Tz\WordPress\Tools;
13 use Tz\WordPress\Tools\Auth; 13 use Tz\WordPress\Tools\Auth;
14 use Tz\WordPress\Tools\Sequencer;
14 use Tz\WordPress\UAM; 15 use Tz\WordPress\UAM;
15 use Tz\WordPress\Tools\HTML; 16 use Tz\WordPress\Tools\HTML;
16 use Tz\WordPress\CBV; 17 use Tz\WordPress\CBV;
...@@ -194,62 +195,102 @@ class ProfileValidation extends Common\Validation { ...@@ -194,62 +195,102 @@ class ProfileValidation extends Common\Validation {
194 update_user_meta($_POST['uid'], __FUNCTION__, $val); 195 update_user_meta($_POST['uid'], __FUNCTION__, $val);
195 } 196 }
196 197
197 public function address($val) { 198 public function home_address($val) {
198 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); 199 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
199 } 200 }
200 201
201 public function address2($val) { 202 public function home_address2($val) {
202 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); 203 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
203 } 204 }
204 205
205 public function city($val) { 206 public function home_city($val) {
206 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); 207 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
207 } 208 }
208 209
209 public function province($val) { 210 public function home_province($val) {
210 if (empty($val)) { 211 if (empty($val)) {
211 throw new Exception('Province field can not be empty'); 212 throw new Exception('Province field can not be empty');
212 } 213 }
213 update_user_meta($_POST['uid'], __FUNCTION__, $val); 214 update_user_meta($_POST['uid'], __FUNCTION__, $val);
214 } 215 }
215 216
216 public function postal($val) { 217 public function home_postal($val) {
217 update_user_meta($_POST['uid'], __FUNCTION__, $val); 218 update_user_meta($_POST['uid'], __FUNCTION__, $val);
218 } 219 }
219 220
220 public function country($val) { 221 public function home_country($val) {
221 if (empty($val)) { 222 if (empty($val)) {
222 throw new Exception('Country field can not be empty'); 223 throw new Exception('Country field can not be empty');
223 } 224 }
224 update_user_meta($_POST['uid'], __FUNCTION__, $val); 225 update_user_meta($_POST['uid'], __FUNCTION__, $val);
225 } 226 }
226 227
227 public function phone($val) { 228 public function home_phone($val) {
228 update_user_meta($_POST['uid'], __FUNCTION__, $val); 229 update_user_meta($_POST['uid'], __FUNCTION__, $val);
229 } 230 }
230 231
231 public function fax($val) { 232
233 public function home_mobile($val) {
232 update_user_meta($_POST['uid'], __FUNCTION__, $val); 234 update_user_meta($_POST['uid'], __FUNCTION__, $val);
233 } 235 }
234 236
235 public function mobile($val) { 237 public function home_email($val) {
238 if (!empty($val)) {
239 if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) {
240 throw new Exception('An invalid email address was entered in Email');
241 }
242 }
243 update_user_meta($_POST['uid'], 'home_email', $val);
244 }
245
246 public function work_address($val) {
247 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
248 }
249
250 public function work_address2($val) {
251 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
252 }
253
254 public function work_city($val) {
255 update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
256 }
257
258 public function work_province($val) {
259 if (empty($val)) {
260 throw new Exception('Province field can not be empty');
261 }
262 update_user_meta($_POST['uid'], __FUNCTION__, $val);
263 }
264
265 public function work_postal($val) {
236 update_user_meta($_POST['uid'], __FUNCTION__, $val); 266 update_user_meta($_POST['uid'], __FUNCTION__, $val);
237 } 267 }
238 268
239 public function email($val) { 269 public function work_country($val) {
270 if (empty($val)) {
271 throw new Exception('Country field can not be empty');
272 }
273 update_user_meta($_POST['uid'], __FUNCTION__, $val);
274 }
275
276 public function work_phone($val) {
277 update_user_meta($_POST['uid'], __FUNCTION__, $val);
278 }
279
280
281 public function work_mobile($val) {
282 update_user_meta($_POST['uid'], __FUNCTION__, $val);
283 }
284
285 public function work_email($val) {
240 if (!empty($val)) { 286 if (!empty($val)) {
241 if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) { 287 if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) {
242 throw new Exception('An invalid email address was entered in Email'); 288 throw new Exception('An invalid email address was entered in Email');
243 } 289 }
244 } else { 290 }
245 throw new Exception('Email field can not be empty'); 291 update_user_meta($_POST['uid'], 'work_email', $val);
246 } 292 }
247 293
248 // update user email.
249 wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
250
251 //update_user_meta($_POST['uid'], 'email', $val);
252 }
253 294
254 public function company($val) { 295 public function company($val) {
255 update_user_meta($_POST['uid'],'company', User\clean_string($val)); 296 update_user_meta($_POST['uid'],'company', User\clean_string($val));
...@@ -258,7 +299,10 @@ class ProfileValidation extends Common\Validation { ...@@ -258,7 +299,10 @@ class ProfileValidation extends Common\Validation {
258 public function title($val) { 299 public function title($val) {
259 update_user_meta($_POST['uid'], 'title', User\clean_string($val)); 300 update_user_meta($_POST['uid'], 'title', User\clean_string($val));
260 } 301 }
261 302
303 public function fax($val) {
304 update_user_meta($_POST['uid'], __FUNCTION__, $val);
305 }
262 306
263 public function website($val) { 307 public function website($val) {
264 308
...@@ -438,13 +482,15 @@ class Actions { ...@@ -438,13 +482,15 @@ class Actions {
438 if ($user_role != "member") { unset($_POST['member_id']); } 482 if ($user_role != "member") { unset($_POST['member_id']); }
439 $password = $_POST['password']; unset($_POST['password']); unset($_POST['password2']); 483 $password = $_POST['password']; unset($_POST['password']); unset($_POST['password2']);
440 484
485 $fp = strtolower($_POST['profile_preference'])."_";
486
441 // register the user. 487 // register the user.
442 $user_details = Array( 488 $user_details = Array(
443 'first_name' => User\clean_string($_POST['first_name']) 489 'first_name' => User\clean_string($_POST['first_name'])
444 , 'last_name' => User\clean_string($_POST['last_name']) 490 , 'last_name' => User\clean_string($_POST['last_name'])
445 , 'province' => $_POST['province'] 491 , $fp.'province' => $_POST['province']
446 , 'country' => $_POST['country'] 492 , $fp.'country' => $_POST['country']
447 , 'email' => $email 493 , $fp.'email' => $email
448 ); 494 );
449 unset($user_details['email']); 495 unset($user_details['email']);
450 496
...@@ -622,8 +668,12 @@ class Actions { ...@@ -622,8 +668,12 @@ class Actions {
622 668
623 $timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']); 669 $timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']);
624 670
671 if ($_POST['indexed']=="") {
672 $_POST['indexed'] = Sequencer\generate('KCB');
673 }
674
625 675
626 $cehours[$timestamp] = Array( 676 $cehours[$_POST['indexed']] = Array(
627 'type' => $_POST['type'] 677 'type' => $_POST['type']
628 , 'date' => $timestamp 678 , 'date' => $timestamp
629 , 'activity' => $_POST['activity'] 679 , 'activity' => $_POST['activity']
......
1 /*
2 Masked Input plugin for jQuery
3 Copyright (c) 2007-2010 Josh Bush (digitalbush.com)
4 Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
5 Version: 1.2.3
6 */
7 (function($) {
8 var pasteEventName = ($.browser.msie ? 'paste' : 'input') + ".mask";
9 var iPhone = (window.orientation != undefined);
10
11 $.mask = {
12 //Predefined character definitions
13 definitions: {
14 '9': "[0-9]",
15 'a': "[A-Za-z]",
16 '*': "[A-Za-z0-9]"
17 }
18 };
19
20 $.fn.extend({
21 //Helper Function for Caret positioning
22 caret: function(begin, end) {
23 if (this.length == 0) return;
24 if (typeof begin == 'number') {
25 end = (typeof end == 'number') ? end : begin;
26 return this.each(function() {
27 if (this.setSelectionRange) {
28 this.focus();
29 this.setSelectionRange(begin, end);
30 } else if (this.createTextRange) {
31 var range = this.createTextRange();
32 range.collapse(true);
33 range.moveEnd('character', end);
34 range.moveStart('character', begin);
35 range.select();
36 }
37 });
38 } else {
39 if (this[0].setSelectionRange) {
40 begin = this[0].selectionStart;
41 end = this[0].selectionEnd;
42 } else if (document.selection && document.selection.createRange) {
43 var range = document.selection.createRange();
44 begin = 0 - range.duplicate().moveStart('character', -100000);
45 end = begin + range.text.length;
46 }
47 return { begin: begin, end: end };
48 }
49 },
50 unmask: function() { return this.trigger("unmask"); },
51 mask: function(mask, settings) {
52 if (!mask && this.length > 0) {
53 var input = $(this[0]);
54 var tests = input.data("tests");
55 return $.map(input.data("buffer"), function(c, i) {
56 return tests[i] ? c : null;
57 }).join('');
58 }
59 settings = $.extend({
60 placeholder: "_",
61 completed: null
62 }, settings);
63
64 var defs = $.mask.definitions;
65 var tests = [];
66 var partialPosition = mask.length;
67 var firstNonMaskPos = null;
68 var len = mask.length;
69
70 $.each(mask.split(""), function(i, c) {
71 if (c == '?') {
72 len--;
73 partialPosition = i;
74 } else if (defs[c]) {
75 tests.push(new RegExp(defs[c]));
76 if(firstNonMaskPos==null)
77 firstNonMaskPos = tests.length - 1;
78 } else {
79 tests.push(null);
80 }
81 });
82
83 return this.each(function() {
84 var input = $(this);
85 var buffer = $.map(mask.split(""), function(c, i) { if (c != '?') return defs[c] ? settings.placeholder : c });
86 var ignore = false; //Variable for ignoring control keys
87 var focusText = input.val();
88
89 input.data("buffer", buffer).data("tests", tests);
90
91 function seekNext(pos) {
92 while (++pos <= len && !tests[pos]);
93 return pos;
94 };
95
96 function shiftL(pos) {
97 while (!tests[pos] && --pos >= 0);
98 for (var i = pos; i < len; i++) {
99 if (tests[i]) {
100 buffer[i] = settings.placeholder;
101 var j = seekNext(i);
102 if (j < len && tests[i].test(buffer[j])) {
103 buffer[i] = buffer[j];
104 } else
105 break;
106 }
107 }
108 writeBuffer();
109 input.caret(Math.max(firstNonMaskPos, pos));
110 };
111
112 function shiftR(pos) {
113 for (var i = pos, c = settings.placeholder; i < len; i++) {
114 if (tests[i]) {
115 var j = seekNext(i);
116 var t = buffer[i];
117 buffer[i] = c;
118 if (j < len && tests[j].test(t))
119 c = t;
120 else
121 break;
122 }
123 }
124 };
125
126 function keydownEvent(e) {
127 var pos = $(this).caret();
128 var k = e.keyCode;
129 ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41));
130
131 //delete selection before proceeding
132 if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46))
133 clearBuffer(pos.begin, pos.end);
134
135 //backspace, delete, and escape get special treatment
136 if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete
137 shiftL(pos.begin + (k == 46 ? (tests[pos.begin]?0:1) : -1));
138 return false;
139 } else if (k == 27) {//escape
140 input.val(focusText);
141 input.caret(0, checkVal());
142 return false;
143 }
144 };
145
146 function keypressEvent(e) {
147 if (ignore) {
148 ignore = false;
149 //Fixes Mac FF bug on backspace
150 return (e.keyCode == 8) ? false : null;
151 }
152 e = e || window.event;
153 var k = e.charCode || e.keyCode || e.which;
154 var pos = $(this).caret();
155
156 if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
157 return true;
158 } else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters
159 var p = seekNext(pos.begin - 1);
160 if (p < len) {
161 var c = String.fromCharCode(k);
162 if (tests[p].test(c)) {
163 shiftR(p);
164 buffer[p] = c;
165 writeBuffer();
166 var next = seekNext(p);
167 $(this).caret(next);
168 if (settings.completed && next >= len)
169 settings.completed.call(input);
170 }
171 }
172 }
173 return false;
174 };
175
176 function clearBuffer(start, end) {
177 for (var i = start; i < end && i < len; i++) {
178 if (tests[i])
179 buffer[i] = settings.placeholder;
180 }
181 };
182
183 function writeBuffer() { return input.val(buffer.join('')).val(); };
184
185 function checkVal(allow) {
186 //try to place characters where they belong
187 var test = input.val();
188 var lastMatch = -1;
189 for (var i = 0, pos = 0; i < len; i++) {
190 if (tests[i]) {
191 buffer[i] = settings.placeholder;
192 while (pos++ < test.length) {
193 var c = test.charAt(pos - 1);
194 if (tests[i].test(c)) {
195 buffer[i] = c;
196 lastMatch = i;
197 break;
198 }
199 }
200 if (pos > test.length)
201 break;
202 } else if (buffer[i] == test.charAt(pos) && i!=partialPosition) {
203 pos++;
204 lastMatch = i;
205 }
206 }
207 if (!allow && lastMatch + 1 < partialPosition) {
208 input.val("");
209 clearBuffer(0, len);
210 } else if (allow || lastMatch + 1 >= partialPosition) {
211 writeBuffer();
212 if (!allow) input.val(input.val().substring(0, lastMatch + 1));
213 }
214 return (partialPosition ? i : firstNonMaskPos);
215 };
216
217 if (!input.attr("readonly"))
218 input
219 .one("unmask", function() {
220 input
221 .unbind(".mask")
222 .removeData("buffer")
223 .removeData("tests");
224 })
225 .bind("focus.mask", function() {
226 focusText = input.val();
227 var pos = checkVal();
228 writeBuffer();
229 setTimeout(function() {
230 if (pos == mask.length)
231 input.caret(0, pos);
232 else
233 input.caret(pos);
234 }, 0);
235 })
236 .bind("blur.mask", function() {
237 checkVal();
238 if (input.val() != focusText)
239 input.change();
240 })
241 .bind("keydown.mask", keydownEvent)
242 .bind("keypress.mask", keypressEvent)
243 .bind(pasteEventName, function() {
244 setTimeout(function() { input.caret(checkVal(true)); }, 0);
245 });
246
247 checkVal(); //Perform initial check for existing values
248 });
249 }
250 });
251 })(jQuery);
...\ No newline at end of file ...\ No newline at end of file
...@@ -60,10 +60,6 @@ unset($rc, $roles['administrator']); ...@@ -60,10 +60,6 @@ unset($rc, $roles['administrator']);
60 <td><input type="text" name="username" required /></td> 60 <td><input type="text" name="username" required /></td>
61 </tr> 61 </tr>
62 <tr> 62 <tr>
63 <th>Email:</th>
64 <td><input type="text" name="email" required /></td>
65 </tr>
66 <tr>
67 <th>First Name:</th> 63 <th>First Name:</th>
68 <td><input type="text" name="first_name" required /></td> 64 <td><input type="text" name="first_name" required /></td>
69 </tr> 65 </tr>
...@@ -71,6 +67,15 @@ unset($rc, $roles['administrator']); ...@@ -71,6 +67,15 @@ unset($rc, $roles['administrator']);
71 <th>Last Name:</th> 67 <th>Last Name:</th>
72 <td><input type="text" name="last_name" id="create_last_name" required /></td> 68 <td><input type="text" name="last_name" id="create_last_name" required /></td>
73 </tr> 69 </tr>
70 <tr><td colspan="2">&nbsp;</td></tr>
71 <tr>
72 <th>&nbsp;</th>
73 <td><select name="profile_preference" id="profile_preference"><option value="Home">Home&nbsp;</option><option value="Work">Work&nbsp;</option></select></td>
74 </tr>
75 <tr>
76 <th>Email:</th>
77 <td><input type="text" name="email" required /></td>
78 </tr>
74 <tr> 79 <tr>
75 <th>Country:</th> 80 <th>Country:</th>
76 <td> 81 <td>
......
...@@ -40,7 +40,7 @@ else: ...@@ -40,7 +40,7 @@ else:
40 </tr> 40 </tr>
41 </thead> 41 </thead>
42 <tbody> 42 <tbody>
43 <?php foreach($cehours as $ce): 43 <?php foreach($cehours as $index=>$ce):
44 $ce_date = date('F j, Y',$ce['date']); 44 $ce_date = date('F j, Y',$ce['date']);
45 ?> 45 ?>
46 <tr> 46 <tr>
...@@ -48,7 +48,7 @@ else: ...@@ -48,7 +48,7 @@ else:
48 <td><?php echo $ce['activity']; ?></td> 48 <td><?php echo $ce['activity']; ?></td>
49 <td><?php echo ($ce['type']=="structured") ? $ce['hours'] : 0;?></td> 49 <td><?php echo ($ce['type']=="structured") ? $ce['hours'] : 0;?></td>
50 <td><?php echo ($ce['type']=="unstructured") ? $ce['hours'] : 0;?></td> 50 <td><?php echo ($ce['type']=="unstructured") ? $ce['hours'] : 0;?></td>
51 <td class="cehours-remove-td"><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_cehour_form&uid=<?php echo $uid?>&indexed=<?php echo $ce['date'];?>" class="cehours-edit" rel="<?php echo $ce['date'];?>">edit</a> | <a href="#" class="cehours-remove" rel="<?php echo $ce['date'];?>">remove</a></td> 51 <td class="cehours-remove-td"><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_cehour_form&uid=<?php echo $uid?>&indexed=<?php echo $index;?>" class="cehours-edit" rel="<?php echo $index;?>">edit</a> | <a href="#" class="cehours-remove" rel="<?php echo $index;?>">remove</a></td>
52 </tr> 52 </tr>
53 <?php endforeach; ?> 53 <?php endforeach; ?>
54 </tbody> 54 </tbody>
......
...@@ -65,18 +65,117 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); ...@@ -65,18 +65,117 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
65 </tr> 65 </tr>
66 <tr> 66 <tr>
67 <th>Date of Birth:<br /><span style="font-size:10px;color:#999;font-weight:normal;">(Ex. YYYY-MM-DD)</span></th> 67 <th>Date of Birth:<br /><span style="font-size:10px;color:#999;font-weight:normal;">(Ex. YYYY-MM-DD)</span></th>
68 <td><input type="text" name="date_of_birth" class="datepicker" value="<?php echo get_user_meta($_GET['uid'], 'date_of_birth', true);?>" /></td> 68 <td><input type="text" name="date_of_birth" class="datepicker" value="<?php echo get_user_meta($_GET['uid'], 'date_of_birth', true);?>" rel="mask-birthdate" /></td>
69 </tr> 69 </tr>
70 </tbody> 70 </tbody>
71 </table> 71 </table>
72 72
73 <h4>Contact Information</h4> 73 <h4>Notification & Settings</h4>
74 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table"> 74 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
75 <tbody> 75 <tbody>
76 <tr> 76 <tr>
77 <th width="150">&nbsp;</th> 77 <th width="150">Profile Preference</th>
78 <td><select name="profile_preference" id="profile_preference"><option value="Home" <?php echo ($profile_preference=="Home") ? "selected" : ""; ?>>Home&nbsp;</option><option value="Work" <?php echo ($profile_preference=="Work") ? "selected" : ""; ?>>Work&nbsp;</option></select></td> 78 <td><select name="profile_preference" id="profile_preference"><option value="Home" <?php echo ($profile_preference=="Home") ? "selected" : ""; ?>>Home&nbsp;</option><option value="Work" <?php echo ($profile_preference=="Work") ? "selected" : ""; ?>>Work&nbsp;</option></select></td>
79 </tr> 79 </tr>
80 <tr>
81 <th width="150">Email for Notifications:</th>
82 <td>
83 <select name="email_address_preference">
84 <?php
85 $preference = get_user_meta($_GET['uid'], 'email_address_preference',true);
86 $home_email = get_user_meta($_GET['uid'],'home_email',true);
87 $work_email = get_user_meta($_GET['uid'],'work_email',true);
88 ?>
89 <option value="none" <?php echo ($preference=="none") ? "selected" : "";?>>None</option>
90 <?php if(!empty($home_email)):?><option value="Home" <?php echo ($preference=="Home") ? "selected" : "";?>>Home > <?php echo $home_email;?></option><?php endif;?>
91 <?php if(!empty($work_email)):?><option value="Work"<?php echo ($preference=="Work") ? "selected" : "";?>>Work > <?php echo $work_email;?></option><?php endif;?>
92 </select>
93 </td>
94 </tr>
95 </tbody>
96 </table>
97
98 <?php if ($role=="member") :?>
99 <h4>Membership</h4>
100 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
101 <tbody>
102 <tr>
103 <th width="150">Member Since:</th>
104 <td><input type="text" name="member_since" value="<?php echo get_user_meta($_GET['uid'], 'member_since', true);?>" /></td>
105 </tr>
106 </tbody>
107 </table>
108 <?php endif;?>
109
110
111
112
113 </div>
114
115
116 <div style="float:left; width:350px;"> <!-- RIGHT SIDE -->
117
118 <h4>Home Contact Information</h4>
119 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
120 <tbody>
121 <tr>
122 <th>Address:</th>
123 <td><input type="text" name="home_address" value="<?php echo get_user_meta($_GET['uid'], 'home_address', true);?>" /></td>
124 </tr>
125 <tr>
126 <th>Suite:</th>
127 <td><input type="text" name="home_address2" value="<?php echo get_user_meta($_GET['uid'], 'home_address2', true);?>" /></td>
128 </tr>
129 <tr>
130 <th>City:</th>
131 <td><input type="text" name="home_city" value="<?php echo get_user_meta($_GET['uid'], 'home_city', true);?>" /></td>
132 </tr>
133 <tr>
134 <th>State/Province:</th>
135 <td>
136 <select name="home_province">
137 <option disabled value="">Select a State/Province</option>
138 <optgroup label="Canada">
139 <?php HTML\select_opts_provinces(get_user_meta($_GET['uid'], 'home_province', true)); ?>
140 </optgroup>
141
142 <optgroup label="United States">
143 <?php HTML\select_opts_states(get_user_meta($_GET['uid'], 'home_province', true)); ?>
144 </optgroup>
145 </select>
146 </td>
147 </tr>
148 <tr>
149 <th>Postal:</th>
150 <td><input type="text" name="home_postal" value="<?php echo get_user_meta($_GET['uid'], 'home_postal', true); ?>" /></td>
151 </tr>
152 <tr>
153 <th>Country:</th>
154 <td>
155 <select name="home_country">
156 <?php HTML\select_opts_countries(get_user_meta($_GET['uid'], 'home_country', true)); ?>
157 </select>
158 </td>
159 </tr>
160 <tr>
161 <th>Phone:</th>
162 <td><input type="text" name="home_phone" value="<?php echo get_user_meta($_GET['uid'], 'home_phone', true);?>" rel="mask-phone" /></td>
163 </tr>
164 <tr>
165 <th>Email:</th>
166 <td><input type="text" name="home_email" value="<?php echo get_user_meta($_GET['uid'], 'home_email', true);?>" /></td>
167 </tr>
168 <tr>
169 <th>Mobile:</th>
170 <td><input type="text" name="home_mobile" value="<?php echo get_user_meta($_GET['uid'], 'home_mobile', true);?>" rel="mask-phone" /></td>
171 </tr>
172 </tbody>
173 </table>
174
175 <h4>Work Contact Information</h4>
176 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
177 <tbody>
178
80 <tr class="work-only"> 179 <tr class="work-only">
81 <th>Company:</th> 180 <th>Company:</th>
82 <td><input type="text" name="company" value="<?php echo get_user_meta($_GET['uid'], 'company', true);?>" /></td> 181 <td><input type="text" name="company" value="<?php echo get_user_meta($_GET['uid'], 'company', true);?>" /></td>
...@@ -87,58 +186,58 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); ...@@ -87,58 +186,58 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
87 </tr> 186 </tr>
88 <tr> 187 <tr>
89 <th>Address:</th> 188 <th>Address:</th>
90 <td><input type="text" name="address" value="<?php echo get_user_meta($_GET['uid'], 'address', true);?>" /></td> 189 <td><input type="text" name="work_address" value="<?php echo get_user_meta($_GET['uid'], 'work_address', true);?>" /></td>
91 </tr> 190 </tr>
92 <tr> 191 <tr>
93 <th>Suite:</th> 192 <th>Suite:</th>
94 <td><input type="text" name="address2" value="<?php echo get_user_meta($_GET['uid'], 'address2', true);?>" /></td> 193 <td><input type="text" name="work_address2" value="<?php echo get_user_meta($_GET['uid'], 'work_address2', true);?>" /></td>
95 </tr> 194 </tr>
96 <tr> 195 <tr>
97 <th>City:</th> 196 <th>City:</th>
98 <td><input type="text" name="city" value="<?php echo get_user_meta($_GET['uid'], 'city', true);?>" /></td> 197 <td><input type="text" name="work_city" value="<?php echo get_user_meta($_GET['uid'], 'work_city', true);?>" /></td>
99 </tr> 198 </tr>
100 <tr> 199 <tr>
101 <th>State/Province:</th> 200 <th>State/Province:</th>
102 <td> 201 <td>
103 <select name="province"> 202 <select name="work_province">
104 <option disabled value="">Select a State/Province</option> 203 <option disabled value="">Select a State/Province</option>
105 <optgroup label="Canada"> 204 <optgroup label="Canada">
106 <?php HTML\select_opts_provinces(get_user_meta($_GET['uid'], 'province', true)); ?> 205 <?php HTML\select_opts_provinces(get_user_meta($_GET['uid'], 'work_province', true)); ?>
107 </optgroup> 206 </optgroup>
108 207
109 <optgroup label="United States"> 208 <optgroup label="United States">
110 <?php HTML\select_opts_states(get_user_meta($_GET['uid'], 'province', true)); ?> 209 <?php HTML\select_opts_states(get_user_meta($_GET['uid'], 'work_province', true)); ?>
111 </optgroup> 210 </optgroup>
112 </select> 211 </select>
113 </td> 212 </td>
114 </tr> 213 </tr>
115 <tr> 214 <tr>
116 <th>Postal:</th> 215 <th>Postal:</th>
117 <td><input type="text" name="postal" value="<?php echo get_user_meta($_GET['uid'], 'postal', true); ?>" /></td> 216 <td><input type="text" name="work_postal" value="<?php echo get_user_meta($_GET['uid'], 'work_postal', true); ?>" /></td>
118 </tr> 217 </tr>
119 <tr> 218 <tr>
120 <th>Country:</th> 219 <th>Country:</th>
121 <td> 220 <td>
122 <select name="country"> 221 <select name="work_country">
123 <?php HTML\select_opts_countries(get_user_meta($_GET['uid'], 'country', true)); ?> 222 <?php HTML\select_opts_countries(get_user_meta($_GET['uid'], 'work_country', true)); ?>
124 </select> 223 </select>
125 </td> 224 </td>
126 </tr> 225 </tr>
127 <tr> 226 <tr>
128 <th>Phone:</th> 227 <th>Phone:</th>
129 <td><input type="text" name="phone" value="<?php echo get_user_meta($_GET['uid'], 'phone', true);?>" /></td> 228 <td><input type="text" name="work_phone" value="<?php echo get_user_meta($_GET['uid'], 'work_phone', true);?>" rel="mask-phone" /></td>
130 </tr> 229 </tr>
131 <tr> 230 <tr>
132 <th>Fax:</th> 231 <th>Fax:</th>
133 <td><input type="text" name="fax" value="<?php echo get_user_meta($_GET['uid'], 'fax', true);?>" /></td> 232 <td><input type="text" name="work_fax" value="<?php echo get_user_meta($_GET['uid'], 'work_fax', true);?>" rel="mask-phone" /></td>
134 </tr> 233 </tr>
135 <tr> 234 <tr>
136 <th>Email:</th> 235 <th>Email:</th>
137 <td><input type="text" name="email" value="<?php echo $user->user_email;?>" /></td> 236 <td><input type="text" name="work_email" value="<?php echo get_user_meta($_GET['uid'], 'work_email', true);?>" /></td>
138 </tr> 237 </tr>
139 <tr> 238 <tr>
140 <th>Mobile:</th> 239 <th>Mobile:</th>
141 <td><input type="text" name="mobile" value="<?php echo get_user_meta($_GET['uid'], 'mobile', true);?>" /></td> 240 <td><input type="text" name="work_mobile" value="<?php echo get_user_meta($_GET['uid'], 'work_mobile', true);?>" rel="mask-phone" /></td>
142 </tr> 241 </tr>
143 <tr class="work-only"> 242 <tr class="work-only">
144 <th>Website:</th> 243 <th>Website:</th>
...@@ -146,38 +245,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); ...@@ -146,38 +245,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
146 </tr> 245 </tr>
147 </tbody> 246 </tbody>
148 </table> 247 </table>
149 248
150 </div>
151 <div style="float:left; width:350px;">
152 <h4>Notification Settings</h4>
153 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
154 <tbody>
155 <tr>
156 <th width="150">Email for Notifications:</th>
157 <td>
158 <select name="email_address_preference">
159 <?php
160 $email = $user->user_email;
161 ?>
162 <option value="none" <?php echo ($preference=="none") ? "selected" : "";?>>None</option>
163 <?php if(!empty($email)): ?><option value="email" <?php echo ($preference=="email") ? "selected" : "";?>><?php echo $email;?></option><?php endif;?>
164 </select>
165 </td>
166 </tr>
167 </tbody>
168 </table>
169
170 <?php if ($role=="member") :?>
171 <h4>Membership</h4>
172 <table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
173 <tbody>
174 <tr>
175 <th width="150">Member Since:</th>
176 <td><input type="text" name="member_since" value="<?php echo get_user_meta($_GET['uid'], 'member_since', true);?>" /></td>
177 </tr>
178 </tbody>
179 </table>
180 <?php endif;?>
181 </div> 249 </div>
182 250
183 251
...@@ -191,12 +259,18 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); ...@@ -191,12 +259,18 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
191 </form> 259 </form>
192 </div> 260 </div>
193 <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script> 261 <script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script>
262 <script src="<?php echo Tools\url('../');?>"></script>
194 <script> 263 <script>
195 jQuery(function() { 264 jQuery(function($) {
265 $('input[rel="mask-phone"]').mask("999-999-9999");
266 $('input[rel="mask-birthdate"]').mask("9999-99-99");
267 /*
196 update_listing_preference(); 268 update_listing_preference();
197 269
270
198 jQuery('#profile_preference').change(function() { 271 jQuery('#profile_preference').change(function() {
199 update_listing_preference(); 272 update_listing_preference();
200 }); 273 });
274 */
201 }); 275 });
202 </script> 276 </script>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
21 cursor: default; 21 cursor: default;
22 padding: 0em; padding:3px 10px 3px 10px; 22 padding: 0em; padding:3px 10px 3px 10px;
23 margin: 0em; 23 margin: 0em;
24
24 } 25 }
25 26
27
26 form { 28 form {
27 display: block; 29 display: block;
28 margin-right:20px; 30 margin-right:20px;
...@@ -34,6 +36,8 @@ ...@@ -34,6 +36,8 @@
34 36
35 <body> 37 <body>
36 38
39 <div style="display:block; width:500px;">
40
37 <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Edit <?php echo $name; ?>'s CE Hours:</div> 41 <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Edit <?php echo $name; ?>'s CE Hours:</div>
38 42
39 <form method="post" action="" id="edit-cehours-form"> 43 <form method="post" action="" id="edit-cehours-form">
...@@ -69,21 +73,19 @@ ...@@ -69,21 +73,19 @@
69 <th>Hours:</th> 73 <th>Hours:</th>
70 <td><input type="text" name="hours" value="<?php echo $hours;?>" /></td> 74 <td><input type="text" name="hours" value="<?php echo $hours;?>" /></td>
71 </tr> 75 </tr>
76
77 <tr>
78 <th>&nbsp;</th>
79 <td><div><input type="submit" value="<?php echo ($action=="edit") ? "Update" : "Apply"; ?>" /></div> </td>
80 </tr>
72 </tbody> 81 </tbody>
73 </table> 82 </table>
74 83
75 </div> 84 </div>
76 </div> 85 </div>
77 86
78 <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> 87
79 <div class="dashboard-section-title"></div>
80 <div class="dashboard-section-links"></div>
81 <div class="dashboard-section-content small">
82 <div><input type="submit" value="<?php echo ($action=="edit") ? "Update" : "Apply"; ?>" /></div>
83 </div>
84 </div>
85
86 </form> 88 </form>
87 89 </div>
88 </body> 90 </body>
89 </html> 91 </html>
...\ No newline at end of file ...\ No newline at end of file
......