forked from science-ation/science-ation
- Add First Aid and CPR data collection to the user table.
- Modify the config so a committee can enable it for volutneers and committee members
This commit is contained in:
parent
e26453f06e
commit
15a56ce13f
@ -95,6 +95,20 @@ $report_committees_fields = array(
|
|||||||
'width' => 2,
|
'width' => 2,
|
||||||
'table' => 'users.organization'),
|
'table' => 'users.organization'),
|
||||||
|
|
||||||
|
'firstaid' => array(
|
||||||
|
'name' => 'Committee Member -- First Aid Training',
|
||||||
|
'header' => 'F.Aid',
|
||||||
|
'width' => 0.5,
|
||||||
|
'table' => 'users.firstaid',
|
||||||
|
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
|
||||||
|
|
||||||
|
'cpr' => array(
|
||||||
|
'name' => 'Committee Member -- CPR Training',
|
||||||
|
'header' => 'CPR',
|
||||||
|
'width' => 0.5,
|
||||||
|
'table' => 'users.cpr',
|
||||||
|
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
|
||||||
|
|
||||||
'static_text' => array(
|
'static_text' => array(
|
||||||
'name' => 'Static Text (useful for labels)',
|
'name' => 'Static Text (useful for labels)',
|
||||||
'header' => '',
|
'header' => '',
|
||||||
|
@ -73,6 +73,20 @@ $report_volunteers_fields = array(
|
|||||||
'width' => 1.0,
|
'width' => 1.0,
|
||||||
'table' => 'users.organization'),
|
'table' => 'users.organization'),
|
||||||
|
|
||||||
|
'firstaid' => array(
|
||||||
|
'name' => 'Volunteer -- First Aid Training',
|
||||||
|
'header' => 'F.Aid',
|
||||||
|
'width' => 0.5,
|
||||||
|
'table' => 'users.firstaid',
|
||||||
|
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
|
||||||
|
|
||||||
|
'cpr' => array(
|
||||||
|
'name' => 'Volunteer -- CPR Training',
|
||||||
|
'header' => 'CPR',
|
||||||
|
'width' => 0.5,
|
||||||
|
'table' => 'users.cpr',
|
||||||
|
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
|
||||||
|
|
||||||
'position_name' => array (
|
'position_name' => array (
|
||||||
'name' => 'Volunteer Position -- Name',
|
'name' => 'Volunteer Position -- Name',
|
||||||
'header' => 'Position',
|
'header' => 'Position',
|
||||||
|
@ -1 +1 @@
|
|||||||
103
|
104
|
||||||
|
9
db/db.update.104.sql
Normal file
9
db/db.update.104.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE `users` ADD `firstaid` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'no' AFTER `postalcode` ;
|
||||||
|
ALTER TABLE `users` ADD `cpr` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'no' AFTER `firstaid` ;
|
||||||
|
|
||||||
|
UPDATE `config` SET `type_values` = 'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province|firstaid=First Aid and CPR' WHERE `var` = 'committee_personal_fields' ;
|
||||||
|
UPDATE `config` SET `type_values` = 'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province|firstaid=First Aid and CPR' WHERE `var` = 'committee_personal_required' ;
|
||||||
|
|
||||||
|
UPDATE `config` SET `type_values` = 'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province|firstaid=First Aid and CPR' WHERE `var` = 'volunteer_personal_fields' ;
|
||||||
|
UPDATE `config` SET `type_values` = 'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province|firstaid=First Aid and CPR' WHERE `var` = 'volunteer_personal_required' ;
|
||||||
|
|
@ -219,7 +219,8 @@ function user_save($u)
|
|||||||
$fields = array('firstname','lastname','username','password',
|
$fields = array('firstname','lastname','username','password',
|
||||||
'email',
|
'email',
|
||||||
'phonehome','phonework','phonecell','fax','organization',
|
'phonehome','phonework','phonecell','fax','organization',
|
||||||
'address','address2','city','province','postalcode','sex');
|
'address','address2','city','province','postalcode','sex',
|
||||||
|
'firstaid', 'cpr');
|
||||||
|
|
||||||
$set = "";
|
$set = "";
|
||||||
foreach($fields as $f) {
|
foreach($fields as $f) {
|
||||||
@ -466,7 +467,8 @@ $user_personal_fields_map = array(
|
|||||||
'lang' => array('lang'),
|
'lang' => array('lang'),
|
||||||
'address' => array('address', 'address2', 'postalcode'),
|
'address' => array('address', 'address2', 'postalcode'),
|
||||||
'city' => array('city'),
|
'city' => array('city'),
|
||||||
'province' => array('province'));
|
'province' => array('province'),
|
||||||
|
'firstaid' => array('firstaid','cpr'));
|
||||||
|
|
||||||
function user_personal_fields($type)
|
function user_personal_fields($type)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
'province' => array('name' => 'Province'),
|
'province' => array('name' => 'Province'),
|
||||||
'organization' => array('name' => 'Organization'),
|
'organization' => array('name' => 'Organization'),
|
||||||
'sex' => array('name' => 'Gender'),
|
'sex' => array('name' => 'Gender'),
|
||||||
|
'firstaid' => array ('name' => 'First Aid Training',
|
||||||
|
'type' => 'yesno'),
|
||||||
|
'cpr' => array ('name' => 'CPR Training',
|
||||||
|
'type' => 'yesno'),
|
||||||
'phonehome' => array('name' => 'Phone (Home)',
|
'phonehome' => array('name' => 'Phone (Home)',
|
||||||
'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$',
|
'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$',
|
||||||
'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',),
|
'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',),
|
||||||
@ -225,9 +229,23 @@ function item($user, $fname, $subtext='')
|
|||||||
if(in_array($fname, $errorfields)) $style = 'style="color:red;"';
|
if(in_array($fname, $errorfields)) $style = 'style="color:red;"';
|
||||||
echo "<td><span $style>$text</span>: ";
|
echo "<td><span $style>$text</span>: ";
|
||||||
if($subtext != '') echo '<br /><span style="font-size: 0.5em;">'.i18n($subtext).'</span>';
|
if($subtext != '') echo '<br /><span style="font-size: 0.5em;">'.i18n($subtext).'</span>';
|
||||||
echo '</td>';
|
echo '</td><td>';
|
||||||
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
|
||||||
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
$req = in_array($fname, $required) ? REQUIREDFIELD : '';
|
||||||
|
|
||||||
|
switch($user_personal_fields[$fname]['type']) {
|
||||||
|
case 'yesno':
|
||||||
|
echo "<select name=\"$fname\">";
|
||||||
|
$sel = ($user[$fname]=='yes') ? 'selected="selected"' : '';
|
||||||
|
echo "<option value=\"yes\" $sel>".i18n("Yes")."</option>\n";
|
||||||
|
$sel = ($user[$fname]=='no') ? 'selected="selected"' : '';
|
||||||
|
echo "<option value=\"no\" $sel>".i18n("No")."</option>\n";
|
||||||
|
echo "</select> $req";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo "<input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />$req";
|
||||||
|
break;
|
||||||
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
} else {
|
} else {
|
||||||
echo '<td></td><td></td>';
|
echo '<td></td><td></td>';
|
||||||
@ -303,6 +321,11 @@ item($u, 'fax');
|
|||||||
}
|
}
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
item($u, 'firstaid');
|
||||||
|
item($u, 'cpr');
|
||||||
|
echo "</tr>";
|
||||||
|
|
||||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||||
|
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
Loading…
Reference in New Issue
Block a user