Public Member Functions

assQuestionTypeTemplateGUI Class Reference

Question type GUI representation. More...

Inheritance diagram for assQuestionTypeTemplateGUI:
Collaboration diagram for assQuestionTypeTemplateGUI:

Public Member Functions

 assQuestionTypeTemplateGUI ($id=-1)
 assQuestionTypeTemplateGUI constructor
 getCommand ($cmd)
 This method has to be implemented to make the ilCtrl class work.
 getQuestionType ()
 Returns the question type string stored in the qpl_question_type database table.
 editQuestion ()
 Creates an output of the edit form for the question.
 mycommandObject ()
 Define methods for all the form commands in your edit form.
 outQuestionForTest ($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 Creates an output of the question for a test.
 getSolutionOutput ($active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE)
 Creates a solution output of the question.
 getPreview ()
 Creates a preview output of the question.
 getTestOutput ($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE)
 Helper method for outQuestionForTest to create the question output for a test.
 addSuggestedSolution ()
 Handler for cmd[addSuggestedSolution] to add a suggested solution for the question.

Detailed Description

Question type GUI representation.

The assQuestionTypeTemplateGUI class encapsulates the GUI representation of a new question type

Author:
Unknown <unknowns>
Version:
Id:
class.assQuestionTypeTemplateGUI.php 12601 2006-11-23 11:30:25Z hschottm

class.assQuestionTypeTemplateGUI.php Assessment

Definition at line 38 of file class.assQuestionTypeTemplateGUI.php.


Member Function Documentation

assQuestionTypeTemplateGUI::addSuggestedSolution (  ) 

Handler for cmd[addSuggestedSolution] to add a suggested solution for the question.

Handler for cmd[addSuggestedSolution] to add a suggested solution for the question

public

Reimplemented from assQuestionGUI.

Definition at line 205 of file class.assQuestionTypeTemplateGUI.php.

References $_GET, $_POST, $_SESSION, editQuestion(), assQuestionGUI::getErrorMessage(), assQuestionGUI::getQuestionTemplate(), sendInfo(), and assQuestionGUI::writePostData().

        {
                // this method is inherited from assQuestionGUI
                
                // overwrite it here and define your own code which adds a suggested solution to the question
                // the following code is example code and you have to exchange it with your own code:
                $_SESSION["subquestion_index"] = 0;
                if ($_POST["cmd"]["addSuggestedSolution"])
                {
                        if ($this->writePostData())
                        {
                                sendInfo($this->getErrorMessage());
                                $this->editQuestion();
                                return;
                        }
                        if (!$this->checkInput())
                        {
                                sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
                                $this->editQuestion();
                                return;
                        }
                }
                $this->object->saveToDb();
                $_GET["q_id"] = $this->object->getId();
                $this->tpl->setVariable("HEADER", $this->object->getTitle());
                $this->getQuestionTemplate();
                parent::addSuggestedSolution();
        }

Here is the call graph for this function:

assQuestionTypeTemplateGUI::assQuestionTypeTemplateGUI ( id = -1  ) 

assQuestionTypeTemplateGUI constructor

The constructor takes possible arguments an creates an instance of the question type GUI object.

Parameters:
integer $id The database id of the question object public

Definition at line 48 of file class.assQuestionTypeTemplateGUI.php.

References $id, and assQuestionGUI::assQuestionGUI().

        {
                $this->assQuestionGUI();

                // instanciate the question type class, save it in the object attribute
                // and load the question type data from the database
                include_once "./assessment/classes/class.assQuestionTypeTemplate.php";
                $this->object = new assQuestionTypeTemplate();
                if ($id >= 0)
                {
                        $this->object->loadFromDb($id);
                }
        }

Here is the call graph for this function:

assQuestionTypeTemplateGUI::editQuestion (  ) 

Creates an output of the edit form for the question.

Creates an output of the edit form for the question

public

Definition at line 99 of file class.assQuestionTypeTemplateGUI.php.

Referenced by addSuggestedSolution().

        {
                // this method creates the output of the property edit form for your question
                // where the author adds all necessary information
                // Please have a look at one of the existing question GUI classes how to create a working output

                // 1. Load the template file of your question type (you have to create one)
                // The last parameter TRUE forces ILIAS to load the template from the assessment/templates/default directory
                $this->tpl->addBlockFile("QUESTION_DATA", "question_data", "tpl.il_as_qpl_mytype.html", TRUE);

                // 2. Do some output stuff
                
                // fill the form
                // use the language variables
                // enter the form action
                // ...
        }

Here is the caller graph for this function:

assQuestionTypeTemplateGUI::getCommand ( cmd  ) 

This method has to be implemented to make the ilCtrl class work.

This method has to be implemented to make the ilCtrl class work

Parameters:
string $cmd The command which was called by an ILIAS form public

Reimplemented from assQuestionGUI.

Definition at line 72 of file class.assQuestionTypeTemplateGUI.php.

References $cmd.

        {
                // do something here if you want to change certain commands
                return $cmd;
        }

assQuestionTypeTemplateGUI::getPreview (  ) 

Creates a preview output of the question.

Creates a preview output of the question

Returns:
string HTML code which contains the preview output of the question public

Definition at line 174 of file class.assQuestionTypeTemplateGUI.php.

        {
                // Please have a look at the existing question types how to create a preview output for a question
                // you should use your own template for the output
        }

assQuestionTypeTemplateGUI::getQuestionType (  ) 

Returns the question type string stored in the qpl_question_type database table.

Returns the question type string stored in the qpl_question_type database table

Returns:
string The question type string public

Reimplemented from assQuestionGUI.

Definition at line 87 of file class.assQuestionTypeTemplateGUI.php.

        {
                return "assQuestionTypeTemplate";
        }

assQuestionTypeTemplateGUI::getSolutionOutput ( active_id,
pass = NULL,
graphicalOutput = FALSE,
result_output = FALSE 
)

Creates a solution output of the question.

Creates a solution output of the question

Parameters:
integer $active_id The active id of the current user from the tst_active database table
integer $pass The test pass of the current user
boolean $graphicalOutput If TRUE, additional graphics (checkmark, cross) are shown to indicate wrong or right answers
Returns:
string HTML code which contains the solution output of the question public

Definition at line 159 of file class.assQuestionTypeTemplateGUI.php.

        {
                // Please have a look at the existing question types how to create a solution output for a question
                // you should use your own template for the output
                return $questionoutput;
        }

assQuestionTypeTemplateGUI::getTestOutput ( active_id,
pass = NULL,
is_postponed = FALSE,
use_post_solutions = FALSE 
)

Helper method for outQuestionForTest to create the question output for a test.

Helper method for outQuestionForTest to create the question output for a test

Parameters:
integer $active_id The active id of the current user from the tst_active database table
integer $pass The test pass of the current user
boolean $is_postponed The information if the question is a postponed question or not
boolean $use_post_solutions Fills the question output with answers from the previous post if TRUE, otherwise with the user results from the database
Returns:
string HTML code which contains the output of the question public

Definition at line 192 of file class.assQuestionTypeTemplateGUI.php.

Referenced by outQuestionForTest().

        {
                // Please have a look at the existing question types how to create an output for a question
                // you should use your own template for the output
        }

Here is the caller graph for this function:

assQuestionTypeTemplateGUI::mycommandObject (  ) 

Define methods for all the form commands in your edit form.

Define methods for all the form commands in your edit form

public

Definition at line 124 of file class.assQuestionTypeTemplateGUI.php.

        {
                // this method handles the cmd[mycommand] POST command in the edit form
        }

assQuestionTypeTemplateGUI::outQuestionForTest ( formaction,
active_id,
pass = NULL,
is_postponed = FALSE,
use_post_solutions = FALSE 
)

Creates an output of the question for a test.

Creates an output of the question for a test

Parameters:
string $formaction The form action for the test output
integer $active_id The active id of the current user from the tst_active database table
integer $pass The test pass of the current user
boolean $is_postponed The information if the question is a postponed question or not
boolean $use_post_solutions Fills the question output with answers from the previous post if TRUE, otherwise with the user results from the database public

Definition at line 141 of file class.assQuestionTypeTemplateGUI.php.

References getTestOutput().

        {
                $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions); 
                $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
                $this->tpl->setVariable("FORMACTION", $formaction);
        }

Here is the call graph for this function:


The documentation for this class was generated from the following file: