function wmv_mail_form($form_values = NULL) {
// unset($form);
$form['#multistep'] = TRUE;
if ($form_values == null) {
}
if (isset($form_values)) {
// this is at least already the second time that
// this form gets called
$step = $form_values['step'];
switch($step) {
case 1 :
// this is after a submit the first time, so
// that submit action is still to be confirmed
'#type' => 'hidden',
'#value' => $step + 1
);
$form['stepindicatie'] =
array(
'#type' => 'item',
'#value' => 'Stap 2 van 3'
);
'#type' => 'submit',
'#value' =>
t('Naar stap 3')
);
break;
case 2 :
break;
}
return $form;
} else {
// this is the very first time the form is called
$step = 1;
'#type' => 'hidden',
'#value' => $step
);
// drupal_add_js(
// drupal_get_path('module', 'wmv') . '/sitejs.js');
$form['stepindicatie'] =
array(
'#type' => 'item',
'#value' => 'Stap ' . $step . ' van 3'
);
"SELECT SpecialeBevoegdheden FROM {wmv_gebruiker} WHERE DrupalID = %d",
$user->uid)
);
$endresult['own'] = t('Mijzelf');
if ($rsresult != "") {
foreach (explode(',',
$rsresult) as $bevoegdheid) {
$endresult[$bevoegdheid] = $bevoegdheid;
}
$form['hoedanigheid'] =
array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#title' =>
t('Mail versturen in de hoedanigheid van : '),
);
$form['hoedanigheid']['keuzes'] =
array(
'#type' => 'select',
'#options' => $endresult,
'#default_value' => 'own'
);
}
'#type' => 'fieldset',
'#collapsible' => FALSE,
);
$form['aan']['keuzesaan'] =
array(
'#type' => 'radios',
'#options' =>
array('groep' =>
t('Groep'),
'lid' =>
t('WMV-lid')),
'#default_value' => 'lid',
'#attributes' =>
array('onclick' =>
'add_js_code_to_show_and_hide("aan");')
);
// fill the combobox with the values of the members
$result =
db_query("SELECT Naam, Voornaam FROM {wmv_gebruiker} " .
"ORDER BY Naam, Voornaam");
$ledenarray[] = $lidentry->Naam . ' ' . $lidentry->Voornaam;
}
$form['aan']['comboledenaan'] =
array(
'#type' => 'select',
'#options' => $ledenarray,
'#default_value' => 0,
'#multiple' => false
);
// fill the combobox with the values of the groups
// first part : all OWN groups
$result =
db_query("SELECT GroepsNaam FROM {wmv_groepen} WHERE OwnerDrupalID = %d " .
"ORDER BY GroepsNaam", $user->uid);
$groepenarray[] = $groepentry->GroepsNaam;
}
// second part : all COMMON groups
$result =
db_query("SELECT GroepsNaam FROM {wmv_groepen} WHERE OwnerDrupalID = 0 " .
"ORDER BY SorteerVeld");
$gevonden = FALSE;
if (!$gevonden) {
$gevonden = TRUE;
if (count($groepenarray) >
0) {
$groepenarray[] = '---------';
}
}
$groepenarray[] = $groepentry->GroepsNaam;
}
if (count(($groepenarray) >
0)) {
$form['aan']['combogroepenaan'] =
array(
'#type' => 'select',
'#options' => $groepenarray,
'#default_value' => 0,
'#multiple' => false
);
}
'#type' => 'fieldset',
'#collapsible' => FALSE,
);
$form['cc']['keuzescc'] =
array(
'#type' => 'radios',
'#options' =>
array('groep' =>
t('Groep'),
'lid' =>
t('WMV-lid')),
'#default_value' => 'groep',
'#attributes' =>
array('onclick' =>
'add_js_code_to_show_and_hide("cc");')
);
$form['cc']['comboledencc'] =
array(
'#type' => 'select',
'#options' => $ledenarray,
'#default_value' => 0,
'#multiple' => false
);
if (count(($groepenarray) >
0)) {
$form['cc']['combogroepencc'] =
array(
'#type' => 'select',
'#options' => $groepenarray,
'#default_value' => 0,
'#multiple' => false
);
}
$form['onderwerp'] =
array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#title' =>
t('Onderwerp : '),
);
$form['onderwerp']['tekstveld'] =
array(
'#type' => 'textfield',
'#default_value' =>
t('')
);
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#title' =>
t('Tekst : '),
);
$form['tekst']['tekstarea'] =
array(
'#type' => 'textarea',
'#default_value' =>
t(''),
'#rows' => 5
);
$form['attachment'] =
array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#title' =>
t('Bestand toevoegen : '),
);
$form['attachment']['filebutton'] =
array(
'#type' => 'file',
'#size' => 50
// '#description' => t('')
// '#title' => t('')
// '#text' => t('')
);
// needed because the 'file' type is being used in this form :
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['eigenadres'] =
array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#title' =>
t('Eigen email adres in BCC: plaatsen'),
);
$form['eigenadres']['selectie'] =
array(
'#type' => 'checkboxes',
'#description' =>
t('Vink dit veld aan indien deze mail ook naar jouw eigen emailadres ' .
'moet worden gezonden'),
// '#text' => t('')
);
'#type' => 'submit',
'#value' =>
t('Naar stap') .
' ' .
($step +
1)
);
$form['#redirect'] = false;
return $form;
}
}