ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCQuestionGUI Class Reference

Class ilPCQuestionGUI. More...

+ Inheritance diagram for ilPCQuestionGUI:
+ Collaboration diagram for ilPCQuestionGUI:

Public Member Functions

 ilPCQuestionGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public.
executeCommand ()
 execute command
 setSelfAssessmentMode ($a_selfassessmentmode)
 Set Self Assessment Mode.
 getSelfAssessmentMode ()
 Get Self Assessment Mode.
 setInsertTabs ($a_active)
 Set insert tabs.
 insert ($a_mode="create")
 Insert new question form.
 create ()
 Create new question.
 setNewQuestionId ($a_par)
 Set new question id.
 edit ()
 edit question
 feedback ()
 createQuestionPool ($name="Dummy")
 Creates a new questionpool and returns the reference id.
 setTabs ()
 Set tabs.
 insertFromPool ()
 Insert question from ppol.
 poolSelection ()
 Pool selection.
 selectPool ()
 Select concrete question pool.
 listPoolQuestions ()
 List questions of pool.
 copyQuestion ()
 Copy question into page.
- Public Member Functions inherited from ilPageContentGUI
 ilPageContentGUI ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public.
 setContentObject ($a_val)
 Set content object.
 getContentObject ()
 Get content object.
 setPage ($a_val)
 Set page.
 getPage ()
 Get page.
 setPageConfig ($a_val)
 Set Page Config.
 getPageConfig ()
 Get Page Config.
 setStyleId ($a_styleid)
 Set Style Id.
 getStyleId ()
 Get Style Id.
 getStyle ()
 Get style object.
 setCharacteristics ($a_chars)
 Set Characteristics.
 getCharacteristics ()
 Get characteristics.
 getHierId ()
 get hierarchical id in dom object
 setHierId ($a_hier_id)
 get hierarchical id in dom object
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl.
 delete ()
 delete content element
 moveAfter ()
 move content element after another element
 moveBefore ()
 move content element before another element
 splitPage ()
 split page to new page at specified position
 splitPageNext ()
 split page to next page at specified position
 displayValidationError ()
 display validation errors
 cancelCreate ()
 cancel creating page content
 cancelUpdate ()
 cancel update
 cancel ()
 Cancel.
 deactivate ()
 gui function set enabled if is not enabled and vice versa
 cut ()
 Cut single element.
 copy ()
 Copy single element.
 getTemplateOptions ($a_type)
 Get table templates.

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons.
- Data Fields inherited from ilPageContentGUI
 $content_obj
 $ilias
 $tpl
 $lng
 $ctrl
 $pg_obj
 $hier_id
 $dom
 $updated
 $target_script
 $return_location
 $page_config = null
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style.
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons

Detailed Description

Class ilPCQuestionGUI.

Adapter User Interface class for assessment questions

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilPCQuestionGUI.php 54731 2014-10-31 09:34:50Z akill

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

Member Function Documentation

ilPCQuestionGUI::copyQuestion ( )

Copy question into page.

Parameters
@return

Definition at line 566 of file class.ilPCQuestionGUI.php.

References $_GET, $ilCtrl, and ilPageContentGUI\getPage().

