ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilObjSurveyQuestionPool Class Reference

Class ilObjSurveyQuestionPool. More...

+ Inheritance diagram for ilObjSurveyQuestionPool:
+ Collaboration diagram for ilObjSurveyQuestionPool:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create ($a_upload=false)
 
 update ()
 
 read ()
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
 createQuestion (string $question_type, int $question_id=-1)
 
 copyQuestion (int $question_id, int $questionpool_to)
 
 loadFromDb ()
 
 saveToDb ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 deleteAllData ()
 
 removeQuestion (int $question_id)
 Removes a question from the question pool. More...
 
 getQuestiontype (int $question_id)
 
 isInUse (int $question_id)
 Checks if a question is in use by a survey. More...
 
 paste (int $question_id)
 Pastes a duplicate of a question in the question pool. More...
 
 getQuestionsInfo (array $question_array)
 
 duplicateQuestion (int $question_id, int $obj_id=0)
 Duplicates a question for a question pool. More...
 
 getQuestionsData (array $arrFilter)
 Retrieve the data for the output of the question pool. More...
 
 createExportDirectory ()
 creates data directory for export files data_dir/spl_data/spl_<id>/export More...
 
 getExportDirectory ()
 get export directory of survey More...
 
 getExportFiles (string $dir)
 get export files More...
 
 createImportDirectory ()
 creates data directory for import files (data_dir/spl_data/spl_<id>/import More...
 
 getImportDirectory ()
 
 toXML (?array $questions)
 export questions to xml More...
 
 toXmlForExport ()
 
 getQuestions ()
 
 importObject (string $source, bool $spl_exists=false)
 Imports survey questions into ILIAS. More...
 
 getQuestionInfos (array $question_ids)
 Returns title, description and type for an array of question id's. More...
 
 purgeQuestions ()
 Remove all questions with tstamp = 0. More...
 
 copyToClipboard (int $question_id)
 Copies a question to the clipboard. More...
 
 moveToClipboard (int $question_id)
 Moves a question to the clipboard. More...
 
 pasteFromClipboard ()
 Copies/Moves a question from the clipboard. More...
 
 setObligatoryStates (array $obligatory_questions)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id, int $new_obj_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupOnline (int $a_obj_id)
 
static _isWriteable (int $object_id)
 Returns true, if the question pool is writeable for the current user. More...
 
static _getQuestiontypes ()
 Get all available question types. More...
 
static _getQuestionClasses ()
 
static _getQuestionTypeTranslations ()
 
static _getAvailableQuestionpools (bool $use_object_id=false, bool $could_be_offline=false, bool $showPath=false, string $permission="read")
 Returns the available question pools for the active user. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

bool $online = false
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Attributes

InternalDomainService $domain
 
EditManager $edit_manager
 
ilObjUser $user
 
ilComponentRepository $component_repository
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSurveyQuestionPool::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = true 
)

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

