ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCQuestion Class Reference

Class ilPCQuestion. More...

+ Inheritance diagram for ilPCQuestion:
+ Collaboration diagram for ilPCQuestion:

Public Member Functions

 init ()
 Init page content component.
 setNode (&$a_node)
 Set node.
 setQuestionReference ($a_questionreference)
 Set Question Reference.
 getQuestionReference ()
 Get Question Reference.
 create (&$a_pg_obj, $a_hier_id)
 Create Question Element.
 copyPoolQuestionIntoPage ($a_q_id, $a_hier_id)
 Copy question from pool into page.
- Public Member Functions inherited from ilPageContent
 __construct ($a_dom)
 Constructor.
 getType ()
 Get type of page content.
getNode ()
 Get xml node of page content.
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure.
 getHierId ()
 Get hierarchical id.
 lookupHierId ()
 Get hierarchical id from dom.
 readHierId ()
 Read PC Id.
 setPcId ($a_pcid)
 Set PC Id.
 getPCId ()
 Get PC Id.
 readPCId ()
 Read PC Id.
 writePCId ($a_pc_id)
 Write pc id.
 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b.
 setEnabled ($value)
 Set Enabled value for page content component.
 enable ()
 Enable page content.
 disable ()
 Disable page content.
 isEnabled ()
 Check whether page content is enabled.
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element)

Data Fields

 $dom
 $q_node
- Data Fields inherited from ilPageContent
 $hier_id
 $node
 $dom

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number)
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number)
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container.
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order.
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type.

Detailed Description

Class ilPCQuestion.

Assessment Question of ilPageObject

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 36 of file class.ilPCQuestion.php.

Member Function Documentation

ilPCQuestion::copyPoolQuestionIntoPage (   $a_q_id,
  $a_hier_id 
)

Copy question from pool into page.

Parameters
@return

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

References $t, assQuestion\_instanciateQuestion(), assQuestionGUI\getSelfAssessmentTags(), and ilUtil\secureString().

{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
$question = assQuestion::_instanciateQuestion($a_q_id);
$duplicate_id = $question->copyObject(0, $question->getTitle());
$duplicate = assQuestion::_instanciateQuestion($duplicate_id);
$duplicate->setObjId(0);
// we remove everything not supported by the non-tiny self
// assessment question editor
$q = $duplicate->getQuestion();
// we try to save all latex tags
$try = true;
$ls = '<span class="latex">';
$le = '</span>';
while ($try)
{
// search position of start tag
$pos1 = strpos($q, $ls);
if (is_int($pos1))
{
$pos2 = strpos($q, $le, $pos1);
if (is_int($pos2))
{
// both found: replace end tag
$q = substr($q, 0, $pos2)."[/tex]".substr($q, $pos2+7);
$q = substr($q, 0, $pos1)."[tex]".substr($q, $pos1+20);
}
else
{
$try = false;
}
}
else
{
$try = false;
}
}
$tstr = "";
foreach ($tags as $t)
{
$tstr.="<".$t.">";
}
$q = ilUtil::secureString($q, true, $tstr);
// self assessment uses nl2br, not p
$duplicate->setQuestion($q);
$duplicate->saveQuestionDataToDb();
$this->q_node->set_attribute("QRef", "il__qst_".$duplicate_id);
}

+ Here is the call graph for this function:

ilPCQuestion::create ( $a_pg_obj,
  $a_hier_id 
)

Create Question Element.

Definition at line 88 of file class.ilPCQuestion.php.

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

{
$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER);
$this->q_node = $this->dom->create_element("Question");
$this->q_node = $this->node->append_child($this->q_node);
$this->q_node->set_attribute("QRef", "");
}

+ Here is the call graph for this function:

ilPCQuestion::getQuestionReference ( )

Get Question Reference.

Returns
string Question Reference

Definition at line 76 of file class.ilPCQuestion.php.

{
if (is_object($this->q_node))
{
return $this->q_node->get_attribute("QRef", $a_questionreference);
}
return false;
}
ilPCQuestion::init ( )

Init page content component.

Reimplemented from ilPageContent.

Definition at line 44 of file class.ilPCQuestion.php.

References ilPageContent\setType().

{
$this->setType("pcqst");
}

+ Here is the call graph for this function:

ilPCQuestion::setNode ( $a_node)

Set node.

Reimplemented from ilPageContent.

Definition at line 52 of file class.ilPCQuestion.php.

{
parent::setNode($a_node); // this is the PageContent node
$this->q_node =& $a_node->first_child(); //... and this the Question
}
ilPCQuestion::setQuestionReference (   $a_questionreference)

Set Question Reference.

Parameters
string$a_questionreferenceQuestion Reference

Definition at line 63 of file class.ilPCQuestion.php.

{
if (is_object($this->q_node))
{
$this->q_node->set_attribute("QRef", $a_questionreference);
}
}

Field Documentation

ilPCQuestion::$dom

Definition at line 38 of file class.ilPCQuestion.php.

ilPCQuestion::$q_node

Definition at line 39 of file class.ilPCQuestion.php.


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