ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjQuestionPool.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
25 
37 {
43  var $online;
44 
51  function ilObjQuestionPool($a_id = 0,$a_call_by_reference = true)
52  {
53  $this->type = "qpl";
54  $this->ilObject($a_id,$a_call_by_reference);
55  $this->setOnline(0);
56  }
57 
61  function create($a_upload = false)
62  {
64 
65  // meta data will be created by
66  // import parser
67  if (!$a_upload)
68  {
69  $this->createMetaData();
70  }
71  }
72 
81  function createReference()
82  {
84  $this->saveToDb();
85  return $result;
86  }
87 
94  function update()
95  {
96  $this->updateMetaData();
97  if (!parent::update())
98  {
99  return false;
100  }
101 
102  // put here object specific stuff
103 
104  return true;
105  }
106 
107  function updateMetaData()
108  {
109  global $ilUser;
110  include_once "./Services/MetaData/classes/class.ilMD.php";
111  $md =& new ilMD($this->getId(), 0, $this->getType());
112  $md_gen =& $md->getGeneral();
113  if ($md_gen == false)
114  {
115  include_once "./Services/MetaData/classes/class.ilMDCreator.php";
116  $md_creator = new ilMDCreator($this->getId(),0,$this->getType());
117  $md_creator->setTitle($this->getTitle());
118  $md_creator->setTitleLanguage($ilUser->getPref('language'));
119  $md_creator->create();
120  }
122  }
123 
129  function read($a_force_db = false)
130  {
131  parent::read($a_force_db);
132  $this->loadFromDb();
133  }
134 
135 
142  function delete()
143  {
144 /* $questions =& $this->getAllQuestions();
145  $used_questions = 0;
146  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
147  foreach ($questions as $question_id)
148  {
149  if (assQuestion::_isUsedInRandomTest($question_id))
150  {
151  $used_questions++;
152  }
153  }
154 
155  if ($used_questions)
156  {
157  return false;
158  }
159 */
160  // always call parent delete function first!!
161  if (!parent::delete())
162  {
163  return false;
164  }
165 
166  // delete meta data
167  $this->deleteMetaData();
168 
169  //put here your module specific stuff
170  $this->deleteQuestionpool();
171 
172  return true;
173  }
174 
176  {
177  $questions =& $this->getAllQuestions();
178 
179  if (count($questions))
180  {
181  foreach ($questions as $question_id)
182  {
183  $this->deleteQuestion($question_id);
184  }
185  }
186 
187  // delete export files
188  include_once "./Services/Utilities/classes/class.ilUtil.php";
189  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
190  $directory = $qpl_data_dir."/qpl_".$this->getId();
191  if (is_dir($directory))
192  {
193  include_once "./Services/Utilities/classes/class.ilUtil.php";
194  ilUtil::delDir($directory);
195  }
196  }
197 
207  function initDefaultRoles()
208  {
209  global $rbacadmin;
210 
211  // create a local role folder
212  //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
213 
214  // create moderator role and assign role to rolefolder...
215  //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
216  //$roles[] = $roleObj->getId();
217 
218  //unset($rfoldObj);
219  //unset($roleObj);
220 
221  return $roles ? $roles : array();
222  }
223 
237  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
238  {
239  global $tree;
240 
241  switch ($a_event)
242  {
243  case "link":
244 
245  //var_dump("<pre>",$a_params,"</pre>");
246  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
247  //exit;
248  break;
249 
250  case "cut":
251 
252  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
253  //exit;
254  break;
255 
256  case "copy":
257 
258  //var_dump("<pre>",$a_params,"</pre>");
259  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
260  //exit;
261  break;
262 
263  case "paste":
264 
265  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
266  //exit;
267  break;
268 
269  case "new":
270 
271  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
272  //exit;
273  break;
274  }
275 
276  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
277  if ($a_node_id==$_GET["ref_id"])
278  {
279  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
280  $parent_type = $parent_obj->getType();
281  if($parent_type == $this->getType())
282  {
283  $a_node_id = (int) $tree->getParentId($a_node_id);
284  }
285  }
286 
287  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
288  }
289 
298  function deleteQuestion($question_id)
299  {
300  include_once "./Modules/Test/classes/class.ilObjTest.php";
301 
302  $question =& ilObjTest::_instanciateQuestion($question_id);
303  $question->delete($question_id);
304  }
305 
313  function loadFromDb()
314  {
315  global $ilDB;
316 
317  $query = sprintf("SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
318  $ilDB->quote($this->getId() . "")
319  );
320  $result = $ilDB->query($query);
321  if ($result->numRows() == 1)
322  {
323  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
324  $this->setOnline($row["online"]);
325  }
326  }
327 
335  function saveToDb()
336  {
337  global $ilDB;
338 
339  $query = sprintf("SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
340  $ilDB->quote($this->getId() . "")
341  );
342  $result = $ilDB->query($query);
343  if ($result->numRows() == 1)
344  {
345  $query = sprintf("UPDATE qpl_questionpool SET online = %s WHERE obj_fi = %s",
346  $ilDB->quote($this->getOnline() . ""),
347  $ilDB->quote($this->getId() . "")
348  );
349  $result = $ilDB->query($query);
350  if (PEAR::isError($result))
351  {
352  global $ilias;
353  $ilias->raiseError($result->getMessage());
354  }
355  }
356  else
357  {
358  $query = sprintf("INSERT INTO qpl_questionpool (online, obj_fi) VALUES (%s, %s)",
359  $ilDB->quote($this->getOnline() . ""),
360  $ilDB->quote($this->getId() . "")
361  );
362  $result = $ilDB->query($query);
363  if (PEAR::isError($result))
364  {
365  global $ilias;
366  $ilias->raiseError($result->getMessage());
367  }
368  }
369  }
370 
380  function getQuestiontype($question_id)
381  {
382  global $ilDB;
383 
384  if ($question_id < 1)
385  {
386  return;
387  }
388 
389  $query = sprintf("SELECT qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.question_id = %s",
390  $ilDB->quote($question_id));
391 
392  $result = $ilDB->query($query);
393  if ($result->numRows() == 1)
394  {
395  $data = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
396  return $data->type_tag;
397  }
398  else
399  {
400  return;
401  }
402  }
403 
409  function getDescription()
410  {
411  return parent::getDescription();
412  }
413 
417  function setDescription($a_description)
418  {
419  parent::setDescription($a_description);
420  }
421 
427  function getTitle()
428  {
429  return parent::getTitle();
430  }
431 
435  function setTitle($a_title)
436  {
437  parent::setTitle($a_title);
438  }
439 
449  function isInUse($question_id)
450  {
451  global $ilDB;
452 
453  $query = sprintf("SELECT COUNT(solution_id) AS solution_count FROM tst_solutions WHERE question_fi = %s",
454  $ilDB->quote("$question_id"));
455 
456  $result = $ilDB->query($query);
457  $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
458 
459  return $row->solution_count;
460  }
461 
462  function &createQuestion($question_type, $question_id = -1)
463  {
464  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
465  if ($question_id > 0) return assQuestion::_instanciateQuestionGUI($question_id);
466  assQuestion::_includeClass($question_type, 1);
467  $question_type_gui = $question_type . "GUI";
468  $question_gui =& new $question_type_gui();
469  return $question_gui;
470  }
471 
480  function duplicateQuestion($question_id)
481  {
482  $question =& $this->createQuestion("", $question_id);
483  $newtitle = $question->object->getTitle();
484  if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
485  {
486  $counter = 2;
487  while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . " ($counter)"))
488  {
489  $counter++;
490  }
491  $newtitle = $question->object->getTitle() . " ($counter)";
492  }
493  $question->object->duplicate(false, $newtitle);
494  // update question count of question pool
496  }
497 
507  function copyQuestion($question_id, $questionpool_to)
508  {
509  $question_gui =& $this->createQuestion("", $question_id);
510  if ($question_gui->object->getObjId() == $questionpool_to)
511  {
512  // the question is copied into the same question pool
513  $this->duplicateQuestion($question_id);
514  }
515  else
516  {
517  // the question is copied into another question pool
518  $newtitle = $question_gui->object->getTitle();
519  if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
520  {
521  $counter = 2;
522  while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . " ($counter)"))
523  {
524  $counter++;
525  }
526  $newtitle = $question_gui->object->getTitle() . " ($counter)";
527  }
528  $question_gui->object->copyObject($this->getId(), $newtitle);
529  }
530  }
531 
539  function getQuestionsTable($sort, $sortorder, $filter_text, $sel_filter_type, $startrow = 0)
540  {
541  global $ilUser;
542  global $ilDB;
543 
544  $where = "";
545  if (strlen($filter_text) > 0)
546  {
547  switch($sel_filter_type)
548  {
549  case "title":
550  $where = " AND qpl_questions.title LIKE " . $ilDB->quote("%" . $filter_text . "%");
551  break;
552  case "comment":
553  $where = " AND qpl_questions.comment LIKE " . $ilDB->quote("%" . $filter_text . "%");
554  break;
555  case "author":
556  $where = " AND qpl_questions.author LIKE " . $ilDB->quote("%" . $filter_text . "%");
557  break;
558  }
559  }
560 
561  // build sort order for sql query
562  $order = "";
563  $images = array();
564  include_once "./Services/Utilities/classes/class.ilUtil.php";
565  switch($sort)
566  {
567  case "title":
568  $order = " ORDER BY title $sortorder";
569  $images["title"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
570  break;
571  case "comment":
572  $order = " ORDER BY comment $sortorder";
573  $images["comment"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
574  break;
575  case "type":
576  $order = " ORDER BY question_type_id $sortorder";
577  $images["type"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
578  break;
579  case "author":
580  $order = " ORDER BY author $sortorder";
581  $images["author"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
582  break;
583  case "created":
584  $order = " ORDER BY created $sortorder";
585  $images["created"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
586  break;
587  case "updated":
588  $order = " ORDER BY timestamp14 $sortorder";
589  $images["updated"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
590  break;
591  }
592  $maxentries = $ilUser->prefs["hits_per_page"];
593  if ($maxentries < 1)
594  {
595  $maxentries = 9999;
596  }
597  $query = "SELECT qpl_questions.question_id, qpl_questions.TIMESTAMP + 0 AS timestamp14 FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->getId() . " $where$order$limit";
598  $query_result = $ilDB->query($query);
599  $max = $query_result->numRows();
600  if ($startrow > $max -1)
601  {
602  $startrow = $max - ($max % $maxentries);
603  }
604  else if ($startrow < 0)
605  {
606  $startrow = 0;
607  }
608  $limit = " LIMIT $startrow, $maxentries";
609  $query = "SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS timestamp14, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->getId() . " $where$order$limit";
610  $query_result = $ilDB->query($query);
611  $rows = array();
612  if ($query_result->numRows())
613  {
614  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
615  {
616  if ($row["plugin"])
617  {
618  if ($this->isPluginActive($row["type_tag"]))
619  {
620  array_push($rows, $row);
621  }
622  }
623  else
624  {
625  array_push($rows, $row);
626  }
627  }
628  }
629  $nextrow = $startrow + $maxentries;
630  if ($nextrow > $max - 1)
631  {
632  $nextrow = $startrow;
633  }
634  $prevrow = $startrow - $maxentries;
635  if ($prevrow < 0)
636  {
637  $prevrow = 0;
638  }
639  return array(
640  "rows" => $rows,
641  "images" => $images,
642  "startrow" => $startrow,
643  "nextrow" => $nextrow,
644  "prevrow" => $prevrow,
645  "step" => $maxentries,
646  "rowcount" => $max
647  );
648  }
649 
657  function &getPrintviewQuestions($sort)
658  {
659  global $ilDB;
660 
661  // build sort order for sql query
662  $order = "";
663  switch($sort)
664  {
665  case "title":
666  $order = " ORDER BY title";
667  break;
668  case "comment":
669  $order = " ORDER BY comment,title";
670  break;
671  case "type":
672  $order = " ORDER BY question_type_id,title";
673  break;
674  case "author":
675  $order = " ORDER BY author,title";
676  break;
677  case "created":
678  $order = " ORDER BY created,title";
679  break;
680  case "updated":
681  $order = " ORDER BY timestamp14,title";
682  break;
683  }
684  $query = "SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS timestamp14, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.question_type_fi = qpl_question_type.question_type_id AND qpl_questions.obj_fi = " . $this->getId() . " $order";
685  $query_result = $ilDB->query($query);
686  $rows = array();
687  if ($query_result->numRows())
688  {
689  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
690  {
691  if ($row["plugin"])
692  {
693  if ($this->isPluginActive($row["type_tag"]))
694  {
695  array_push($rows, $row);
696  }
697  }
698  else
699  {
700  array_push($rows, $row);
701  }
702  }
703  }
704  return $rows;
705  }
706 
713  function exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
714  {
715  global $ilBench;
716 
717  $this->mob_ids = array();
718  $this->file_ids = array();
719 
720  $attrs = array();
721  $attrs["Type"] = "Questionpool_Test";
722  $a_xml_writer->xmlStartTag("ContentObject", $attrs);
723 
724  // MetaData
725  $this->exportXMLMetaData($a_xml_writer);
726 
727  // PageObjects
728  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
729  $ilBench->start("ContentObjectExport", "exportPageObjects");
730  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
731  $ilBench->stop("ContentObjectExport", "exportPageObjects");
732  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
733 
734  // MediaObjects
735  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
736  $ilBench->start("ContentObjectExport", "exportMediaObjects");
737  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
738  $ilBench->stop("ContentObjectExport", "exportMediaObjects");
739  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
740 
741  // FileItems
742  $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
743  $ilBench->start("ContentObjectExport", "exportFileItems");
744  $this->exportFileItems($a_target_dir, $expLog);
745  $ilBench->stop("ContentObjectExport", "exportFileItems");
746  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
747 
748  $a_xml_writer->xmlEndTag("ContentObject");
749  }
750 
757  function exportXMLMetaData(&$a_xml_writer)
758  {
759  include_once("Services/MetaData/classes/class.ilMD2XML.php");
760  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
761  $md2xml->setExportMode(true);
762  $md2xml->startExport();
763  $a_xml_writer->appendXML($md2xml->getXML());
764  }
765 
766  function modifyExportIdentifier($a_tag, $a_param, $a_value)
767  {
768  if ($a_tag == "Identifier" && $a_param == "Entry")
769  {
770  include_once "./Services/Utilities/classes/class.ilUtil.php";
771  $a_value = ilUtil::insertInstIntoID($a_value);
772  }
773 
774  return $a_value;
775  }
776 
777 
784  function exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
785  {
786  global $ilBench;
787 
788  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
789 
790  foreach ($questions as $question_id)
791  {
792  $ilBench->start("ContentObjectExport", "exportPageObject");
793  $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
794 
795  $attrs = array();
796  $a_xml_writer->xmlStartTag("PageObject", $attrs);
797 
798 
799  // export xml to writer object
800  $ilBench->start("ContentObjectExport", "exportPageObject_XML");
801  $page_object = new ilPageObject("qpl", $question_id);
802  $page_object->buildDom();
803  $page_object->insertInstIntoIDs($a_inst);
804  $mob_ids = $page_object->collectMediaObjects(false);
805  $file_ids = $page_object->collectFileItems();
806  $xml = $page_object->getXMLFromDom(false, false, false, "", true);
807  $xml = str_replace("&","&amp;", $xml);
808  $a_xml_writer->appendXML($xml);
809  $page_object->freeDom();
810  unset ($page_object);
811 
812  $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
813 
814  // collect media objects
815  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
816  //$mob_ids = $page_obj->getMediaObjectIDs();
817  foreach($mob_ids as $mob_id)
818  {
819  $this->mob_ids[$mob_id] = $mob_id;
820  }
821  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
822 
823  // collect all file items
824  $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
825  //$file_ids = $page_obj->getFileItemIds();
826  foreach($file_ids as $file_id)
827  {
828  $this->file_ids[$file_id] = $file_id;
829  }
830  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
831 
832  $a_xml_writer->xmlEndTag("PageObject");
833  //unset($page_obj);
834 
835  $ilBench->stop("ContentObjectExport", "exportPageObject");
836 
837 
838  }
839  }
840 
847  function exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
848  {
849  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
850 
851  foreach ($this->mob_ids as $mob_id)
852  {
853  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
854  if (ilObjMediaObject::_exists($mob_id))
855  {
856  $media_obj = new ilObjMediaObject($mob_id);
857  $media_obj->exportXML($a_xml_writer, $a_inst);
858  $media_obj->exportFiles($a_target_dir);
859  unset($media_obj);
860  }
861  }
862  }
863 
868  function exportFileItems($a_target_dir, &$expLog)
869  {
870  include_once("./Modules/File/classes/class.ilObjFile.php");
871 
872  foreach ($this->file_ids as $file_id)
873  {
874  $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
875  $file_obj = new ilObjFile($file_id, false);
876  $file_obj->export($a_target_dir);
877  unset($file_obj);
878  }
879  }
880 
887  {
888  include_once "./Services/Utilities/classes/class.ilUtil.php";
889  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
890  ilUtil::makeDir($qpl_data_dir);
891  if(!is_writable($qpl_data_dir))
892  {
893  $this->ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
894  .") not writeable.",$this->ilias->error_obj->FATAL);
895  }
896 
897  // create learning module directory (data_dir/lm_data/lm_<id>)
898  $qpl_dir = $qpl_data_dir."/qpl_".$this->getId();
899  ilUtil::makeDir($qpl_dir);
900  if(!@is_dir($qpl_dir))
901  {
902  $this->ilias->raiseError("Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
903  }
904  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
905  $export_dir = $qpl_dir."/export";
906  ilUtil::makeDir($export_dir);
907  if(!@is_dir($export_dir))
908  {
909  $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
910  }
911  }
912 
917  {
918  include_once "./Services/Utilities/classes/class.ilUtil.php";
919  $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export";
920  return $export_dir;
921  }
922 
927  {
928  // quit if import dir not available
929  if (!@is_dir($dir) or
930  !is_writeable($dir))
931  {
932  return array();
933  }
934  // open directory
935  $dir = dir($dir);
936 
937  // initialize array
938  $file = array();
939 
940  // get files and save the in the array
941  while ($entry = $dir->read())
942  {
943  if ($entry != "." and
944  $entry != ".." and
945  (substr($entry, -4) == ".zip" or substr($entry, -4) == ".xls") and
946  ereg("^[0-9]{10}_{2}[0-9]+_{2}(qpl__)*[0-9]+\.(zip|xls)\$", $entry))
947  {
948  $file[] = $entry;
949  }
950  }
951 
952  // close import directory
953  $dir->close();
954 
955  // sort files
956  sort ($file);
957  reset ($file);
958  return $file;
959  }
960 
967  {
968  global $ilias;
969 
970  include_once "./Services/Utilities/classes/class.ilUtil.php";
971  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
972  ilUtil::makeDir($qpl_data_dir);
973 
974  if(!is_writable($qpl_data_dir))
975  {
976  $ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
977  .") not writeable.",$ilias->error_obj->FATAL);
978  }
979 
980  // create questionpool directory (data_dir/qpl_data/qpl_import)
981  $qpl_dir = $qpl_data_dir."/qpl_import";
982  ilUtil::makeDir($qpl_dir);
983  if(!@is_dir($qpl_dir))
984  {
985  $ilias->raiseError("Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
986  }
987  }
988 
993  {
994  include_once "./Services/Utilities/classes/class.ilUtil.php";
995  $import_dir = ilUtil::getDataDir()."/qpl_data/qpl_import";
996  if(@is_dir($import_dir))
997  {
998  return $import_dir;
999  }
1000  else
1001  {
1002  return false;
1003  }
1004  }
1005 
1010  {
1011  include_once "./Services/Utilities/classes/class.ilUtil.php";
1012  $import_dir = ilUtil::getDataDir()."/qpl_data/qpl_import";
1013  if(@is_dir($import_dir))
1014  {
1015  return $import_dir;
1016  }
1017  else
1018  {
1019  return false;
1020  }
1021  }
1022 
1030  function &getAllQuestions()
1031  {
1032  global $ilDB;
1033 
1034  $query = sprintf("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND original_id IS NULL",
1035  $ilDB->quote($this->getId())
1036  );
1037 
1038  $result = $ilDB->query($query);
1039  $questions = array();
1040 
1041  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1042  {
1043  array_push($questions, $row["question_id"]);
1044  }
1045  return $questions;
1046  }
1047 
1048  function &getAllQuestionIds()
1049  {
1050  global $ilDB;
1051 
1052  $query = sprintf("SELECT question_id, qpl_question_type.type_tag, qpl_question_type.plugin FROM qpl_questions, qpl_question_type WHERE ISNULL(original_id) AND obj_fi = %s AND complete = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
1053  $ilDB->quote($this->getId()),
1054  $ilDB->quote("1")
1055  );
1056  $query_result = $ilDB->query($query);
1057  $questions = array();
1058  if ($query_result->numRows())
1059  {
1060  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1061  {
1062  if ($row["plugin"])
1063  {
1064  if ($this->isPluginActive($row["type_tag"]))
1065  {
1066  array_push($questions, $row["question_id"]);
1067  }
1068  }
1069  else
1070  {
1071  array_push($questions, $row["question_id"]);
1072  }
1073  }
1074  }
1075  return $questions;
1076  }
1077 
1082  function getImportMapping()
1083  {
1084  if (!is_array($this->import_mapping))
1085  {
1086  return array();
1087  }
1088  else
1089  {
1090  return $this->import_mapping;
1091  }
1092  }
1093 
1103  function toXML($questions)
1104  {
1105  $xml = "";
1106  // export button was pressed
1107  if (count($questions) > 0)
1108  {
1109  foreach ($questions as $key => $value)
1110  {
1111  $question =& $this->createQuestion("", $value);
1112  $xml .= $question->object->toXML();
1113  }
1114  if (count($questions) > 1)
1115  {
1116  $xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
1117  }
1118  }
1119  $xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
1120  return $xml;
1121  }
1122 
1133  function _getQuestionCount($questionpool_id, $complete_questions_only = FALSE)
1134  {
1135  global $ilDB;
1136  $query = sprintf("SELECT COUNT(question_id) AS question_count FROM qpl_questions WHERE obj_fi = %s AND ISNULL(original_id)",
1137  $ilDB->quote($questionpool_id . "")
1138  );
1139  if ($complete_questions_only)
1140  {
1141  $query .= " AND complete = '1'";
1142  }
1143  $result = $ilDB->query($query);
1144  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
1145  return $row["question_count"];
1146  }
1147 
1157  function setOnline($a_online_status)
1158  {
1159  switch ($a_online_status)
1160  {
1161  case 0:
1162  case 1:
1163  $this->online = $a_online_status;
1164  break;
1165  default:
1166  $this->online = 0;
1167  break;
1168  }
1169  }
1170 
1171  function getOnline()
1172  {
1173  if (strcmp($this->online, "") == 0) $this->online = "0";
1174  return $this->online;
1175  }
1176 
1177  function _lookupOnline($a_obj_id, $is_reference = FALSE)
1178  {
1179  global $ilDB;
1180 
1181  if ($is_reference)
1182  {
1183  $query = sprintf("SELECT qpl_questionpool.online FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
1184  $ilDB->quote($a_obj_id . "")
1185  );
1186  }
1187  else
1188  {
1189  $query = sprintf("SELECT online FROM qpl_questionpool WHERE obj_fi = %s",
1190  $ilDB->quote($a_obj_id . "")
1191  );
1192  }
1193  $result = $ilDB->query($query);
1194  if ($result->numRows() == 1)
1195  {
1196  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
1197  return $row["online"];
1198  }
1199  return 0;
1200  }
1201 
1210  function _hasEqualPoints($a_obj_id, $is_reference = FALSE)
1211  {
1212  global $ilDB;
1213 
1214  if ($is_reference)
1215  {
1216  $query = sprintf("SELECT count(DISTINCT qpl_questions.points) AS equal_points FROM qpl_questions, object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questions.obj_fi AND qpl_questions.original_id IS NULL",
1217  $ilDB->quote($a_obj_id . "")
1218  );
1219  }
1220  else
1221  {
1222  $query = sprintf("SELECT count(DISTINCT points) AS equal_points FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.original_id IS NULL",
1223  $ilDB->quote($a_obj_id . "")
1224  );
1225  }
1226  $result = $ilDB->query($query);
1227  if ($result->numRows() == 1)
1228  {
1229  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
1230  if ($row["equal_points"] == 1)
1231  {
1232  return 1;
1233  }
1234  else
1235  {
1236  return 0;
1237  }
1238  }
1239  return 0;
1240  }
1241 
1250  {
1251  global $ilDB;
1252 
1253  if (array_key_exists("qpl_clipboard", $_SESSION))
1254  {
1255  foreach ($_SESSION["qpl_clipboard"] as $question_object)
1256  {
1257  if (strcmp($question_object["action"], "move") == 0)
1258  {
1259  $query = sprintf("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1260  $ilDB->quote($question_object["question_id"])
1261  );
1262  $result = $ilDB->query($query);
1263  if ($result->numRows() == 1)
1264  {
1265  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
1266  $source_questionpool = $row["obj_fi"];
1267  // change the questionpool id in the qpl_questions table
1268  $query = sprintf("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1269  $ilDB->quote($this->getId() . ""),
1270  $ilDB->quote($question_object["question_id"])
1271  );
1272  $ilDB->query($query);
1273 
1274  // move question data to the new target directory
1275  $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
1276  if (@is_dir($source_path))
1277  {
1278  $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
1279  if (!@is_dir($target_path))
1280  {
1281  include_once "./Services/Utilities/classes/class.ilUtil.php";
1282  ilUtil::makeDirParents($target_path);
1283  }
1284  @rename($source_path, $target_path . $question_object["question_id"]);
1285  }
1286  // update question count of source question pool
1287  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
1288  }
1289  }
1290  else
1291  {
1292  $this->copyQuestion($question_object["question_id"], $this->getId());
1293  }
1294  }
1295  }
1296  // update question count of question pool
1298  unset($_SESSION["qpl_clipboard"]);
1299  }
1300 
1309  function copyToClipboard($question_id)
1310  {
1311  if (!array_key_exists("qpl_clipboard", $_SESSION))
1312  {
1313  $_SESSION["qpl_clipboard"] = array();
1314  }
1315  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
1316  }
1317 
1326  function moveToClipboard($question_id)
1327  {
1328  if (!array_key_exists("qpl_clipboard", $_SESSION))
1329  {
1330  $_SESSION["qpl_clipboard"] = array();
1331  }
1332  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
1333  }
1334 
1344  function _isWriteable($object_id, $user_id)
1345  {
1346  global $rbacsystem;
1347  global $ilDB;
1348 
1349  $result_array = array();
1350  $query = sprintf("SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.obj_id = %s",
1351  $ilDB->quote($object_id . "")
1352  );
1353  $result = $ilDB->query($query);
1354  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1355  {
1356  include_once "./classes/class.ilObject.php";
1357  if ($rbacsystem->checkAccess("write", $row["ref_id"]) && (ilObject::_hasUntrashedReference($row["obj_id"])))
1358  {
1359  return true;
1360  }
1361  }
1362  return false;
1363  }
1364 
1374  function &getQuestionDetails($question_ids)
1375  {
1376  global $ilDB;
1377 
1378  $result = array();
1379  $whereclause = join($question_ids, " OR qpl_questions.question_id = ");
1380  $whereclause = " AND (qpl_questions.question_id = " . $whereclause . ")";
1381  $query = "SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1382  $query_result = $ilDB->query($query);
1383  if ($query_result->numRows())
1384  {
1385  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1386  {
1387  array_push($result, $row);
1388  }
1389  }
1390  return $result;
1391  }
1392 
1404  function &getDeleteableQuestionDetails($question_ids)
1405  {
1406  global $ilDB;
1407 
1408  $result = array();
1409  $whereclause = join($question_ids, " OR qpl_questions.question_id = ");
1410  $whereclause = " AND (qpl_questions.question_id = " . $whereclause . ")";
1411  $query = "SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1412  $query_result = $ilDB->query($query);
1413  if ($query_result->numRows())
1414  {
1415  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1416  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1417  {
1418  if (!assQuestion::_isUsedInRandomTest($row["question_id"]))
1419  {
1420  array_push($result, $row);
1421  }
1422  else
1423  {
1424  // the question was used in a random test prior to ILIAS 3.7 so it was inserted
1425  // as a reference to the original question pool object and not as a copy. To allow
1426  // the deletion of the question pool object, a copy must be created and all database references
1427  // of the original question must changed with the reference of the copy
1428 
1429  // 1. Create a copy of the original question
1430  $question =& $this->createQuestion("", $row["question_id"]);
1431  $duplicate_id = $question->object->duplicate(true);
1432  if ($duplicate_id > 0)
1433  {
1434  // 2. replace the question id in the solutions
1435  $query = sprintf("UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1436  $ilDB->quote($duplicate_id),
1437  $ilDB->quote($row["question_id"])
1438  );
1439  $ilDB->query($query);
1440 
1441  // 3. replace the question id in the question list of random tests
1442  $query = sprintf("UPDATE tst_test_random_question SET question_fi = %s WHERE question_fi = %s",
1443  $ilDB->quote($duplicate_id),
1444  $ilDB->quote($row["question_id"])
1445  );
1446  $ilDB->query($query);
1447 
1448  // 4. replace the question id in the test results
1449  $query = sprintf("UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1450  $ilDB->quote($duplicate_id),
1451  $ilDB->quote($row["question_id"])
1452  );
1453  $ilDB->query($query);
1454 
1455  // 5. replace the question id in the test&assessment log
1456  $query = sprintf("UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1457  $ilDB->quote($duplicate_id),
1458  $ilDB->quote($row["question_id"])
1459  );
1460  $ilDB->query($query);
1461 
1462  // 6. The original question can be deleted, so add it to the list of questions
1463  array_push($result, $row);
1464  }
1465  }
1466  }
1467  }
1468  return $result;
1469  }
1470 
1482  function &getUsedQuestionDetails($question_ids)
1483  {
1484  global $ilDB;
1485 
1486  $result = array();
1487  $whereclause = join($question_ids, " OR qpl_questions.question_id = ");
1488  $whereclause = " AND (qpl_questions.question_id = " . $whereclause . ")";
1489  $query = "SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id$whereclause ORDER BY qpl_questions.title";
1490  $query_result = $ilDB->query($query);
1491  if ($query_result->numRows())
1492  {
1493  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1494  while ($row = $query_result->fetchRow(MDB2_FETCHMODE_ASSOC))
1495  {
1496  if (assQuestion::_isUsedInRandomTest($row["question_id"]))
1497  {
1498  array_push($result, $row);
1499  }
1500  }
1501  }
1502  return $result;
1503  }
1504 
1505 
1515  {
1516  global $tree;
1517  $path = $tree->getPathFull($ref_id);
1518  $items = array();
1519  $counter = 0;
1520  foreach ($path as $item)
1521  {
1522  if (($counter > 0) && ($counter < count($path)-1))
1523  {
1524  array_push($items, $item["title"]);
1525  }
1526  $counter++;
1527  }
1528  $fullpath = join(" > ", $items);
1529  include_once "./Services/Utilities/classes/class.ilStr.php";
1530  if (strlen($fullpath) > 60)
1531  {
1532  $fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
1533  }
1534  return $fullpath;
1535  }
1536 
1545  function &_getAvailableQuestionpools($use_object_id = FALSE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, $permission = "read")
1546  {
1547  global $ilUser;
1548  global $ilDB;
1549 
1550  $result_array = array();
1551  $permission = (strlen($permission) == 0) ? "read" : $permission;
1552  $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, $ilUser->getId(), -1);
1553  $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
1554  if (count($qpls))
1555  {
1556  $query = "";
1557  if ($could_be_offline)
1558  {
1559  $query = sprintf("SELECT object_data.*, object_reference.ref_id, qpl_questionpool.questioncount FROM object_data, object_reference, qpl_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND qpl_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
1560  implode("','", $qpls)
1561  );
1562  }
1563  else
1564  {
1565  $query = sprintf("SELECT object_data.*, object_reference.ref_id, qpl_questionpool.questioncount FROM object_data, object_reference, qpl_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND qpl_questionpool.online = '1' AND qpl_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
1566  implode("','", $qpls)
1567  );
1568  }
1569  $result = $ilDB->query($query);
1570  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1571  {
1572  $add = TRUE;
1573  if ($equal_points)
1574  {
1575  if (!ilObjQuestionPool::_hasEqualPoints($row["obj_id"]))
1576  {
1577  $add = FALSE;
1578  }
1579  }
1580  if ($add)
1581  {
1582  $title = (($showPath) ? $titles[$row["ref_id"]] : $row["title"]);
1583  if ($with_questioncount)
1584  {
1585  $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $this->lng->txt("ass_question") : $this->lng->txt("assQuestions")) . "]";
1586  }
1587 
1588  if ($use_object_id)
1589  {
1590  $result_array[$row["obj_id"]] = array("title" => $title, "count" => $row["questioncount"]);
1591  }
1592  else
1593  {
1594  $result_array[$row["ref_id"]] = array("title" => $title, "count" => $row["questioncount"]);
1595  }
1596  }
1597  }
1598  }
1599  return $result_array;
1600  }
1601 
1602  function &getQplQuestions()
1603  {
1604  global $ilDB;
1605 
1606  $questions = array();
1607  $query = sprintf("SELECT qpl_questions.question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.obj_fi = %s",
1608  $ilDB->quote($this->getId() . "")
1609  );
1610  $result = $ilDB->query($query);
1611  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1612  {
1613  array_push($questions, $row["question_id"]);
1614  }
1615  return $questions;
1616  }
1624  function cloneObject($a_target_id,$a_copy_id = 0)
1625  {
1626  global $ilLog;
1627  $newObj = parent::cloneObject($a_target_id,$a_copy_id);
1628  $newObj->setOnline($this->getOnline());
1629  $newObj->saveToDb();
1630  // clone the questions in the question pool
1631  $questions =& $this->getQplQuestions();
1632  foreach ($questions as $question_id)
1633  {
1634  $newObj->copyQuestion($question_id, $newObj->getId());
1635  }
1636 
1637  // clone meta data
1638  include_once "./Services/MetaData/classes/class.ilMD.php";
1639  $md = new ilMD($this->getId(),0,$this->getType());
1640  $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
1641 
1642  // update the metadata with the new title of the question pool
1643  $newObj->updateMetaData();
1644  return $newObj;
1645  }
1646 
1647  function &getQuestionTypes($all_tags = FALSE)
1648  {
1649  return $this->_getQuestionTypes($all_tags);
1650  }
1651 
1652  function &_getQuestionTypes($all_tags = FALSE)
1653  {
1654  global $ilDB;
1655  global $lng;
1656 
1657  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1659  $lng->loadLanguageModule("assessment");
1660  $query = "SELECT * FROM qpl_question_type";
1661  $result = $ilDB->query($query);
1662  $types = array();
1663  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1664  {
1665  if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types)))
1666  {
1667  global $ilLog;
1668 
1669  if ($row["plugin"] == 0)
1670  {
1671  if (strcmp($row["type_tag"], "assFlashQuestion") != 0)
1672  {
1673  $types[$lng->txt($row["type_tag"])] = $row;
1674  }
1675  }
1676  else
1677  {
1678  global $ilPluginAdmin;
1679  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1680  foreach ($pl_names as $pl_name)
1681  {
1682  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1683  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1684  {
1685  $types[$pl->getQuestionTypeTranslation()] = $row;
1686  }
1687  }
1688  }
1689  }
1690  }
1691  ksort($types);
1692  return $types;
1693  }
1694 
1695  function &getQuestionList()
1696  {
1697  global $ilDB;
1698 
1699  $questions = array();
1700  $query = sprintf("SELECT qpl_questions.*, qpl_questions.TIMESTAMP+0 AS timestamp14, qpl_question_type.* FROM qpl_questions, qpl_question_type WHERE ISNULL(qpl_questions.original_id) AND qpl_questions.obj_fi = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
1701  $ilDB->quote($this->getId() . "")
1702  );
1703  $result = $ilDB->query($query);
1704  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
1705  {
1706  array_push($questions, $row);
1707  }
1708  return $questions;
1709  }
1710 
1719  public static function _updateQuestionCount($object_id)
1720  {
1721  global $ilDB;
1722  $query = sprintf("UPDATE qpl_questionpool SET questioncount = %s WHERE obj_fi = %s",
1723  $ilDB->quote(ilObjQuestionPool::_getQuestionCount($object_id, TRUE)),
1724  $ilDB->quote($object_id)
1725  );
1726  $result = $ilDB->query($query);
1727  }
1728 
1735  function isPluginActive($a_pname)
1736  {
1737  global $ilPluginAdmin;
1738  if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "TestQuestionPool", "qst", $a_pname))
1739  {
1740  return TRUE;
1741  }
1742  else
1743  {
1744  return FALSE;
1745  }
1746  }
1747 } // END class.ilObjQuestionPool
1748 ?>