[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [websites/akademy-registration] /: add project roles fields
From:       Marijn Kruisselbrink <mkruisselbrink () kde ! org>
Date:       2012-01-31 22:23:53
Message-ID: 20120131222353.4DDB5A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 878ed2ecfa09db08d00d5aba2ebc6fae03c9472b by Marijn Kruisselbrink.
Committed on 31/01/2012 at 20:52.
Pushed by mkruisselbrink into branch 'master'.

add project roles fields

M  +15   -0    registration.install
M  +49   -18   registration.module
M  +8    -0    registration_admin.inc

http://commits.kde.org/websites/akademy-registration/878ed2ecfa09db08d00d5aba2ebc6fae03c9472b


diff --git a/registration.install b/registration.install
index 8962362..51df1c9 100644
--- a/registration.install
+++ b/registration.install
@@ -383,6 +383,10 @@ function registration_schema() {
          'confirmation_date' => array('type' => 'int', 'not null' => FALSE, \
                'disp-width' => '11'),
          'announce_subscribe' => array('type' => 'int', 'size' => 'tiny', 'not null' \
                => FALSE, 'disp-width' => '1'),
          'notified_to_travel_agency' => array('type' => 'int', 'size' => 'tiny', \
'not null' => FALSE, 'disp-width' => '1')), +
+         'project_roles' => array('type' => 'varchar', 'length' => '255', 'not null' \
=> FALSE), +         'project_custom_role' => array('type' => 'text', 'not null' => \
FALSE), +         'first_time' => array('type' => 'int', 'size' => 'tiny', 'not null' \
=> FALSE),  'primary key' => array('uid'),
     'indexes' => array(
          'groupid' => array('groupid')),
@@ -453,3 +457,14 @@ function registration_schema() {
 
   return $schema;
 }
+
+function registration_update_1() {
+  $ret = array();
+  db_add_field($ret, 'registration_registrant', 'project_roles',
+    array('type' => 'varchar', 'length' => '255', 'not null' => FALSE));
+  db_add_field($ret, 'registration_registrant', 'project_custom_role',
+    array('type' => 'text', 'not null' => FALSE));
+  db_add_field($ret, 'registration_registrant', 'first_time',
+    array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE));
+  return $ret;
+}
diff --git a/registration.module b/registration.module
index 29d6a48..486a047 100644
--- a/registration.module
+++ b/registration.module
@@ -54,6 +54,7 @@ function registration_variable_get($name) {
         'participant_mailing_list' => 'registration_participant',
         'welcome_text' => "<p>Now you are registered in !event_name. We'll be \
waiting for you!</p><p>As part of this registration process you have already been \
subscribed to the akademy-announce mailing-list, a low-volume list with important \
announcements for registrants. You might also want to subscribe to the \
akademy_participant list at <a \
href=\"https://mail.kde.org/mailman/listinfo/akademy-participant\">https://mail.kde.org/mailman/listinfo/akademy-participant</a> \
to discuss or chat about Camp KDE with other participants.</p>",  'start_text' => \
"<p>Some text here</p>", +        'project_roles'  => array('Developer', \
'Translator', 'Community', 'Promo', 'Artist', 'User'),  );
     return variable_get('registration_' . $name, $default_values[$name]);
 }
@@ -573,7 +574,10 @@ function registration_user($op, &$edit, &$account, $category = \
NULL) {  "groupid = %s, ".
           "ispaid = %d, ".
           "confirmation_sent = %d, ".
-          "announce_subscribe = %d ".
+          "announce_subscribe = %d, ".
+          "project_roles = '%s', ".
+          "project_custom_role = '%s', ".
+          "first_time = %d " .
         "WHERE ".
           "uid=%d",
         $account->registrant->locked,
@@ -615,6 +619,9 @@ function registration_user($op, &$edit, &$account, $category = \
NULL) {  $account->registrant->ispaid,
         $account->registrant->confirmation_sent,
         $account->registrant->announce_subscribe,
+        $account->registrant->project_roles,
+        $account->registrant->project_custom_role,
+        $account->registrant->first_time,
         $account->uid
       );
 
@@ -971,6 +978,40 @@ function registration_registrant_form(&$form_state, $account, \
                $isadmin = FALSE)
         '#description'   => t('If you have any other health problems or allergies, \
please let us know about it')  );
 
