6 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
37 $this->q_node =& $a_node->first_child();
47 if (is_object($this->q_node))
49 $this->q_node->set_attribute(
"QRef", $a_questionreference);
60 if (is_object($this->q_node))
62 return $this->q_node->get_attribute(
"QRef", $a_questionreference);
70 function create(&$a_pg_obj, $a_hier_id)
74 $this->q_node = $this->dom->create_element(
"Question");
75 $this->q_node = $this->node->append_child($this->q_node);
76 $this->q_node->set_attribute(
"QRef",
"");
87 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
88 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
90 $duplicate_id = $question->copyObject(0, $question->getTitle());
92 $duplicate->setObjId(0);
96 $q = $duplicate->getQuestion();
100 $ls =
'<span class="latex">';
105 $pos1 = strpos($q, $ls);
108 $pos2 = strpos($q, $le, $pos1);
112 $q = substr($q, 0, $pos2).
"[/tex]".substr($q, $pos2+7);
113 $q = substr($q, 0, $pos1).
"[tex]".substr($q, $pos1+20);
128 foreach ($tags as
$t)
134 $duplicate->setQuestion($q);
136 $duplicate->saveQuestionDataToDb();
138 $this->q_node->set_attribute(
"QRef",
"il__qst_".$duplicate_id);
147 return array(
"ed_insert_pcqst",
"empty_question",
"pc_qst");
162 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
164 $ilDB->manipulateF(
"DELETE FROM page_question WHERE page_parent_type = %s ".
165 " AND page_id = %s AND page_lang = %s", array(
"text",
"integer",
"text"),
166 array($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage()));
168 $xpath =
new DOMXPath($a_domdoc);
169 $nodes = $xpath->query(
'//Question');
171 foreach ($nodes as
$node)
173 $q_ref = $node->getAttribute(
"QRef");
181 $q_ids[$q_id] = $q_id;
185 foreach($q_ids as $qid)
187 $ilDB->manipulateF(
"INSERT INTO page_question (page_parent_type, page_id, page_lang, question_id)".
188 " VALUES (%s,%s,%s,%s)",
189 array(
"text",
"integer",
"text",
"integer"),
190 array($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage(), $qid));
204 $ilDB->manipulateF(
"DELETE FROM page_question WHERE page_parent_type = %s ".
205 " AND page_id = %s AND page_lang = %s", array(
"text",
"integer",
"text"),
206 array($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage()));
216 $res = $ilDB->queryF(
"SELECT * FROM page_question WHERE page_parent_type = %s ".
217 " AND page_id = %s AND page_lang = %s",
218 array(
"text",
"integer",
"text"),
219 array($a_parent_type, $a_page_id, $a_lang));
221 while ($rec = $ilDB->fetchAssoc(
$res))
223 $q_ids[] = $rec[
"question_id"];
239 $set = $ilDB->query(
"SELECT * FROM page_question ".
240 " WHERE question_id = ".$ilDB->quote($a_q_id,
"integer")
242 while ($rec = $ilDB->fetchAssoc($set))
244 if ($a_parent_type ==
"" || $rec[
"page_parent_type"] == $a_parent_type)
246 return array(
"page_id" => $rec[
"page_id"],
"parent_type" => $rec[
"page_parent_type"]);