{
global $ilCtrl;
$this->content_obj = new ilPCQuestion($this->getPage());
$this->content_obj->create($this->pg_obj, $_GET["hier_id"]);
$this->content_obj->copyPoolQuestionIntoPage(
(int) $_GET["q_id"], $_GET["hier_id"]);
$this->updated = $this->pg_obj->update();
$ilCtrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilPCQuestionGUI::create ( )

Create new question.

Definition at line 218 of file class.ilPCQuestionGUI.php.

References $_POST, ilPageContentGUI\$hier_id, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\getPage(), and insert().

{
global $lng, $ilCtrl, $ilTabs;
$ilTabs->setTabActive('question');
$this->content_obj = new ilPCQuestion($this->getPage());
$this->content_obj->create($this->pg_obj, $this->hier_id);
$this->updated = $this->pg_obj->update();
if ($this->updated)
{
// create question pool, if necessary
/* if ($_POST["qpool_ref_id"] <= 0)
{
$pool_ref_id = $this->createQuestionPool($_POST["qpool_title"]);
}
else
{
$pool_ref_id = $_POST["qpool_ref_id"];
}*/
$this->pg_obj->stripHierIDs();
$this->pg_obj->addHierIDs();
$hier_id = $this->content_obj->lookupHierId();
$ilCtrl->setParameter($this, "q_type", $_POST["q_type"]);
$ilCtrl->setParameter($this, "add_quest_cont_edit_mode", $_POST["add_quest_cont_edit_mode"]);
// $ilCtrl->setParameter($this, "qpool_ref_id", $pool_ref_id);
//$ilCtrl->setParameter($this, "hier_id", $hier_id);
$ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
$ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
$ilCtrl->redirect($this, "edit");
}
$this->insert();
}

+ Here is the call graph for this function:

ilPCQuestionGUI::createQuestionPool (   $name = "Dummy")

Creates a new questionpool and returns the reference id.

Creates a new questionpool and returns the reference id

Returns
integer Reference id of the newly created questionpool public

Definition at line 399 of file class.ilPCQuestionGUI.php.

References $_GET.

{
global $tree;
$parent_ref = $tree->getParentId($_GET["ref_id"]);
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
$qpl = new ilObjQuestionPool();
$qpl->setType("qpl");
$qpl->setTitle($name);
$qpl->setDescription("");
$qpl->create();
$qpl->createReference();
$qpl->putInTree($parent_ref);
$qpl->setPermissions($parent_ref);
$qpl->setOnline(1); // must be online to be available
$qpl->saveToDb();
return $qpl->getRefId();
}
ilPCQuestionGUI::edit ( )

edit question

Definition at line 272 of file class.ilPCQuestionGUI.php.

References $_GET, $_POST, $_REQUEST, $ilCtrl, $ret, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilObjSAHSLearningModule\_getTries(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT, getSelfAssessmentMode(), insert(), and ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled().

{
global $ilCtrl, $ilTabs;
$ilTabs->setTabActive('question');
if ($this->getSelfAssessmentMode()) // behaviour in content pages, e.g. scorm
{
$q_ref = $this->content_obj->getQuestionReference();
if ($q_ref != "")
{
if (!($inst_id > 0))
{
}
}
$q_type = ($_POST["q_type"] != "")
? $_POST["q_type"]
: $_GET["q_type"];
$ilCtrl->setParameter($this, "q_type", $q_type);
if ($q_id == "" && $q_type == "")
{
return $this->insert("edit_empty");
}
include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
/* $ilCtrl->setCmdClass("ilquestioneditgui");
$ilCtrl->setCmd("editQuestion");
$edit_gui = new ilQuestionEditGUI();*/
// create question first-hand (needed for uploads)
if($q_id < 1 && $q_type)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
$q_gui =& assQuestionGUI::_getQuestionGUI($q_type);
// feedback editing mode
include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
&& $_REQUEST['add_quest_cont_edit_mode'] != "")
{
$addContEditMode = $_GET['add_quest_cont_edit_mode'];
}
else
{
}
$q_gui->object->setAdditionalContentEditingMode($addContEditMode);
//set default tries
$q_gui->object->setDefaultNrOfTries(ilObjSAHSLearningModule::_getTries($this->scormlmid));
$q_id = $q_gui->object->createNewQuestion(true);
$this->content_obj->setQuestionReference("il__qst_".$q_id);
$this->pg_obj->update();
unset($q_gui);
}
$ilCtrl->setParameterByClass("ilQuestionEditGUI", "q_id", $q_id);
$ilCtrl->redirectByClass(array(get_class($this->pg_obj)."GUI", "ilQuestionEditGUI"), "editQuestion");
/* $edit_gui->setPoolObjId(0);
$edit_gui->setQuestionId($q_id);
$edit_gui->setQuestionType($q_type);
$edit_gui->setSelfAssessmentEditingMode(true);
$edit_gui->setPageConfig($this->getPageConfig());
$ret = $ilCtrl->forwardCommand($edit_gui);
$this->tpl->setContent($ret);*/
return $ret;
}
else // behaviour in question pool
{
require_once("./Modules/TestQuestionPool/classes/class.assQuestionGUI.php");
$q_gui =& assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
$this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($q_gui)), "editQuestion");
}
}

