echo "</td><td> \n"; echo "echo feedback_create_action_submit('submitbutton_picture', array('You pressed the submit-button'), 'Just Submit');\n"; echo "</td></tr><tr align='left'><td> \n"; echo "</td><td> \n"; echo "</td></tr></table> \n"; echo '</form>'; //------------------------------------------------------------------------------- //demonstrating hidden variables //------------------------------------------------------------------------------- echo '<form action="testpage_1.php?id=' . $SESSION->feedback->coursemoduleid . '" method="post">'; echo "<br /><table><tr align='left'><td width='200px'> \n"; echo "<strong>This is a lonely guy on a form of its own <br />Icon to click on:</strong>"; echo "</td><td> \n"; echo "<strong>PHP to create the button, demonstrates adding hidden variable: </strong>\n"; echo "</td></tr><tr align='left'><td> \n"; echo feedback_create_action('print_picture', array('You defined also a hidden var \'testvar\''), 'move.gif', '', '', array('testvar' => 'working OK!')); echo "</td><td> \n"; echo "echo feedback_create_action('print_picture', array('You defined also a hidden var 'testvar'),'move.gif','','',array('testvar'=>'working OK!'));\n"; echo "</td></tr><tr align='left'><td> \n"; echo "</td><td> \n"; echo "</td></tr></table> \n"; echo '</form>'; echo "<br /><br />\n"; echo "<table><tr align='left'><td> \n"; echo "<strong>The result of your action:</strong> (from call to function feedback_handler_print_picture(\$text) in item/picture/lib.php) \n"; echo "</td></tr><tr align='left'><td> \n"; echo isset($SESSION->feedback->testmessage) ? $SESSION->feedback->testmessage . '<br />' : '<br /><br />'; unset($SESSION->feedback->testmessage); echo "</td></tr><tr align='left'><td> \n"; if (isset($_POST['testvar'])) { echo "Value of 'testvar' :" . $_POST['testvar'] . '<br />';
/** * creates an action request onto a separate HTML form * * creates a action request entry in $SESSION->feedback->$actions variable, * each entry contains the argument values for the action handler function in an array, * action can be activated from browser window by clicking the image ($picfile), * feedback_action_handler will automatically call a function * feedback_handler_$actionname() * * @param string $actionname the name of the action to be defined, * can contain only numbers, alphabet and underscore _ charater, * two or more underscores __ are not allowed * @param array $params array containing the variables that will be forwarded to function feedback_handler_$actionname() * count($param) must be less than * @param string $picfile picture file of the clickable image * @param string $title string for tool tip text, defaults to $actionname * @param string $actionscript value of the the action atribute in a form tag, defaults to me() * @param array $hiddenvars array('name'=>value,...) name, value -pairs will be made hidden variables on a form * @return string HTML code to show the icon */ function feedback_create_action_form($actionname, $params, $picfile = '', $title = '', $actionscript = '', $hiddenvars = array()) { global $USER; global $SESSION; $actionscript = empty($actionscript) ? me() : $actionscript; $HTML = '<form action="' . $actionscript . '" method="post" >' . "\n"; $HTML .= feedback_create_action($actionname, $params, $picfile, $title, '', $hiddenvars) . "\n"; $HTML .= '<input type="hidden" name="id" id="id" value="' . $SESSION->feedback->coursemoduleid . '" />' . "\n"; $HTML .= '<input type="hidden" name="sesskey" id="sesskey" value="' . $USER->sesskey . '" />' . "\n"; $HTML .= "</form>\n"; return $HTML; }