ILIAS  release_4-3 Revision
 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 15 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 155 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%');
// 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->questionGUI->getPreventRteUsage() ) $areaInp->setUseRte(true);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$areaInp->setRteTags( ilObjAdvancedEditing::_getUsedHTMLTags("assessment") );
$areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment', null, false, '3.4.7');
$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';
$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()
));
}
$form->setFormAction($ilCtrl->getFormAction($this));
$form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel'));
$form->addCommandButton(self::CMD_SAVE_FORM, $lng->txt('tst_question_hints_form_cmd_save'));
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 140 of file class.ilAssQuestionHintGUI.php.

References $ilCtrl.

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

Execute Command.

public ilCtrl $ilCtrl

Returns
mixed

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

References $cmd, and $ilCtrl.

{
global $ilCtrl;
$cmd = $ilCtrl->getCmd(self::CMD_SHOW_FORM);
$nextClass = $ilCtrl->getNextClass($this);
switch($nextClass)
{
default:
$cmd .= 'Cmd';
return $this->$cmd();
break;
}
}
ilAssQuestionHintGUI::saveFormCmd ( )
private

saves the form on successfull validation and redirects to showForm command

private ilCtrl $ilCtrl ilLanguage $lng

Definition at line 91 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') );
}
else
{
$questionHint->setQuestionId( $this->questionOBJ->getId() );
$questionHint->setIndex(
);
}
$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);
}
$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 56 of file class.ilAssQuestionHintGUI.php.

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

Referenced by saveFormCmd().

{
global $ilCtrl, $tpl;
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 22 of file class.ilAssQuestionHintGUI.php.

const ilAssQuestionHintGUI::CMD_CONFIRM_FORM = 'confirmForm'

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

const ilAssQuestionHintGUI::CMD_SAVE_FORM = 'saveForm'

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

const ilAssQuestionHintGUI::CMD_SHOW_FORM = 'showForm'

command constants

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

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


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