Function Module_cms_quiz->get_form_fields
Definitions
cms/pages/modules/cms_quiz.php
- Get Tempcode for a adding/editing form.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $id | ?AUTO_LINK | No | No | Null | N/A | N/A | The quiz ID (null: new) |
| $name | SHORT_TEXT | No | No | Blank (empty string) | N/A | N/A | The name of the quiz |
| $timeout | ?integer | No | No | Null | N/A | N/A | The number of minutes allowed for completion (null: NA) |
| $start_text | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The text shown at the start of the quiz |
| $end_text | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The text shown at the end of the quiz |
| $end_text_fail | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The text shown at the end of the quiz on failure |
| $notes | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | Notes |
| $percentage | integer | No | No | 70 | N/A | N/A | Percentage correctness required for competition |
| $open_time | ?TIME | No | No | Null | N/A | N/A | The time the quiz is opened (null: now) |
| $close_time | ?TIME | No | No | Null | N/A | N/A | The time the quiz is closed (null: never) |
| $num_winners | integer | No | No | 2 | N/A | N/A | The number of winners for this if it is a competition |
| $redo_time | ?integer | No | No | Null | N/A | N/A | The minimum number of hours between attempts (null: no restriction) |
| $type | ID_TEXT | No | No | SURVEY | SURVEY COMPETITION TEST | N/A | The type |
| $validated | BINARY | No | No | 1 | N/A | N/A | Whether this is validated |
| $validation_time | ?TIME | No | No | Null | N/A | N/A | The time on which this content should be validated (null: do not schedule) |
| $text | ?string | No | No | Null | N/A | N/A | Text for questions (null: default) |
| $points_for_passing | integer | No | No | 0 | N/A | N/A | The number of points awarded for completing/passing the quiz/test |
| $tied_newsletter | ?AUTO_LINK | No | No | Null | N/A | N/A | Newsletter for which a member must be on to enter (null: none) |
| $reveal_answers | BINARY | No | No | 0 | N/A | N/A | Whether to reveal correct answers after the quiz is complete, so that the answerer can learn from the experience |
| $shuffle_questions | BINARY | No | No | 0 | N/A | N/A | Whether to shuffle questions, to make cheating a bit harder |
| $shuffle_answers | BINARY | No | No | 0 | N/A | N/A | Whether to shuffle multiple-choice answers, to make cheating a bit harder |
Returns
- A pair: The input fields, Hidden fields
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get Tempcode for a adding/editing form.
*
* @param ?AUTO_LINK $id The quiz ID (null: new)
* @param SHORT_TEXT $name The name of the quiz
* @param ?integer $timeout The number of minutes allowed for completion (null: NA)
* @param LONG_TEXT $start_text The text shown at the start of the quiz
* @param LONG_TEXT $end_text The text shown at the end of the quiz
* @param LONG_TEXT $end_text_fail The text shown at the end of the quiz on failure
* @param LONG_TEXT $notes Notes
* @param integer $percentage Percentage correctness required for competition
* @param ?TIME $open_time The time the quiz is opened (null: now)
* @param ?TIME $close_time The time the quiz is closed (null: never)
* @param integer $num_winners The number of winners for this if it is a competition
* @param ?integer $redo_time The minimum number of hours between attempts (null: no restriction)
* @param ID_TEXT $type The type
* @set SURVEY COMPETITION TEST
* @param BINARY $validated Whether this is validated
* @param ?TIME $validation_time The time on which this content should be validated (null: do not schedule)
* @param ?string $text Text for questions (null: default)
* @param integer $points_for_passing The number of points awarded for completing/passing the quiz/test
* @param ?AUTO_LINK $tied_newsletter Newsletter for which a member must be on to enter (null: none)
* @param BINARY $reveal_answers Whether to reveal correct answers after the quiz is complete, so that the answerer can learn from the experience
* @param BINARY $shuffle_questions Whether to shuffle questions, to make cheating a bit harder
* @param BINARY $shuffle_answers Whether to shuffle multiple-choice answers, to make cheating a bit harder
* @return array A pair: The input fields, Hidden fields
*/
public function get_form_fields(?int $id = null, string $name = '', ?int $timeout = null, string $start_text = '', string $end_text = '', string $end_text_fail = '', string $notes = '', int $percentage = 70, ?int $open_time = null, ?int $close_time = null, int $num_winners = 2, ?int $redo_time = null, string $type = 'SURVEY', int $validated = 1, ?int $validation_time = null, ?string $text = null, int $points_for_passing = 0, ?int $tied_newsletter = null, int $reveal_answers = 0, int $shuffle_questions = 0, int $shuffle_answers = 0) : array
* Get Tempcode for a adding/editing form.
*
* @param ?AUTO_LINK $id The quiz ID (null: new)
* @param SHORT_TEXT $name The name of the quiz
* @param ?integer $timeout The number of minutes allowed for completion (null: NA)
* @param LONG_TEXT $start_text The text shown at the start of the quiz
* @param LONG_TEXT $end_text The text shown at the end of the quiz
* @param LONG_TEXT $end_text_fail The text shown at the end of the quiz on failure
* @param LONG_TEXT $notes Notes
* @param integer $percentage Percentage correctness required for competition
* @param ?TIME $open_time The time the quiz is opened (null: now)
* @param ?TIME $close_time The time the quiz is closed (null: never)
* @param integer $num_winners The number of winners for this if it is a competition
* @param ?integer $redo_time The minimum number of hours between attempts (null: no restriction)
* @param ID_TEXT $type The type
* @set SURVEY COMPETITION TEST
* @param BINARY $validated Whether this is validated
* @param ?TIME $validation_time The time on which this content should be validated (null: do not schedule)
* @param ?string $text Text for questions (null: default)
* @param integer $points_for_passing The number of points awarded for completing/passing the quiz/test
* @param ?AUTO_LINK $tied_newsletter Newsletter for which a member must be on to enter (null: none)
* @param BINARY $reveal_answers Whether to reveal correct answers after the quiz is complete, so that the answerer can learn from the experience
* @param BINARY $shuffle_questions Whether to shuffle questions, to make cheating a bit harder
* @param BINARY $shuffle_answers Whether to shuffle multiple-choice answers, to make cheating a bit harder
* @return array A pair: The input fields, Hidden fields
*/
public function get_form_fields(?int $id = null, string $name = '', ?int $timeout = null, string $start_text = '', string $end_text = '', string $end_text_fail = '', string $notes = '', int $percentage = 70, ?int $open_time = null, ?int $close_time = null, int $num_winners = 2, ?int $redo_time = null, string $type = 'SURVEY', int $validated = 1, ?int $validation_time = null, ?string $text = null, int $points_for_passing = 0, ?int $tied_newsletter = null, int $reveal_answers = 0, int $shuffle_questions = 0, int $shuffle_answers = 0) : array
