phpDocumentor KuoteObjects
Quiz
[ class tree: KuoteObjects ] [ index: KuoteObjects ] [ all elements ]

Class: KuoteObjects_Quiz

Source Location: /classes/KuoteObjects/Quiz.php

Class KuoteObjects_Quiz

Class Overview

Implements interfaces:

KuoteObjects Quiz

The KuoteObjects_Quiz is used for a student to actually take a quiz. It is a child of KuoteObjects_QuestionSet. It's methods supply a way to start a quiz, get questions, answer questions and so forth. The Quiz handles all the responibilities of writing said data to the datastore.

Located in /classes/KuoteObjects/Quiz.php [line 21]

KuoteObjects_QuestionSet
   |
   --KuoteObjects_Quiz
Author(s):
  • Kyle Hall
Information Tags:
Copyright:  2006

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From KuoteObjects_QuestionSet

KuoteObjects_QuestionSet::$questions

Inherited From KuoteObjects_QuestionSet

KuoteObjects_QuestionSet::count()
Returns the number of Enrollments in this set.
KuoteObjects_QuestionSet::fetch()
Returns the first Question in the set on the first call.
KuoteObjects_QuestionSet::getByLearningId()
Populates the question set with questions that are part of the given Learning's quiz.
KuoteObjects_QuestionSet::reset()
After calling reset(), fetch() will begin from the beginning of the set again.

[ Top ]
Property Summary
mixed   $currentQuestion   Variable to contain the question currently being asked in the quiz.
mixed   $currentQuestionAnswered   Variable to contain the QuestionAnswered for the question currently being asked in the quiz.
mixed   $enrollment   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.
mixed   $learning   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.
mixed   $learningOffering   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.
mixed   $learningOfferTaken   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.
mixed   $questionsAnsweredUnused   Array to containt the set of QuestionAnswered objects for
mixed   $questionsAnsweredUsed   Array to containt the set of QuestionAnswered objects for questions that have been asked
mixed   $questionsUnused   Array to containt the set of Question objects that have not yet been asked
mixed   $questionsUsed   Array to containt the set of Question objects that have been asked
mixed   $result   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.
mixed   $user   Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

[ Top ]
Method Summary
KuoteObjects_Quiz   __construct()   Constructor instantiates all the neccessary objects for the quiz to function.
boolean   answerQuestion()   Takes the given option number an 'answers' the question with it.
integer   fetchResult()   Returns an array where each element of the array is another hashed array of the format:
string   getCurrentQuestionBody()   Returns the body of the current question.
integer   getCurrentQuestionNumber()   Returns the number of the current question.
string   getCurrentQuestionOption()   Returns the text of the given question option number
$bool   getQuestion()   Grabs the next question for asking.
integer   getQuestionsCorrectCount()   Returns the number of correctly answered questions for this quiz.
integer   getQuestionsCount()   Returns the total number of questions for this quiz.
integer   getQuestionsIncorrectCount()   Returns the number of incorrectly answered questions for this quiz.
string   getTitle()   Returns the title of the learning this quiz is part of.
boolean   isCurrentQuestionOption()   Returns true if there is text for the given option number
boolean   randomize()   Randomizes the order in which the quiz questions are asked.
boolean   sortByDifficulty()   Randomizes the order in which the quiz questions are asked, but only within sets of difficutly.

[ Top ]
Properties
mixed   $currentQuestion [line 81]

Variable to contain the question currently being asked in the quiz.

API Tags:
Access:  protected


[ Top ]
mixed   $currentQuestionAnswered [line 86]

Variable to contain the QuestionAnswered for the question currently being asked in the quiz.

API Tags:
Access:  protected


[ Top ]
mixed   $enrollment [line 37]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
mixed   $learning [line 32]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
mixed   $learningOffering [line 27]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
mixed   $learningOfferTaken [line 47]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
mixed   $questionsAnsweredUnused = array() [line 75]

Array to containt the set of QuestionAnswered objects for

questions that have not yet been asked

API Tags:
Access:  protected


[ Top ]
mixed   $questionsAnsweredUsed = array() [line 69]

Array to containt the set of QuestionAnswered objects for questions that have been asked

API Tags:
Access:  protected


[ Top ]
mixed   $questionsUnused = array() [line 63]

Array to containt the set of Question objects that have not yet been asked

API Tags:
Access:  protected


[ Top ]
mixed   $questionsUsed = array() [line 58]

