ILIAS  eassessment Revision 61809
 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.
 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.
- 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
 deactivate ()
 gui function set enabled if is not enabled and vice versa
 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 25692 2010-09-15 09:44:16Z mwarkus

ilPCQuestionGUI: ilQuestionEditGUI

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

Member Function Documentation

ilPCQuestionGUI::create ( )

Create new question.

Definition at line 202 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 372 of file class.ilPCQuestionGUI.php.

References $_GET, and $name.

{
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 255 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);
// @todo: check access stuff
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();
if ($q_id > 0)
{
$edit_gui->setQuestionId($q_id);
// $edit_gui->setPoolObjId(assQuestion::_lookupQPoolId($q_id));
$edit_gui->setPoolObjId(0);
}
else
{
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));
}
if ($q_id == "" && $q_type == "")
{
return $this->insert("edit_empty");
}
$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();
}
$ret = $this->$cmd();
}
return $ret;
}

+ Here is the call graph for this function:

ilPCQuestionGUI::feedback ( )

Definition at line 327 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 120 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 131 of file class.ilPCQuestionGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilObjQuestionPool\_getSelfAssessmentQuestionTypes(), ilPageContentGUI\displayValidationError(), ilSelectInputGUI\setOptions(), and ilUtil\sortArray().

Referenced by create(), and edit().

{
global $ilUser, $lng, $ilCtrl;
// 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, "question_type_id", "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::setNewQuestionId (   $a_par)

Set new question id.

Definition at line 243 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 110 of file class.ilPCQuestionGUI.php.

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

Set tabs.

Definition at line 393 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: