ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAssQuestionPreviewGUI Class Reference
+ Collaboration diagram for ilAssQuestionPreviewGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilTabsGUI $tabs, ilTemplate $tpl, ilLanguage $lng, ilDB $db)
 initQuestion ($questionId, $parentObjId)
 initPreviewSettings ($parentRefId)
 initPreviewSession ($userId, $questionId)
 initHintTracking ()
 initStyleSheets ()
 executeCommand ()
 saveQuestionSolution ()
 gatewayConfirmHintRequestCmd ()
 gatewayShowHintListCmd ()

Data Fields

const CMD_SHOW = 'show'
const CMD_RESET = 'reset'
const CMD_INSTANT_RESPONSE = 'instantResponse'
const CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'
const CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'
const CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'
const TAB_ID_QUESTION_PREVIEW = 'preview'

Protected Attributes

 $ctrl
 $tabs
 $tpl
 $lng
 $db
 $questionGUI
 $questionOBJ
 $previewSettings
 $previewSession
 $hintTracking

Private Member Functions

 showCmd ()
 resetCmd ()
 instantResponseCmd ()
 handleQuestionActionCmd ()
 populatePreviewToolbar (ilTemplate $tpl)
 populateQuestionOutput (ilTemplate $tpl)
 populateSolutionOutput (ilTemplate $tpl)
 populateQuestionNavigation (ilTemplate $tpl)
 populateGenericQuestionFeedback (ilTemplate $tpl)
 populateSpecificQuestionFeedback (ilTemplate $tpl)
 isShowBestSolutionRequired ()
 isShowGenericQuestionFeedbackRequired ()
 isShowSpecificQuestionFeedbackRequired ()

Detailed Description

Definition at line 18 of file class.ilAssQuestionPreviewGUI.php.

Constructor & Destructor Documentation

ilAssQuestionPreviewGUI::__construct ( ilCtrl  $ctrl,
ilTabsGUI  $tabs,
ilTemplate  $tpl,
ilLanguage  $lng,
ilDB  $db 
)

Definition at line 79 of file class.ilAssQuestionPreviewGUI.php.

References $ctrl, $db, $lng, $tabs, and $tpl.

{
$this->ctrl = $ctrl;
$this->tabs = $tabs;
$this->tpl = $tpl;
$this->lng = $lng;
$this->db = $db;
}

Member Function Documentation

ilAssQuestionPreviewGUI::executeCommand ( )

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

References $cmd.

{
$this->tabs->setTabActive(self::TAB_ID_QUESTION_PREVIEW);
$this->lng->loadLanguageModule('content');
$nextClass = $this->ctrl->getNextClass($this);
switch($nextClass)
{
case 'ilassquestionhintrequestgui':
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
$gui = new ilAssQuestionHintRequestGUI($this, self::CMD_SHOW, $this->questionGUI, $this->hintTracking);
$this->ctrl->forwardCommand($gui);
break;
case 'ilassspecfeedbackpagegui':
case 'ilassgenfeedbackpagegui':
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
$forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->questionOBJ, $this->ctrl, $this->tabs, $this->lng);
$forwarder->forward();
break;
default:
$cmd = $this->ctrl->getCmd(self::CMD_SHOW).'Cmd';
$this->$cmd();
}
}
ilAssQuestionPreviewGUI::gatewayConfirmHintRequestCmd ( )

Definition at line 385 of file class.ilAssQuestionPreviewGUI.php.

References ilAssQuestionHintRequestGUI\CMD_CONFIRM_REQUEST, and saveQuestionSolution().

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
$this->ctrl->redirectByClass(
'ilAssQuestionHintRequestGUI', ilAssQuestionHintRequestGUI::CMD_CONFIRM_REQUEST
);
}

+ Here is the call graph for this function:

ilAssQuestionPreviewGUI::gatewayShowHintListCmd ( )

Definition at line 396 of file class.ilAssQuestionPreviewGUI.php.

References ilAssQuestionHintRequestGUI\CMD_SHOW_LIST, and saveQuestionSolution().

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
$this->ctrl->redirectByClass(
'ilAssQuestionHintRequestGUI', ilAssQuestionHintRequestGUI::CMD_SHOW_LIST
);
}

+ Here is the call graph for this function:

ilAssQuestionPreviewGUI::handleQuestionActionCmd ( )
private

Definition at line 223 of file class.ilAssQuestionPreviewGUI.php.

{
$this->questionOBJ->persistPreviewState($this->previewSession);
$this->ctrl->redirect($this, self::CMD_SHOW);
}
ilAssQuestionPreviewGUI::initHintTracking ( )

Definition at line 122 of file class.ilAssQuestionPreviewGUI.php.

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewHintTracking.php';
$this->hintTracking = new ilAssQuestionPreviewHintTracking($this->db, $this->previewSession);
}
ilAssQuestionPreviewGUI::initPreviewSession (   $userId,
  $questionId 
)

Definition at line 114 of file class.ilAssQuestionPreviewGUI.php.

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSession.php';
$this->previewSession = new ilAssQuestionPreviewSession($userId, $questionId);
$this->previewSession->init();
}
ilAssQuestionPreviewGUI::initPreviewSettings (   $parentRefId)

