Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c25bc9b6
authored
2011-01-19 14:20:58 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
User Manager CE Hours
1 parent
16b32285
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
35 deletions
com/UserManager/UserManager.js
com/UserManager/UserManager.php
com/UserManager/views/edit_user_profile.php
com/UserManager/views/partials/edit_cehour.php
com/UserManager/UserManager.js
View file @
c25bc9b
...
...
@@ -7,7 +7,7 @@ function update_listing_preference() {
}
}
jQuery
(
function
()
{
jQuery
(
function
(
$
)
{
Date
.
firstDayOfWeek
=
0
;
Date
.
format
=
'yyyy-mm-dd'
;
...
...
com/UserManager/UserManager.php
View file @
c25bc9b
...
...
@@ -187,11 +187,6 @@ class ProfileValidation extends Common\Validation {
}
public
function
date_of_birth
(
$val
)
{
if
(
!
empty
(
$val
))
{
if
(
!
HTML\validateDate
(
$val
))
{
throw
new
Exception
(
User\Vars
::
$field_lookup
[
__FUNCTION__
]
.
' must be in YYYY-MM-DD format.'
);
}
}
update_user_meta
(
$_POST
[
'uid'
],
__FUNCTION__
,
$val
);
}
...
...
@@ -240,6 +235,11 @@ class ProfileValidation extends Common\Validation {
throw
new
Exception
(
'An invalid email address was entered in Email'
);
}
}
if
(
$_POST
[
'profile_preference'
]
==
"Home"
)
{
wp_update_user
(
Array
(
'ID'
=>
$_POST
[
'uid'
]
,
'user_email'
=>
$val
)
);
}
update_user_meta
(
$_POST
[
'uid'
],
'home_email'
,
$val
);
}
...
...
@@ -288,6 +288,11 @@ class ProfileValidation extends Common\Validation {
throw
new
Exception
(
'An invalid email address was entered in Email'
);
}
}
if
(
$_POST
[
'profile_preference'
]
==
"Work"
)
{
wp_update_user
(
Array
(
'ID'
=>
$_POST
[
'uid'
]
,
'user_email'
=>
$val
)
);
}
update_user_meta
(
$_POST
[
'uid'
],
'work_email'
,
$val
);
}
...
...
@@ -673,12 +678,30 @@ class Actions {
}
$postarray
=
$_POST
;
$cehours
[
$_POST
[
'indexed'
]]
=
Array
(
'type'
=>
$postarray
[
'type'
]
,
'subtype'
=>
isset
(
$postarray
[
'subtype'
])
?
$postarray
[
'subtype'
]
:
""
,
'date'
=>
CEHours\mysqldatetime_to_timestamp
(
$postarray
[
'date'
])
,
'activity'
=>
isset
(
$postarray
[
'activity'
])
?
$postarray
[
'activity'
]
:
""
,
'institute'
=>
isset
(
$postarray
[
'institution'
])
?
$postarray
[
'institution'
]
:
""
,
'hours'
=>
$postarray
[
'hours'
]
,
'attended'
=>
isset
(
$postarray
[
'attended'
])
?
"yes"
:
"no"
,
'event_id'
=>
"0"
,
'recorded'
=>
time
()
);
/*
$cehours[$_POST['indexed']] = Array(
'type' => $_POST['type']
, 'date' => $timestamp
, 'activity' => $_POST['activity']
, 'hours' => $_POST['hours']
);
*/
update_user_meta
(
$_POST
[
'uid'
],
'cehours'
,
$cehours
);
// return json object
...
...
@@ -713,12 +736,18 @@ class Actions {
$type
=
$record
[
'type'
];
$date
=
date
(
'Y-m-d'
,
$record
[
'date'
]);
$activity
=
$record
[
'activity'
];
$subtype
=
isset
(
$record
[
'subtype'
])
?
$record
[
'subtype'
]
:
""
;
$institute
=
isset
(
$record
[
'institute'
])
?
$record
[
'institute'
]
:
""
;
$attended
=
isset
(
$record
[
'attended'
])
?
$record
[
'attended'
]
:
""
;
$hours
=
$record
[
'hours'
];
}
else
{
$indexed
=
""
;
$type
=
"unstructured"
;
$date
=
date
(
'Y-m-d'
,
time
());
$activity
=
""
;
$subtype
=
""
;
$institute
=
""
;
$attended
=
""
;
$hours
=
"0"
;
}
...
...
com/UserManager/views/edit_user_profile.php
View file @
c25bc9b
...
...
@@ -70,14 +70,10 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
</tbody>
</table>
<h4>
Notification
&
Settings
</h4>
<h4>
Notification Settings
</h4>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
class=
"my-profile-table"
>
<tbody>
<tr>
<th
width=
"150"
>
Profile Preference
</th>
<td><select
name=
"profile_preference"
id=
"profile_preference"
><option
value=
"Home"
<?php
echo
(
$profile_preference
==
"Home"
)
?
"selected"
:
""
;
?>
>
Home
</option><option
value=
"Work"
<?php
echo
(
$profile_preference
==
"Work"
)
?
"selected"
:
""
;
?>
>
Work
</option></select></td>
</tr>
<tr>
<th
width=
"150"
>
Email for Notifications:
</th>
<td>
<select
name=
"email_address_preference"
>
...
...
@@ -119,6 +115,10 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
class=
"my-profile-table"
>
<tbody>
<tr>
<td
colspan=
"2"
><input
type=
"radio"
name=
"profile_preference"
value=
"Home"
<?php
echo
(
get_user_meta
(
$_GET
[
'uid'
],
'profile_preference'
,
true
)
==
"Home"
)
?
"checked='checked'"
:
""
;
?>
/>
<em>
Preferred
</em>
contact method.
</td>
</tr>
<tr><td
colspan=
"2"
>
</td></tr>
<tr>
<th>
Address:
</th>
<td><input
type=
"text"
name=
"home_address"
value=
"
<?php
echo
get_user_meta
(
$_GET
[
'uid'
],
'home_address'
,
true
);
?>
"
/></td>
</tr>
...
...
@@ -175,7 +175,10 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
<h4>
Work Contact Information
</h4>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
class=
"my-profile-table"
>
<tbody>
<tr>
<td
colspan=
"2"
><input
type=
"radio"
name=
"profile_preference"
value=
"Home"
<?php
echo
(
get_user_meta
(
$_GET
[
'uid'
],
'profile_preference'
,
true
)
==
"Work"
)
?
"checked='checked'"
:
""
;
?>
/>
<em>
Preferred
</em>
contact method.
</td>
</tr>
<tr><td
colspan=
"2"
>
</td></tr>
<tr
class=
"work-only"
>
<th>
Company:
</th>
<td><input
type=
"text"
name=
"company"
value=
"
<?php
echo
get_user_meta
(
$_GET
[
'uid'
],
'company'
,
true
);
?>
"
/></td>
...
...
com/UserManager/views/partials/edit_cehour.php
View file @
c25bc9b
...
...
@@ -36,7 +36,7 @@
<body>
<div
style=
"display:block; width:
50
0px;"
>
<div
style=
"display:block; width:
75
0px;"
>
<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>
...
...
@@ -51,32 +51,20 @@
<div
class=
"dashboard-section-content small"
>
<table
class=
"clean no-left-padding"
>
<tbody>
<tr>
<th
width=
"100"
>
Type:
</th>
<td>
<select
name=
"type"
>
<option
value=
"structured"
<?php
echo
(
$type
==
"structured"
)
?
"selected"
:
""
;
?>
>
Structured
</option>
<option
value=
"unstructured"
<?php
echo
(
$type
==
"unstructured"
)
?
"selected"
:
""
;
?>
>
Unstructured
</option>
</select>
</td>
</tr>
<tr>
<tr
class=
"top-td"
>
<td
width=
"140"
><select
style=
"width:120px;"
name=
"type"
><option
value=
"structured"
<?php
echo
(
$type
==
"structured"
)
?
"selected"
:
""
;
?>
>
Structured
</option><option
value=
"unstructured"
<?php
echo
(
$type
==
"unstructured"
)
?
"selected"
:
""
;
?>
>
Unstructured
</option></select></td>
<th>
Date:
</th>
<td><input
type=
"text"
class=
"datepicker"
name=
"date"
value=
"
<?php
echo
$date
;
?>
"
/></td>
</tr>
<tr>
<th>
Activity
</th>
<td><input
type=
"text"
name=
"activity"
value=
"
<?php
echo
$activity
;
?>
"
/></td>
</tr>
<tr>
<td
width=
"150"
><input
type=
"text"
name=
"date"
readonly
class=
"datepicker"
style=
"width:120px;"
value=
"
<?php
echo
$date
;
?>
"
/></td>
<th>
Activity Type:
</th>
<td><select
style=
"width:120px;"
name=
"subtype"
class=
"subtype"
id=
"subtype"
><option
value=
"none"
<?php
echo
(
$subtype
==
""
)
?
"selected"
:
""
?>
>
Non Specific
</option><option
value=
"event"
<?php
echo
(
$subtype
==
"event"
)
?
"selected"
:
""
?>
>
External Event
</option></select></td>
<th>
Hours:
</th>
<td><input
type=
"text"
name=
"hours"
value=
"
<?php
echo
$hours
;
?>
"
/></td>
<td
style=
"width:50px;"
><input
type=
"text"
name=
"hours"
style=
"width:30px;"
maxlength=
"2"
value=
"
<?php
echo
$hours
;
?>
"
/></td>
</tr>
<tr
class=
"activity_row bottom-border-td"
>
<th
colspan=
"7"
style=
"text-align:left;"
><label
style=
"padding-right:10px;"
>
Activity:
</label><input
type=
"text"
name=
"activity"
style=
"width:450px;"
value=
"
<?php
echo
$activity
;
?>
"
/></th>
</tr>
<tr>
<th>
</th>
<td><div><input
type=
"submit"
value=
"
<?php
echo
(
$action
==
"edit"
)
?
"Update"
:
"Apply"
;
?>
"
/></div>
</td>
<td
colspan=
"7"
><div><input
type=
"submit"
value=
"Apply"
/></div></td>
</tr>
</tbody>
</table>
...
...
@@ -87,5 +75,37 @@
</form>
</div>
<script
type=
"text/javascript"
>
var $ = jQuery;
function updateCEType(obj) {
var $selectbox = $(obj);
var $table = $(obj).parent().parent().parent();
var $activity_row = $('tr.activity_row', $table);
switch($selectbox.val()) {
case 'event':
var r = '<th colspan="7" style="text-align:left;"><label style="padding-right:10px;">Activity:</label><input type="text" name="activity" style="width:200px;" value="
<?php
echo
$activity
;
?>
" /> <label style="padding-right:10px;">Institution:</label><input type="text" name="institution" style="width:200px;" value="
<?php
echo
$institute
;
?>
" /> <input type="checkbox" name="attended" value="on"
<?php
echo
(
$attended
==
"yes"
)
?
'checked="checked"'
:
''
;
?>
/> They Attended</th>';
break;
default:
var r = '<th colspan="7" style="text-align:left;"><label style="padding-right:10px;">Activity:</label><input type="text" name="activity" style="width:450px;" value="
<?php
echo
$activity
;
?>
"
/><
/th>'
;
}
$activity_row
.
html
(
r
);
}
jQuery
(
function
(
$
)
{
$
(
'.subtype'
).
live
(
'change'
,
function
()
{
updateCEType
(
this
);
});
updateCEType
(
$
(
'.subtype'
));
});
</script>
</body>
</html>
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment