Function __global->add_quiz

Definitions

sources/quiz2.php

  • Add a quiz.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$name SHORT_TEXT No No required parameter N/A N/A The name of the quiz
$timeout ?integer No No required parameter N/A N/A The number of minutes allowed for completion (null: NA)
$start_text LONG_TEXT No No required parameter N/A N/A The text shown at the start of the quiz
$end_text LONG_TEXT No No required parameter N/A N/A The text shown at the end of the quiz
$end_text_fail LONG_TEXT No No required parameter N/A N/A The text shown at the end of the quiz on failure
$notes LONG_TEXT No No required parameter N/A N/A Notes
$percentage integer No No required parameter N/A N/A Percentage correctness required for competition
$open_time ?TIME No No required parameter N/A N/A The time the quiz is opened (null: now)
$close_time ?TIME No No required parameter N/A N/A The time the quiz is closed (null: never)
$num_winners integer No No required parameter N/A N/A The number of winners for this if it is a competition
$redo_time ?integer No No required parameter N/A N/A The minimum number of hours between attempts (null: N/A)
$type ID_TEXT No No required parameter SURVEY COMPETITION TEST N/A The type
$validated BINARY No No required parameter N/A N/A Whether this is validated
$text string No No required parameter N/A N/A Text for questions
$submitter ?MEMBER No No Null N/A N/A The member adding it (null: current member)
$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
$add_time ?TIME No No Null N/A N/A The add time (null: now)
$meta_keywords ?SHORT_TEXT No No Blank (empty string) N/A N/A Meta keywords for this resource (null: do not edit) (blank: implicit)
$meta_description ?LONG_TEXT No No Blank (empty string) N/A N/A Meta description for this resource (null: do not edit) (blank: implicit)

Returns

  • The ID
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a quiz.
 *
 * @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: N/A)
 * @param  ID_TEXT $type The type
 * @set SURVEY COMPETITION TEST
 * @param  BINARY $validated Whether this is validated
 * @param  string $text Text for questions
 * @param  ?MEMBER $submitter The member adding it (null: current member)
 * @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
 * @param  ?TIME $add_time The add time (null: now)
 * @param  ?SHORT_TEXT $meta_keywords Meta keywords for this resource (null: do not edit) (blank: implicit)
 * @param  ?LONG_TEXT $meta_description Meta description for this resource (null: do not edit) (blank: implicit)
 * @return AUTO_LINK The ID
 */

function add_quiz(string $name, ?int $timeout, string $start_text, string $end_text, string $end_text_fail, string $notes, int $percentage, ?int $open_time, ?int $close_time, int $num_winners, ?int $redo_time, string $type, int $validated, string $text, ?int $submitter = null, int $points_for_passing = 0, ?int $tied_newsletter = null, int $reveal_answers = 0, int $shuffle_questions = 0, int $shuffle_answers = 0, ?int $add_time = null, ?string $meta_keywords = '', ?string $meta_description = '') : int