Definition at line 106 of file class.ilAssQuestionPreviewGUI.php.

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSettings.php';
$this->previewSettings = new ilAssQuestionPreviewSettings($parentRefId);
$this->previewSettings->init();
}
ilAssQuestionPreviewGUI::initQuestion (   $questionId,
  $parentObjId 
)

Definition at line 88 of file class.ilAssQuestionPreviewGUI.php.

References assQuestion\instantiateQuestionGUI(), and OUTPUT_JAVASCRIPT.

{
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$this->questionGUI = assQuestion::instantiateQuestionGUI($questionId);
$this->questionOBJ = $this->questionGUI->object;
$this->questionOBJ->setObjId($parentObjId);
$this->questionGUI->setQuestionTabs();
$this->questionGUI->outAdditionalOutput();
$this->questionOBJ->setOutputType(OUTPUT_JAVASCRIPT);
$this->questionGUI->setTargetGui($this);
$this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
}

+ Here is the call graph for this function:

ilAssQuestionPreviewGUI::initStyleSheets ( )

Definition at line 128 of file class.ilAssQuestionPreviewGUI.php.

References ilObjStyleSheet\getContentStylePath(), and ilObjStyleSheet\getSyntaxStylePath().

{
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$this->tpl->setCurrentBlock("ContentStyle");
$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("SyntaxStyle");
$this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilAssQuestionPreviewGUI::instantResponseCmd ( )
private

Definition at line 216 of file class.ilAssQuestionPreviewGUI.php.

{
$this->questionOBJ->persistPreviewState($this->previewSession);
$this->previewSession->setInstantResponseActive(true);
$this->ctrl->redirect($this, self::CMD_SHOW);
}
ilAssQuestionPreviewGUI::isShowBestSolutionRequired ( )
private

Definition at line 350 of file class.ilAssQuestionPreviewGUI.php.

Referenced by showCmd().

{
if( !$this->previewSettings->isBestSolutionEnabled() )
{
return false;
}
return $this->previewSession->isInstantResponseActive();
}

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::isShowGenericQuestionFeedbackRequired ( )
private

Definition at line 360 of file class.ilAssQuestionPreviewGUI.php.

Referenced by showCmd().

{
if( !$this->previewSettings->isGenericFeedbackEnabled() )
{
return false;
}
return $this->previewSession->isInstantResponseActive();
}

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::isShowSpecificQuestionFeedbackRequired ( )
private

Definition at line 370 of file class.ilAssQuestionPreviewGUI.php.

Referenced by populateQuestionOutput(), and showCmd().

{
if( !$this->previewSettings->isSpecificFeedbackEnabled() )
{
return false;
}
return $this->previewSession->isInstantResponseActive();
}

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populateGenericQuestionFeedback ( ilTemplate  $tpl)
private

Definition at line 327 of file class.ilAssQuestionPreviewGUI.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

{
if( $this->questionOBJ->isPreviewSolutionCorrect($this->previewSession) )
{
$feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
}
else
{
$feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
}
$tpl->setCurrentBlock('instant_feedback_generic');
$tpl->setVariable('GENERIC_FEEDBACK', $feedback);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populatePreviewToolbar ( ilTemplate  $tpl)
private

Definition at line 229 of file class.ilAssQuestionPreviewGUI.php.

References HTML_Template_IT\setVariable().

Referenced by showCmd().

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewToolbarGUI.php';
$toolbarGUI = new ilAssQuestionPreviewToolbarGUI($this->lng);
$toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
$toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
$toolbarGUI->build();
$tpl->setVariable('PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populateQuestionNavigation ( ilTemplate  $tpl)
private

Definition at line 309 of file class.ilAssQuestionPreviewGUI.php.

References HTML_Template_IT\setVariable().

Referenced by showCmd().

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionRelatedNavigationBarGUI.php';
$navGUI = new ilAssQuestionRelatedNavigationBarGUI($this->ctrl, $this->lng);
$navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
$navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
$navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
$navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
$navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
$navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
$navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
$tpl->setVariable('QUESTION_NAVIGATION', $this->ctrl->getHTML($navGUI));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populateQuestionOutput ( ilTemplate  $tpl)
private

Definition at line 242 of file class.ilAssQuestionPreviewGUI.php.

References $_POST, isShowSpecificQuestionFeedbackRequired(), ilPageObjectGUI\setRenderPageContainer(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

{
// FOR WHAT EXACTLY IS THIS USEFUL?
$this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
$this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
$pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
$pageGUI->setRenderPageContainer(false);
$pageGUI->setEditPreview(true);
$pageGUI->setEnabledTabs(false);
// FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) // workaround for page edit imagemaps, keep in mind
{
$this->ctrl->setCmdClass(get_class($pageGUI));
$this->ctrl->setCmd('preview');
}
$this->questionGUI->setPreviewSession($this->previewSession);
$questionHtml = $this->questionGUI->getPreview(true, $this->isShowSpecificQuestionFeedbackRequired());
$pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $questionHtml));
//$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
$pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
//$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
$tpl->setVariable('QUESTION_OUTPUT', $pageGUI->preview());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populateSolutionOutput ( ilTemplate  $tpl)
private

Definition at line 275 of file class.ilAssQuestionPreviewGUI.php.

References $_POST, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), ilPageObjectGUI\setEditPreview(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

{
// FOR WHAT EXACTLY IS THIS USEFUL?
$this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
$this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
$pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
$pageGUI->setEditPreview(true);
$pageGUI->setEnabledTabs(false);
// FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) // workaround for page edit imagemaps, keep in mind
{
$this->ctrl->setCmdClass(get_class($pageGUI));
$this->ctrl->setCmd('preview');
}
$this->questionGUI->setPreviewSession($this->previewSession);
$pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0)));
//$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
//$pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
//$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
$tpl->setCurrentBlock('solution_output');
$tpl->setVariable('TXT_CORRECT_SOLUTION', $this->lng->txt('tst_best_solution_is'));
$tpl->setVariable('SOLUTION_OUTPUT', $pageGUI->preview());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::populateSpecificQuestionFeedback ( ilTemplate  $tpl)
private

Definition at line 343 of file class.ilAssQuestionPreviewGUI.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

{
$tpl->setCurrentBlock('instant_feedback_specific');
$tpl->setVariable('ANSWER_FEEDBACK', $this->questionGUI->getSpecificFeedbackOutput(0, -1));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::resetCmd ( )
private

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

References ilUtil\sendInfo().

{
$this->previewSession->resetRequestedHints();
$this->previewSession->setParticipantsSolution(null);
$this->previewSession->setInstantResponseActive(false);
ilUtil::sendInfo($this->lng->txt('qst_preview_reset_msg'), true);
$this->ctrl->redirect($this, self::CMD_SHOW);
}

+ Here is the call graph for this function:

ilAssQuestionPreviewGUI::saveQuestionSolution ( )

Definition at line 380 of file class.ilAssQuestionPreviewGUI.php.

Referenced by gatewayConfirmHintRequestCmd(), and gatewayShowHintListCmd().

{
$this->questionOBJ->persistPreviewState($this->previewSession);
}

+ Here is the caller graph for this function:

ilAssQuestionPreviewGUI::showCmd ( )
private

Definition at line 175 of file class.ilAssQuestionPreviewGUI.php.

References $tpl, isShowBestSolutionRequired(), isShowGenericQuestionFeedbackRequired(), isShowSpecificQuestionFeedbackRequired(), populateGenericQuestionFeedback(), populatePreviewToolbar(), populateQuestionNavigation(), populateQuestionOutput(), populateSolutionOutput(), and populateSpecificQuestionFeedback().

{
$tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'Modules/TestQuestionPool');
$tpl->setVariable('PREVIEW_FORMACTION', $this->ctrl->getFormAction($this, self::CMD_SHOW));
{
}
{
}
{
}
$this->tpl->setContent($tpl->get());
}

+ Here is the call graph for this function:

Field Documentation

ilAssQuestionPreviewGUI::$ctrl
protected

Definition at line 32 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

ilAssQuestionPreviewGUI::$db
protected

Definition at line 52 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

ilAssQuestionPreviewGUI::$hintTracking
protected

Definition at line 77 of file class.ilAssQuestionPreviewGUI.php.

ilAssQuestionPreviewGUI::$lng
protected

Definition at line 47 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

ilAssQuestionPreviewGUI::$previewSession
protected

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

ilAssQuestionPreviewGUI::$previewSettings
protected

Definition at line 67 of file class.ilAssQuestionPreviewGUI.php.

ilAssQuestionPreviewGUI::$questionGUI
protected

Definition at line 57 of file class.ilAssQuestionPreviewGUI.php.

ilAssQuestionPreviewGUI::$questionOBJ
protected

Definition at line 62 of file class.ilAssQuestionPreviewGUI.php.

ilAssQuestionPreviewGUI::$tabs
protected

Definition at line 37 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

ilAssQuestionPreviewGUI::$tpl
protected

Definition at line 42 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct(), and showCmd().

const ilAssQuestionPreviewGUI::CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'

Definition at line 24 of file class.ilAssQuestionPreviewGUI.php.

const ilAssQuestionPreviewGUI::CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'

Definition at line 25 of file class.ilAssQuestionPreviewGUI.php.

const ilAssQuestionPreviewGUI::CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'

Definition at line 23 of file class.ilAssQuestionPreviewGUI.php.

const ilAssQuestionPreviewGUI::CMD_INSTANT_RESPONSE = 'instantResponse'

Definition at line 22 of file class.ilAssQuestionPreviewGUI.php.

const ilAssQuestionPreviewGUI::CMD_RESET = 'reset'

Definition at line 21 of file class.ilAssQuestionPreviewGUI.php.

const ilAssQuestionPreviewGUI::CMD_SHOW = 'show'
const ilAssQuestionPreviewGUI::TAB_ID_QUESTION_PREVIEW = 'preview'

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