/** * @param TiiLTI $object * @param array $params * @param string $endpoint * @param string $target * @param string $buttonimg * @param string $buttontext * @param boolean $uploadfile * @param boolean $uploadtext * @return string */ public function getFormHtml($object, $params, $uploadfile, $uploadtext) { if ($uploadfile or $uploadtext) { $enctype = 'multipart/form-data'; } else { $enctype = 'application/x-www-form-urlencoded'; } $output = '<form action="' . $this->getEndPoint() . '" method="POST" target="' . $object->getFormTarget() . '" enctype="' . $enctype . '">' . PHP_EOL; foreach ($params as $name => $value) { $output .= '<input name="' . htmlentities($name, ENT_QUOTES) . '" value="' . htmlentities($value, ENT_QUOTES) . '" type="hidden" />' . PHP_EOL; } if ($uploadtext) { $output .= '<textarea name="custom_submission_data"></textarea>' . PHP_EOL; } else { if ($uploadfile) { $output .= '<input name="custom_submission_data" type="file" />' . PHP_EOL; } } if (!is_null($object->getHasButton())) { $output .= '<input type="submit" value="' . $object->getButtonText() . '" style="' . $object->getButtonStyle() . '" />' . PHP_EOL; } $output .= '</form>' . PHP_EOL; return $output; }