+ Here is the call graph for this function:

& ilPCQuestionGUI::executeCommand ( )

execute command

Definition at line 35 of file class.ilPCQuestionGUI.php.

References $_GET, $_POST, $cmd, $ilCtrl, ilPageContentGUI\$lng, $ret, ilPageContentGUI\$tpl, and setTabs().

{
global $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng;
// get current command
$cmd = $ilCtrl->getCmd();
$next_class = $ilCtrl->getNextClass($this);
$q_type = ($_POST["q_type"] != "")
? $_POST["q_type"]
: $_GET["q_type"];
switch($next_class)
{
default:
//set tabs
if ($cmd != "insert")
{
$this->setTabs();
}
else if ($_GET["subCmd"] != "")
{
$cmd = $_GET["subCmd"];
}
$ret = $this->$cmd();
}
return $ret;
}

+ Here is the call graph for this function:

ilPCQuestionGUI::feedback ( )

Definition at line 356 of file class.ilPCQuestionGUI.php.

References $ilCtrl, $ret, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), and ilPageContentGUI\getPageConfig().

{
global $ilCtrl, $ilTabs;
include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
$ilTabs->setTabActive('feedback');
$q_ref = $this->content_obj->getQuestionReference();
if ($q_ref != "")
{
if (!($inst_id > 0))
{
}
}
$ilCtrl->setCmdClass("ilquestioneditgui");
$ilCtrl->setCmd("feedback");
$edit_gui = new ilQuestionEditGUI();
if ($q_id > 0)
{
$edit_gui->setQuestionId($q_id);
}
// $edit_gui->setQuestionType("assSingleChoice");
$edit_gui->setSelfAssessmentEditingMode(true);
$edit_gui->setPageConfig($this->getPageConfig());
$ret = $ilCtrl->forwardCommand($edit_gui);
$this->tpl->setContent($ret);
return $ret;
}

+ Here is the call graph for this function:

ilPCQuestionGUI::getSelfAssessmentMode ( )

Get Self Assessment Mode.

Returns
boolean Self Assessment Mode

Definition at line 83 of file class.ilPCQuestionGUI.php.

Referenced by edit(), and setTabs().

{
return $this->selfassessmentmode;
}

+ Here is the caller graph for this function:

ilPCQuestionGUI::ilPCQuestionGUI ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

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

References $ilCtrl, and ilPageContentGUI\ilPageContentGUI().

{
global $ilCtrl;
$this->scormlmid = $a_pg_obj->parent_id;
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
$ilCtrl->saveParameter($this, array("qpool_ref_id"));
}

+ Here is the call graph for this function:

ilPCQuestionGUI::insert (   $a_mode = "create")

Insert new question form.

Definition at line 116 of file class.ilPCQuestionGUI.php.

