function print_hidden_input($p_field_key, $p_field_val) { if (is_array($p_field_val)) { foreach ($p_field_val as $t_key => $t_value) { if (is_array($t_value)) { $t_key = string_html_entities($t_key); $t_field_key = $p_field_key . '[' . $t_key . ']'; print_hidden_input($t_field_key, $t_value); } else { $t_field_key = $p_field_key . '[' . $t_key . ']'; print_hidden_input($t_field_key, $t_value); } } } else { $t_key = string_html_entities($p_field_key); $t_val = string_html_entities($p_field_val); echo "<input type=\"hidden\" name=\"{$t_key}\" value=\"{$t_val}\" />\n"; } }
function generate_form($inst_id) { global $USER, $COURSE, $CFG; $options = print_options($COURSE->id); $html = ''; $html .= "<span id='massaction_javascriptwarning'>" . get_string('javascript', 'block_massaction') . "</span>"; $html .= "<form name = \"massactionexecute\" id =\"massactionexecute\" action=\"{$CFG->wwwroot}/blocks/massaction/action.php\" method=\"post\">"; $html .= print_hidden_input("return_to", $_SERVER["REQUEST_URI"]); $html .= print_hidden_input("act_move", "move"); $html .= print_hidden_input("sesskey", $USER->sesskey); $html .= print_hidden_input("courseid", $COURSE->id); $html .= print_hidden_input("instance_id", $inst_id); $html .= "<table>"; $html .= "<tr><td colspan = 3><b>" . get_string('select', 'block_massaction') . "</b></td></tr>"; $html .= "<tr><td><img src=\"{$CFG->pixpath}/spacer.gif\" style='width:11px';/></td>"; $html .= "<td colspan = 2><a href=\"javascript:select_all()\">" . get_string('selectall', 'block_massaction') . "</a></td></tr> "; $html .= $options['select']; $html .= "<tr><td/><td colspan = 2><a href=\"javascript:deselect_all()\">" . get_string('deselectall', 'block_massaction') . "</a></td></tr>"; $html .= "<tr><td><div style='height:8px;'></div></td></tr>"; $html .= "<tr><td colspan = 3><b>" . get_string('with_selected', 'block_massaction') . "</b></td></tr>"; if (right_to_left()) { // support rtl / ltr (nadavkav patch) $html .= print_submit_text('outdent', '/t/right.gif'); $html .= print_submit_text('indent', '/t/left.gif'); } else { $html .= print_submit_text('outdent', '/t/left.gif'); $html .= print_submit_text('indent', '/t/right.gif'); } $html .= print_submit_text('hide', '/t/show.gif'); $html .= print_submit_text('show', '/t/hide.gif'); $html .= print_submit_text('delete', '/t/delete.gif'); $html .= $options['move']; $html .= "<tr><td colspan=4 style='text-align:center; width:100%'>" . helpbutton('massaction', get_string('title', 'block_massaction'), 'block_massaction', true, false, NULL, true) . "</td></tr>"; $html .= "</table></form>"; return $html; }
/** * Print an input field * $p_field_def contains the definition of the custom field (including it's field id * $p_bug_id contains the bug where this field belongs to. If it's left * away, it'll default to 0 and thus belongs to a new (i.e. non-existant) bug * NOTE: This probably belongs in the print_api.php * @param array $p_field_def Custom field definition. * @param integer $p_bug_id A bug identifier. * @return void * @access public */ function print_custom_field_input(array $p_field_def, $p_bug_id = null) { if (null === $p_bug_id) { $t_custom_field_value = custom_field_default_to_value($p_field_def['default_value'], $p_field_def['type']); } else { $t_custom_field_value = custom_field_get_value($p_field_def['id'], $p_bug_id); # If the custom field value is undefined and the field cannot hold a null value, use the default value instead if ($t_custom_field_value === null && ($p_field_def['type'] == CUSTOM_FIELD_TYPE_ENUM || $p_field_def['type'] == CUSTOM_FIELD_TYPE_LIST || $p_field_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || $p_field_def['type'] == CUSTOM_FIELD_TYPE_RADIO)) { $t_custom_field_value = custom_field_default_to_value($p_field_def['default_value'], $p_field_def['type']); } } global $g_custom_field_type_definition; if (isset($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'])) { call_user_func($g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'], $p_field_def, $t_custom_field_value); print_hidden_input(custom_field_presence_field_name($p_field_def['id']), '1'); } else { trigger_error(ERROR_CUSTOM_FIELD_INVALID_DEFINITION, ERROR); } }
$modnames = massaction_get_modnames($modids); $string = ''; // Get the custom string for the chosen action; if ($confirm_page) { $string .= $confirm_function($modnames, $_POST); } else { $string .= $continue_function($modnames, $_POST); } // Print the form print_header_simple(get_string($action, 'block_massaction') . " (Mass Action)"); print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox'); echo $string; echo "<form method='post'>\n"; echo print_hidden_input('post', $encoded_post); if ($confirm_page) { $name = 'do'; } else { $name = 'continue'; } echo print_hidden_input('modids', $encoded_mods); echo print_hidden_input('action', $action); echo print_hidden_input('sesskey', $sesskey); echo print_hidden_input('return_to', $return_to); echo print_hidden_input('courseid', $_POST['courseid']); echo print_hidden_input('instance_id', $instance_id); echo print_submit_input($name, get_string($action, 'block_massaction')); echo print_submit_input('cancel', get_string('cancel', 'block_massaction')); echo "</form>\n"; print_simple_box_end(); print_footer(); }