ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAssQuestionHintGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintGUI:
+ Collaboration diagram for ilAssQuestionHintGUI:

Public Member Functions

 executeCommand ()
 Execute Command.
- Public Member Functions inherited from ilAssQuestionHintAbstractGUI
 __construct (assQuestionGUI $questionGUI)
 Constructor.

Data Fields

const CMD_SHOW_FORM = 'showForm'
 command constants
const CMD_SAVE_FORM = 'saveForm'
const CMD_CANCEL_FORM = 'cancelForm'
const CMD_CONFIRM_FORM = 'confirmForm'

Private Member Functions

 showFormCmd (ilPropertyFormGUI $form=null)
 shows the form for managing a new/existing hint
 saveFormCmd ()
 saves the form on successfull validation and redirects to showForm command
 cancelFormCmd ()
 gateway command method to jump back to question hints overview
 buildForm (ilAssQuestionHint $questionHint=null)
 builds the questions hints form

Additional Inherited Members

- Protected Attributes inherited from ilAssQuestionHintAbstractGUI
 $questionGUI = null
 $questionOBJ = null

Detailed Description

Definition at line 17 of file class.ilAssQuestionHintGUI.php.

Member Function Documentation

ilAssQuestionHintGUI::buildForm ( ilAssQuestionHint  $questionHint = null)
private

builds the questions hints form

private ilCtrl $ilCtrl ilLanguage $lng

Returns
ilPropertyFormGUI $form

Definition at line 180 of file class.ilAssQuestionHintGUI.php.

References $ilCtrl, $lng, ilObjAdvancedEditing\_getUsedHTMLTags(), ilNumberInputGUI\allowDecimals(), ilUtil\prepareTextareaOutput(), and ilFormPropertyGUI\setRequired().

Referenced by saveFormCmd(), and showFormCmd().

{
global $ilCtrl, $lng;
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
require_once 'Services/Form/classes/class.ilNumberInputGUI.php';
require_once 'Services/Form/classes/class.ilHiddenInputGUI.php';
$form = new ilPropertyFormGUI();
$form->setTableWidth('100%');
if( !$this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
// form input: hint text
$areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text');
$areaInp->setRequired(true);
$areaInp->setRows(10);
$areaInp->setCols(80);
if( !$this->questionOBJ->getPreventRteUsage() ) $areaInp->setUseRte(true);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$areaInp->setRteTags( ilObjAdvancedEditing::_getUsedHTMLTags("assessment") );
$areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment');
$areaInp->addPlugin("latex");
$areaInp->addButton("latex");
$areaInp->addButton("pastelatex");
$form->addItem($areaInp);
}
// form input: hint points
$numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
$numInp->allowDecimals(true);
$numInp->setRequired(true);
$numInp->setSize(3);
$form->addItem($numInp);
if( $questionHint instanceof ilAssQuestionHint )
{
// build form title for an existing hint
$form->setTitle(sprintf(
$lng->txt('tst_question_hints_form_header_edit'),
$questionHint->getIndex(),
$this->questionOBJ->getTitle()
));
// hidden input: hint id
$hiddenInp = new ilHiddenInputGUI('hint_id');
$form->addItem($hiddenInp);
// init values
require_once 'Services/Utilities/classes/class.ilUtil.php';
if( !$this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$areaInp->setValue( ilUtil::prepareTextareaOutput($questionHint->getText(), true) );
}
$numInp->setValue($questionHint->getPoints());
$hiddenInp->setValue($questionHint->getId());
}
else
{
// build form title for a new hint
$form->setTitle(sprintf(
$lng->txt('tst_question_hints_form_header_create'),
$this->questionOBJ->getTitle()
));
}
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
if( $questionHint instanceof ilAssQuestionHint )
{
$saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points');
}
else
{
$saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page');
}
}
else
{
$saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save');
}
$form->setFormAction($ilCtrl->getFormAction($this));
$form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel'));
$form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel);
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionHintGUI::cancelFormCmd ( )
private

gateway command method to jump back to question hints overview

private ilCtrl $ilCtrl

Definition at line 165 of file class.ilAssQuestionHintGUI.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI');
}
ilAssQuestionHintGUI::executeCommand ( )

