[10] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * Description of SurveyTool |
---|
| 5 | * |
---|
| 6 | * SurveyTool is where the survey can be created. |
---|
| 7 | * |
---|
| 8 | */ |
---|
| 9 | class SurveyCreationTool { |
---|
| 10 | |
---|
| 11 | public function __construct() { |
---|
[11] | 12 | SurveyCreationTool::javascript(); |
---|
| 13 | ?> |
---|
| 14 | <div id="surveyCreation"><form action="submitsurvey.php" method="post"> |
---|
| 15 | <?php |
---|
| 16 | SurveyCreationTool::titleBox(); |
---|
| 17 | SurveyCreationTool::descriptionBox(); |
---|
| 18 | SurveyCreationTool::questionCreationForm(); |
---|
| 19 | SurveyCreationTool::submitButton(); |
---|
| 20 | ?></form></div> |
---|
| 21 | <?php |
---|
[10] | 22 | } |
---|
| 23 | |
---|
[11] | 24 | private static function javascript() { |
---|
| 25 | ?> |
---|
| 26 | <script type="text/javascript"> |
---|
| 27 | |
---|
| 28 | function handleFocus(input) |
---|
| 29 | { |
---|
| 30 | if (input.clicked == null) |
---|
| 31 | { |
---|
| 32 | input.value = ""; |
---|
| 33 | input.style.color = "black"; |
---|
| 34 | input.clicked = true; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function handleBlur(input) |
---|
| 39 | { |
---|
| 40 | if (input.value == "") |
---|
| 41 | { |
---|
| 42 | input.style.color = "gray"; |
---|
| 43 | input.value = "Untitled Survey"; |
---|
| 44 | input.clicked = null; |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | </script> |
---|
| 49 | <?php |
---|
| 50 | } |
---|
| 51 | |
---|
[10] | 52 | private static function titleBox() { |
---|
[11] | 53 | ?> |
---|
| 54 | <input type="text" name="surveyTitle" value="Untitled Survey" id="surveyTitle" size="30" onblur="handleBlur(this)" onfocus="handleFocus(this)" /> |
---|
| 55 | <?php |
---|
[10] | 56 | } |
---|
[11] | 57 | |
---|
| 58 | private static function descriptionBox() { |
---|
| 59 | ?> |
---|
| 60 | <textarea id="surveyDescription" rows="3" cols="80" name="surveyDescription">Write a helpful description for this survey here.</textarea> |
---|
| 61 | <?php |
---|
[10] | 62 | } |
---|
[11] | 63 | |
---|
| 64 | private static function questionCreationForm() { |
---|
| 65 | |
---|
| 66 | SurveyCreationTool::addQuestionButton(); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | private static function addQuestionButton() { |
---|
[10] | 70 | |
---|
| 71 | } |
---|
| 72 | |
---|
[11] | 73 | private static function submitbutton() { |
---|
| 74 | ?> |
---|
| 75 | <input type="submit" name="submitSurvey" |
---|
| 76 | value="Submit Survey!" id="submitSurvey"/> |
---|
| 77 | <?php |
---|
| 78 | } |
---|
| 79 | |
---|
[10] | 80 | } |
---|
| 81 | ?> |
---|