/** * add a GET request variable list to the given URL * @param string url url * @param array variableList list of the request variables to add * @return string url */ function add_request_variable_list_to_url(&$url, $variableList) { foreach ($variableList as $name => $value) { $url = add_request_variable_to_url($url, $name, $value); } return $url; }
/** * Generate html code ofthe preview panel button bar * @param int wikiId ID of the Wiki * @param string title page title * @param string content page content * @param string script callback script url * @return string html code of the preview pannel button bar */ function claro_disp_wiki_preview_buttons($wikiId, $title, $content, $changelog = '', $script = null) { global $langSave, $langEdit, $langCancel, $course_code; $script = is_null($script) ? $_SERVER['SCRIPT_NAME'] . "?course={$course_code}" : $script; $out = "<br>\n <div><form method='POST' action='{$script}' name='previewform' id='previewform'>\n <input type='hidden' name='wiki_content' value='" . q($content) . "'>\n <input type='hidden' name='changelog' value='" . q($changelog) . "'>\n <input type='hidden' name='title' value='" . q($title) . "'>\n <input type='hidden' name='wikiId' value='{$wikiId}'>\n <input class='btn btn-primary' type='submit' name='action[save]' value='{$langSave}'>\n <input class='btn btn-primary' type='submit' name='action[edit]' value='{$langEdit}'>\n "; $location = add_request_variable_to_url($script, "wikiId", $wikiId); $location = add_request_variable_to_url($location, "title", $title); $location = add_request_variable_to_url($location, "action", "show"); $out .= "<a class='btn btn-default' href='{$location}'>{$langCancel}</a>"; $out .= "</form></div>"; return $out; }
/** * Generate html code ofthe preview panel button bar * @param int wikiId ID of the Wiki * @param string title page title * @param string content page content * @param string script callback script url * @return string html code of the preview pannel button bar */ function claro_disp_wiki_preview_buttons($wikiId, $title, $content, $script = null) { $script = is_null($script) ? Url::Contextualize($_SERVER['PHP_SELF']) : $script; $out = '<div><form method="post" action="' . claro_htmlspecialchars($script) . '" name="previewform" id="previewform">' . "\n"; $out .= '<input type="hidden" name="content" value="' . claro_htmlspecialchars($content) . '" />' . "\n"; $out .= '<input type="hidden" name="title" value="' . claro_htmlspecialchars($title) . '" />' . "\n"; $out .= '<input type="hidden" name="wikiId" value="' . (int) $wikiId . '" />' . "\n"; $out .= claro_form_relay_context() . "\n"; $out .= '<input type="submit" name="action[edit]" value="' . get_lang("Edit") . '"/>' . "\n"; $out .= '<input type="submit" name="action[save]" value="' . get_lang("Save") . '" />' . "\n"; $location = add_request_variable_to_url($script, "wikiId", $wikiId); $location = add_request_variable_to_url($location, "title", $title); $location = add_request_variable_to_url($location, "action", "show"); $out .= claro_html_button(claro_htmlspecialchars($location), get_lang("Cancel")); $out .= "</form></div>\n"; return $out; }