Execute Command.

public ilCtrl $ilCtrl

Returns
mixed

Definition at line 34 of file class.ilAssQuestionHintGUI.php.

References $cmd, $ilCtrl, $lng, $tpl, and ilAssQuestionHintPageObjectCommandForwarder\PRESENTATION_MODE_AUTHOR.

{
global $ilCtrl, $ilTabs, $lng, $tpl;
$cmd = $ilCtrl->getCmd(self::CMD_SHOW_FORM);
$nextClass = $ilCtrl->getNextClass($this);
switch($nextClass)
{
case 'ilasshintpagegui':
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
$forwarder = new ilAssQuestionHintPageObjectCommandForwarder($this->questionOBJ, $ilCtrl, $ilTabs, $lng);
$forwarder->forward();
break;
default:
$cmd .= 'Cmd';
$this->$cmd();
break;
}
return true;
}
ilAssQuestionHintGUI::saveFormCmd ( )
private

saves the form on successfull validation and redirects to showForm command

private ilCtrl $ilCtrl ilLanguage $lng

Definition at line 103 of file class.ilAssQuestionHintGUI.php.

References $_GET, $ilCtrl, $ilUser, $lng, assQuestion\_isWriteable(), buildForm(), ilAssQuestionHintsGUI\CMD_CONFIRM_SYNC, ilAssQuestionHintsGUI\CMD_SHOW_LIST, ilAssQuestionHintList\getNextIndexByQuestionId(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showFormCmd().

{
global $ilCtrl, $lng, $ilUser;
$form = $this->buildForm();
if( $form->checkInput() )
{
$questionHint = new ilAssQuestionHint();
if( (int)$form->getInput('hint_id') )
{
$questionHint->load( (int)$form->getInput('hint_id') );
$hintJustCreated = false;
}
else
{
$questionHint->setQuestionId( $this->questionOBJ->getId() );
$questionHint->setIndex(
);
$hintJustCreated = true;
}
$questionHint->setText( $form->getInput('hint_text') );
$questionHint->setPoints( $form->getInput('hint_points') );
$questionHint->save();
ilUtil::sendSuccess($lng->txt('tst_question_hints_form_saved_msg'), true);
$originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
{
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
}
if( $hintJustCreated && $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $questionHint->getId());
$ilCtrl->redirectByClass('ilasshintpagegui', 'edit');
}
else
{
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
}
ilUtil::sendFailure($lng->txt('tst_question_hints_form_invalid_msg'));
$this->showFormCmd($form);
}

+ Here is the call graph for this function:

ilAssQuestionHintGUI::showFormCmd ( ilPropertyFormGUI  $form = null)
private

shows the form for managing a new/existing hint

private ilCtrl $ilCtrl ilTemplate $tpl

Definition at line 68 of file class.ilAssQuestionHintGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, buildForm(), ilAssQuestionHintsGUI\CMD_SHOW_LIST, and ilUtil\sendFailure().

Referenced by saveFormCmd().

{
global $ilCtrl, $tpl, $ilToolbar, $lng, $ilCtrl;
if( $form instanceof ilPropertyFormGUI )
{
$form->setValuesByPost();
}
elseif( isset($_GET['hint_id']) && (int)$_GET['hint_id'] )
{
$questionHint = new ilAssQuestionHint();
if( !$questionHint->load((int)$_GET['hint_id']) )
{
ilUtil::sendFailure('invalid hint id given: '.(int)$_GET['hint_id'], true);
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
$form = $this->buildForm($questionHint);
}
else
{
$form = $this->buildForm();
}
$tpl->setContent( $form->getHTML() );
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const ilAssQuestionHintGUI::CMD_CANCEL_FORM = 'cancelForm'

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

const ilAssQuestionHintGUI::CMD_CONFIRM_FORM = 'confirmForm'

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

const ilAssQuestionHintGUI::CMD_SAVE_FORM = 'saveForm'

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

const ilAssQuestionHintGUI::CMD_SHOW_FORM = 'showForm'

command constants

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

Referenced by ilAssQuestionHintsTableGUI\fillRow(), and ilAssQuestionHintsGUI\showListCmd().


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