+  //FIELDSET
+  $form['fs5'] = array(
+    '#type'         => 'fieldset',
+    '#title'        => t('You and KDE'),
+    '#collapsible'  => TRUE,
+    '#collapsed'    => FALSE,
+  );
+
+  $roles = registration_variable_get('project_roles');
+  if (count($roles)) {
+    $options = array();
+    foreach ($roles as $role) {
+      $options[$role] = $role;
+    }
+    ksort($options);
+
+    $form['fs5']['project_roles'] = array(
+        '#type'          => 'checkboxes',
+        '#title'         => t('Your role in KDE'),
+        '#options'       => $options,
+        '#default_value' => split(',',$account->registrant->project_roles),
+        '#disabled'      => $locked,
+        );
+
+    $form['fs5']['project_custom_role'] = array(
+        '#type'          => 'textarea',
+        '#title'         => t('Other'),
+        '#disabled'      => $locked,
+        '#default_value' => $account->registrant->project_custom_role,
+        );
+  }
+
+  // TODO: firsttime
+
 
   //FIELDSET
   $form['fs3'] = array(
@@ -980,7 +1021,6 @@ function registration_registrant_form(&$form_state, $account, \
$isadmin = FALSE)  '#collapsed'    => FALSE,
   );
 
-
   //Interest and contributions
   $form['fs3']['interest'] = array(
     '#type'              => 'textarea',
@@ -1093,6 +1133,13 @@ function registration_registrant_form_submit($form, \
                &$form_state) {
         if (!$locked) $account->registrant->dietary_requirements = join(',', \
$values);  break;
 
+      case 'project_roles':
+        $values = array();
+        foreach ($value as $key => $v) if ($v && !is_numeric($key))
+          $values[] = $v;
+        if (!$locked) $account->registrant->project_roles = join(',', $values);
+        break;
+
       default:
         if (substr($field, 0, 7) == 'option_') {
           $account->registrant->options[(int) substr($field, 7)] = $value;
@@ -1316,13 +1363,6 @@ function registration_attendance_form_submit($form, \
&$form_state) {  foreach ($form_state['values'] as $field => $value) {
       switch ($field)
       {
-        case 'dietary_requirements':
-          $values = array();
-          foreach ($value as $key => $v) if ($v && !is_numeric($key))
-            $values[] = $v;
-          $account->registrant->dietary_requirements = join(',', $values);
-          break;
-
         default:
           if (substr($field, 0, 7) == 'option_') {
             $account->registrant->options[(int) substr($field, 7)] = $value;
@@ -1792,16 +1832,7 @@ function registration_accommodation_form_submit($form, \
&$form_state) {  foreach ($form_state['values'] as $field => $value) {
       switch ($field)
       {
-        case 'dietary_requirements':
-          $values = array();
-          foreach ($value as $key => $v) if ($v && !is_numeric($key))
-            $values[] = $v;
-          $account->registrant->dietary_requirements = join(',', $values);
-          break;
-
         default:
-
-
           if (substr($field, 0, 7) == 'option_') {
             $account->registrant->options[(int) substr($field, 7)] = $value;
           } else if (!$paid && substr($field, 0, 17) == "accommodation_day") {
diff --git a/registration_admin.inc b/registration_admin.inc
index 1c02693..d5075ee 100644
--- a/registration_admin.inc
+++ b/registration_admin.inc
@@ -858,6 +858,13 @@ function registration_admin_form(&$form_state) {
       '#default_value'  => join(', ', \
registration_variable_get('dietary_requirements')),  );
 
+    $form['project_roles'] = array(
+      '#title'          => t('Project roles'),
+      '#description'    => t('Comma-seperated list of possible project roles \
checkboxes should be available for in the registratino form'), +      '#type'         \
=> 'textarea', +      '#default_value'  => join(', ', \
registration_variable_get('project_roles')), +    );
+
     $form['submit'] = array(
       '#type'           => 'submit',
       '#value'          => t('Save'),
@@ -891,6 +898,7 @@ function registration_admin_form_submit($form, &$form_state) {
                 variable_set('registration_' . $name, trim($value));
                 break;
             case 'dietary_requirements':
+            case 'project_roles':
                 $vals = explode(",", $value);
                 for ($i = 0; $i < count($vals); ++$i) $vals[$i] = trim($vals[$i]);
                 variable_set('registration_' . $name, $vals);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic