HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Quizzes

» Return to Contents



sources/quiz.php

Global_functions_quiz.php

Function summary

tempcode show_quiz_html (array row, string zone)
void handle_quiz_answers (AUTO_LINK id, string text, ID_TEXT type)
AUTO_LINK add_quiz (SHORT_TEXT name, ?integer timeout, LONG_TEXT start_text, LONG_TEXT end_text, LONG_TEXT end_text_fail, LONG_TEXT notes, integer percentage, ?TIME open_time, ?TIME close_time, integer num_winners, integer redo_time, ID_TEXT type, BINARY validated, string text, ?MEMBER submitter, integer points_for_passing, ?AUTO_LINK tied_newsletter)
void edit_quiz (AUTO_LINK id, SHORT_TEXT name, ?integer timeout, LONG_TEXT start_text, LONG_TEXT end_text, LONG_TEXT end_text_fail, LONG_TEXT notes, integer percentage, ?TIME open_time, ?TIME close_time, integer num_winners, integer redo_time, ID_TEXT type, BINARY validated, string text, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, integer points_for_passing, ?AUTO_LINK tied_newsletter)
void delete_quiz (AUTO_LINK id)
array get_quizz_data_for_csv (AUTO_LINK quiz_id)
tempcode render_quiz (array questions)

tempcode show_quiz_html(array row, string zone)

Show a quiz box.

Parameters…

Name row
Description The database row
Type array

Name zone
Description The zone to show in
Default value _SEARCH
Type string

Returns…

Description The rendered quiz link
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void handle_quiz_answers(AUTO_LINK id, string text, ID_TEXT type)

Add the answers for a quiz.

Parameters…

Name id
Description The quiz ID
Type AUTO_LINK

Name text
Description Text for questions
Type string

Name type
Description The type
Type ID_TEXT
Values restricted to COMPETITION TEST SURVEY

(No return value)


Return to the function index for this class Expand: View the source code to this function

AUTO_LINK add_quiz(SHORT_TEXT name, ?integer timeout, LONG_TEXT start_text, LONG_TEXT end_text, LONG_TEXT end_text_fail, LONG_TEXT notes, integer percentage, ?TIME open_time, ?TIME close_time, integer num_winners, integer redo_time, ID_TEXT type, BINARY validated, string text, ?MEMBER submitter, integer points_for_passing, ?AUTO_LINK tied_newsletter)

Add a quiz.

Parameters…

Name name
Description The name of the quiz
Type SHORT_TEXT

Name timeout
Description The number of minutes allowed for completion (NULL: NA)
Type ?integer

Name start_text
Description The text shown at the start of the quiz
Type LONG_TEXT

Name end_text
Description The text shown at the end of the quiz
Type LONG_TEXT

Name end_text_fail
Description The text shown at the end of the quiz on failure
Type LONG_TEXT

Name notes
Description Notes
Type LONG_TEXT

Name percentage
Description Percentage correctness required for competition
Type integer

Name open_time
Description The time the quiz is opened (NULL: now)
Type ?TIME

Name close_time
Description The time the quiz is closed (NULL: never)
Type ?TIME

Name num_winners
Description The number of winners for this if it is a competition
Type integer

Name redo_time
Description The minimum number of hours between attempts
Type integer

Name type
Description The type
Type ID_TEXT
Values restricted to SURVEY COMPETITION TEST

Name validated
Description Whether this is validated
Type BINARY

Name text
Description Text for questions
Type string

Name submitter
Description The member adding it (NULL: current member)
Default value
Type ?MEMBER

Name points_for_passing
Description The number of points awarded for completing/passing the quiz/test
Default value 0
Type integer

Name tied_newsletter
Description Newsletter for which a member must be on to enter (NULL: none)
Default value
Type ?AUTO_LINK

Returns…

Description The ID
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_quiz(AUTO_LINK id, SHORT_TEXT name, ?integer timeout, LONG_TEXT start_text, LONG_TEXT end_text, LONG_TEXT end_text_fail, LONG_TEXT notes, integer percentage, ?TIME open_time, ?TIME close_time, integer num_winners, integer redo_time, ID_TEXT type, BINARY validated, string text, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, integer points_for_passing, ?AUTO_LINK tied_newsletter)

Edit a quiz.

Parameters…

Name id
Description The ID
Type AUTO_LINK

Name name
Description The name of the quiz
Type SHORT_TEXT

Name timeout
Description The number of minutes allowed for completion (NULL: NA)
Type ?integer

Name start_text
Description The text shown at the start of the quiz
Type LONG_TEXT

Name end_text
Description The text shown at the end of the quiz
Type LONG_TEXT

Name end_text_fail
Description The text shown at the end of the quiz on failure
Type LONG_TEXT

Name notes
Description Notes
Type LONG_TEXT

Name percentage
Description Percentage correctness required for competition
Type integer

Name open_time
Description The time the quiz is opened (NULL: now)
Type ?TIME

Name close_time
Description The time the quiz is closed (NULL: never)
Type ?TIME

Name num_winners
Description The number of winners for this if it is a competition
Type integer

Name redo_time
Description The minimum number of hours between attempts
Type integer

Name type
Description The type
Type ID_TEXT
Values restricted to SURVEY COMPETITION TEST

Name validated
Description Whether this is validated
Type BINARY

Name text
Description Text for questions
Type string

Name meta_keywords
Description Meta keywords
Type SHORT_TEXT

Name meta_description
Description Meta description
Type LONG_TEXT

Name points_for_passing
Description The number of points awarded for completing/passing the quiz/test
Default value 0
Type integer

Name tied_newsletter
Description Newsletter for which a member must be on to enter (NULL: none)
Default value
Type ?AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_quiz(AUTO_LINK id)

Delete a quiz.

Parameters…

Name id
Description The ID
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

array get_quizz_data_for_csv(AUTO_LINK quiz_id)

Get quiz data for exporting it as csv

Parameters…

Name quiz_id
Description Quiz ID
Type AUTO_LINK

Returns…

Description Quiz data array
Type array

Return to the function index for this class Expand: View the source code to this function

tempcode render_quiz(array questions)

Get quiz data for exporting it as csv

Parameters…

Name questions
Description The quiz questions
Type array

Returns…

Description The rendered quiz
Type tempcode

Return to the function index for this class Expand: View the source code to this function