views:

116

answers:

0

Hello, just started creating my own module. below is my code for the admin.inc file. in the administrative settings im looking to be able to enter numbers into a series of textfields.

ideally this data is represented into a table format, however ive found this process to be very long winded and although it does as i want, i still feel it is the wrong method in which to complete this task.

could anybody with better coding experience please advise..

function marli_admin_settings() {

$form['grades'] = array(
    '#type' => 'fieldset',
    '#title' => t('Grades'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
);      
$form['grades']['marli_score'] = array(
    '#type' => 'hidden',
    '#prefix' => '<table><tr><th>',
    '#suffix' => '</th>'

);
$form['grades']['mind'] = array(
    '#type' => 'hidden',
    '#prefix' => '<th><b>Mind</b>',
    '#suffix' => '</th>'
);

$form['grades']['action'] = array(
    '#type' => 'hidden',
    '#prefix' => '<th><b>Action</b>',
    '#suffix' => '</th>'
);
    $form['grades']['relationship'] = array(
    '#type' => 'hidden',
    '#prefix' => '<th><b>Relationship</b>',
    '#suffix' => '</th>'
);
    $form['grades']['language'] = array(
    '#type' => 'hidden',
    '#prefix' => '<th><b>Language</b>',
    '#suffix' => '</th>'
);
    $form['grades']['IT'] = array(
    '#type' => 'hidden',
    '#prefix' => '<th><b>IT</b>',
    '#suffix' => '</th></tr>'
);

$test = '123';
//GRADES - A
    $form['grades']['grade_A'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>A</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_A'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_A'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_A'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_A'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_A'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr>'
);

//GRADE - B
    $form['grades']['grade_B'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>B</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_B'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_B'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_B'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_B'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_B'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr>'
);

    $form['grades']['grade_C'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>C</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_C'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_C'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_C'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_C'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_C'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr>'
);
    $form['grades']['grade_D'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>D</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_D'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_D'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_D'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_D'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_D'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr>'
);
    $form['grades']['grade_E'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>E</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_E'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_E'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_E'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_E'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_E'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr>'
);

    $form['grades']['grade_F'] = array(
    '#type' => 'hidden',
    '#prefix' => '<tr><td><b>F</b>',
    '#suffix' => '</td>'
);
    $form['grades']['mind_F'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['action_F'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['relationship_F'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['language_F'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td>'
);
    $form['grades']['IT_F'] = array(
    '#type' => 'textfield',
    '#maxlength' => 2, 
    '#size' => 1,
    '#value' => '',
    '#prefix' => '<td>',
    '#suffix' => '</td></tr></table>'
);

$form['submit'] = array(
    '#type' => 'submit', 
    '#value' => t('Save')
);

return $form;

}