Array to containt the set of Question objects that have been asked

API Tags:
Access:  protected


[ Top ]
mixed   $result [line 52]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
mixed   $user [line 42]

Private variable to contain a DB_DataObjects object derived from MySQL or another DB.

API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 94]

  KuoteObjects_Quiz __construct( KuoteObjects_User $user, KuoteObjects_Learning $learning, KuoteObjects_LearningOffering $learningOffering  )

Constructor instantiates all the neccessary objects for the quiz to function.

Parameters:
KuoteObjects_User   $user:  The user taking the quiz.
KuoteObjects_Learning   $learning:  The learning of the quiz being taken.
KuoteObjects_LearningOffering   $learningOffering:  The offering of the learning taken.

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
answerQuestion  [line 212]

  boolean answerQuestion( integer $selectedAnswer  )

Takes the given option number an 'answers' the question with it.

The QuestionAnswered for the question is updated in the datastore.

Parameters:
integer   $selectedAnswer:  Selected Question Option.

API Tags:
Return:  True on successful answering, false otherwise.
Access:  public

Information Tags:
Throws:  Exception 2 if there is no current question.

Redefined in descendants as:

[ Top ]
fetchResult  [line 308]

  integer fetchResult( )

Returns an array where each element of the array is another hashed array of the format:

  1.  array "question" => KuoteObjects_Question Object,
  2.  "questionAnswered" => KuoteObjects_QuestionAnswered }


API Tags:
Return:  Correct Questions Count
Access:  public


[ Top ]
getCurrentQuestionBody  [line 162]

  string getCurrentQuestionBody( )

Returns the body of the current question.


API Tags:
Return:  Question Body
Access:  public

Information Tags:
Throws:  Exception 2 if there is no current question.

[ Top ]
getCurrentQuestionNumber  [line 257]

  integer getCurrentQuestionNumber( )

Returns the number of the current question.

That is, if 2 questions have been asked and answered, getCurrentQuestion() will return 3.


API Tags:
Return:  Question Number.
Access:  public


[ Top ]
getCurrentQuestionOption  [line 176]

  string getCurrentQuestionOption( integer $optionNumber  )

Returns the text of the given question option number

Parameters:
integer   $optionNumber:  Option Number

API Tags:
Return:  Option Text
Access:  public

Information Tags:
Throws:  Exception 2 if there is no current question.

[ Top ]
getQuestion  [line 143]

  $bool getQuestion( )

Grabs the next question for asking.


API Tags:
Return:  True if successful
Access:  public

Information Tags:
Throws:  Exception 3 if there are no more questions.
Throws:  Exception 1 if the current quesiton has not been answered yet.

[ Top ]
getQuestionsCorrectCount  [line 273]

  integer getQuestionsCorrectCount( )

Returns the number of correctly answered questions for this quiz.


API Tags:
Return:  Correct Questions Count
Access:  public


[ Top ]
getQuestionsCount  [line 265]

  integer getQuestionsCount( )

Returns the total number of questions for this quiz.


API Tags:
Return:  Questions Count
Access:  public


[ Top ]
getQuestionsIncorrectCount  [line 288]

  integer getQuestionsIncorrectCount( )

Returns the number of incorrectly answered questions for this quiz.


API Tags:
Return:  Incorrect Questions Count
Access:  public


[ Top ]
getTitle  [line 298]

  string getTitle( )

Returns the title of the learning this quiz is part of.


API Tags:
Return:  Learning Title
Access:  public


[ Top ]
isCurrentQuestionOption  [line 193]

  boolean isCurrentQuestionOption( $optionNumber  )

Returns true if there is text for the given option number

Parameters:
   $optionNumber: 

API Tags:
Return:  True if option is set, false otherwise.
Access:  public

Information Tags:
Throws:  Exception 2 if there is no current question.

[ Top ]
randomize  [line 240]

  boolean randomize( )

Randomizes the order in which the quiz questions are asked.


API Tags:
Return:  True on success, false otherwise.
Access:  public


[ Top ]
sortByDifficulty  [line 248]

  boolean sortByDifficulty( )

Randomizes the order in which the quiz questions are asked, but only within sets of difficutly.


API Tags:
Return:  True on success, false otherwise.
Access:  public


[ Top ]

Documentation generated on Fri, 15 Dec 2006 11:18:25 -0500 by phpDocumentor 1.3.0