Revision: 4145
Updated Code
at October 28, 2007 15:27 by WimLeers
Updated Code
function mymodule_payment_tracker_form($foo_id) { $foos = foo_get_foos($foo_id); $bars = bar_get_bars($bar_id); if (count($foos) > 0) { // Create the table header. $form['header'][]['#value'] = t('Foos'); foreach ($bars as $bar_id => $bar_name) { $form['header'][]['#value'] = $bar_name; } // Create the rows. foreach ($foos as $foo_id => $foo_name) { $row = array(); $row['firstcol']['#value'] = $foo_name; foreach ($bars as $bar_id => $bar_name) { $row['payments']['#tree'] = TRUE; $row['payments'][$foo_id][] = array( 'paid' => array('#type' => 'checkbox', '#default_value' => $bars[$foo_id], ); } $form['rows'][] = $row; } // Create a heading. $form['heading']['#value'] = '<h3>'. t('Payment tracker for foo.') .'</h3>'; $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); } else { $form['empty']['#value'] = '<p class="foo-empty">'. t('No foos found.') .'</p>'; } $form['#theme'] = 'mymodule_table_form'; return $form; }
Revision: 4144
Updated Code
at October 28, 2007 15:25 by WimLeers
Updated Code
function hockeystars_pt_team_form($foo_id) { $foos = foo_get_foos($foo_id); $bars = bar_get_bars($bar_id); if (count($foos) > 0) { // Create the table header. $form['header'][]['#value'] = t('Foos'); foreach ($bars as $bar_id => $bar_name) { $form['header'][]['#value'] = $bar_name; } // Create the rows. foreach ($foos as $foo_id => $foo_name) { $row = array(); $row['firstcol']['#value'] = $foo_name; foreach ($bars as $bar_id => $bar_name) { $row['payments']['#tree'] = TRUE; $row['payments'][$foo_id][] = array( 'paid' => array('#type' => 'checkbox', '#default_value' => $bars[$foo_id], ); } $form['rows'][] = $row; } // Create a heading. $form['heading']['#value'] = '<h3>'. t('Payment tracker for foo.') .'</h3>'; $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); } else { $form['empty']['#value'] = '<p class="foo-empty">'. t('No foos found.') .'</p>'; } $form['#theme'] = 'mymodule_table_form'; return $form; }
Revision: 4143
Updated Code
at October 28, 2007 15:24 by WimLeers
Updated Code
function hockeystars_pt_team_form($foo_id) { $foos = foo_get_foos($foo_id); $bars = bar_get_bars($bar_id); if (count($fooss) > 0) { // Create the table header. $form['header'][]['#value'] = t('Foos'); foreach ($bars as $bar_id => $bar_name) { $form['header'][]['#value'] = $bar_name; } // Create the rows. foreach ($foos as $foo_id => $foo_name) { $row = array(); $row['firstcol']['#value'] = $foo_name; foreach ($bars as $bar_id => $bar_name) { $row['payments']['#tree'] = TRUE; $row['payments'][$foo_id][] = array( 'paid' => array('#type' => 'checkbox', '#default_value' => $bars[$foo_id], ); } $form['rows'][] = $row; } // Create a heading. $form['heading']['#value'] = '<h3>'. t('Payment tracker for foo.') .'</h3>'; $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); } else { $form['empty']['#value'] = '<p class="foo-empty">'. t('No foos found.') .'</p>'; } $form['#theme'] = 'mymodule_table_form'; return $form; }
Revision: 4142
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 28, 2007 15:20 by WimLeers
Initial Code
function hockeystars_pt_team_form($team_nid) { $players = hockeystars_teams_team_players($team_nid); $seasons = hockeystars_teams_team_seasons($team_nid); if (count($players) > 0) { // Create the table header. $form['header'][]['#value'] = t('Players'); foreach ($seasons as $season_tid => $season_name) { $form['header'][]['#value'] = $season_name; } // Get the payment status for all players of this team. foreach ($seasons as $season_tid => $season_name) { $players_payments[$season_tid] = hockeystars_pt_load_by_season_and_team($season_tid, $team_nid); } // Create the rows. foreach ($players as $player_uid => $player_name) { $row = array(); $row['firstcol']['#value'] = l($player_name, 'user/'. $player_uid); foreach ($seasons as $season_tid => $season_name) { $row['payments']['#tree'] = TRUE; $row['payments'][$player_uid][] = array( 'season_tid' => array('#type' => 'hidden', '#value' => $season_tid), 'paid' => array('#type' => 'checkbox', '#default_value' => $players_payments[$season_tid][$player_uid]), ); } $form['rows'][] = $row; } // Save the team nid. $form['team_nid'] = array('#type' => 'value', '#value' => $team_nid); // Create a heading. $team_name = db_result(db_query("SELECT title FROM node WHERE nid = %d", $team_nid)); $form['heading']['#value'] = '<h3>'. t('Payment tracker for the %team-name team.', array('%team-name' => $team_name)) .'</h3>'; $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); } else { $form['empty']['#value'] = '<p class="team-empty">'. t('Your team does not yet have any players.') .'</p>'; } $form['#theme'] = 'eightye_table_form'; return $form; }
Initial URL
Initial Description
Initial Title
table form form definition
Initial Tags
textmate, drupal
Initial Language
PHP