function tableBox($contents, $direct_output = false) { $tableBox_string = '<table border="' . gen_output_string($this->table_border) . '" width="' . gen_output_string($this->table_width) . '" cellspacing="' . gen_output_string($this->table_cellspacing) . '" cellpadding="' . gen_output_string($this->table_cellpadding) . '"'; if (gen_not_null($this->table_parameters)) { $tableBox_string .= ' ' . $this->table_parameters; } $tableBox_string .= '>' . "\n"; for ($i = 0, $n = sizeof($contents); $i < $n; $i++) { if (isset($contents[$i]['form']) && gen_not_null($contents[$i]['form'])) { $tableBox_string .= $contents[$i]['form'] . "\n"; } $tableBox_string .= ' <tr'; if (gen_not_null($this->table_row_parameters)) { $tableBox_string .= ' ' . $this->table_row_parameters; } if (isset($contents[$i]['params']) && gen_not_null($contents[$i]['params'])) { $tableBox_string .= ' ' . $contents[$i]['params']; } $tableBox_string .= '>' . "\n"; if (isset($contents[$i][0]) && is_array($contents[$i][0])) { for ($x = 0, $n2 = sizeof($contents[$i]); $x < $n2; $x++) { if (isset($contents[$i][$x]['text']) && gen_not_null($contents[$i][$x]['text'])) { $tableBox_string .= ' <td'; if (isset($contents[$i][$x]['align']) && gen_not_null($contents[$i][$x]['align'])) { $tableBox_string .= ' align="' . gen_output_string($contents[$i][$x]['align']) . '"'; } if (isset($contents[$i][$x]['params']) && gen_not_null($contents[$i][$x]['params'])) { $tableBox_string .= ' ' . $contents[$i][$x]['params']; } elseif (gen_not_null($this->table_data_parameters)) { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>'; if (isset($contents[$i][$x]['form']) && gen_not_null($contents[$i][$x]['form'])) { $tableBox_string .= $contents[$i][$x]['form']; } $tableBox_string .= $contents[$i][$x]['text']; if (isset($contents[$i][$x]['form']) && gen_not_null($contents[$i][$x]['form'])) { $tableBox_string .= '</form>'; } $tableBox_string .= '</td>' . "\n"; } } } else { $tableBox_string .= ' <td'; if (isset($contents[$i]['align']) && gen_not_null($contents[$i]['align'])) { $tableBox_string .= ' align="' . gen_output_string($contents[$i]['align']) . '"'; } if (isset($contents[$i]['params']) && gen_not_null($contents[$i]['params'])) { $tableBox_string .= ' ' . $contents[$i]['params']; } elseif (gen_not_null($this->table_data_parameters)) { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n"; } $tableBox_string .= ' </tr>' . "\n"; if (isset($contents[$i]['form']) && gen_not_null($contents[$i]['form'])) { $tableBox_string .= '</form>' . "\n"; } } $tableBox_string .= '</table>' . "\n"; if ($direct_output == true) { echo $tableBox_string; } return $tableBox_string; }
function html_combo_box($name, $values, $default = '', $parameters = '', $width = '220px', $onchange = '', $id = false) { if (!$id) { if (strpos($name, '[]')) { // don't show id attribute if generic array $id = str_replace('[]', '', $name); } else { $id = str_replace('[', '_', gen_output_string($name)); // clean up for array inputs causing html errors $id = str_replace(']', '', $id); } } $field = '<input type="text" name="' . $name . '"'; if ($id) { $field .= ' id="' . $id . '"'; } $field .= ' value="' . $default . '" ' . $parameters . ' />'; $field .= '<img name="imgName' . $id . '" id="imgName' . $id . '" alt="" src="' . DIR_WS_ICONS . '16x16/phreebooks/pull_down_inactive.gif" height="16" width="16" align="top" style="border:none;" onmouseover="handleOver(\'imgName' . $id . '\'); return true;" onmouseout="handleOut(\'imgName' . $id . '\'); return true;" onclick="JavaScript:menuActivate(\'' . $id . '\', \'combodiv' . $id . '\', \'combosel' . $id . '\', \'imgName' . $id . '\')" />'; $field .= '<div id="combodiv' . $id . '" style="position:absolute; display:none; top:0px; left:0px; z-index:10000" onmouseover="javascript:oOverMenu=\'combodiv' . $id . '\';" onmouseout="javascript:oOverMenu=false;">'; $field .= '<select size="10" id="combosel' . $id . '" style="width:' . $width . '; border-style:none" onchange="JavaScript:textSet(\'' . $id . '\', this.value); ' . $onchange . ';" onkeypress="JavaScript:comboKey(\'' . $id . '\', this, event);">'; for ($i = 0; $i < sizeof($values); $i++) { $field .= '<option value="' . $values[$i]['id'] . '"'; if ($default == $values[$i]['id']) { $field .= ' selected="selected"'; } $field .= '>' . htmlspecialchars($values[$i]['text']) . '</option>'; } $field .= '</select></div>'; return $field; }