References $ilCtrl, $ilUser, ilPageContentGUI\$lng, $options, ilObjQuestionPool\_getSelfAssessmentQuestionTypes(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, ilRadioGroupInputGUI\addOption(), ilPageContentGUI\displayValidationError(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), setInsertTabs(), ilSelectInputGUI\setOptions(), and ilUtil\sortArray().

Referenced by create(), and edit().

{
global $ilUser, $lng, $ilCtrl;
$this->setInsertTabs("new_question");
// get all question types (@todo: we have to check, whether they are
// suitable for self assessment or not)
include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
$options = array();
$all_types = ilUtil::sortArray($all_types, "order", "asc", true, true);
foreach ($all_types as $k => $v)
{
$options[$v["type_tag"]] = $k;
}
// new table form (input of rows and columns)
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form_gui = new ilPropertyFormGUI();
$this->form_gui->setFormAction($ilCtrl->getFormAction($this));
$this->form_gui->setTitle($lng->txt("cont_ed_insert_pcqst"));
// Select Question Type
$qtype_input = new ilSelectInputGUI($lng->txt("cont_question_type"), "q_type");
$qtype_input->setOptions($options);
$qtype_input->setRequired(true);
$this->form_gui->addItem($qtype_input);
// additional content editor
// assessment
include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
{
$ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
$this->lng->txt('tst_add_quest_cont_edit_mode_default'),
));
$ri->addOption(new ilRadioOption(
$this->lng->txt('tst_add_quest_cont_edit_mode_page_object'),
));
$this->form_gui->addItem($ri, true);
}
else
{
$hi = new ilHiddenInputGUI("question_content_editing_type");
$this->form_gui->addItem($hi, true);
}
// Select Question Pool
/*
include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
$qpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, false, true, false, "write");
if (count($qpools) > 0)
{
$pool_options = array();
foreach ($qpools as $key => $value)
{
$pool_options[$key] = $value["title"];
}
$pool_input = new ilSelectInputGUI($lng->txt("cont_question_pool"), "qpool_ref_id");
$pool_input->setOptions($pool_options);
$pool_input->setRequired(true);
$this->form_gui->addItem($pool_input);
}
else
{
$pool_input = new ilTextInputGUI($lng->txt("cont_question_pool"), "qpool_title");
$pool_input->setRequired(true);
$this->form_gui->addItem($pool_input);
}
*/
if ($a_mode == "edit_empty")
{
$this->form_gui->addCommandButton("edit", $lng->txt("save"));
}
else
{
$this->form_gui->addCommandButton("create_pcqst", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
}
$this->tpl->setContent($this->form_gui->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCQuestionGUI::insertFromPool ( )

Insert question from ppol.

Definition at line 475 of file class.ilPCQuestionGUI.php.

References $_SESSION, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilObject\_lookupObjId(), ilObject\_lookupType(), listPoolQuestions(), and poolSelection().

{
global $ilCtrl, $ilAccess, $ilTabs, $tpl, $lng, $ilToolbar;
//var_dump($_SESSION["cont_qst_pool"]);
if ($_SESSION["cont_qst_pool"] != "" &&
$ilAccess->checkAccess("write", "", $_SESSION["cont_qst_pool"])
&& ilObject::_lookupType(ilObject::_lookupObjId($_SESSION["cont_qst_pool"])) == "qpl")
{
}
else
{
$this->poolSelection();
}
}

+ Here is the call graph for this function:

ilPCQuestionGUI::listPoolQuestions ( )

List questions of pool.

Parameters
@return

Definition at line 537 of file class.ilPCQuestionGUI.php.

References $_SESSION, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilUtil\sendInfo(), and setInsertTabs().

Referenced by insertFromPool().

{
global $ilToolbar, $tpl, $ilCtrl, $lng;
ilUtil::sendInfo($lng->txt("cont_cp_question_diff_formats_info"));
$ilCtrl->setParameter($this, "subCmd", "poolSelection");
$ilToolbar->addButton(
$lng->txt("cont_select_other_qpool"),
$ilCtrl->getLinkTarget($this, "insert"));
$ilCtrl->setParameter($this, "subCmd", "");
$this->setInsertTabs("copy_question");
include_once "./Services/COPage/classes/class.ilCopySelfAssQuestionTableGUI.php";
$ilCtrl->setParameter($this, "subCmd", "listPoolQuestions");
$table_gui = new ilCopySelfAssQuestionTableGUI($this, 'insert',
$_SESSION["cont_qst_pool"]);
$tpl->setContent($table_gui->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCQuestionGUI::poolSelection ( )

Pool selection.

Parameters
@return

Definition at line 497 of file class.ilPCQuestionGUI.php.

References $ilCtrl, ilPageContentGUI\$tpl, and setInsertTabs().

Referenced by insertFromPool().

{
global $ilCtrl, $tree, $tpl, $ilTabs;
$this->setInsertTabs("copy_question");
include_once "./Services/COPage/classes/class.ilPoolSelectorGUI.php";
$ilCtrl->setParameter($this, "subCmd", "poolSelection");
$exp = new ilPoolSelectorGUI($this, "insert");
// filter
$exp->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", "qpl"));
$exp->setClickableTypes(array('qpl'));
if (!$exp->handleCommand())
{
$tpl->setContent($exp->getHTML());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCQuestionGUI::selectPool ( )

Select concrete question pool.

Definition at line 522 of file class.ilPCQuestionGUI.php.

References $_GET, $_SESSION, and $ilCtrl.

{
global $ilCtrl;
$_SESSION["cont_qst_pool"] = $_GET["pool_ref_id"];
$ilCtrl->setParameter($this, "subCmd", "insertFromPool");
$ilCtrl->redirect($this, "insert");
}
ilPCQuestionGUI::setInsertTabs (   $a_active)

Set insert tabs.

Parameters
string$a_activeactive tab id

Definition at line 93 of file class.ilPCQuestionGUI.php.

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by insert(), listPoolQuestions(), and poolSelection().

{
global $ilTabs, $ilCtrl, $lng;
// new question
$ilTabs->addSubTab("new_question",
$lng->txt("cont_new_question"),
$ilCtrl->getLinkTarget($this, "insert"));
// copy from pool
$ilCtrl->setParameter($this, "subCmd", "insertFromPool");
$ilTabs->addSubTab("copy_question",
$lng->txt("cont_copy_question_from_pool"),
$ilCtrl->getLinkTarget($this, "insert"));
$ilTabs->activateSubTab($a_active);
$ilCtrl->setParameter($this, "subCmd", "");
}

+ Here is the caller graph for this function:

ilPCQuestionGUI::setNewQuestionId (   $a_par)

Set new question id.

Definition at line 260 of file class.ilPCQuestionGUI.php.

{
if ($a_par["new_id"] > 0)
{
$this->content_obj->setQuestionReference("il__qst_".$a_par["new_id"]);
$this->pg_obj->update();
}
}
ilPCQuestionGUI::setSelfAssessmentMode (   $a_selfassessmentmode)

Set Self Assessment Mode.

Parameters
boolean$a_selfassessmentmodeSelf Assessment Mode

Definition at line 73 of file class.ilPCQuestionGUI.php.

{
$this->selfassessmentmode = $a_selfassessmentmode;
}
ilPCQuestionGUI::setTabs ( )

Set tabs.

Definition at line 420 of file class.ilPCQuestionGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), assQuestion\_getQuestionType(), ilUtil\appendUrlParameterString(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, assQuestionGUI\getCommandsFromClassConstants(), and getSelfAssessmentMode().

Referenced by executeCommand().

{
if ($this->getSelfAssessmentMode())
{
return;
}
global $ilTabs, $ilCtrl, $lng;
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
if ($this->content_obj!="") {
$q_ref = $this->content_obj->getQuestionReference();
}
if ($q_ref != "")
{
if (!($inst_id > 0))
{
}
}
$ilTabs->addTarget("question",
$ilCtrl->getLinkTarget($this, "edit"), array("editQuestion", "save", "cancel", "addSuggestedSolution",
"cancelExplorer", "linkChilds", "removeSuggestedSolution",
"addPair", "addTerm", "delete", "deleteTerms", "editMode", "upload",
"saveEdit","uploadingImage", "uploadingImagemap", "addArea",
"deletearea", "saveShape", "back", "saveEdit", "changeGapType","createGaps","addItem","addYesNo", "addTrueFalse",
"toggleGraphicalAnswers", "setMediaMode"),
"");
if ($q_id > 0)
{
if (assQuestion::_getQuestionType($q_id)!= "assTextQuestion")
{
require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
$tabCommands = assQuestionGUI::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
$ilCtrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW),
"q_id=".(int)$q_id
);
$ilTabs->addTarget('feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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