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
@ -94,6 +94,20 @@ $report_committees_fields = array(
|
||||
'header' => 'Organization',
|
||||
'width' => 2,
|
||||
'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(
|
||||
'name' => 'Static Text (useful for labels)',
|
||||
|
@ -73,6 +73,20 @@ $report_volunteers_fields = array(
|
||||
'width' => 1.0,
|
||||
'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 (
|
||||
'name' => 'Volunteer Position -- Name',
|
||||
'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',
|
||||
'email',
|
||||
'phonehome','phonework','phonecell','fax','organization',
|
||||
'address','address2','city','province','postalcode','sex');
|
||||
'address','address2','city','province','postalcode','sex',
|
||||
'firstaid', 'cpr');
|
||||
|
||||
$set = "";
|
||||
foreach($fields as $f) {
|
||||
@ -466,7 +467,8 @@ $user_personal_fields_map = array(
|
||||
'lang' => array('lang'),
|
||||
'address' => array('address', 'address2', 'postalcode'),
|
||||
'city' => array('city'),
|
||||
'province' => array('province'));
|
||||
'province' => array('province'),
|
||||
'firstaid' => array('firstaid','cpr'));
|
||||
|
||||
function user_personal_fields($type)
|
||||
{
|
||||
|
@ -45,6 +45,10 @@
|
||||
'province' => array('name' => 'Province'),
|
||||
'organization' => array('name' => 'Organization'),
|
||||
'sex' => array('name' => 'Gender'),
|
||||
'firstaid' => array ('name' => 'First Aid Training',
|
||||
'type' => 'yesno'),
|
||||
'cpr' => array ('name' => 'CPR Training',
|
||||
'type' => 'yesno'),
|
||||
'phonehome' => array('name' => 'Phone (Home)',
|
||||
'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\'',),
|
||||
@ -225,9 +229,23 @@ function item($user, $fname, $subtext='')
|
||||
if(in_array($fname, $errorfields)) $style = 'style="color:red;"';
|
||||
echo "<td><span $style>$text</span>: ";
|
||||
if($subtext != '') echo '<br /><span style="font-size: 0.5em;">'.i18n($subtext).'</span>';
|
||||
echo '</td>';
|
||||
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
||||
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
||||
echo '</td><td>';
|
||||
|
||||
$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>';
|
||||
} else {
|
||||
echo '<td></td><td></td>';
|
||||
@ -303,6 +321,11 @@ item($u, 'fax');
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
item($u, 'firstaid');
|
||||
item($u, 'cpr');
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
|
||||
echo "</table>";
|
||||
|
Loading…
Reference in New Issue
Block a user