ILIAS  Release_4_2_x_branch Revision 61807
 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.
 setPageConfig ($a_val)
 Set Page Config.
 getPageConfig ()
 Get Page Config.
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.
 setStyleId ($a_styleid)
 Set Style Id.
 getStyleId ()
 Get Style Id.
 setEnableInternalLinks ($a_val)
 Set enable internal links.
 getEnableInternalLinks ()
 Get enable internal links.
 setEnableKeywords ($a_val)
 Set enable keywords handling.
 getEnableKeywords ()
 Get enable keywords handling.
 setEnableAnchors ($a_val)
 Set enable anchors.
 getEnableAnchors ()
 Get enable anchors.
 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.

Data Fields

 $page_config = null
- Data Fields inherited from ilPageContentGUI
 $content_obj
 $ilias
 $tpl
 $lng
 $ctrl
 $pg_obj
 $hier_id
 $dom
 $updated
 $target_script
 $return_location

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons.
- 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 33666 2012-03-12 11:07:35Z akill

ilPCQuestionGUI: ilQuestionEditGUI

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

Member Function Documentation

ilPCQuestionGUI::copyQuestion ( )

Copy question into page.

Parameters
@return

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

References $_GET, and $ilCtrl.

{
global $ilCtrl;
$this->content_obj = new ilPCQuestion($this->dom);
$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);
}
ilPCQuestionGUI::create ( )

Create new question.

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

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

{
global $lng, $ilCtrl, $ilTabs;
$ilTabs->setTabActive('question');
$this->content_obj = new ilPCQuestion($this->dom);
$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, "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 402 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 285 of file class.ilPCQuestionGUI.php.

References $_GET, $_POST, $ilCtrl, $ret, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilObjSAHSLearningModule\_getTries(), getPageConfig(), getSelfAssessmentMode(), and insert().

{
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);
$q_id = $q_gui->object->createNewQuestion(true);
unset($q_gui);
if ($_GET["qpool_ref_id"] > 0)
{
$edit_gui->setPoolRefId($_GET["qpool_ref_id"]);
$edit_gui->setPoolRefId(0);
}
//set default tries
$edit_gui->setDefaultNrOfTries(ilObjSAHSLearningModule::_getTries($this->scormlmid));
}
$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 58 of file class.ilPCQuestionGUI.php.

References $_GET, $_POST, $cmd, $ilCtrl, $ret, getPageConfig(), and setTabs().

{
global $ilCtrl;
// 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)
{
case "ilquestioneditgui":
include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
$edit_gui = new ilQuestionEditGUI();
if ($q_type != "")
{
$edit_gui->setQuestionType($q_type);
}
$edit_gui->setPageConfig($this->getPageConfig());
//$edit_gui->setPoolRefId($qpool_ref_id);
$this->setTabs();
$edit_gui->addNewIdListener($this, "setNewQuestionId");
$edit_gui->setSelfAssessmentEditingMode(true);
$ret = $ilCtrl->forwardCommand($edit_gui);
$this->tpl->setContent($ret);
break;
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 357 of file class.ilPCQuestionGUI.php.

References $ilCtrl, $ret, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), and 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::getPageConfig ( )

Get Page Config.

Returns
object Page Config

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

References $page_config.

Referenced by edit(), executeCommand(), and feedback().

{
}

+ Here is the caller graph for this function:

ilPCQuestionGUI::getSelfAssessmentMode ( )

Get Self Assessment Mode.

Returns
boolean Self Assessment Mode

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

Referenced by edit().

{
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 27 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 159 of file class.ilPCQuestionGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilObjQuestionPool\_getSelfAssessmentQuestionTypes(), ilPageContentGUI\displayValidationError(), 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);
// 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 469 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 551 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 491 of file class.ilPCQuestionGUI.php.

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

Referenced by insertFromPool().

{
global $ilCtrl, $tree, $tpl, $ilTabs;
$this->setInsertTabs("copy_question");
include_once "./Services/COPage/classes/class.ilPoolSelectorGUI.php";
$exp = new ilPoolSelectorGUI($ilCtrl->getLinkTarget($this, "insert"));
if ($_GET["expand"] == "")
{
$expanded = $tree->readRootId();
}
else
{
$expanded = $_GET["expand"];
}
$exp->setExpand($expanded);
$exp->setTargetGet("sel_id");
$ilCtrl->setParameter($this, "target_type", $a_type);
$ilCtrl->setParameter($this, "subCmd", "poolSelection");
$exp->setParamsGet($this->ctrl->getParameterArray($this, "insert"));
// filter
$exp->setFiltered(true);
$exp->setFilterMode(IL_FM_POSITIVE);
$exp->addFilter("root");
$exp->addFilter("cat");
$exp->addFilter("grp");
$exp->addFilter("fold");
$exp->addFilter("crs");
$exp->addFilter("qpl");
$exp->setContentGUIClass("ilpcquestiongui");
$exp->setSelectableTypes(array('qpl'));
$exp->setOutput(0);
$tpl->setContent($exp->getOutput());
}

+ 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 536 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 136 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 273 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::setPageConfig (   $a_val)

Set Page Config.

Parameters
objectPage Config

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

{
$this->page_config = $a_val;
}
ilPCQuestionGUI::setSelfAssessmentMode (   $a_selfassessmentmode)

Set Self Assessment Mode.

Parameters
boolean$a_selfassessmentmodeSelf Assessment Mode

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

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

Set tabs.

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

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

Referenced by executeCommand().

{
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) {
$q_obj = new assQuestion();
if ($q_obj->_getQuestionType($q_id)!= "assTextQuestion")
{
$ilTabs->addTarget("feedback",
$ilCtrl->getLinkTarget($this, "feedback"), array("feedback","saveFeedback"),
"");
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilPCQuestionGUI::$page_config = null

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

Referenced by getPageConfig().


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