41 {
42 global $DIC;
43 $this->main_tpl = $DIC->ui()->mainTemplate();
44
45 $this->log = $DIC["ilLog"];
46 $this->db = $DIC->database();
47 $this->user = $DIC->user();
48 $this->component_repository = $DIC["component.repository"];
49 $this->type = "spl";
50 parent::__construct($a_id, $a_call_by_reference);
51 $this->edit_manager = $DIC->surveyQuestionPool()
52 ->internal()
53 ->domain()
54 ->editing();
55 $this->domain = $DIC->surveyQuestionPool()->internal()->domain();
56 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getAvailableQuestionpools()

static ilObjSurveyQuestionPool::_getAvailableQuestionpools ( bool  $use_object_id = false,
bool  $could_be_offline = false,
bool  $showPath = false,
string  $permission = "read" 
)
static

Returns the available question pools for the active user.

Returns
array<int, string> keys are ref or obj IDs, values are titles

Definition at line 762 of file class.ilObjSurveyQuestionPool.php.

767 : array {
768 global $DIC;
769
770 $ilUser = $DIC->user();
771 global $DIC;
772
773 $ilDB = $DIC->database();
774
775 $result_array = array();
776 $qpls = ilUtil::_getObjectsByOperations("spl", $permission, $ilUser->getId(), -1);
777 $titles = ilObject::_prepareCloneSelection($qpls, "spl", $showPath);
778 $allqpls = array();
779 $result = $ilDB->query("SELECT sq.obj_fi, od.offline as offline FROM svy_qpl sq JOIN object_data od ON (sq.obj_fi = od.obj_id) WHERE sq.obj_fi > 0 AND sq.tstamp > 0 AND NOT(od.offline = 1)");
780 while ($row = $ilDB->fetchAssoc($result)) {
781 $allqpls[(int) $row['obj_fi']] = !((int) $row['offline']);
782 }
783 foreach ($qpls as $ref_id) {
784 $ref_id = (int) $ref_id;
786 if ($could_be_offline || ($allqpls[$obj_id] ?? 0) == 1) {
787 if ($use_object_id) {
788 $result_array[$obj_id] = $titles[$ref_id];
789 } else {
790 $result_array[(int) $ref_id] = $titles[$ref_id];
791 }
792 }
793 }
794 return $result_array;
795 }
static _lookupObjectId(int $ref_id)
static _prepareCloneSelection(array $ref_ids, string $new_type, bool $show_path=true)
Prepare copy wizard object selection.
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive,...

Referenced by ilSurveyQuestionbrowserTableGUI\__construct().

+ Here is the caller graph for this function:

◆ _getQuestionClasses()

static ilObjSurveyQuestionPool::_getQuestionClasses ( )
static

Definition at line 722 of file class.ilObjSurveyQuestionPool.php.

722 : array
723 {
724 $classes = array_map(
725 static function (array $c): string {
726 return (string) $c["type_tag"];
727 },
729 );
730 return $classes;
731 }
static _getQuestiontypes()
Get all available question types.

References Vendor\Package\$c.

Referenced by ilObjSurvey\getMaxSumScore().

+ Here is the caller graph for this function:

◆ _getQuestiontypes()

static ilObjSurveyQuestionPool::_getQuestiontypes ( )
static

Get all available question types.

Todo:
move to question manager, use dto

Definition at line 663 of file class.ilObjSurveyQuestionPool.php.

663 : array
664 {
665 global $DIC;
666
667 $ilDB = $DIC->database();
668 $lng = $DIC->language();
669
670 $lng->loadLanguageModule("survey");
671 $types = array();
672 $query_result = $ilDB->query("SELECT * FROM svy_qtype ORDER BY type_tag");
673 while ($row = $ilDB->fetchAssoc($query_result)) {
674 $row["questiontype_id"] = (int) $row["questiontype_id"];
675 $row["type_tag"] = (string) $row["type_tag"];
676 $row["plugin"] = (int) $row["plugin"];
677 //array_push($questiontypes, $row["type_tag"]);
678 if ($row["plugin"] === 0) {
679 $types[$lng->txt($row["type_tag"])] = $row;
680 }
681 }
682 ksort($types);
683
684
685 // #14263 - default sorting
686
687 $default_sorting = array_flip(array(
688 "SurveySingleChoiceQuestion",
689 "SurveyMultipleChoiceQuestion",
690 "SurveyMatrixQuestion",
691 "SurveyMetricQuestion",
692 "SurveyTextQuestion"
693 ));
694
695 $sorted = array();
696 $idx = count($default_sorting);
697 foreach ($types as $caption => $item) {
698 $type = $item["type_tag"];
699 $item["caption"] = $caption;
700
701 // default
702 if (array_key_exists($type, $default_sorting)) {
703 $sorted[$default_sorting[$type]] = $item;
704 }
705 // plugin (append alphabetically sorted)
706 else {
707 $sorted[$idx] = $item;
708 $idx++;
709 }
710 }
711 ksort($sorted);
712
713 // redo captions as index
714 $types = array();
715 foreach ($sorted as $item) {
716 $types[$item["caption"]] = $item;
717 }
718
719 return $types;
720 }
loadLanguageModule(string $a_module)
Load language module.
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
string $type

References $DIC, $ilDB, $lng, and ILIAS\Repository\int().

Referenced by ilSurveyQuestionTableGUI\importData(), ilSurveyQuestionbrowserTableGUI\initFilter(), ilSurveyQuestionsTableGUI\initFilter(), ilSurveyEditorGUI\questionsObject(), and ilObjSurveyQuestionPoolGUI\questionsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionTypeTranslations()

static ilObjSurveyQuestionPool::_getQuestionTypeTranslations ( )
static
Todo:
move to question manager, use dto

Definition at line 736 of file class.ilObjSurveyQuestionPool.php.

736 : array
737 {
738 global $DIC;
739
740 $ilDB = $DIC->database();
741 $lng = $DIC->language();
742
743 $component_factory = $DIC["component.factory"];
744
745 $lng->loadLanguageModule("survey");
746 $result = $ilDB->query("SELECT * FROM svy_qtype");
747 $types = array();
748 while ($row = $ilDB->fetchAssoc($result)) {
749 if ((int) $row["plugin"] === 0) {
750 $type_tag = (string) $row['type_tag'];
751 $types[$type_tag] = $lng->txt($type_tag);
752 }
753 }
754 ksort($types);
755 return $types;
756 }

References $DIC, $ilDB, and $lng.

◆ _isWriteable()

static ilObjSurveyQuestionPool::_isWriteable ( int  $object_id)
static

Returns true, if the question pool is writeable for the current user.

Definition at line 643 of file class.ilObjSurveyQuestionPool.php.

645 : bool {
646 global $DIC;
647
648 $rbacsystem = $DIC->rbac()->system();
649 $refs = ilObject::_getAllReferences($object_id);
650 $result = false;
651 foreach ($refs as $ref) {
652 if ($rbacsystem->checkAccess("write", (int) $ref) && (ilObject::_hasUntrashedReference($object_id))) {
653 $result = true;
654 }
655 }
656 return $result;
657 }
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _getAllReferences(int $id)
get all reference ids for object ID

◆ _lookupOnline()

static ilObjSurveyQuestionPool::_lookupOnline ( int  $a_obj_id)
static

Definition at line 634 of file class.ilObjSurveyQuestionPool.php.

634 : bool
635 {
636 return !self::getOfflineStatus($a_obj_id);
637 }

◆ cloneObject()

ilObjSurveyQuestionPool::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Definition at line 82 of file class.ilObjSurveyQuestionPool.php.

82 : ?ilObject
83 {
84 $newObj = parent::cloneObject($target_id, $copy_id, $omit_tree);
85
86 //copy online status if object is not the root copy object
87 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
88
89 $newObj->saveToDb();
90 // clone the questions in the question pool
91 $questions = $this->getQuestions();
92 foreach ($questions as $question_id) {
93 $newObj->copyQuestion($question_id, $newObj->getId());
94 }
95
96 // clone meta data
97 $this->cloneMetaData($newObj);
98
99 // update the metadata with the new title of the question pool
100 $newObj->updateMetaData();
101 return $newObj;
102 }
static _getInstance(int $a_copy_id)
Class ilObject Basic functions for all objects.
cloneMetaData(ilObject $target_obj)
Copy meta data.

References ilCopyWizardOptions\_getInstance(), ilObject\cloneMetaData(), and getQuestions().

+ Here is the call graph for this function:

◆ copyQuestion()

ilObjSurveyQuestionPool::copyQuestion ( int  $question_id,
int  $questionpool_to 
)
Parameters
int$question_id
int$questionpool_toquestion pool id

Definition at line 129 of file class.ilObjSurveyQuestionPool.php.

132 : void {
133 $question_gui = $this->createQuestion("", $question_id);
134 if ($question_gui->object->getObjId() === $questionpool_to) {
135 // the question is copied into the same question pool
136 $this->duplicateQuestion($question_id);
137 } else {
138 // the question is copied into another question pool
139 $newtitle = $question_gui->object->getTitle();
140 if ($question_gui->object->questionTitleExists($question_gui->object->getTitle(), $questionpool_to)) {
141 $counter = 2;
142 while ($question_gui->object->questionTitleExists($question_gui->object->getTitle() . " ($counter)", $questionpool_to)) {
143 $counter++;
144 }
145 $newtitle = $question_gui->object->getTitle() . " ($counter)";
146 }
147 $question_gui->object->copyObject($this->getId(), $newtitle);
148 }
149 }
duplicateQuestion(int $question_id, int $obj_id=0)
Duplicates a question for a question pool.
createQuestion(string $question_type, int $question_id=-1)

◆ copyToClipboard()

ilObjSurveyQuestionPool::copyToClipboard ( int  $question_id)

Copies a question to the clipboard.

Parameters
int$question_idObject id of the question

Definition at line 849 of file class.ilObjSurveyQuestionPool.php.

851 : void {
852 $this->edit_manager->addQuestionToClipboard($question_id, "copy");
853 }

◆ create()

ilObjSurveyQuestionPool::create (   $a_upload = false)

Definition at line 58 of file class.ilObjSurveyQuestionPool.php.

58 : int
59 {
60 $id = parent::create();
61 if (!$a_upload) {
62 $this->createMetaData();
63 }
64 return $id;
65 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ilObject\createMetaData().

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjSurveyQuestionPool::createExportDirectory ( )

creates data directory for export files data_dir/spl_data/spl_<id>/export

Exceptions
ilSurveyException

Definition at line 402 of file class.ilObjSurveyQuestionPool.php.

402 : void
403 {
404 $spl_data_dir = ilFileUtils::getDataDir() . "/spl_data";
405 ilFileUtils::makeDir($spl_data_dir);
406 if (!is_writable($spl_data_dir)) {
407 throw new ilSurveyException("Survey Questionpool Data Directory (" . $spl_data_dir . ") not writeable.");
408 }
409
410 // create learning module directory (data_dir/lm_data/lm_<id>)
411 $spl_dir = $spl_data_dir . "/spl_" . $this->getId();
412 ilFileUtils::makeDir($spl_dir);
413 if (!is_dir($spl_dir)) {
414 throw new ilSurveyException("Creation of Survey Questionpool Directory failed.");
415 }
416 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
417 $export_dir = $spl_dir . "/export";
418 ilFileUtils::makeDir($export_dir);
419 if (!is_dir($export_dir)) {
420 throw new ilSurveyException("Creation of Survey Questionpool Export Directory failed.");
421 }
422 }
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilFileUtils\getDataDir(), ILIAS\Survey\Mode\getId(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ createImportDirectory()

ilObjSurveyQuestionPool::createImportDirectory ( )

creates data directory for import files (data_dir/spl_data/spl_<id>/import

Exceptions
ilSurveyException

Definition at line 472 of file class.ilObjSurveyQuestionPool.php.

472 : void
473 {
474 $spl_data_dir = ilFileUtils::getDataDir() . "/spl_data";
475 ilFileUtils::makeDir($spl_data_dir);
476
477 if (!is_writable($spl_data_dir)) {
478 throw new ilSurveyException("Survey Questionpool Data Directory (" . $spl_data_dir . ") not writeable.");
479 }
480
481 // create test directory (data_dir/spl_data/spl_<id>)
482 $spl_dir = $spl_data_dir . "/spl_" . $this->getId();
483 ilFileUtils::makeDir($spl_dir);
484 if (!is_dir($spl_dir)) {
485 throw new ilSurveyException("Creation of Survey Questionpool Directory failed.");
486 }
487
488 // create import subdirectory (data_dir/spl_data/spl_<id>/import)
489 $import_dir = $spl_dir . "/import";
490 ilFileUtils::makeDir($import_dir);
491 if (!is_dir($import_dir)) {
492 throw new ilSurveyException("Creation of Survey Questionpool Import Directory failed.");
493 }
494 }

References ilFileUtils\getDataDir(), ILIAS\Survey\Mode\getId(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ createQuestion()

ilObjSurveyQuestionPool::createQuestion ( string  $question_type,
int  $question_id = -1 
)
Todo:
check this method, it does not seem to create anything

Definition at line 107 of file class.ilObjSurveyQuestionPool.php.

111 if ((!$question_type) and ($question_id > 0)) {
112 $question_type = (string) $this->getQuestiontype($question_id);
113 }
114
115 $question_type_gui = $question_type . "GUI";
116 $question = new $question_type_gui();
117
118 if ($question_id > 0) {
119 $question->object->loadFromDb($question_id);
120 }
121
122 return $question;
123 }
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...

References getQuestiontype().

+ Here is the call graph for this function:

◆ delete()

ilObjSurveyQuestionPool::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

Definition at line 176 of file class.ilObjSurveyQuestionPool.php.

176 : bool
177 {
178 $remove = parent::delete();
179 // always call parent delete function first!!
180 if (!$remove) {
181 return false;
182 }
183
184 // delete all related questions
185 $this->deleteAllData();
186
187 // delete meta data
188 $this->deleteMetaData();
189
190 return true;
191 }

◆ deleteAllData()

ilObjSurveyQuestionPool::deleteAllData ( )

Definition at line 193 of file class.ilObjSurveyQuestionPool.php.

193 : void
194 {
196 $result = $ilDB->queryF(
197 "SELECT question_id FROM svy_question WHERE obj_fi = %s AND original_id IS NULL",
198 array('integer'),
199 array($this->getId())
200 );
201 $found_questions = array();
202 while ($row = $ilDB->fetchAssoc($result)) {
203 $this->removeQuestion((int) $row["question_id"]);
204 }
205
206 // delete export files
207 $spl_data_dir = ilFileUtils::getDataDir() . "/spl_data";
208 $directory = $spl_data_dir . "/spl_" . $this->getId();
209 if (is_dir($directory)) {
210 ilFileUtils::delDir($directory);
211 }
212 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
removeQuestion(int $question_id)
Removes a question from the question pool.
ilDBInterface $db

References $ilDB, ilFileUtils\delDir(), ilFileUtils\getDataDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ duplicateQuestion()

ilObjSurveyQuestionPool::duplicateQuestion ( int  $question_id,
int  $obj_id = 0 
)

Duplicates a question for a question pool.

Definition at line 320 of file class.ilObjSurveyQuestionPool.php.

323 : void {
324 $ilUser = $this->user;
325 $question = SurveyQuestion::_instanciateQuestion($question_id);
326 $suffix = "";
327 $counter = 1;
328 while ($question->questionTitleExists($question->getTitle() . $suffix, $obj_id)) {
329 $counter++;
330 if ($counter > 1) {
331 $suffix = " ($counter)";
332 }
333 }
334 if ($obj_id) {
335 $question->setObjId($obj_id);
336 }
337 $max_len = 195;
338 if (strlen($question->getTitle() . $suffix) > $max_len) {
339 $title = substr($question->getTitle(), 0, $max_len - strlen($suffix)) . $suffix;
340 } else {
341 $title = $question->getTitle() . $suffix;
342 }
343 $question->duplicate(false, $title, $ilUser->getFullname(), $ilUser->id);
344 }
static _instanciateQuestion(int $question_id)
Get question object.
string $title

◆ getExportDirectory()

ilObjSurveyQuestionPool::getExportDirectory ( )

get export directory of survey

Definition at line 427 of file class.ilObjSurveyQuestionPool.php.

427 : string
428 {
429 $export_dir = ilFileUtils::getDataDir() . "/spl_data" . "/spl_" . $this->getId() . "/export";
430 return $export_dir;
431 }

References ilFileUtils\getDataDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getExportFiles()

ilObjSurveyQuestionPool::getExportFiles ( string  $dir)

get export files

Definition at line 436 of file class.ilObjSurveyQuestionPool.php.

436 : array
437 {
438 // quit if import dir not available
439 if (!is_dir($dir) or
440 !is_writable($dir)) {
441 return array();
442 }
443
444 // open directory
445 $dir = dir($dir);
446
447 // initialize array
448 $file = array();
449
450 // get files and save the in the array
451 while ($entry = $dir->read()) {
452 if ($entry !== "." &&
453 $entry !== ".." &&
454 preg_match("/^[0-9]{10}__[0-9]+__(spl_)*[0-9]+\.[A-Za-z]{3}$/", $entry)) {
455 $file[] = $entry;
456 }
457 }
458
459 // close import directory
460 $dir->close();
461 // sort files
462 sort($file);
463
464 return $file;
465 }

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

+ Here is the call graph for this function:

◆ getImportDirectory()

ilObjSurveyQuestionPool::getImportDirectory ( )

Definition at line 496 of file class.ilObjSurveyQuestionPool.php.

496 : string
497 {
498 return ilFileUtils::getDataDir() . "/spl_data" .
499 "/spl_" . $this->getId() . "/import";
500 }

References ilFileUtils\getDataDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getQuestionInfos()

ilObjSurveyQuestionPool::getQuestionInfos ( array  $question_ids)

Returns title, description and type for an array of question id's.

Parameters
int[]$question_idsAn array of question id's
Returns
array Array of associated arrays with title, description, type_tag
Todo:
move to question manager, use dto

Definition at line 803 of file class.ilObjSurveyQuestionPool.php.

803 : array
804 {
806
807 $found = array();
808 $query_result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag FROM svy_question, svy_qtype " .
809 "WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id " .
810 "AND svy_question.tstamp > 0 AND " . $ilDB->in('svy_question.question_id', $question_ids, false, 'integer') . " " .
811 "ORDER BY svy_question.title");
812 if ($query_result->numRows() > 0) {
813 while ($data = $ilDB->fetchAssoc($query_result)) {
814 $question_id = (int) $data["question_id"];
815 if (in_array($question_id, $question_ids, true)) {
816 $found[] = array('id' => $question_id,
817 'title' => (string) $data["title"],
818 'description' => (string) $data["description"],
819 'type_tag' => (string) $data["type_tag"]
820 );
821 }
822 }
823 }
824 return $found;
825 }
$data
Definition: storeScorm.php:45

References $data, $ilDB, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getQuestions()

ilObjSurveyQuestionPool::getQuestions ( )

Definition at line 576 of file class.ilObjSurveyQuestionPool.php.

576 : array
577 {
579 $questions = array();
580 $result = $ilDB->queryF(
581 "SELECT question_id FROM svy_question WHERE obj_fi = %s AND svy_question.tstamp > 0 AND original_id IS NULL",
582 array('integer'),
583 array($this->getId())
584 );
585 if ($result->numRows()) {
586 while ($row = $ilDB->fetchAssoc($result)) {
587 $questions[] = (int) $row["question_id"];
588 }
589 }
590 return $questions;
591 }

References $ilDB, ILIAS\Survey\Mode\getId(), and ILIAS\Repository\int().

Referenced by cloneObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionsData()

ilObjSurveyQuestionPool::getQuestionsData ( array  $arrFilter)

Retrieve the data for the output of the question pool.

Todo:
move to question/pool manager

Definition at line 350 of file class.ilObjSurveyQuestionPool.php.

352 : array {
354 $where = "";
355 if (count($arrFilter) > 0) {
356 foreach ($arrFilter as $key => $value) {
357 $arrFilter[$key] = str_replace('%', '', $value);
358 }
359 if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'] ?? "")) {
360 $where .= " AND " . $ilDB->like('svy_question.title', 'text', "%%" . $arrFilter['title'] . "%%");
361 }
362 if (array_key_exists('description', $arrFilter) && strlen($arrFilter['description'] ?? "")) {
363 $where .= " AND " . $ilDB->like('svy_question.description', 'text', "%%" . $arrFilter['description'] . "%%");
364 }
365 if (array_key_exists('author', $arrFilter) && strlen($arrFilter['author'] ?? "")) {
366 $where .= " AND " . $ilDB->like('svy_question.author', 'text', "%%" . $arrFilter['author'] . "%%");
367 }
368 if (array_key_exists('type', $arrFilter) && strlen($arrFilter['type'] ?? "")) {
369 $where .= " AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter['type'], 'text');
370 }
371 }
372 $query_result = $ilDB->queryF(
373 "SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin FROM svy_question, svy_qtype WHERE svy_question.original_id IS NULL AND svy_question.tstamp > 0 AND svy_question.questiontype_fi = svy_qtype.questiontype_id AND svy_question.obj_fi = %s" . $where,
374 array('integer'),
375 array($this->getId())
376 );
377 $rows = array();
378 if ($query_result->numRows()) {
379 while ($row = $ilDB->fetchAssoc($query_result)) {
380 if ($row["plugin"]) {
381 continue;
382 } else {
383 $row["question_id"] = (int) $row["question_id"];
384 $row["questiontype_fi"] = (int) $row["questiontype_fi"];
385 $row["obj_fi"] = (int) $row["obj_fi"];
386 $row["owner_fi"] = (int) $row["owner_fi"];
387 $row["original_id"] = $row["original_id"] === null ? null : (int) $row["original_id"];
388 $row["tstamp"] = (int) $row["tstamp"];
389 $row["type_tag"] = (string) $row["type_tag"];
390 $rows[] = $row;
391 }
392 }
393 }
394 return $rows;
395 }

References $ilDB.

◆ getQuestionsInfo()

ilObjSurveyQuestionPool::getQuestionsInfo ( array  $question_array)
Parameters
int[]$question_arrayquestion ids
Todo:
move to question manager/repo, use dto

Definition at line 294 of file class.ilObjSurveyQuestionPool.php.

296 : array {
298 $result_array = array();
299 $result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin FROM svy_question, svy_qtype WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id AND svy_question.tstamp > 0 AND " . $ilDB->in('svy_question.question_id', $question_array, false, 'integer'));
300 while ($row = $ilDB->fetchAssoc($result)) {
301 if ($row["plugin"]) {
302 continue;
303 } else {
304 $row["question_id"] = (int) $row["question_id"];
305 $row["questiontype_fi"] = (int) $row["questiontype_fi"];
306 $row["obj_fi"] = (int) $row["obj_fi"];
307 $row["owner_fi"] = (int) $row["owner_fi"];
308 $row["original_id"] = $row["original_id"] === null ? null : (int) $row["original_id"];
309 $row["tstamp"] = (int) $row["tstamp"];
310 $row["type_tag"] = (string) $row["type_tag"];
311 $result_array[] = $row;
312 }
313 }
314 return $result_array;
315 }

◆ getQuestiontype()

ilObjSurveyQuestionPool::getQuestiontype ( int  $question_id)
Returns
string|null question type string

Definition at line 229 of file class.ilObjSurveyQuestionPool.php.

231 : ?string {
233 if ($question_id < 1) {
234 return null;
235 }
236 $result = $ilDB->queryF(
237 "SELECT svy_qtype.type_tag FROM svy_question, svy_qtype WHERE svy_question.questiontype_fi = svy_qtype.questiontype_id AND svy_question.question_id = %s",
238 array('integer'),
239 array($question_id)
240 );
241 if ($result->numRows() === 1) {
242 $data = $ilDB->fetchAssoc($result);
243 return (string) $data["type_tag"];
244 } else {
245 return null;
246 }
247 }

Referenced by createQuestion().

+ Here is the caller graph for this function:

◆ importObject()

ilObjSurveyQuestionPool::importObject ( string  $source,
bool  $spl_exists = false 
)

Imports survey questions into ILIAS.

Parameters
string$sourceThe filename of an XML import file
Exceptions
ilInvalidSurveyImportFileException

Definition at line 598 of file class.ilObjSurveyQuestionPool.php.

601 : void {
602 if (is_file($source)) {
603 $isZip = (strcmp(strtolower(substr($source, -3)), 'zip') === 0);
604 if ($isZip) {
605 // unzip file
606 $this->domain->resources()->zip()->unzipFile($source);
607
608 // determine filenames of xml files
609 $subdir = basename($source, ".zip");
610 $source = dirname($source) . "/" . $subdir . "/" . $subdir . ".xml";
611 }
612
613 $xml = file_get_contents($source);
614 if ($xml === false) {
615 throw new ilInvalidSurveyImportFileException("Could not read survey import file.");
616 }
617 if ($isZip) {
618 $subdir = basename($source, ".zip");
619 if (is_dir(dirname($source) . "/" . $subdir)) {
620 ilFileUtils::delDir(dirname($source) . "/" . $subdir);
621 }
622 }
623 if (strpos($xml, "questestinterop") > 0) {
624 throw new ilInvalidSurveyImportFileException("Unsupported survey version (< 3.8) found.");
625 }
626
627 // survey questions for ILIAS >= 3.8
628 $import = new SurveyImportParser($this->getId(), "", $spl_exists);
629 $import->setXMLContent($xml);
630 $import->startParsing();
631 }
632 }
Survey Question Import Parser.

References ilFileUtils\delDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ isInUse()

ilObjSurveyQuestionPool::isInUse ( int  $question_id)

Checks if a question is in use by a survey.

Returns
mixed array of the surveys which use the question, when the question is in use by at least one survey, otherwise false

Definition at line 254 of file class.ilObjSurveyQuestionPool.php.

254 : ?array
255 {
257 // check out the already answered questions
258 $result = $ilDB->queryF(
259 "SELECT answer_id FROM svy_answer WHERE question_fi = %s",
260 array('integer'),
261 array($question_id)
262 );
263 $answered = $result->numRows();
264
265 // check out the questions inserted in surveys
266 $result = $ilDB->queryF(
267 "SELECT svy_svy.* FROM svy_svy, svy_svy_qst WHERE svy_svy_qst.survey_fi = svy_svy.survey_id AND svy_svy_qst.question_fi = %s",
268 array('integer'),
269 array($question_id)
270 );
271 $inserted = $result->numRows();
272 if (($inserted + $answered) === 0) {
273 return null;
274 }
275 $result_array = array();
276 while ($row = $ilDB->fetchObject($result)) {
277 $result_array[] = $row;
278 }
279 return $result_array;
280 }

References $ilDB.

◆ loadFromDb()

ilObjSurveyQuestionPool::loadFromDb ( )

Definition at line 151 of file class.ilObjSurveyQuestionPool.php.

151 : void
152 {
153 }

Referenced by read().

+ Here is the caller graph for this function:

◆ moveToClipboard()

ilObjSurveyQuestionPool::moveToClipboard ( int  $question_id)

Moves a question to the clipboard.

Definition at line 858 of file class.ilObjSurveyQuestionPool.php.

860 : void {
861 $this->edit_manager->addQuestionToClipboard($question_id, "move");
862 }

◆ paste()

ilObjSurveyQuestionPool::paste ( int  $question_id)

Pastes a duplicate of a question in the question pool.

Definition at line 285 of file class.ilObjSurveyQuestionPool.php.

285 : void
286 {
287 $this->duplicateQuestion($question_id, $this->getId());
288 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ pasteFromClipboard()

ilObjSurveyQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

Definition at line 867 of file class.ilObjSurveyQuestionPool.php.

867 : void
868 {
870
871 $qentries = $this->edit_manager->getQuestionsFromClipboard();
872 if (count($qentries) > 0) {
873 foreach ($qentries as $question_object) {
874 if (!is_array($question_object)) {
875 continue;
876 }
877 $question_id = (int) ($question_object["question_id"] ?? 0);
878 if (strcmp((string) ($question_object["action"] ?? ""), "move") === 0) {
879 $result = $ilDB->queryF(
880 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
881 array('integer'),
882 array($question_id)
883 );
884 if ($result->numRows() === 1) {
885 $row = $ilDB->fetchAssoc($result);
886 $source_questionpool = (int) $row["obj_fi"];
887 if ($this->getId() != $source_questionpool) {
888 // change the questionpool id in the qpl_questions table
889 $affectedRows = $ilDB->manipulateF(
890 "UPDATE svy_question SET obj_fi = %s WHERE question_id = %s",
891 array('integer','integer'),
892 array($this->getId(), $question_id)
893 );
894
895 // move question data to the new target directory
896 $source_path = CLIENT_WEB_DIR . "/survey/" . $source_questionpool . "/" . $question_id . "/";
897 if (is_dir($source_path)) {
898 $target_path = CLIENT_WEB_DIR . "/survey/" . $this->getId() . "/";
899 if (!is_dir($target_path)) {
900 ilFileUtils::makeDirParents($target_path);
901 }
902 ilFileUtils::rename($source_path, $target_path . $question_id);
903 }
904 } else {
905 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("spl_move_same_pool"), true);
906 return;
907 }
908 }
909 } else {
910 $this->copyQuestion($question_id, $this->getId());
911 }
912 }
913 }
914 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt("spl_paste_success"), true);
915 $this->edit_manager->clearClipboardQuestions();
916 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static rename(string $a_source, string $a_target)
copyQuestion(int $question_id, int $questionpool_to)
const CLIENT_WEB_DIR
Definition: constants.php:47

References $ilDB, CLIENT_WEB_DIR, ILIAS\Survey\Mode\getId(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilFileUtils\makeDirParents(), and ilFileUtils\rename().

+ Here is the call graph for this function:

◆ purgeQuestions()

ilObjSurveyQuestionPool::purgeQuestions ( )

Remove all questions with tstamp = 0.

Definition at line 830 of file class.ilObjSurveyQuestionPool.php.

830 : void
831 {
833 $ilUser = $this->user;
834
835 $result = $ilDB->queryF(
836 "SELECT question_id FROM svy_question WHERE owner_fi = %s AND tstamp = %s",
837 array("integer", "integer"),
838 array($ilUser->getId(), 0)
839 );
840 while ($data = $ilDB->fetchAssoc($result)) {
841 $this->removeQuestion((int) $data["question_id"]);
842 }
843 }

References $data, and $ilDB.

◆ read()

ilObjSurveyQuestionPool::read ( )

Reimplemented from ilObject.

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

76 : void
77 {
78 parent::read();
79 $this->loadFromDb();
80 }

References loadFromDb().

+ Here is the call graph for this function:

◆ removeQuestion()

ilObjSurveyQuestionPool::removeQuestion ( int  $question_id)

Removes a question from the question pool.

Definition at line 217 of file class.ilObjSurveyQuestionPool.php.

217 : void
218 {
219 if ($question_id < 1) {
220 return;
221 }
222 $question = SurveyQuestion::_instanciateQuestion($question_id);
223 $question->delete($question_id);
224 }

References SurveyQuestion\_instanciateQuestion().

+ Here is the call graph for this function:

◆ saveToDb()

ilObjSurveyQuestionPool::saveToDb ( )

Definition at line 155 of file class.ilObjSurveyQuestionPool.php.

155 : void
156 {
158
159 parent::update();
160
161 $result = $ilDB->queryF(
162 "SELECT * FROM svy_qpl WHERE obj_fi = %s",
163 array('integer'),
164 array($this->getId())
165 );
166 if ($result->numRows() !== 1) {
167 $next_id = $ilDB->nextId('svy_qpl');
168 $query = $ilDB->manipulateF(
169 "INSERT INTO svy_qpl (id_questionpool, obj_fi, tstamp) VALUES (%s, %s, %s)",
170 array('integer', 'integer', 'integer'),
171 array($next_id, $this->getId(), time())
172 );
173 }
174 }

References $ilDB, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ setObligatoryStates()

ilObjSurveyQuestionPool::setObligatoryStates ( array  $obligatory_questions)
Parameters
int[]$obligatory_questionsobligatory question ids

Definition at line 921 of file class.ilObjSurveyQuestionPool.php.

923 : void {
925 foreach ($this->getQuestions() as $question_id) {
926 $status = (int) (isset($obligatory_questions["$question_id"]));
927
928 $ilDB->manipulate("UPDATE svy_question" .
929 " SET obligatory = " . $ilDB->quote($status, "integer") .
930 " WHERE question_id = " . $ilDB->quote($question_id, "integer"));
931 }
932 }

References $ilDB, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ toXML()

ilObjSurveyQuestionPool::toXML ( ?array  $questions)

export questions to xml

Todo:
move to export sub-component

Definition at line 506 of file class.ilObjSurveyQuestionPool.php.

506 : string
507 {
508 if (is_null($questions) || count($questions) === 0) {
509 $questions = $this->getQuestions();
510 }
511 $a_xml_writer = new ilXmlWriter();
512 // set xml header
513 $a_xml_writer->xmlHeader();
514 $attrs = array(
515 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
516 "xsi:noNamespaceSchemaLocation" => "https://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
517 );
518 $a_xml_writer->xmlStartTag("surveyobject", $attrs);
519 $attrs = array(
520 "id" => "qpl_" . $this->getId(),
521 "label" => $this->getTitle()
522 );
523 $a_xml_writer->xmlStartTag("surveyquestions", $attrs);
524 $a_xml_writer->xmlElement("dummy", null, "dummy");
525
526 $a_xml_writer->xmlEndTag("surveyquestions");
527 $a_xml_writer->xmlEndTag("surveyobject");
528
529 $xml = $a_xml_writer->xmlDumpMem(false);
530
531 $questionxml = "";
532 foreach ($questions as $key => $value) {
533 $value = (int) $value;
534 $questiontype = (string) $this->getQuestiontype($value);
535 SurveyQuestion::_includeClass($questiontype);
536 $question = new $questiontype();
537 $question->loadFromDb($value);
538 $questionxml .= $question->toXML(false);
539 }
540
541 $xml = str_replace("<dummy>dummy</dummy>", $questionxml, $xml);
542 return $xml;
543 }
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References SurveyQuestion\_includeClass(), ILIAS\Survey\Mode\getId(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ toXmlForExport()

ilObjSurveyQuestionPool::toXmlForExport ( )

Definition at line 545 of file class.ilObjSurveyQuestionPool.php.

545 : string
546 {
547 $questions = $this->getQuestions();
548 $a_xml_writer = new ilXmlWriter();
549 $attrs = array(
550 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
551 "xsi:noNamespaceSchemaLocation" => "https://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
552 );
553 $a_xml_writer->xmlStartTag("surveyobject", $attrs);
554 $attrs = array(
555 "id" => "qpl_" . $this->getId(),
556 "label" => $this->getTitle()
557 );
558 $a_xml_writer->xmlStartTag("surveyquestions", $attrs);
559 $a_xml_writer->xmlElement("dummy", null, "dummy");
560 $a_xml_writer->xmlEndTag("surveyquestions");
561 $a_xml_writer->xmlEndTag("surveyobject");
562 $xml = $a_xml_writer->xmlDumpMem(false);
563 $questionxml = "";
564 foreach ($questions as $key => $value) {
565 $value = (int) $value;
566 $questiontype = (string) $this->getQuestiontype($value);
567 SurveyQuestion::_includeClass($questiontype);
568 $question = new $questiontype();
569 $question->loadFromDb($value);
570 $questionxml .= $question->toXML(false);
571 }
572 $xml = str_replace("<dummy>dummy</dummy>", $questionxml, $xml);
573 return $xml;
574 }

References SurveyQuestion\_includeClass(), ILIAS\Survey\Mode\getId(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ update()

ilObjSurveyQuestionPool::update ( )

Reimplemented from ilObject.

Definition at line 67 of file class.ilObjSurveyQuestionPool.php.

67 : bool
68 {
69 $this->updateMetaData();
70 if (!parent::update()) {
71 return false;
72 }
73 return true;
74 }

References ilObject\updateMetaData().

+ Here is the call graph for this function:

Field Documentation

◆ $component_repository

ilComponentRepository ilObjSurveyQuestionPool::$component_repository
protected

Definition at line 35 of file class.ilObjSurveyQuestionPool.php.

◆ $domain

InternalDomainService ilObjSurveyQuestionPool::$domain
protected

Definition at line 31 of file class.ilObjSurveyQuestionPool.php.

◆ $edit_manager

EditManager ilObjSurveyQuestionPool::$edit_manager
protected

Definition at line 32 of file class.ilObjSurveyQuestionPool.php.

◆ $main_tpl

ilGlobalTemplateInterface ilObjSurveyQuestionPool::$main_tpl
private

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

◆ $online

bool ilObjSurveyQuestionPool::$online = false

Definition at line 34 of file class.ilObjSurveyQuestionPool.php.

◆ $user

ilObjUser ilObjSurveyQuestionPool::$user
protected

Definition at line 33 of file class.ilObjSurveyQuestionPool.php.


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