ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjSurvey Class Reference
+ Inheritance diagram for ilObjSurvey:
+ Collaboration diagram for ilObjSurvey:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create ($a_upload=false)
 
 update ($a_upload=false)
 
 createReference ()
 
 read ()
 
 addQuestion (int $question_id)
 Adds a question to the survey (used in importer!) More...
 
 delete ()
 
 deleteSurveyRecord ()
 Deletes the survey from the database. More...
 
 deleteAllUserData (bool $reset_LP=true)
 Deletes all user data of a survey. More...
 
 removeSelectedSurveyResults (array $finished_ids)
 Deletes the user data of a given array of survey participants. More...
 
 getSurveyParticipants (?array $finished_ids=null, bool $force_non_anonymous=false, bool $include_invites=false)
 
 isComplete ()
 Check if survey is complete for use. More...
 
 hasQuestions ()
 
 saveCompletionStatus ()
 Saves the completion status of the survey. More...
 
 duplicateQuestionForSurvey (int $question_id, bool $a_force=false)
 Takes a question and creates a copy of the question for use in the survey. More...
 
 insertQuestion (int $question_id)
 Inserts a question in the survey and saves the relation to the database. More...
 
 isQuestionInSurvey (int $a_question_fi)
 
 insertQuestionblock (int $questionblock_id)
 
 saveUserSettings (int $usr_id, string $key, string $title, string $value)
 
 deleteUserSettings (int $id)
 
 getUserSettings (int $usr_id, string $key)
 
 saveToDb ()
 
 saveQuestionsToDb ()
 
 getQuestionGUI (string $questiontype, int $question_id)
 
 getQuestionType (int $question_id)
 
 getSurveyId ()
 
 setAnonymize (int $a_anonymize)
 set anonymize status More...
 
 getAnonymize ()
 
 setCalculateSumScore (bool $a_val)
 
 getCalculateSumScore ()
 
 isAccessibleWithoutCode ()
 
 hasAnonymizedResults ()
 
 loadFromDb ()
 
 loadQuestionsFromDb ()
 
 fixSequenceStructure ()
 
 setAuthor (string $author="")
 
 saveAuthorToMetadata (string $a_author="")
 Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be called for conversion of "old" surveys where the author hasn't been stored in the lifecycle metadata. More...
 
 getAuthor ()
 
 getShowQuestionTitles ()
 
 setShowQuestionTitles (bool $a_show)
 
 setIntroduction (string $introduction="")
 
 setOutro (string $outro="")
 
 getStartDate ()
 
 setStartDate (string $start_date="")
 
 setStartDateAndTime (string $start_date, string $start_time)
 
 getEndDate ()
 
 setEndDate (string $end_date="")
 
 hasStarted ()
 
 hasEnded ()
 
 setEndDateAndTime (string $end_date, string $end_time)
 
 getEvaluationAccess ()
 
 setEvaluationAccess (string $evaluation_access=self::EVALUATION_ACCESS_OFF)
 
 setActivationVisibility (bool $a_value)
 
 getActivationVisibility ()
 
 isActivationLimited ()
 
 setActivationLimited (bool $a_value)
 
 getIntroduction ()
 
 getOutro ()
 
 getExistingQuestions ()
 Gets the question id's of the questions which are already in the survey. More...
 
 getQuestionpoolTitles (bool $could_be_offline=false, bool $showPath=false)
 Returns the available question pools for the active user. More...
 
 moveQuestions (array $move_questions, int $target_index, int $insert_mode)
 Move questions and/or questionblocks to another position. More...
 
 removeQuestion (int $question_id)
 
 removeConstraintsConcerningQuestion (int $question_id)
 Remove constraints concerning a question with a given question_id. More...
 
 removeQuestions (array $remove_questions, array $remove_questionblocks)
 
 unfoldQuestionblocks (array $questionblocks)
 
 removeQuestionFromBlock (int $question_id, int $questionblock_id)
 
 addQuestionToBlock (int $question_id, int $questionblock_id)
 
 isQuestionInAnyBlock (int $a_question_fi)
 
 getQuestionblockQuestions (int $questionblock_id)
 
 getQuestionblockQuestionIds (int $questionblock_id)
 
 createQuestionblock (string $title, bool $show_questiontext, bool $show_blocktitle, array $questions, bool $compress_view=false)
 
 modifyQuestionblock (int $questionblock_id, string $title, bool $show_questiontext, bool $show_blocktitle, bool $compress_view=false)
 
 deleteConstraints (int $question_id)
 Deletes the constraints for a question. More...
 
 deleteConstraint (int $constraint_id)
 Deletes a single constraint. More...
 
 getSurveyQuestions (bool $with_answers=false)
 Returns the survey questions and questionblocks in an array. More...
 
 setObligatoryStates (array $obligatory_questions)
 Sets the obligatory states for questions in a survey from the questions form. More...
 
 getSurveyPages ()
 Returns the survey pages in an array (a page contains one or more questions) More...
 
 getNextPage (int $active_page_question_id, int $direction)
 Get current, previous or next page. More...
 
 getAvailableQuestionpools (bool $use_obj_id=false, bool $could_be_offline=false, bool $showPath=false, string $permission="read")
 Returns the available question pools for the active user. More...
 
 getPrecondition (int $constraint_id)
 Returns a precondition with a given id. More...
 
 getConstraints (int $question_id)
 Returns the constraints to a given question or questionblock. More...
 
 getVariables (int $question_id)
 Returns all variables (answer options/scale values) of a question. More...
 
 addConstraint (int $if_question_id, int $relation, float $value, int $conjunction)
 Adds a constraint. More...
 
 addConstraintToQuestion (int $to_question_id, int $constraint_id)
 
 updateConstraint (int $precondition_id, int $if_question_id, int $relation, float $value, int $conjunction)
 
 updateConjunctionForQuestions (array $questions, int $conjunction)
 
 getAllRelations (bool $short_as_key=false)
 
 deleteWorkingData (int $question_id, int $active_id)
 Deletes the working data of a question in the database. More...
 
 loadWorkingData (int $question_id, int $active_id)
 Gets the given answer data of a question in a run. More...
 
 finishSurvey (int $finished_id, int $appr_id=0)
 Finishes the survey creating an entry in the database. More...
 
 setPage (int $finished_id, int $page_id)
 Sets the number of the active survey page. More...
 
 sendNotificationMail (int $a_user_id, string $a_anonymize_id, int $a_appr_id=0)
 These mails are sent to tutors for each single participant that finishes a survey. More...
 
 getActiveID (int $user_id, string $anonymize_id, int $appr_id)
 Get run id. More...
 
 getLastActivePage (int $active_id)
 Returns the question id of the last active page a user visited in a survey. More...
 
 checkConstraint (array $constraint_data, ?array $working_data)
 Checks if a constraint is valid. More...
 
 getSurveyFinishedIds ()
 Get run ids. More...
 
 getUserSpecificResults (array $finished_ids)
 Calculates the evaluation data for the user specific results. More...
 
 getUserDataFromActiveId (int $active_id, bool $force_non_anonymous=false)
 Returns run information. More...
 
 getEvaluationByUser (array $questions, int $active_id)
 Calculates the evaluation data for a given run. More...
 
 getQuestionsTable (array $arrFilter)
 Retrieve data for question browser. More...
 
 getQuestionblocksTable (array $arrFilter)
 Retrieve data for question block browser. More...
 
 toXML ()
 Returns a QTI xml representation of the survey. More...
 
 locateImportFiles (string $a_dir)
 Locates the import directory and the xml file in a directory with an unzipped import file. More...
 
 importObject (array $file_info, int $svy_qpl_id)
 
 getTextblock (int $question_id)
 
 cloneTextblocks (array $mapping)
 Clones the text blocks of survey questions. More...
 
 createExportDirectory ()
 creates data directory for export files (data_dir/svy_data/svy_<id>/export) More...
 
 getExportDirectory ()
 
 createImportDirectory ()
 creates data directory for import files (data_dir/svy_data/svy_<id>/import) More...
 
 getImportDirectory ()
 get import directory of survey More...
 
 saveHeading (string $heading, int $insertbefore)
 
 isAnonymizedParticipant (string $key)
 
 getSurveyCodesForExport (?array $a_codes=null, ?array $a_ids=null)
 Return a list of survey codes for file export, note: user_key needs to be null to export a record. More...
 
 getSurveyCodesTableData (?array $ids=null, ?string $lang=null)
 Fetches the data for the survey codes table. More...
 
 isSurveyCodeUsed (string $code)
 
 isSurveyCodeUnique (string $code)
 
 importSurveyCode (string $a_anonymize_key, int $a_created, array $a_data)
 
 sendCodes (int $not_sent, string $subject, string $message, string $lang)
 
 getExternalCodeRecipients (bool $a_check_finished=false)
 
 isSurveyFinishedByCode (string $a_code)
 Get if survey is finished for a specific anonymous user code. More...
 
 deleteSurveyCode (string $survey_code)
 
 getUserAccessCode (int $user_id)
 Returns a survey access code that was saved for a registered user. More...
 
 saveUserAccessCode (int $user_id, string $access_code)
 Saves a survey access code for a registered user to the database. More...
 
 getLastAccess (int $finished_id)
 
 prepareTextareaOutput (string $txt_output)
 Prepares a string for a text area output in surveys. More...
 
 isHTML (string $a_text)
 Checks if a given string contains HTML or not. More...
 
 addMaterialTag (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true, ?array $attribs=null)
 Creates an XML material tag from a plain text or xhtml text. More...
 
 canExportSurveyCode ()
 Checks if the survey code can be exported with the survey evaluation. More...
 
 setSurveyId (int $survey_id)
 
 getUserData (array $ids)
 Returns a data of all users specified by id list. More...
 
 getMailNotification ()
 Send mail to tutors each time a participant finishes the survey? More...
 
 setMailNotification (bool $a_notification)
 Activate mail to tutors each time a participant finishes the survey. More...
 
 getMailAddresses ()
 (Tutor) Recipients of "single participant has finished" mails More...
 
 setMailAddresses (string $a_addresses)
 Set (Tutor) Recipients of "single participant has finished" mails. More...
 
 getMailParticipantData ()
 Preceding text (incl. More...
 
 setMailParticipantData (string $a_data)
 Set preceding text (incl. More...
 
 getWorkingtimeForParticipant (int $finished_id)
 
 updateOrder (array $a_order)
 
 getPoolUsage ()
 
 setPoolUsage (bool $a_value)
 
 updateCode (int $a_id, string $a_email, string $a_last_name, string $a_first_name, int $a_sent)
 
 get360Mode ()
 
 set360SelfEvaluation (bool $a_value)
 
 get360SelfEvaluation ()
 
 set360SelfAppraisee (bool $a_value)
 
 get360SelfAppraisee ()
 
 set360SelfRaters (bool $a_value)
 
 get360SelfRaters ()
 
 set360Results (int $a_value)
 
 get360Results ()
 
 addAppraisee (int $a_user_id)
 
 sendAppraiseeNotification (int $a_user_id)
 
 sendAppraiseeCloseNotification (int $a_user_id)
 
 sendRaterNotification (int $a_user_id, int $a_appraisee_id)
 
 isAppraisee (int $a_user_id)
 
 isAppraiseeClosed (int $a_user_id)
 
 deleteAppraisee (int $a_user_id)
 
 getAppraiseesData ()
 
 addRater (int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
 
 isRater (int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
 
 deleteRater (int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
 
 getRatersData (int $a_appraisee_id)
 
 getAppraiseesToRate (?int $a_user_id, ?int $a_anonymous_id=null)
 
 getAnonymousIdByCode (string $a_code)
 
 is360SurveyStarted (int $appr_id, int $user_id, ?string $anonymous_code=null)
 
 getUserSurveyExecutionStatus (?string $a_code=null)
 Get current user execution status. More...
 
 findCodeForUser (int $a_user_id)
 
 isUnusedCode (string $a_code, int $a_user_id)
 
 getFinishedIdsForAppraiseeId (int $a_appr_id, bool $a_exclude_appraisee=false)
 
 getFinishedIdForAppraiseeIdAndRaterId (int $a_appr_id, int $a_rat_id)
 Get finished id for an appraisee and a rater. More...
 
 setSkillService (bool $a_val)
 
 getSkillService ()
 
 set360RaterSent (int $a_appraisee_id, int $a_user_id, int $a_anonymous_id, ?int $a_tstamp=null)
 
 closeAppraisee (int $a_user_id)
 
 openAllAppraisees ()
 
 getReminderStatus ()
 
 setReminderStatus (bool $a_value)
 
 getReminderStart ()
 
 setReminderStart (?ilDate $a_value=null)
 
 getReminderEnd ()
 
 setReminderEnd (?ilDate $a_value=null)
 
 getReminderFrequency ()
 
 setReminderFrequency (int $a_value)
 
 getReminderTarget ()
 
 setReminderTarget (int $a_value)
 
 getReminderLastSent ()
 
 setReminderLastSent (?string $a_value)
 
 getReminderTemplate (bool $selectDefault=false)
 
 setReminderTemplate (?int $a_value)
 
 getTutorNotificationStatus ()
 
 setTutorNotificationStatus (bool $a_value)
 Activates mail being sent to tutors after all participants have finished the survey. More...
 
 getTutorNotificationRecipients ()
 Mail being sent to tutors after all participants have finished the survey? More...
 
 setTutorNotificationRecipients (array $a_value)
 Set tutor recipients for "all participants have finished" mail. More...
 
 getTutorNotificationTarget ()
 Group that is checked for the "all participants have finished" mail Either a) all members of a parent group/course or b) all users which have been invited (svy_invitation) (= task on dashboard) More...
 
 setTutorNotificationTarget (int $a_value)
 
 getTutorResultsStatus ()
 
 setTutorResultsStatus (bool $a_value)
 
 getTutorResultsRecipients ()
 
 setTutorResultsRecipients (array $a_value)
 
 sent360Reminders ()
 Send 360 reminders. More...
 
 send360ReminderToUser (int $a_user_id, array $a_appraisee_ids)
 
 getNotificationTargetUserIds (bool $a_use_invited)
 These users must finish the survey to trigger the tutor notification "all users finished the survey" a) members of a parent group/course or b) all members that have been invited (svy_invitation) invitations are presented as tasks on the dashboard. More...
 
 checkReminder ()
 
 setActivationStartDate (?int $starting_time=null)
 
 setActivationEndDate (?int $ending_time=null)
 
 getActivationStartDate ()
 
 getActivationEndDate ()
 
 setViewOwnResults (bool $a_value)
 
 hasViewOwnResults ()
 
 setMailOwnResults (bool $a_value)
 
 hasMailOwnResults ()
 
 setMailConfirmation (bool $a_value)
 
 hasMailConfirmation ()
 
 setAnonymousUserList (bool $a_value)
 
 hasAnonymousUserList ()
 
 getReminderMailTemplates (?int &$defaultTemplateId=null)
 
 setMode (int $a_value)
 
 getMode ()
 
 setSelfEvaluationResults (int $a_value)
 
 getSelfEvaluationResults ()
 
 getMaxSumScore ()
 
- 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)
 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 _getQuestionblock (int $questionblock_id)
 get question block properties More...
 
static _addQuestionblock (string $title="", int $owner=0, bool $show_questiontext=true, bool $show_blocktitle=false, bool $compress_view=false)
 
static _getConstraints (int $survey_id)
 
static _hasDatasets (int $survey_id)
 
static _instanciateQuestion (int $question_id)
 Creates an instance of a question with a given question id. More...
 
static getSurveySkippedValue ()
 
static getSurveysWithTutorResults ()
 
- 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

const EVALUATION_ACCESS_OFF = "0"
 
const EVALUATION_ACCESS_ALL = "1"
 
const EVALUATION_ACCESS_PARTICIPANTS = "2"
 
const ANONYMIZE_OFF = 0
 
const ANONYMIZE_ON = 1
 
const ANONYMIZE_FREEACCESS = 2
 
const ANONYMIZE_CODE_ALL = 3
 
const QUESTIONTITLES_HIDDEN = 0
 
const QUESTIONTITLES_VISIBLE = 1
 
const PRINT_HIDE_LABELS = 1
 
const PRINT_SHOW_LABELS = 3
 
const MODE_STANDARD = 0
 
const MODE_360 = 1
 
const MODE_SELF_EVAL = 2
 
const MODE_IND_FEEDB = 3
 
const RESULTS_SELF_EVAL_NONE = 0
 
const RESULTS_SELF_EVAL_OWN = 1
 
const RESULTS_SELF_EVAL_ALL = 2
 
const RESULTS_360_NONE = 0
 
const RESULTS_360_OWN = 1
 
const RESULTS_360_ALL = 2
 
const NOTIFICATION_PARENT_COURSE = 1
 
const NOTIFICATION_INVITED_USERS = 2
 
const NOTIFICATION_APPRAISEES = 3
 
const NOTIFICATION_RATERS = 4
 
const NOTIFICATION_APPRAISEES_AND_RATERS = 5
 
int $survey_id = 0
 A unique positive numerical ID which identifies the survey. More...
 
string $author = ""
 A text representation of the authors name. More...
 
string $introduction = ""
 
string $outro = ""
 
string $evaluation_access = self::EVALUATION_ACCESS_OFF
 
string $start_date = ""
 
string $end_date = ""
 
array $questions = []
 
int $anonymize = 0
 
int $display_question_titles = 0
 
bool $surveyCodeSecurity = false
 
bool $mailnotification = false
 
string $mailaddresses = ""
 
string $mailparticipantdata = ""
 
bool $pool_usage = 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 Member Functions

 initServices ()
 
 doCreateMetaData ()
 
 getParticipantTextResults (int $active_id)
 
 checkTutorNotification ()
 Check, if mail to tutors after all participants have finished the survey should be sent. More...
 
 sendTutorNotification ()
 Send mail to tutors after all participants have finished the survey. More...
 
 sentReminderPlaceholders (string $a_message, int $a_user_id, array $a_context_params)
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

InternalDomainService $domain
 
ilLogger $svy_log
 
bool $activation_limited = false
 
ilObjUser $user
 
ilAccessHandler $access
 
ilPluginAdmin $plugin_admin
 
bool $calculate_sum_score = false
 
bool $activation_visibility = false
 
int $activation_starting_time = null
 
int $activation_ending_time = null
 
bool $mode_360_self_eval = false
 
bool $mode_360_self_appr = false
 
bool $mode_360_self_rate = false
 
int $mode_360_results = 0
 
bool $mode_skill_service = false
 
bool $reminder_status = false
 
ilDate $reminder_start = null
 
ilDate $reminder_end = null
 
int $reminder_frequency = 0
 
int $reminder_target = 0
 
string $reminder_last_sent = null
 
int $reminder_tmpl = null
 
bool $tutor_ntf_status = false
 
array $tutor_ntf_recipients = []
 
int $tutor_ntf_target = 0
 
bool $tutor_res_status = false
 
array $tutor_res_recipients = []
 
bool $view_own_results = false
 
bool $mail_own_results = false
 
bool $mail_confirmation = false
 
bool $anon_user_list = false
 
int $mode = 0
 
int $mode_self_eval_results = 0
 
Participants InvitationsManager $invitation_manager
 
ILIAS Survey InternalService $survey_service
 
ILIAS Survey Code CodeManager $code_manager
 
ILIAS Survey InternalDataService $data_manager
 
Mode FeatureConfig $feature_config
 
ILIAS SurveyQuestionPool Export ImportManager $import_manager
 
ilMailTemplatePlaceholderResolver $placeholder_resolver
 
- 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 145 of file class.ilObjSurvey.php.

References $DIC, ilObject\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ilLoggerFactory\getLogger(), initServices(), ILIAS\Repository\lng(), ilLanguage\txt(), and ILIAS\Repository\user().

148  {
149  global $DIC;
150 
151  $this->survey_service = $DIC->survey()->internal();
152 
153  $this->user = $DIC->user();
154  $this->lng = $DIC->language();
155  $this->db = $DIC->database();
156  $this->access = $DIC->access();
157  $this->plugin_admin = $DIC["ilPluginAdmin"];
158  $this->tree = $DIC->repositoryTree();
159  $ilUser = $DIC->user();
160  $lng = $DIC->language();
161 
162  $this->type = "svy";
163  $this->survey_id = -1;
164  $this->introduction = "";
165  $this->outro = $lng->txt("survey_finished");
166  $this->author = $ilUser->getFullname();
167  $this->evaluation_access = self::EVALUATION_ACCESS_OFF;
168  $this->questions = array();
169  $this->anonymize = self::ANONYMIZE_OFF;
170  $this->display_question_titles = self::QUESTIONTITLES_VISIBLE;
171  $this->surveyCodeSecurity = true;
172  $this->pool_usage = true;
173  $this->mode = self::MODE_STANDARD;
174  $this->mode_self_eval_results = self::RESULTS_SELF_EVAL_OWN;
175 
176  $this->invitation_manager = $this
177  ->survey_service
178  ->domain()
179  ->participants()
180  ->invitations();
181 
182  $this->import_manager = $DIC->surveyQuestionPool()
183  ->internal()
184  ->domain()
185  ->import();
186  $this->placeholder_resolver = $DIC->mail()->placeholderResolver();
187 
188  parent::__construct($a_id, $a_call_by_reference);
189  $this->svy_log = ilLoggerFactory::getLogger("svy");
190  $this->initServices();
191  $this->domain = $DIC->survey()->internal()->domain();
192  }
static getLogger(string $a_component_id)
Get component logger.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _addQuestionblock()

static ilObjSurvey::_addQuestionblock ( string  $title = "",
int  $owner = 0,
bool  $show_questiontext = true,
bool  $show_blocktitle = false,
bool  $compress_view = false 
)
static
Todo:
move to survey question manager/repo

Definition at line 1674 of file class.ilObjSurvey.php.

References $DIC, $ilDB, ilObject\$owner, and ilObject\$title.

1680  : int {
1681  global $DIC;
1682 
1683  $ilDB = $DIC->database();
1684  $next_id = $ilDB->nextId('svy_qblk');
1685  $ilDB->manipulateF(
1686  "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
1687  " show_blocktitle, owner_fi, tstamp, compress_view) " .
1688  "VALUES (%s, %s, %s, %s, %s, %s, %s)",
1689  array('integer','text','integer','integer','integer','integer','integer'),
1690  array($next_id, $title, $show_questiontext, $show_blocktitle, $owner, time(),$compress_view)
1691  );
1692  return $next_id;
1693  }
string $title
global $DIC
Definition: shib_login.php:22

◆ _getConstraints()

static ilObjSurvey::_getConstraints ( int  $survey_id)
static
Todo:
move to constraint manager/repo, use dto

Definition at line 2100 of file class.ilObjSurvey.php.

References $DIC, and $ilDB.

2102  : array {
2103  global $DIC;
2104 
2105  $ilDB = $DIC->database();
2106  $result_array = array();
2107  $result = $ilDB->queryF(
2108  "SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* " .
2109  "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id " .
2110  "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2111  array('integer'),
2112  array($survey_id)
2113  );
2114  while ($row = $ilDB->fetchAssoc($result)) {
2115  $result_array[] = array("id" => $row["constraint_id"],
2116  "for_question" => $row["for_question"],
2117  "question" => $row["question_fi"],
2118  "short" => $row["shortname"],
2119  "long" => $row["longname"],
2120  "relation_id" => $row["relation_id"],
2121  "value" => $row["value"],
2122  'conjunction' => $row['conjunction']
2123  );
2124  }
2125  return $result_array;
2126  }
int $survey_id
A unique positive numerical ID which identifies the survey.
global $DIC
Definition: shib_login.php:22

◆ _getQuestionblock()

static ilObjSurvey::_getQuestionblock ( int  $questionblock_id)
static

get question block properties

Todo:
move to survey question manager/repo

Definition at line 1656 of file class.ilObjSurvey.php.

References $DIC, and $ilDB.

Referenced by ilSurveyEvaluationGUI\evaluation(), and ilSurveyEditorGUI\initQuestionblockForm().

1658  : array {
1659  global $DIC;
1660 
1661  $ilDB = $DIC->database();
1662  $result = $ilDB->queryF(
1663  "SELECT * FROM svy_qblk WHERE questionblock_id = %s",
1664  array('integer'),
1665  array($questionblock_id)
1666  );
1667  $row = $ilDB->fetchAssoc($result);
1668  return $row;
1669  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _hasDatasets()

static ilObjSurvey::_hasDatasets ( int  $survey_id)
static
Todo:
move to run manager

Definition at line 2634 of file class.ilObjSurvey.php.

References $DIC, and $ilDB.

Referenced by ilSurveyConstraintsGUI\constraintsObject(), ILIAS\Survey\Mode\Standard\UIModifier\getSurveySettingsResults(), ilSurveySyncTableGUI\importData(), ilSurveyEditorGUI\questionsObject(), ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm(), ilSurveyConstraintsGUI\validateConstraintForEdit(), and ILIAS\Survey\Settings\SettingsFormGUI\withAccess().

2636  : bool {
2637  global $DIC;
2638 
2639  $ilDB = $DIC->database();
2640 
2641  $result = $ilDB->queryF(
2642  "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
2643  array('integer'),
2644  array($survey_id)
2645  );
2646  return (bool) $result->numRows();
2647  }
int $survey_id
A unique positive numerical ID which identifies the survey.
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _instanciateQuestion()

static ilObjSurvey::_instanciateQuestion ( int  $question_id)
static

Creates an instance of a question with a given question id.

Todo:
move to factory in pool module

Definition at line 3092 of file class.ilObjSurvey.php.

References SurveyQuestion\_getQuestionType(), SurveyQuestion\_includeClass(), and null.

Referenced by ilSurveyEditorGUI\copyPasteObject(), ilSurveyEditorGUI\copyQuestionsToPoolObject(), and ilSurveyEditorGUI\executeCopyQuestionsToPoolObject().

3094  : ?SurveyQuestion {
3095  if ($question_id < 1) {
3096  return null;
3097  }
3098  $question_type = SurveyQuestion::_getQuestionType($question_id);
3099  if ($question_type === '') {
3100  return null;
3101  }
3102  SurveyQuestion::_includeClass($question_type);
3103  $question = new $question_type();
3104  $question->loadFromDb($question_id);
3105  return $question;
3106  }
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAppraisee()

ilObjSurvey::addAppraisee ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4275 of file class.ilObjSurvey.php.

References $DIC, $ilDB, ANONYMOUS_USER_ID, ilRBACAccessHandler\checkAccessOfUser(), getSurveyId(), isAppraisee(), and sendAppraiseeNotification().

4277  : void {
4278  global $DIC;
4279 
4280  $ilDB = $DIC->database();
4281  $access = $DIC->access();
4282 
4283  if (!$this->isAppraisee($a_user_id) &&
4284  $a_user_id !== ANONYMOUS_USER_ID) {
4285  $fields = array(
4286  "obj_id" => array("integer", $this->getSurveyId()),
4287  "user_id" => array("integer", $a_user_id)
4288  );
4289  $ilDB->insert("svy_360_appr", $fields);
4290 
4291  // send notification and add to desktop
4292  if ($access->checkAccessOfUser($a_user_id, "read", "", $this->getRefId())) {
4293  $this->sendAppraiseeNotification($a_user_id);
4294  }
4295  }
4296  }
isAppraisee(int $a_user_id)
const ANONYMOUS_USER_ID
Definition: constants.php:27
ilAccessHandler $access
sendAppraiseeNotification(int $a_user_id)
global $DIC
Definition: shib_login.php:22
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:

◆ addConstraint()

ilObjSurvey::addConstraint ( int  $if_question_id,
int  $relation,
float  $value,
int  $conjunction 
)

Adds a constraint.

Parameters
int$if_question_idquestion id of the question which defines a precondition
int$relationrelation id
float$valuevalue compared with the relation
int$conjunction
Returns
?int
Todo:
move to constraint manager/repo

Definition at line 2161 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and null.

2166  : ?int {
2167  $ilDB = $this->db;
2168 
2169  $next_id = $ilDB->nextId('svy_constraint');
2170  $affectedRows = $ilDB->manipulateF(
2171  "INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES " .
2172  "(%s, %s, %s, %s, %s)",
2173  array('integer','integer','integer','float', 'integer'),
2174  array($next_id, $if_question_id, $relation, $value, $conjunction)
2175  );
2176  if ($affectedRows) {
2177  return $next_id;
2178  } else {
2179  return null;
2180  }
2181  }
$relation
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db

◆ addConstraintToQuestion()

ilObjSurvey::addConstraintToQuestion ( int  $to_question_id,
int  $constraint_id 
)
Todo:
move to constraint manager/repo

Definition at line 2187 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

2190  : void {
2191  $ilDB = $this->db;
2192 
2193  $next_id = $ilDB->nextId('svy_qst_constraint');
2194  $ilDB->manipulateF(
2195  "INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, " .
2196  "constraint_fi) VALUES (%s, %s, %s, %s)",
2197  array('integer','integer','integer','integer'),
2198  array($next_id, $this->getSurveyId(), $to_question_id, $constraint_id)
2199  );
2200  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ addMaterialTag()

ilObjSurvey::addMaterialTag ( ilXmlWriter  $a_xml_writer,
string  $a_material,
bool  $close_material_tag = true,
bool  $add_mobs = true,
?array  $attribs = null 
)

Creates an XML material tag from a plain text or xhtml text.

Todo:
move to export sub-service

Definition at line 4009 of file class.ilObjSurvey.php.

References ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), ilObject\getId(), IL_INST_ID, isHTML(), null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by toXML().

4015  : void {
4016  $a_xml_writer->xmlStartTag("material", $attribs);
4017  $attrs = array(
4018  "type" => "text/plain"
4019  );
4020  if ($this->isHTML($a_material)) {
4021  $attrs["type"] = "text/xhtml";
4022  }
4023  $mattext = ilRTE::_replaceMediaObjectImageSrc($a_material, 0);
4024  $a_xml_writer->xmlElement("mattext", $attrs, $mattext);
4025 
4026  if ($add_mobs) {
4027  $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->getId());
4028  foreach ($mobs as $mob) {
4029  $mob_id = "il_" . IL_INST_ID . "_mob_" . $mob;
4030  if (strpos($mattext, $mob_id) !== false) {
4031  $mob_obj = new ilObjMediaObject($mob);
4032  $imgattrs = array(
4033  "label" => $mob_id,
4034  "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle(),
4035  "type" => "svy:html",
4036  "id" => $this->getId()
4037  );
4038  $a_xml_writer->xmlElement("matimage", $imgattrs, null);
4039  }
4040  }
4041  }
4042  if ($close_material_tag) {
4043  $a_xml_writer->xmlEndTag("material");
4044  }
4045  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
const IL_INST_ID
Definition: constants.php:40
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
isHTML(string $a_text)
Checks if a given string contains HTML or not.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQuestion()

ilObjSurvey::addQuestion ( int  $question_id)

Adds a question to the survey (used in importer!)

Definition at line 260 of file class.ilObjSurvey.php.

260  : void
261  {
262  $this->questions[] = $question_id;
263  }

◆ addQuestionToBlock()

ilObjSurvey::addQuestionToBlock ( int  $question_id,
int  $questionblock_id 
)
Todo:
move to survey question manager/repo

Definition at line 1547 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, deleteConstraints(), getSurveyId(), and isQuestionInAnyBlock().

1550  : void {
1551  $ilDB = $this->db;
1552 
1553  // see #22018
1554  if (!$this->isQuestionInAnyBlock($question_id)) {
1555  $next_id = $ilDB->nextId('svy_qblk_qst');
1556  $affectedRows = $ilDB->manipulateF(
1557  "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1558  "question_fi) VALUES (%s, %s, %s, %s)",
1559  array('integer', 'integer', 'integer', 'integer'),
1560  array($next_id, $this->getSurveyId(), $questionblock_id, $question_id)
1561  );
1562 
1563  $this->deleteConstraints($question_id); // #13713
1564  }
1565  }
ilDBInterface $db
deleteConstraints(int $question_id)
Deletes the constraints for a question.
isQuestionInAnyBlock(int $a_question_fi)
+ Here is the call graph for this function:

◆ addRater()

ilObjSurvey::addRater ( int  $a_appraisee_id,
int  $a_user_id,
int  $a_anonymous_id = 0 
)
Todo:
move to appraisal manager

Definition at line 4476 of file class.ilObjSurvey.php.

References $DIC, $ilDB, ilRBACAccessHandler\checkAccessOfUser(), getSurveyId(), isAppraisee(), and isRater().

4480  : void {
4481  global $DIC;
4482 
4483  $ilDB = $DIC->database();
4484  $access = $DIC->access();
4485 
4486  if ($this->isAppraisee($a_appraisee_id) &&
4487  !$this->isRater($a_appraisee_id, $a_user_id, $a_anonymous_id)) {
4488  $fields = array(
4489  "obj_id" => array("integer", $this->getSurveyId()),
4490  "appr_id" => array("integer", $a_appraisee_id),
4491  "user_id" => array("integer", $a_user_id),
4492  "anonymous_id" => array("integer", $a_anonymous_id)
4493  );
4494  $ilDB->insert("svy_360_rater", $fields);
4495 
4496  // send notification and add to desktop
4497  if ($access->checkAccessOfUser($a_user_id, "read", "", $this->getRefId())) {
4498  // out-commented, since adding raters will end in a mail
4499  // form to send the mail "manually"
4500  // otherwise two mails would be sent (tested in individual feedback)
4501  //$this->sendRaterNotification($a_user_id, $a_appraisee_id);
4502  }
4503  }
4504  }
isAppraisee(int $a_user_id)
ilAccessHandler $access
global $DIC
Definition: shib_login.php:22
isRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:

◆ canExportSurveyCode()

ilObjSurvey::canExportSurveyCode ( )

Checks if the survey code can be exported with the survey evaluation.

In some cases this may be necessary but usually you should prevent it because people who sent the survey codes could connect real people with the survey code in the evaluation and undermine the anonymity

Returns
bool true if the survey is anonymized and the survey code may be shown in the export file
Todo:
move to code manager

Definition at line 4054 of file class.ilObjSurvey.php.

References getAnonymize().

4054  : bool
4055  {
4056  if ($this->getAnonymize() !== self::ANONYMIZE_OFF) {
4057  if ($this->surveyCodeSecurity === false) {
4058  return true;
4059  }
4060  }
4061  return false;
4062  }
+ Here is the call graph for this function:

◆ checkConstraint()

ilObjSurvey::checkConstraint ( array  $constraint_data,
?array  $working_data 
)

Checks if a constraint is valid.

Parameters
array$constraint_dataconstraint data
?array$working_data user input of the related question
Returns
bool true if the constraint is valid, otherwise false
Todo:
move to run/constraint manager

Definition at line 2572 of file class.ilObjSurvey.php.

References $data.

2575  : bool {
2576  if (!is_array($working_data) || count($working_data) === 0) {
2577  return 0;
2578  }
2579 
2580  if ((count($working_data) === 1) and (strcmp($working_data[0]["value"], "") === 0)) {
2581  return 0;
2582  }
2583 
2584  $found = false;
2585  foreach ($working_data as $data) {
2586  switch ($constraint_data["short"]) {
2587  case "<":
2588  if ($data["value"] < $constraint_data["value"]) {
2589  $found = true;
2590  }
2591  break;
2592 
2593  case "<=":
2594  if ($data["value"] <= $constraint_data["value"]) {
2595  $found = true;
2596  }
2597  break;
2598 
2599  case "=":
2600  if ($data["value"] == $constraint_data["value"]) {
2601  $found = true;
2602  }
2603  break;
2604 
2605  case "<>":
2606  if ($data["value"] <> $constraint_data["value"]) {
2607  $found = true;
2608  }
2609  break;
2610 
2611  case ">=":
2612  if ($data["value"] >= $constraint_data["value"]) {
2613  $found = true;
2614  }
2615  break;
2616 
2617  case ">":
2618  if ($data["value"] > $constraint_data["value"]) {
2619  $found = true;
2620  }
2621  break;
2622  }
2623  if ($found) {
2624  break;
2625  }
2626  }
2627 
2628  return (int) $found;
2629  }

◆ checkReminder()

ilObjSurvey::checkReminder ( )

Definition at line 5314 of file class.ilObjSurvey.php.

References $access, ilObject\$db, $DIC, $ilDB, $message, $user_id, ilLanguageFactory\_getLanguageOfUser(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, getEndDate(), ilObject\getId(), ilObjectActivation\getItem(), getNotificationTargetUserIds(), ilObject\getOfflineStatus(), ilObject\getRefId(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderMailTemplates(), getReminderStart(), getReminderStatus(), getReminderTarget(), getReminderTemplate(), getStartDate(), ilObject\getTitle(), IL_CAL_DATE, IL_CAL_DAY, null, saveToDb(), sent360Reminders(), sentReminderPlaceholders(), setReminderLastSent(), and ilObjectActivation\TIMINGS_ACTIVATION.

5314  : ?int
5315  {
5316  $ilDB = $this->db;
5317  $ilAccess = $this->access;
5318 
5319  $now = time();
5320  $now_with_format = date("YmdHis", $now);
5321  $today = date("Y-m-d");
5322 
5323  $this->svy_log->debug("Check status and dates.");
5324 
5325  // object settings / participation period
5326  if (
5327  $this->getOfflineStatus() ||
5328  !$this->getReminderStatus() ||
5329  ($this->getStartDate() && $now_with_format < $this->getStartDate()) ||
5330  ($this->getEndDate() && $now_with_format > $this->getEndDate())) {
5331  return null;
5332  }
5333 
5334  // reminder period
5335  $start = $this->getReminderStart();
5336  if ($start) {
5337  $start = $start->get(IL_CAL_DATE);
5338  }
5339  $end = $this->getReminderEnd();
5340  if ($end) {
5341  $end = $end->get(IL_CAL_DATE);
5342  }
5343  if ($today < $start ||
5344  ($end && $today > $end)) {
5345  return null;
5346  }
5347 
5348  $this->svy_log->debug("Check access period.");
5349 
5350  // object access period
5351  $item_data = ilObjectActivation::getItem($this->getRefId());
5352  if ((int) $item_data["timing_type"] === ilObjectActivation::TIMINGS_ACTIVATION &&
5353  ($now < $item_data["timing_start"] ||
5354  $now > $item_data["timing_end"])) {
5355  return null;
5356  }
5357 
5358  $this->svy_log->debug("Check frequency.");
5359 
5360  // check frequency
5361  $cut = new ilDate($today, IL_CAL_DATE);
5362  $cut->increment(IL_CAL_DAY, $this->getReminderFrequency() * -1);
5363  if (!$this->getReminderLastSent() ||
5364  $cut->get(IL_CAL_DATE) >= substr($this->getReminderLastSent(), 0, 10)) {
5365  $missing_ids = array();
5366  if (!$this->feature_config->usesAppraisees()) {
5367  $this->svy_log->debug("Entering survey mode.");
5368 
5369  // #16871
5370  $user_ids = $this->getNotificationTargetUserIds(($this->getReminderTarget() === self::NOTIFICATION_INVITED_USERS));
5371  if ($user_ids) {
5372  // gather participants who already finished
5373  $finished_ids = array();
5374  $set = $ilDB->query("SELECT user_fi FROM svy_finished" .
5375  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5376  " AND state = " . $ilDB->quote(1, "text") .
5377  " AND " . $ilDB->in("user_fi", $user_ids, "", "integer"));
5378  while ($row = $ilDB->fetchAssoc($set)) {
5379  $finished_ids[] = $row["user_fi"];
5380  }
5381 
5382  // some users missing out?
5383  $missing_ids = array_diff($user_ids, $finished_ids);
5384  if ($missing_ids) {
5385  foreach ($missing_ids as $idx => $user_id) {
5386  // should be able to participate
5387  if (!$ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId())) {
5388  unset($missing_ids[$idx]);
5389  }
5390  }
5391  }
5392  if ($missing_ids) {
5393  $this->sentReminder($missing_ids);
5394  }
5395  }
5396  } else {
5397  $this->svy_log->debug("Entering 360 mode.");
5398 
5399  $this->sent360Reminders();
5400  }
5401 
5402 
5403  $this->setReminderLastSent($today);
5404  $this->saveToDb();
5405 
5406  return count($missing_ids);
5407  }
5408 
5409  return null;
5410  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DAY
ilAccessHandler $access
ilDBInterface $db
getNotificationTargetUserIds(bool $a_use_invited)
These users must finish the survey to trigger the tutor notification "all users finished the survey" ...
setReminderLastSent(?string $a_value)
const IL_CAL_DATE
static getItem(int $ref_id)
sent360Reminders()
Send 360 reminders.
+ Here is the call graph for this function:

◆ checkTutorNotification()

ilObjSurvey::checkTutorNotification ( )
protected

Check, if mail to tutors after all participants have finished the survey should be sent.

Definition at line 5122 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getNotificationTargetUserIds(), getTutorNotificationStatus(), getTutorNotificationTarget(), and sendTutorNotification().

Referenced by finishSurvey().

5122  : void
5123  {
5124  $ilDB = $this->db;
5125 
5126  if ($this->getTutorNotificationStatus()) {
5127  // get target users, either parent course/group members or
5128  // user with the survey on the dashboard
5129  $user_ids = $this->getNotificationTargetUserIds(($this->getTutorNotificationTarget() === self::NOTIFICATION_INVITED_USERS));
5130  if ($user_ids) {
5131  $set = $ilDB->query("SELECT COUNT(*) numall FROM svy_finished" .
5132  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5133  " AND state = " . $ilDB->quote(1, "integer") .
5134  " AND " . $ilDB->in("user_fi", $user_ids, "", "integer"));
5135  $row = $ilDB->fetchAssoc($set);
5136 
5137  // all users finished the survey -> send notifications
5138  if ((int) $row["numall"] === count($user_ids)) {
5139  $this->sendTutorNotification();
5140  }
5141  }
5142  }
5143  }
getTutorNotificationTarget()
Group that is checked for the "all participants have finished" mail Either a) all members of a parent...
sendTutorNotification()
Send mail to tutors after all participants have finished the survey.
ilDBInterface $db
getNotificationTargetUserIds(bool $a_use_invited)
These users must finish the survey to trigger the tutor notification "all users finished the survey" ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneTextblocks()

ilObjSurvey::cloneTextblocks ( array  $mapping)

Clones the text blocks of survey questions.

Todo:
move to survey question manager
Parameters
array<int,int>$mapping (key is original, value is new id)

Definition at line 3428 of file class.ilObjSurvey.php.

References ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), getTextblock(), saveHeading(), and ilUtil\stripSlashes().

3430  : void {
3431  foreach ($mapping as $original_id => $new_id) {
3432  $textblock = $this->getTextblock($original_id);
3433  $this->saveHeading(ilUtil::stripSlashes($textblock, true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("survey")), $new_id);
3434  }
3435  }
getTextblock(int $question_id)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
saveHeading(string $heading, int $insertbefore)
+ Here is the call graph for this function:

◆ closeAppraisee()

ilObjSurvey::closeAppraisee ( int  $a_user_id)
Todo:
move to appraisal/run manager/mode

Definition at line 4883 of file class.ilObjSurvey.php.

References $DIC, $ilDB, ilObject\getId(), getSkillService(), getSurveyId(), and sendAppraiseeCloseNotification().

4885  : void {
4886  global $DIC;
4887 
4888  $ilDB = $DIC->database();
4889  $user = $DIC->user();
4890 
4891  // close the appraisee
4892  $ilDB->manipulate("UPDATE svy_360_appr" .
4893  " SET has_closed = " . $ilDB->quote(time(), "integer") .
4894  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4895  " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
4896 
4897  // write competences
4898  $skmg_set = new ilSkillManagementSettings();
4899  if ($this->getSkillService() && $skmg_set->isActivated()) {
4900  $sskill = new ilSurveySkill($this);
4901  $sskill->writeAndAddAppraiseeSkills($a_user_id);
4902  }
4903 
4904  // send notification
4905  if ($user->getId() !== $a_user_id) {
4906  $this->sendAppraiseeCloseNotification($a_user_id);
4907  }
4908  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sendAppraiseeCloseNotification(int $a_user_id)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ create()

ilObjSurvey::create (   $a_upload = false)

Definition at line 212 of file class.ilObjSurvey.php.

References $id, ilObject\createMetaData(), ilObject\setOfflineStatus(), and ilObject\update().

212  : int
213  {
214  $id = parent::create();
215  if (!$a_upload) {
216  $this->createMetaData();
217  }
218  $this->setOfflineStatus(true);
219  $this->update($a_upload);
220  return $id;
221  }
setOfflineStatus(bool $status)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjSurvey::createExportDirectory ( )

creates data directory for export files (data_dir/svy_data/svy_<id>/export)

Todo:
move to export sub-service
Exceptions
ilSurveyException

Definition at line 3443 of file class.ilObjSurvey.php.

References ilFileUtils\getDataDir(), ilObject\getId(), and ilFileUtils\makeDir().

3443  : void
3444  {
3445  $svy_data_dir = ilFileUtils::getDataDir() . "/svy_data";
3446  ilFileUtils::makeDir($svy_data_dir);
3447  if (!is_writable($svy_data_dir)) {
3448  throw new ilSurveyException("Survey Data Directory (" . $svy_data_dir . ") not writeable.");
3449  }
3450 
3451  // create learning module directory (data_dir/lm_data/lm_<id>)
3452  $svy_dir = $svy_data_dir . "/svy_" . $this->getId();
3453  ilFileUtils::makeDir($svy_dir);
3454  if (!is_dir($svy_dir)) {
3455  throw new ilSurveyException("Creation of Survey Directory failed.");
3456  }
3457  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
3458  $export_dir = $svy_dir . "/export";
3459  ilFileUtils::makeDir($export_dir);
3460  if (!is_dir($export_dir)) {
3461  throw new ilSurveyException("Creation of Export Directory failed.");
3462  }
3463  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ createImportDirectory()

ilObjSurvey::createImportDirectory ( )

creates data directory for import files (data_dir/svy_data/svy_<id>/import)

Todo:
move to export sub-service
Exceptions
ilSurveyException

Definition at line 3481 of file class.ilObjSurvey.php.

References ilFileUtils\getDataDir(), ilObject\getId(), and ilFileUtils\makeDir().

3481  : void
3482  {
3483  $svy_data_dir = ilFileUtils::getDataDir() . "/svy_data";
3484  ilFileUtils::makeDir($svy_data_dir);
3485 
3486  if (!is_writable($svy_data_dir)) {
3487  throw new ilSurveyException("Survey Data Directory (" . $svy_data_dir . ") not writeable.");
3488  }
3489 
3490  // create test directory (data_dir/svy_data/svy_<id>)
3491  $svy_dir = $svy_data_dir . "/svy_" . $this->getId();
3492  ilFileUtils::makeDir($svy_dir);
3493  if (!is_dir($svy_dir)) {
3494  throw new ilSurveyException("Creation of Survey Directory failed.");
3495  }
3496 
3497  // create import subdirectory (data_dir/svy_data/svy_<id>/import)
3498  $import_dir = $svy_dir . "/import";
3499  ilFileUtils::makeDir($import_dir);
3500  if (!is_dir($import_dir)) {
3501  throw new ilSurveyException("Creation of Import Directory failed.");
3502  }
3503  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ createQuestionblock()

ilObjSurvey::createQuestionblock ( string  $title,
bool  $show_questiontext,
bool  $show_blocktitle,
array  $questions,
bool  $compress_view = false 
)
Parameters
int[]$questions array with question ids

Definition at line 1698 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $user, deleteConstraints(), getSurveyId(), isQuestionInAnyBlock(), and moveQuestions().

Referenced by insertQuestionblock().

1704  : void {
1705  $ilDB = $this->db;
1706 
1707  // if the selected questions are not in a continous selection, move all questions of the
1708  // questionblock at the position of the first selected question
1709  $this->moveQuestions($questions, $questions[0], 0);
1710 
1711  // now save the question block
1712  $ilUser = $this->user;
1713  $next_id = $ilDB->nextId('svy_qblk');
1714  $affectedRows = $ilDB->manipulateF(
1715  "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
1716  " show_blocktitle, owner_fi, tstamp, compress_view) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1717  array('integer','text','text','text','integer','integer','integer'),
1718  array($next_id, $title, $show_questiontext, $show_blocktitle, $ilUser->getId(), time(), $compress_view)
1719  );
1720  if ($affectedRows) {
1721  $questionblock_id = $next_id;
1722  foreach ($questions as $index) {
1723  if (!$this->isQuestionInAnyBlock($index)) {
1724  $next_id = $ilDB->nextId('svy_qblk_qst'); // #22018
1725  $affectedRows = $ilDB->manipulateF(
1726  "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1727  "question_fi) VALUES (%s, %s, %s, %s)",
1728  array('integer', 'integer', 'integer', 'integer'),
1729  array($next_id, $this->getSurveyId(), $questionblock_id, $index)
1730  );
1731  $this->deleteConstraints($index);
1732  }
1733  }
1734  }
1735  }
string $title
moveQuestions(array $move_questions, int $target_index, int $insert_mode)
Move questions and/or questionblocks to another position.
ilDBInterface $db
deleteConstraints(int $question_id)
Deletes the constraints for a question.
isQuestionInAnyBlock(int $a_question_fi)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjSurvey::createReference ( )

Definition at line 243 of file class.ilObjSurvey.php.

References saveToDb().

243  : int
244  {
245  $result = parent::createReference();
246  $this->saveToDb();
247  return $result;
248  }
+ Here is the call graph for this function:

◆ delete()

ilObjSurvey::delete ( )

Definition at line 265 of file class.ilObjSurvey.php.

References ilObject\countReferences(), ilFileUtils\delDir(), ilObject\deleteMetaData(), deleteSurveyRecord(), ilObject\getId(), getImportDirectory(), ilObject\getRefId(), ilObject\getTitle(), and removeQuestion().

265  : bool
266  {
267  $this->svy_log->debug("Deleting Survey, ref id: " . $this->getRefId() . ", obj id: " .
268  $this->getId() . ", title: " . $this->getTitle());
269  $this->svy_log->debug("References: " . $this->countReferences());
270  if ($this->countReferences() === 1) {
271  $this->deleteMetaData();
272 
273  // Delete all survey questions, constraints and materials
274  foreach ($this->questions as $question_id) {
275  $this->svy_log->debug("Remove question " . $question_id);
276  $this->removeQuestion($question_id);
277  }
278  $this->deleteSurveyRecord();
279 
281  }
282 
283  $this->svy_log->debug("Call parent delete.");
284  $remove = parent::delete();
285 
286  // always call parent delete function first!!
287  if (!$remove) {
288  return false;
289  }
290  return true;
291  }
deleteSurveyRecord()
Deletes the survey from the database.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getImportDirectory()
get import directory of survey
removeQuestion(int $question_id)
+ Here is the call graph for this function:

◆ deleteAllUserData()

ilObjSurvey::deleteAllUserData ( bool  $reset_LP = true)

Deletes all user data of a survey.

Parameters
bool$reset_LPnotice that the LP can only be reset it the determining components still exist
Todo:
move to run manager/repo

Definition at line 354 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObject\getId(), ilObjectLP\getInstance(), and getSurveyId().

Referenced by deleteSurveyRecord().

356  : void {
357  $ilDB = $this->db;
358 
359  $result = $ilDB->queryF(
360  "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
361  array('integer'),
362  array($this->getSurveyId())
363  );
364  $active_array = array();
365  while ($row = $ilDB->fetchAssoc($result)) {
366  $active_array[] = $row["finished_id"];
367  }
368 
369  $affectedRows = $ilDB->manipulateF(
370  "DELETE FROM svy_finished WHERE survey_fi = %s",
371  array('integer'),
372  array($this->getSurveyId())
373  );
374 
375  foreach ($active_array as $active_fi) {
376  $affectedRows = $ilDB->manipulateF(
377  "DELETE FROM svy_answer WHERE active_fi = %s",
378  array('integer'),
379  array($active_fi)
380  );
381  $affectedRows = $ilDB->manipulateF(
382  "DELETE FROM svy_times WHERE finished_fi = %s",
383  array('integer'),
384  array($active_fi)
385  );
386  }
387 
388  if ($reset_LP) {
389  $lp_obj = ilObjectLP::getInstance($this->getId());
390  $lp_obj->resetLPDataForCompleteObject();
391  }
392 
393  $this->invitation_manager->removeAll($this->getSurveyId());
394  }
ilDBInterface $db
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAppraisee()

ilObjSurvey::deleteAppraisee ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4420 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, deleteRater(), and get360SelfEvaluation().

4422  : void {
4423  $ilDB = $this->db;
4424 
4425  $ilDB->manipulate("DELETE FROM svy_360_appr" .
4426  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4427  " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
4428 
4429  $set = $ilDB->query("SELECT user_id" .
4430  " FROM svy_360_rater" .
4431  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4432  " AND appr_id = " . $ilDB->quote($a_user_id, "integer"));
4433  while ($row = $ilDB->fetchAssoc($set)) {
4434  $this->deleteRater($a_user_id, $row["user_id"]);
4435  }
4436  // appraisee will not be part of raters table
4437  if ($this->get360SelfEvaluation()) {
4438  $this->deleteRater($a_user_id, $a_user_id);
4439  }
4440  }
ilDBInterface $db
deleteRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
+ Here is the call graph for this function:

◆ deleteConstraint()

ilObjSurvey::deleteConstraint ( int  $constraint_id)

Deletes a single constraint.

Todo:
move to constraint manager/repo

Definition at line 1782 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

Referenced by deleteConstraints(), and moveQuestions().

1784  : void {
1785  $ilDB = $this->db;
1786  $affectedRows = $ilDB->manipulateF(
1787  "DELETE FROM svy_constraint WHERE constraint_id = %s",
1788  array('integer'),
1789  array($constraint_id)
1790  );
1791  $affectedRows = $ilDB->manipulateF(
1792  "DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
1793  array('integer'),
1794  array($constraint_id)
1795  );
1796  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ deleteConstraints()

ilObjSurvey::deleteConstraints ( int  $question_id)

Deletes the constraints for a question.

Todo:
move to constraint manager/repo

Definition at line 1760 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, deleteConstraint(), and getSurveyId().

Referenced by addQuestionToBlock(), and createQuestionblock().

1762  : void {
1763  $ilDB = $this->db;
1764  $result = $ilDB->queryF(
1765  "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1766  array('integer','integer'),
1767  array($question_id, $this->getSurveyId())
1768  );
1769  $constraints = array();
1770  while ($row = $ilDB->fetchAssoc($result)) {
1771  $constraints[] = $row["constraint_fi"];
1772  }
1773  foreach ($constraints as $constraint_id) {
1774  $this->deleteConstraint($constraint_id);
1775  }
1776  }
ilDBInterface $db
deleteConstraint(int $constraint_id)
Deletes a single constraint.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteRater()

ilObjSurvey::deleteRater ( int  $a_appraisee_id,
int  $a_user_id,
int  $a_anonymous_id = 0 
)
Todo:
move to appraisal manager

Definition at line 4540 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getFinishedIdForAppraiseeIdAndRaterId(), and removeSelectedSurveyResults().

Referenced by deleteAppraisee().

4544  : void {
4545  $ilDB = $this->db;
4546 
4547  $finished_id = $this->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_user_id);
4548  if ($finished_id) {
4549  $this->removeSelectedSurveyResults(array($finished_id));
4550  }
4551 
4552  $ilDB->manipulate("DELETE FROM svy_360_rater" .
4553  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4554  " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer") .
4555  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
4556  " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer"));
4557  }
removeSelectedSurveyResults(array $finished_ids)
Deletes the user data of a given array of survey participants.
ilDBInterface $db
getFinishedIdForAppraiseeIdAndRaterId(int $a_appr_id, int $a_rat_id)
Get finished id for an appraisee and a rater.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteSurveyCode()

ilObjSurvey::deleteSurveyCode ( string  $survey_code)
Todo:
move to code manager

Definition at line 3892 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3894  : void {
3895  $ilDB = $this->db;
3896 
3897  if ($survey_code !== '') {
3898  $affectedRows = $ilDB->manipulateF(
3899  "DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
3900  array('integer', 'text'),
3901  array($this->getSurveyId(), $survey_code)
3902  );
3903  }
3904  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ deleteSurveyRecord()

ilObjSurvey::deleteSurveyRecord ( )

Deletes the survey from the database.

Todo:
move to survey manager/repo

Definition at line 297 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilFileUtils\delDir(), deleteAllUserData(), ilFileUtils\getDataDir(), ilObject\getId(), and getSurveyId().

Referenced by delete().

297  : void
298  {
299  $ilDB = $this->db;
300 
301  $ilDB->manipulateF(
302  "DELETE FROM svy_svy WHERE survey_id = %s",
303  array('integer'),
304  array($this->getSurveyId())
305  );
306 
307  $result = $ilDB->queryF(
308  "SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
309  array('integer'),
310  array($this->getSurveyId())
311  );
312  $questionblocks = array();
313  while ($row = $ilDB->fetchAssoc($result)) {
314  $questionblocks[] = $row["questionblock_fi"];
315  }
316  if (count($questionblocks)) {
317  $affectedRows = $ilDB->manipulate("DELETE FROM svy_qblk WHERE " . $ilDB->in('questionblock_id', $questionblocks, false, 'integer'));
318  }
319  $ilDB->manipulateF(
320  "DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
321  array('integer'),
322  array($this->getSurveyId())
323  );
324  $this->deleteAllUserData(false);
325 
326  if (isset($this->code_manager)) {
327  $this->code_manager->deleteAll(true);
328  }
329 
330  // delete export files
331  $svy_data_dir = ilFileUtils::getDataDir() . "/svy_data";
332  $directory = $svy_data_dir . "/svy_" . $this->getId();
333  if (is_dir($directory)) {
334  ilFileUtils::delDir($directory);
335  }
336 
337  $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->getId());
338  // remaining usages are not in text anymore -> delete them
339  // and media objects (note: delete method of ilObjMediaObject
340  // checks whether object is used in another context; if yes,
341  // the object is not deleted!)
342  foreach ($mobs as $mob) {
343  ilObjMediaObject::_removeUsage($mob, "svy:html", $this->getId());
344  $mob_obj = new ilObjMediaObject($mob);
345  $mob_obj->delete();
346  }
347  }
deleteAllUserData(bool $reset_LP=true)
Deletes all user data of a survey.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
ilDBInterface $db
static getDataDir()
get data directory (outside webspace)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _removeUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Remove usage of mob in another container.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteUserSettings()

ilObjSurvey::deleteUserSettings ( int  $id)

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

References ilObject\$db, and $ilDB.

665  : void {
666  $ilDB = $this->db;
667 
668  $ilDB->manipulateF(
669  "DELETE FROM svy_settings WHERE settings_id = %s",
670  array('integer'),
671  array($id)
672  );
673  }
ilDBInterface $db
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ deleteWorkingData()

ilObjSurvey::deleteWorkingData ( int  $question_id,
int  $active_id 
)

Deletes the working data of a question in the database.

Todo:
move to run(?) manager/repo

Definition at line 2276 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2279  : void {
2280  $ilDB = $this->db;
2281 
2282  $affectedRows = $ilDB->manipulateF(
2283  "DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2284  array('integer','integer'),
2285  array($question_id, $active_id)
2286  );
2287  }
ilDBInterface $db

◆ doCreateMetaData()

ilObjSurvey::doCreateMetaData ( )
protected

Definition at line 223 of file class.ilObjSurvey.php.

References saveAuthorToMetadata().

223  : void
224  {
225  $this->saveAuthorToMetadata();
226  }
saveAuthorToMetadata(string $a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
+ Here is the call graph for this function:

◆ duplicateQuestionForSurvey()

ilObjSurvey::duplicateQuestionForSurvey ( int  $question_id,
bool  $a_force = false 
)

Takes a question and creates a copy of the question for use in the survey.

Todo:
move to survey question manager/repo

Definition at line 530 of file class.ilObjSurvey.php.

References ilObject\getId(), getQuestionGUI(), and getQuestionType().

Referenced by insertQuestion().

533  : int {
534  $questiontype = $this->getQuestionType($question_id);
535  $question_gui = $this->getQuestionGUI($questiontype, $question_id);
536 
537  // check if question is a pool question at all, if not do nothing
538  if ($this->getId() === $question_gui->object->getObjId() && !$a_force) {
539  return $question_id;
540  }
541 
542  $duplicate_id = $question_gui->object->duplicate(true, "", "", 0, $this->getId());
543  return $duplicate_id;
544  }
getQuestionGUI(string $questiontype, int $question_id)
getQuestionType(int $question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findCodeForUser()

ilObjSurvey::findCodeForUser ( int  $a_user_id)
Todo:
move to code manager

Definition at line 4763 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and ANONYMOUS_USER_ID.

4765  : string {
4766  $ilDB = $this->db;
4767 
4768  if ($a_user_id !== ANONYMOUS_USER_ID) {
4769  $set = $ilDB->query("SELECT sf.anonymous_id FROM svy_finished sf" .
4770  " WHERE sf.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4771  " AND sf.user_fi = " . $ilDB->quote($a_user_id, "integer"));
4772  $a_code = $ilDB->fetchAssoc($set);
4773  return (string) ($a_code["anonymous_id"] ?? "");
4774  }
4775  return "";
4776  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
ilDBInterface $db

◆ finishSurvey()

ilObjSurvey::finishSurvey ( int  $finished_id,
int  $appr_id = 0 
)

Finishes the survey creating an entry in the database.

Todo:
move to run manager

Definition at line 2316 of file class.ilObjSurvey.php.

References ilObject\$db, $id, $ilDB, ANONYMOUS_USER_ID, checkTutorNotification(), getMode(), getRatersData(), getSurveyId(), getUserDataFromActiveId(), and ILIAS\Repository\user().

2319  : void {
2320  $ilDB = $this->db;
2321 
2322  $ilDB->manipulateF(
2323  "UPDATE svy_finished SET state = %s, tstamp = %s" .
2324  " WHERE survey_fi = %s AND finished_id = %s",
2325  array('text','integer','integer','integer'),
2326  array(1, time(), $this->getSurveyId(), $finished_id)
2327  );
2328 
2329  // self eval writes skills on finishing
2330  if ($this->getMode() === self::MODE_SELF_EVAL) {
2331  $user = $this->getUserDataFromActiveId($finished_id);
2332  $sskill = new ilSurveySkill($this);
2333  $sskill->writeAndAddSelfEvalSkills($user['usr_id']);
2334  }
2335 
2336  // self eval writes skills on finishing
2337  if ($this->getMode() === self::MODE_IND_FEEDB) {
2338  // we use a rater id like "a27" for anonymous or
2339  // "123" for non anonymous user
2340  // @todo: move this e.g. to participant manager
2341  $raters = $this->getRatersData($appr_id);
2342  $run_manager = $this->survey_service
2343  ->domain()
2344  ->execution()
2345  ->run($this, $this->user->getId(), $appr_id);
2346  $run = $run_manager->getById($finished_id);
2347  $rater_id = "";
2348  if ($run->getUserId() !== 0 && $run->getUserId() !== ANONYMOUS_USER_ID) {
2349  $rater_id = $run->getUserId();
2350  } else {
2351  foreach ($raters as $id => $rater) {
2352  if (($rater["code"] ?? "") === $run->getCode()) {
2353  $rater_id = $id;
2354  }
2355  }
2356  }
2357  $sskill = new ilSurveySkill($this);
2358  //$sskill->writeAndAddSelfEvalSkills($user['usr_id']);
2359  $sskill->writeAndAddIndFeedbackSkills($finished_id, $appr_id, $rater_id);
2360  }
2361 
2362  $this->checkTutorNotification();
2363  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
checkTutorNotification()
Check, if mail to tutors after all participants have finished the survey should be sent...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilDBInterface $db
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getUserDataFromActiveId(int $active_id, bool $force_non_anonymous=false)
Returns run information.
getRatersData(int $a_appraisee_id)
+ Here is the call graph for this function:

◆ fixSequenceStructure()

ilObjSurvey::fixSequenceStructure ( )

Definition at line 1074 of file class.ilObjSurvey.php.

References $data, $DIC, $ilDB, $q, and getSurveyId().

1074  : void
1075  {
1076  global $DIC;
1077 
1078  $ilDB = $DIC->database();
1079  //return;
1080  // we keep all survey question ids with their lowest sequence
1081  $result = $ilDB->queryF(
1082  "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1083  array('integer'),
1084  array($this->getSurveyId())
1085  );
1086 
1087  // step 1: find duplicates -> $to_delete_ids
1088  $fis = array();
1089  $to_delete_ids = array();
1090  while ($data = $ilDB->fetchAssoc($result)) {
1091  if (in_array($data["question_fi"], $fis)) { // found a duplicate
1092  $to_delete_ids[] = $data["survey_question_id"];
1093  } else {
1094  $fis[] = $data["question_fi"];
1095  }
1096  }
1097 
1098  // step 2: we delete the duplicates
1099  if (count($to_delete_ids) > 0) {
1100  $ilDB->manipulate($q = "DELETE FROM svy_svy_qst" .
1101  " WHERE " . $ilDB->in("survey_question_id", $to_delete_ids, false, "integer") .
1102  " AND survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer"));
1103  $this->svy_log->debug("delete: " . $q);
1104 
1105  $ilDB->manipulate($q = "DELETE FROM svy_qblk_qst " .
1106  " WHERE " . $ilDB->in("question_fi", $fis, true, "integer") .
1107  " AND survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer"));
1108  $this->svy_log->debug("delete: " . $q);
1109  }
1110 
1111  // step 3: we fix the sequence
1112  $set = $ilDB->query("SELECT * FROM svy_svy_qst " .
1113  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") . " ORDER BY sequence");
1114  $seq = 0;
1115  while ($rec = $ilDB->fetchAssoc($set)) {
1116  $ilDB->manipulate(
1117  $q = "UPDATE svy_svy_qst SET " .
1118  " sequence = " . $ilDB->quote($seq++, "integer") .
1119  " WHERE survey_question_id = " . $ilDB->quote($rec["survey_question_id"], "integer")
1120  );
1121  $this->svy_log->debug("update: " . $q);
1122  }
1123  }
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

◆ get360Mode()

ilObjSurvey::get360Mode ( )

Definition at line 4224 of file class.ilObjSurvey.php.

References getMode().

Referenced by getUserDataFromActiveId().

4224  : bool
4225  {
4226  if ($this->getMode() === self::MODE_360) {
4227  return true;
4228  }
4229  return false;
4230  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get360Results()

ilObjSurvey::get360Results ( )

Definition at line 4267 of file class.ilObjSurvey.php.

References $mode_360_results.

Referenced by ILIAS\Survey\Mode\IndividualFeedback\UIModifier\getSurveySettingsResults(), ILIAS\Survey\Mode\Feedback360\UIModifier\getSurveySettingsResults(), importObject(), saveToDb(), and toXML().

4267  : int
4268  {
4269  return $this->mode_360_results;
4270  }
+ Here is the caller graph for this function:

◆ get360SelfAppraisee()

ilObjSurvey::get360SelfAppraisee ( )

Definition at line 4247 of file class.ilObjSurvey.php.

References $mode_360_self_appr.

Referenced by importObject(), saveToDb(), sent360Reminders(), and toXML().

4247  : bool
4248  {
4250  }
+ Here is the caller graph for this function:

◆ get360SelfEvaluation()

ilObjSurvey::get360SelfEvaluation ( )

Definition at line 4237 of file class.ilObjSurvey.php.

References $mode_360_self_eval.

Referenced by deleteAppraisee(), getAppraiseesToRate(), ILIAS\Survey\Mode\Feedback360\UIModifier\getSurveySettingsGeneral(), importObject(), isRater(), saveToDb(), sent360Reminders(), and toXML().

4237  : bool
4238  {
4240  }
+ Here is the caller graph for this function:

◆ get360SelfRaters()

ilObjSurvey::get360SelfRaters ( )

Definition at line 4257 of file class.ilObjSurvey.php.

References $mode_360_self_rate.

Referenced by importObject(), saveToDb(), and toXML().

4257  : bool
4258  {
4260  }
+ Here is the caller graph for this function:

◆ getActivationEndDate()

ilObjSurvey::getActivationEndDate ( )

Definition at line 5485 of file class.ilObjSurvey.php.

References $activation_ending_time.

Referenced by saveToDb().

5485  : ?int
5486  {
5488  }
+ Here is the caller graph for this function:

◆ getActivationStartDate()

ilObjSurvey::getActivationStartDate ( )

Definition at line 5480 of file class.ilObjSurvey.php.

References $activation_starting_time.

Referenced by saveToDb().

5480  : ?int
5481  {
5483  }
+ Here is the caller graph for this function:

◆ getActivationVisibility()

ilObjSurvey::getActivationVisibility ( )

Definition at line 1303 of file class.ilObjSurvey.php.

References $activation_visibility.

Referenced by saveToDb().

1303  : bool
1304  {
1306  }
+ Here is the caller graph for this function:

◆ getActiveID()

ilObjSurvey::getActiveID ( int  $user_id,
string  $anonymize_id,
int  $appr_id 
)

Get run id.

Todo:
move to run manager/repo

Definition at line 2514 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getSurveyId(), and null.

Referenced by sendNotificationMail().

2518  : ?int {
2519  $ilDB = $this->db;
2520 
2521  // #15031 - should not matter if code was used by registered or anonymous (each code must be unique)
2522  if ($anonymize_id) {
2523  $result = $ilDB->queryF(
2524  "SELECT finished_id FROM svy_finished" .
2525  " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2526  array('integer','text','integer'),
2527  array($this->getSurveyId(), $anonymize_id, $appr_id)
2528  );
2529  } else {
2530  $result = $ilDB->queryF(
2531  "SELECT finished_id FROM svy_finished" .
2532  " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
2533  array('integer','integer','integer'),
2534  array($this->getSurveyId(), $user_id, $appr_id)
2535  );
2536  }
2537  if ($result->numRows() === 0) {
2538  return null;
2539  } else {
2540  $row = $ilDB->fetchAssoc($result);
2541  return (int) $row["finished_id"];
2542  }
2543  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllRelations()

ilObjSurvey::getAllRelations ( bool  $short_as_key = false)
Todo:
move to constraint manager/repo

Definition at line 2242 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and ilArrayUtil\sortArray().

2244  : array {
2245  $ilDB = $this->db;
2246 
2247  // #7987
2248  $custom_order = array("equal", "not_equal", "less", "less_or_equal", "more", "more_or_equal");
2249  $custom_order = array_flip($custom_order);
2250 
2251  $result_array = array();
2252  $result = $ilDB->query("SELECT * FROM svy_relation");
2253  while ($row = $ilDB->fetchAssoc($result)) {
2254  if ($short_as_key) {
2255  $result_array[$row["shortname"]] = array("short" => $row["shortname"], "long" => $row["longname"], "id" => $row["relation_id"], "order" => $custom_order[$row["longname"]]);
2256  } else {
2257  $result_array[$row["relation_id"]] = array("short" => $row["shortname"], "long" => $row["longname"], "order" => $custom_order[$row["longname"]]);
2258  }
2259  }
2260 
2261  $result_array = ilArrayUtil::sortArray($result_array, "order", "ASC", true, true);
2262  foreach ($result_array as $idx => $item) {
2263  unset($result_array[$idx]["order"]);
2264  }
2265 
2266  return $result_array;
2267  }
ilDBInterface $db
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:

◆ getAnonymize()

ilObjSurvey::getAnonymize ( )

Definition at line 951 of file class.ilObjSurvey.php.

References $anonymize.

Referenced by canExportSurveyCode(), getUserSurveyExecutionStatus(), hasAnonymizedResults(), importObject(), isAccessibleWithoutCode(), saveToDb(), ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm(), and toXML().

951  : int
952  {
953  return $this->anonymize;
954  }
+ Here is the caller graph for this function:

◆ getAnonymousIdByCode()

ilObjSurvey::getAnonymousIdByCode ( string  $a_code)
Todo:
move to code manager

Definition at line 4653 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $res, and null.

4655  : ?int {
4656  $ilDB = $this->db;
4657  $set = $ilDB->query("SELECT anonymous_id FROM svy_anonymous" .
4658  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4659  " AND survey_key = " . $ilDB->quote($a_code, "text"));
4660  $res = $ilDB->fetchAssoc($set);
4661  return $res["anonymous_id"] ?? null;
4662  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db

◆ getAppraiseesData()

ilObjSurvey::getAppraiseesData ( )
Todo:
move to appraisal manager, use dto

Definition at line 4445 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $res, ilObjUser\_lookupEmail(), ilObjUser\_lookupName(), and getRatersData().

Referenced by sent360Reminders().

4445  : array
4446  {
4447  $ilDB = $this->db;
4448 
4449  $res = array();
4450 
4451  $set = $ilDB->query("SELECT * FROM svy_360_appr" .
4452  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer"));
4453  while ($row = $ilDB->fetchAssoc($set)) {
4454  $name = ilObjUser::_lookupName($row["user_id"]);
4455  $name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
4456  $name["name"] = $name["lastname"] . ", " . $name["firstname"];
4457  $res[$row["user_id"]] = $name;
4458 
4459  $finished = 0;
4460  $raters = $this->getRatersData($row["user_id"]);
4461  foreach ($raters as $rater) {
4462  if ($rater["finished"]) {
4463  $finished++;
4464  }
4465  }
4466  $res[$row["user_id"]]["finished"] = $finished . "/" . count($raters);
4467  $res[$row["user_id"]]["closed"] = $row["has_closed"];
4468  }
4469 
4470  return $res;
4471  }
$res
Definition: ltiservices.php:66
static _lookupName(int $a_user_id)
lookup user name
ilDBInterface $db
getRatersData(int $a_appraisee_id)
static _lookupEmail(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAppraiseesToRate()

ilObjSurvey::getAppraiseesToRate ( ?int  $a_user_id,
?int  $a_anonymous_id = null 
)
Todo:
move to appraisal manager
Returns
int[]

Definition at line 4618 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $res, get360SelfEvaluation(), getSurveyId(), ILIAS\Repository\int(), and isAppraisee().

4621  : array {
4622  $ilDB = $this->db;
4623 
4624  $res = array();
4625 
4626  $sql = "SELECT appr_id FROM svy_360_rater" .
4627  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer");
4628 
4629  if ($a_user_id) {
4630  $sql .= " AND user_id = " . $ilDB->quote($a_user_id, "integer");
4631  } else {
4632  $sql .= " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer");
4633  }
4634 
4635  $set = $ilDB->query($sql);
4636  while ($row = $ilDB->fetchAssoc($set)) {
4637  $res[] = (int) $row["appr_id"];
4638  }
4639 
4640  // user may evaluate himself if already appraisee
4641  if ($this->get360SelfEvaluation() &&
4642  $this->isAppraisee((int) $a_user_id) &&
4643  !in_array($a_user_id, $res)) {
4644  $res[] = $a_user_id;
4645  }
4646 
4647  return $res;
4648  }
$res
Definition: ltiservices.php:66
isAppraisee(int $a_user_id)
ilDBInterface $db
+ Here is the call graph for this function:

◆ getAuthor()

ilObjSurvey::getAuthor ( )

Definition at line 1152 of file class.ilObjSurvey.php.

References ilObject\getId(), and ilObject\getType().

Referenced by importObject(), saveToDb(), and toXML().

1152  : string
1153  {
1154  return $this->domain->metadata()->getAuthorsFromLOM(
1155  $this->getId(),
1156  0,
1157  $this->getType()
1158  );
1159  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableQuestionpools()

ilObjSurvey::getAvailableQuestionpools ( bool  $use_obj_id = false,
bool  $could_be_offline = false,
bool  $showPath = false,
string  $permission = "read" 
)

Returns the available question pools for the active user.

Definition at line 2029 of file class.ilObjSurvey.php.

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

Referenced by getQuestionsTable().

2034  : array {
2035  return ilObjSurveyQuestionPool::_getAvailableQuestionpools($use_obj_id, $could_be_offline, $showPath, $permission);
2036  }
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCalculateSumScore()

ilObjSurvey::getCalculateSumScore ( )

Definition at line 962 of file class.ilObjSurvey.php.

References $calculate_sum_score.

Referenced by saveToDb().

962  : bool
963  {
965  }
+ Here is the caller graph for this function:

◆ getConstraints()

ilObjSurvey::getConstraints ( int  $question_id)

Returns the constraints to a given question or questionblock.

Todo:
move to constraint manager, introduce dto

Definition at line 2065 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, SurveyQuestion\_getQuestionType(), SurveyQuestion\_includeClass(), and getSurveyId().

Referenced by getSurveyPages(), getSurveyQuestions(), SurveyConstraintsTableGUI\initItems(), and moveQuestions().

2067  : array {
2068  $ilDB = $this->db;
2069 
2070  $result_array = array();
2071  $result = $ilDB->queryF(
2072  "SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation " .
2073  "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2074  "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s " .
2075  "AND svy_qst_constraint.survey_fi = %s",
2076  array('integer','integer'),
2077  array($question_id, $this->getSurveyId())
2078  );
2079  while ($row = $ilDB->fetchAssoc($result)) {
2080  $question_type = SurveyQuestion::_getQuestionType($row["question_fi"]);
2081  SurveyQuestion::_includeClass($question_type);
2082  $question = new $question_type();
2083  $question->loadFromDb($row["question_fi"]);
2084  $valueoutput = $question->getPreconditionValueOutput($row["value"]);
2085  $result_array[] = array("id" => $row["constraint_id"],
2086  "question" => $row["question_fi"],
2087  "short" => $row["shortname"],
2088  "long" => $row["longname"],
2089  "value" => $row["value"],
2090  "conjunction" => $row["conjunction"],
2091  "valueoutput" => $valueoutput
2092  );
2093  }
2094  return $result_array;
2095  }
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
ilDBInterface $db
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEndDate()

ilObjSurvey::getEndDate ( )

Definition at line 1224 of file class.ilObjSurvey.php.

References $end_date.

Referenced by checkReminder(), hasEnded(), importObject(), saveToDb(), and toXML().

1224  : string
1225  {
1226  return $this->end_date;
1227  }
+ Here is the caller graph for this function:

◆ getEvaluationAccess()

ilObjSurvey::getEvaluationAccess ( )

Definition at line 1286 of file class.ilObjSurvey.php.

References $evaluation_access.

Referenced by ILIAS\Survey\Mode\Standard\UIModifier\getSurveySettingsResults(), importObject(), saveToDb(), and toXML().

1286  : string
1287  {
1288  return $this->evaluation_access;
1289  }
string $evaluation_access
+ Here is the caller graph for this function:

◆ getEvaluationByUser()

ilObjSurvey::getEvaluationByUser ( array  $questions,
int  $active_id 
)

Calculates the evaluation data for a given run.

Todo:
move to evaluation manager

Definition at line 2774 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getUserDataFromActiveId(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

2777  : array {
2778  $ilDB = $this->db;
2779 
2780  // collect all answers
2781  $answers = array();
2782  $result = $ilDB->queryF(
2783  "SELECT * FROM svy_answer WHERE active_fi = %s",
2784  array('integer'),
2785  array($active_id)
2786  );
2787  while ($row = $ilDB->fetchAssoc($result)) {
2788  if (!is_array($answers[$row["question_fi"]])) {
2789  $answers[$row["question_fi"]] = array();
2790  }
2791  $answers[$row["question_fi"]][] = $row;
2792  }
2793  $userdata = $this->getUserDataFromActiveId($active_id);
2794  $resultset = array(
2795  "name" => $userdata["fullname"],
2796  "firstname" => $userdata["firstname"],
2797  "lastname" => $userdata["lastname"],
2798  "login" => $userdata["login"],
2799  "gender" => $userdata["gender"],
2800  "answers" => array()
2801  );
2802  foreach ($questions as $key => $question) {
2803  if (array_key_exists($key, $answers)) {
2804  $resultset["answers"][$key] = $answers[$key];
2805  } else {
2806  $resultset["answers"][$key] = array();
2807  }
2808  sort($resultset["answers"][$key]);
2809  }
2810  return $resultset;
2811  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
ilDBInterface $db
getUserDataFromActiveId(int $active_id, bool $force_non_anonymous=false)
Returns run information.
+ Here is the call graph for this function:

◆ getExistingQuestions()

ilObjSurvey::getExistingQuestions ( )

Gets the question id's of the questions which are already in the survey.

Returns
int[]

Definition at line 1332 of file class.ilObjSurvey.php.

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

Referenced by getQuestionsTable().

1332  : array
1333  {
1334  $ilDB = $this->db;
1335  $existing_questions = array();
1336  $result = $ilDB->queryF(
1337  "SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1338  "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1339  array('integer'),
1340  array($this->getSurveyId())
1341  );
1342  while ($data = $ilDB->fetchAssoc($result)) {
1343  if ($data["original_id"]) {
1344  $existing_questions[] = (int) $data["original_id"];
1345  }
1346  }
1347  return $existing_questions;
1348  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportDirectory()

ilObjSurvey::getExportDirectory ( )
Todo:
move to export sub-service

Definition at line 3468 of file class.ilObjSurvey.php.

References ilFileUtils\getDataDir(), and ilObject\getId().

3468  : string
3469  {
3470  $export_dir = ilFileUtils::getDataDir() . "/svy_data" . "/svy_" . $this->getId() . "/export";
3471 
3472  return $export_dir;
3473  }
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ getExternalCodeRecipients()

ilObjSurvey::getExternalCodeRecipients ( bool  $a_check_finished = false)
Todo:
move to code manager

Definition at line 3836 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $res, getSurveyId(), and isSurveyFinishedByCode().

Referenced by sendCodes().

3838  : array {
3839  $ilDB = $this->db;
3840  $result = $ilDB->queryF(
3841  "SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
3842  array('integer'),
3843  array($this->getSurveyId())
3844  );
3845  $res = array();
3846  while ($row = $ilDB->fetchAssoc($result)) {
3847  if (!$row['externaldata']) {
3848  continue;
3849  }
3850 
3851  $externaldata = unserialize((string) $row['externaldata'], ['allowed_classes' => false]);
3852  if (!$externaldata['email']) {
3853  continue;
3854  }
3855 
3856  $externaldata['code'] = $row['code'];
3857  $externaldata['sent'] = $row['sent'];
3858 
3859  if ($a_check_finished) {
3860  #23294
3861  //$externaldata['finished'] = $this->isSurveyCodeUsed($row['code']);
3862  $externaldata['finished'] = $this->isSurveyFinishedByCode($row['code']);
3863  }
3864 
3865  $res[] = $externaldata;
3866  }
3867  return $res;
3868  }
$res
Definition: ltiservices.php:66
isSurveyFinishedByCode(string $a_code)
Get if survey is finished for a specific anonymous user code.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFinishedIdForAppraiseeIdAndRaterId()

ilObjSurvey::getFinishedIdForAppraiseeIdAndRaterId ( int  $a_appr_id,
int  $a_rat_id 
)

Get finished id for an appraisee and a rater.

Todo:
move to run manager

Definition at line 4828 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and null.

Referenced by deleteRater().

4831  : ?int {
4832  $ilDB = $this->db;
4833 
4834  $set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished" .
4835  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4836  " AND appr_id = " . $ilDB->quote($a_appr_id, "integer") .
4837  " AND user_fi = " . $ilDB->quote($a_rat_id, "integer"));
4838  if ($row = $ilDB->fetchAssoc($set)) {
4839  return (int) $row["finished_id"];
4840  }
4841  return null;
4842  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getFinishedIdsForAppraiseeId()

ilObjSurvey::getFinishedIdsForAppraiseeId ( int  $a_appr_id,
bool  $a_exclude_appraisee = false 
)
Returns
int[]
Todo:
move to run manager

Definition at line 4803 of file class.ilObjSurvey.php.

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

4806  : array {
4807  $ilDB = $this->db;
4808 
4809  $res = array();
4810 
4811  $set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished" .
4812  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4813  " AND appr_id = " . $ilDB->quote($a_appr_id, "integer"));
4814  while ($row = $ilDB->fetchAssoc($set)) {
4815  if ($a_exclude_appraisee && $row["user_fi"] == $a_appr_id) {
4816  continue;
4817  }
4818  $res[] = (int) $row["finished_id"];
4819  }
4820 
4821  return $res;
4822  }
$res
Definition: ltiservices.php:66
ilDBInterface $db
+ Here is the call graph for this function:

◆ getImportDirectory()

ilObjSurvey::getImportDirectory ( )

get import directory of survey

Todo:
move to export sub-service

Definition at line 3509 of file class.ilObjSurvey.php.

References ilFileUtils\getDataDir(), ilObject\getId(), and ilFileUtils\makeDirParents().

Referenced by delete(), and importObject().

3509  : string
3510  {
3511  $import_dir = ilFileUtils::getDataDir() . "/svy_data" .
3512  "/svy_" . $this->getId() . "/import";
3513  if (!is_dir($import_dir)) {
3514  ilFileUtils::makeDirParents($import_dir);
3515  }
3516  if (is_dir($import_dir)) {
3517  return $import_dir;
3518  } else {
3519  return "";
3520  }
3521  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIntroduction()

ilObjSurvey::getIntroduction ( )

Definition at line 1318 of file class.ilObjSurvey.php.

References $introduction.

Referenced by importObject(), saveToDb(), and toXML().

1318  : string
1319  {
1320  return $this->introduction;
1321  }
+ Here is the caller graph for this function:

◆ getLastAccess()

ilObjSurvey::getLastAccess ( int  $finished_id)
Todo:
move to run manager

Definition at line 3955 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and null.

3957  : ?int {
3958  $ilDB = $this->db;
3959 
3960  $result = $ilDB->queryF(
3961  "SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
3962  array('integer'),
3963  array($finished_id)
3964  );
3965  if ($result->numRows()) {
3966  $row = $ilDB->fetchAssoc($result);
3967  return (int) $row["tstamp"];
3968  } else {
3969  $result = $ilDB->queryF(
3970  "SELECT tstamp FROM svy_finished WHERE finished_id = %s",
3971  array('integer'),
3972  array($finished_id)
3973  );
3974  if ($result->numRows()) {
3975  $row = $ilDB->fetchAssoc($result);
3976  return (int) $row["tstamp"];
3977  }
3978  }
3979  return null;
3980  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db

◆ getLastActivePage()

ilObjSurvey::getLastActivePage ( int  $active_id)

Returns the question id of the last active page a user visited in a survey.

Todo:
move to run manager/repo

Definition at line 2549 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and null.

2551  : ?int {
2552  $ilDB = $this->db;
2553  $result = $ilDB->queryF(
2554  "SELECT lastpage FROM svy_finished WHERE finished_id = %s",
2555  array('integer'),
2556  array($active_id)
2557  );
2558  if ($row = $ilDB->fetchAssoc($result)) {
2559  return (int) $row["lastpage"];
2560  }
2561  return null;
2562  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db

◆ getMailAddresses()

ilObjSurvey::getMailAddresses ( )

(Tutor) Recipients of "single participant has finished" mails

Definition at line 4112 of file class.ilObjSurvey.php.

References $mailaddresses.

Referenced by importObject(), and saveToDb().

4112  : string
4113  {
4114  return $this->mailaddresses;
4115  }
+ Here is the caller graph for this function:

◆ getMailNotification()

ilObjSurvey::getMailNotification ( )

Send mail to tutors each time a participant finishes the survey?

Definition at line 4096 of file class.ilObjSurvey.php.

References $mailnotification.

Referenced by importObject(), and saveToDb().

4096  : bool
4097  {
4098  return $this->mailnotification;
4099  }
+ Here is the caller graph for this function:

◆ getMailParticipantData()

ilObjSurvey::getMailParticipantData ( )

Preceding text (incl.

placeholders) for "single participant has finished" mails

Definition at line 4128 of file class.ilObjSurvey.php.

References $mailparticipantdata.

Referenced by importObject(), and saveToDb().

4128  : string
4129  {
4131  }
string $mailparticipantdata
+ Here is the caller graph for this function:

◆ getMaxSumScore()

ilObjSurvey::getMaxSumScore ( )

Definition at line 5637 of file class.ilObjSurvey.php.

References $c, ilObjSurveyQuestionPool\_getQuestionClasses(), and getSurveyId().

5637  : int
5638  {
5639  $sum_score = 0;
5641  $sum_score += call_user_func([$c, "getMaxSumScore"], $this->getSurveyId());
5642  }
5643  return $sum_score;
5644  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ getMode()

◆ getNextPage()

ilObjSurvey::getNextPage ( int  $active_page_question_id,
int  $direction 
)

Get current, previous or next page.

Parameters
int$active_page_question_idThe database id of one of the questions on that page
int$directionThe direction of the next page (-1 = previous page, 1 = next page)
Returns
?array question data or null, if there is no previous/next page
Exceptions
ilSurveyException
Todo:
move to execution manager

Definition at line 1996 of file class.ilObjSurvey.php.

References getSurveyPages(), and null.

1999  : ?array {
2000  $foundpage = -1;
2001  $pages = $this->getSurveyPages();
2002  if ($active_page_question_id === 0) {
2003  return $pages[0];
2004  }
2005  foreach ($pages as $key => $question_array) {
2006  foreach ($question_array as $question) {
2007  if ($active_page_question_id == $question["question_id"]) {
2008  $foundpage = $key;
2009  }
2010  }
2011  }
2012  if ($foundpage === -1) {
2013  throw new ilSurveyException("nextPage: Current page not found.");
2014  } else {
2015  $foundpage += $direction;
2016  if ($foundpage < 0) {
2017  return null;
2018  }
2019  if ($foundpage >= count($pages)) {
2020  return null;
2021  }
2022  return $pages[$foundpage];
2023  }
2024  }
getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getNotificationTargetUserIds()

ilObjSurvey::getNotificationTargetUserIds ( bool  $a_use_invited)

These users must finish the survey to trigger the tutor notification "all users finished the survey" a) members of a parent group/course or b) all members that have been invited (svy_invitation) invitations are presented as tasks on the dashboard.

Definition at line 5257 of file class.ilObjSurvey.php.

References ilObject\$tree, ilObject\_lookupObjId(), ilTree\checkForParentType(), ilObject\getRefId(), and getSurveyId().

Referenced by checkReminder(), and checkTutorNotification().

5259  : array {
5260  $tree = $this->tree;
5261 
5262  $user_ids = [];
5263  if ($a_use_invited) {
5264  $user_ids = $this->invitation_manager->getAllForSurvey($this->getSurveyId());
5265  } else {
5266  $parent_grp_ref_id = $tree->checkForParentType($this->getRefId(), "grp");
5267  if ($parent_grp_ref_id) {
5268  $part = new ilGroupParticipants(ilObject::_lookupObjId($parent_grp_ref_id));
5269  $user_ids = $part->getMembers();
5270  } else {
5271  $parent_crs_ref_id = $tree->checkForParentType($this->getRefId(), "crs");
5272  if ($parent_crs_ref_id) {
5273  $part = new ilCourseParticipants(ilObject::_lookupObjId($parent_crs_ref_id));
5274  $user_ids = $part->getMembers();
5275  }
5276  }
5277  }
5278  return $user_ids;
5279  }
ilTree $tree
static _lookupObjId(int $ref_id)
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOutro()

ilObjSurvey::getOutro ( )

Definition at line 1323 of file class.ilObjSurvey.php.

References $outro.

Referenced by importObject(), saveToDb(), and toXML().

1323  : string
1324  {
1325  return $this->outro;
1326  }
+ Here is the caller graph for this function:

◆ getParticipantTextResults()

ilObjSurvey::getParticipantTextResults ( int  $active_id)
protected

Definition at line 2485 of file class.ilObjSurvey.php.

References getSurveyQuestions(), and getUserSpecificResults().

Referenced by sendNotificationMail().

2487  : string {
2488  $textresult = "";
2489  $userResults = $this->getUserSpecificResults(array($active_id));
2490  $questions = $this->getSurveyQuestions(true);
2491  $questioncounter = 1;
2492  foreach ($questions as $question_id => $question_data) {
2493  $textresult .= $questioncounter++ . ". " . $question_data["title"] . "\n";
2494  $found = $userResults[$question_id][$active_id];
2495  $text = "";
2496  if (is_array($found)) {
2497  $text = implode("\n", $found);
2498  } else {
2499  $text = $found;
2500  }
2501  if ($text === '') {
2502  $text = self::getSurveySkippedValue();
2503  }
2504  $text = str_replace("<br />", "\n", $text);
2505  $textresult .= $text . "\n\n";
2506  }
2507  return $textresult;
2508  }
getSurveyQuestions(bool $with_answers=false)
Returns the survey questions and questionblocks in an array.
getUserSpecificResults(array $finished_ids)
Calculates the evaluation data for the user specific results.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPoolUsage()

ilObjSurvey::getPoolUsage ( )

Definition at line 4172 of file class.ilObjSurvey.php.

References $pool_usage.

4172  : bool
4173  {
4174  return $this->pool_usage;
4175  }

◆ getPrecondition()

ilObjSurvey::getPrecondition ( int  $constraint_id)

Returns a precondition with a given id.

Todo:
move to constraint manager, introduce dto

Definition at line 2042 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2044  : array {
2045  $ilDB = $this->db;
2046 
2047  $result = $ilDB->queryF(
2048  "SELECT svy_constraint.*, svy_relation.*, svy_qst_constraint.question_fi ref_question_fi FROM svy_qst_constraint, svy_constraint, " .
2049  "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2050  "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2051  array('integer'),
2052  array($constraint_id)
2053  );
2054  $pc = array();
2055  if ($result->numRows()) {
2056  $pc = $ilDB->fetchAssoc($result);
2057  }
2058  return $pc;
2059  }
ilDBInterface $db

◆ getQuestionblockQuestionIds()

ilObjSurvey::getQuestionblockQuestionIds ( int  $questionblock_id)
Parameters
int$questionblock_id
Returns
int[]
Todo:
move to survey question manager/repo

Definition at line 1629 of file class.ilObjSurvey.php.

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

1631  : array {
1632  $ilDB = $this->db;
1633 
1634  // we need a correct order here, see #22011
1635  $result = $ilDB->queryF(
1636  "SELECT a.question_fi FROM svy_qblk_qst a JOIN svy_svy_qst b ON (a.question_fi = b.question_fi) " .
1637  " WHERE a.questionblock_fi = %s ORDER BY b.sequence",
1638  array("integer"),
1639  array($questionblock_id)
1640  );
1641  $ids = array();
1642  if ($result->numRows()) {
1643  while ($data = $ilDB->fetchAssoc($result)) {
1644  if (!in_array($data['question_fi'], $ids)) { // no duplicates, see #22018
1645  $ids[] = (int) $data['question_fi'];
1646  }
1647  }
1648  }
1649  return $ids;
1650  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ getQuestionblockQuestions()

ilObjSurvey::getQuestionblockQuestions ( int  $questionblock_id)
Parameters
int$questionblock_id
Returns
string[] question titles
Todo:
move to survey question manager/repo

Definition at line 1592 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

Referenced by getQuestionblocksTable().

1594  : array {
1595  $ilDB = $this->db;
1596  $titles = array();
1597  $result = $ilDB->queryF(
1598  "SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM " .
1599  "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
1600  "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
1601  array('integer'),
1602  array($questionblock_id)
1603  );
1604  $survey_id = "";
1605  while ($row = $ilDB->fetchAssoc($result)) {
1606  $titles[$row["question_fi"]] = $row["title"];
1607  $survey_id = $row["survey_fi"];
1608  }
1609  $result = $ilDB->queryF(
1610  "SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1611  array('integer'),
1612  array($survey_id)
1613  );
1614  $resultarray = array();
1615  $counter = 1;
1616  while ($row = $ilDB->fetchAssoc($result)) {
1617  if (array_key_exists($row["question_fi"], $titles)) {
1618  $resultarray[$counter++] = $titles[$row["question_fi"]];
1619  }
1620  }
1621  return $resultarray;
1622  }
int $survey_id
A unique positive numerical ID which identifies the survey.
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getQuestionblocksTable()

ilObjSurvey::getQuestionblocksTable ( array  $arrFilter)

Retrieve data for question block browser.

Todo:
move to survey question manager, use dto

Definition at line 2879 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $survey_id, ilUtil\_getObjectsByOperations(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and getQuestionblockQuestions().

Referenced by ilSurveyQuestionblockbrowserTableGUI\initData().

2881  : array {
2882  $ilDB = $this->db;
2883 
2884  $where = "";
2885  if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'])) {
2886  $where .= " AND " . $ilDB->like('svy_qblk.title', 'text', "%%" . $arrFilter['title'] . "%%");
2887  }
2888 
2889  $query_result = $ilDB->query("SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE " .
2890  "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi " .
2891  "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, " .
2892  "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
2893  $rows = array();
2894  if ($query_result->numRows()) {
2895  $survey_ref_ids = ilUtil::_getObjectsByOperations("svy", "write");
2896  $surveytitles = array();
2897  foreach ($survey_ref_ids as $survey_ref_id) {
2898  $survey_id = ilObject::_lookupObjId($survey_ref_id);
2899  $surveytitles[$survey_id] = ilObject::_lookupTitle($survey_id);
2900  }
2901  while ($row = $ilDB->fetchAssoc($query_result)) {
2902  $questions_array = $this->getQuestionblockQuestions($row["questionblock_id"]);
2903  $counter = 1;
2904  foreach ($questions_array as $key => $value) {
2905  $questions_array[$key] = "$counter. $value";
2906  $counter++;
2907  }
2908  if (strlen($surveytitles[$row["obj_fi"]] ?? "")) { // only questionpools which are not in trash
2909  $rows[$row["questionblock_id"]] = array(
2910  "questionblock_id" => $row["questionblock_id"],
2911  "title" => $row["title"],
2912  "svy" => $surveytitles[$row["obj_fi"]],
2913  "contains" => implode(", ", $questions_array),
2914  "owner" => $row["owner_fi"]
2915  );
2916  }
2917  }
2918  }
2919  return $rows;
2920  }
int $survey_id
A unique positive numerical ID which identifies the survey.
static _lookupObjId(int $ref_id)
getQuestionblockQuestions(int $questionblock_id)
static _lookupTitle(int $obj_id)
ilDBInterface $db
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, instead it parses the serialized rbac_pa entries.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionGUI()

ilObjSurvey::getQuestionGUI ( string  $questiontype,
int  $question_id 
)

Definition at line 899 of file class.ilObjSurvey.php.

References SurveyQuestionGUI\_getQuestionGUI().

Referenced by duplicateQuestionForSurvey().

903  return SurveyQuestionGUI::_getQuestionGUI($questiontype, $question_id);
904  }
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionpoolTitles()

ilObjSurvey::getQuestionpoolTitles ( bool  $could_be_offline = false,
bool  $showPath = false 
)

Returns the available question pools for the active user.

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

Definition at line 1354 of file class.ilObjSurvey.php.

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

1357  : array {
1358  return ilObjSurveyQuestionPool::_getAvailableQuestionpools(true, $could_be_offline, $showPath);
1359  }
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.
+ Here is the call graph for this function:

◆ getQuestionsTable()

ilObjSurvey::getQuestionsTable ( array  $arrFilter)

Retrieve data for question browser.

Todo:
move to survey question manager, use dto

Definition at line 2817 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), getAvailableQuestionpools(), and getExistingQuestions().

Referenced by ilSurveyQuestionbrowserTableGUI\initData().

2819  : array {
2820  $ilDB = $this->db;
2821  $where = "";
2822  if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'])) {
2823  $where .= " AND " . $ilDB->like('svy_question.title', 'text', "%%" . $arrFilter['title'] . "%%");
2824  }
2825  if (array_key_exists('description', $arrFilter) && strlen($arrFilter['description'])) {
2826  $where .= " AND " . $ilDB->like('svy_question.description', 'text', "%%" . $arrFilter['description'] . "%%");
2827  }
2828  if (array_key_exists('author', $arrFilter) && strlen($arrFilter['author'])) {
2829  $where .= " AND " . $ilDB->like('svy_question.author', 'text', "%%" . $arrFilter['author'] . "%%");
2830  }
2831  if (array_key_exists('type', $arrFilter) && strlen($arrFilter['type'])) {
2832  $where .= " AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter['type'], 'text');
2833  }
2834  if (array_key_exists('spl', $arrFilter) && strlen($arrFilter['spl'])) {
2835  $where .= " AND svy_question.obj_fi = " . $ilDB->quote($arrFilter['spl'], 'integer');
2836  }
2837 
2838  $spls = $this->getAvailableQuestionpools(true, false, false);
2839  $forbidden = " AND " . $ilDB->in('svy_question.obj_fi', array_keys($spls), false, 'integer');
2840  $forbidden .= " AND svy_question.complete = " . $ilDB->quote("1", 'text');
2841  $existing = "";
2842  $existing_questions = $this->getExistingQuestions();
2843  if (count($existing_questions)) {
2844  $existing = " AND " . $ilDB->in('svy_question.question_id', $existing_questions, true, 'integer');
2845  }
2846 
2848 
2849  $query_result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id" .
2850  " FROM svy_question, svy_qtype, object_reference" .
2851  " WHERE svy_question.original_id IS NULL" . $forbidden . $existing .
2852  " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0" .
2853  " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
2854 
2855  $rows = array();
2856  if ($query_result->numRows()) {
2857  while ($row = $ilDB->fetchAssoc($query_result)) {
2858  if (array_key_exists('spl_txt', $arrFilter) && strlen($arrFilter['spl_txt'])) {
2859  if (stripos($spls[$row["obj_fi"]], $arrFilter['spl_txt']) === false) {
2860  continue;
2861  }
2862  }
2863 
2864  $row['ttype'] = $trans[$row['type_tag']];
2865  if ($row["plugin"]) {
2866  continue;
2867  } else {
2868  $rows[] = $row;
2869  }
2870  }
2871  }
2872  return $rows;
2873  }
getExistingQuestions()
Gets the question id&#39;s of the questions which are already in the survey.
ilDBInterface $db
getAvailableQuestionpools(bool $use_obj_id=false, bool $could_be_offline=false, bool $showPath=false, string $permission="read")
Returns the available question pools for the active user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionType()

ilObjSurvey::getQuestionType ( int  $question_id)

Definition at line 907 of file class.ilObjSurvey.php.

References $data, ilObject\$db, and $ilDB.

Referenced by duplicateQuestionForSurvey().

909  : string {
910  $ilDB = $this->db;
911  if ($question_id < 1) {
912  return -1;
913  }
914  $result = $ilDB->queryF(
915  "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
916  "svy_question.questiontype_fi = svy_qtype.questiontype_id",
917  array('integer'),
918  array($question_id)
919  );
920  if ($result->numRows() === 1) {
921  $data = $ilDB->fetchAssoc($result);
922  return $data["type_tag"];
923  } else {
924  return "";
925  }
926  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getRatersData()

ilObjSurvey::getRatersData ( int  $a_appraisee_id)
Todo:
move to appraisal manager

Definition at line 4562 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, $res, ilObjUser\_lookupEmail(), ilObjUser\_lookupName(), getSurveyCodesTableData(), is360SurveyStarted(), and null.

Referenced by finishSurvey(), getAppraiseesData(), and sent360Reminders().

4564  : array {
4565  $ilDB = $this->db;
4566 
4567  $res = $anonymous_ids = array();
4568 
4569  $set = $ilDB->query("SELECT * FROM svy_360_rater" .
4570  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4571  " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer"));
4572  while ($row = $ilDB->fetchAssoc($set)) {
4573  if ($row["anonymous_id"]) {
4574  $res["a" . $row["anonymous_id"]] = array(
4575  "lastname" => "unknown code " . $row["anonymous_id"],
4576  "sent" => $row["mail_sent"],
4577  "finished" => null
4578  );
4579  $anonymous_ids[] = $row["anonymous_id"];
4580  } else {
4581  $name = ilObjUser::_lookupName($row["user_id"]);
4582  $name["name"] = $name["lastname"] . ", " . $name["firstname"];
4583  $name["user_id"] = "u" . $name["user_id"];
4584  $name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
4585  $name["sent"] = $row["mail_sent"];
4586  $name["finished"] = (bool) $this->is360SurveyStarted($a_appraisee_id, (int) $row["user_id"]);
4587  $res["u" . $row["user_id"]] = $name;
4588  }
4589  }
4590 
4591  if (count($anonymous_ids)) {
4592  $data = $this->getSurveyCodesTableData($anonymous_ids);
4593  foreach ($data as $item) {
4594  if (isset($res["a" . $item["id"]])) {
4595  $res["a" . $item["id"]] = array(
4596  "user_id" => "a" . $item["id"],
4597  "lastname" => $item["last_name"],
4598  "firstname" => $item["first_name"],
4599  "name" => $item["last_name"] . ", " . $item["first_name"],
4600  "login" => "",
4601  "email" => $item["email"],
4602  "code" => $item["code"],
4603  "href" => $item["href"],
4604  "sent" => $res["a" . $item["id"]]["sent"],
4605  "finished" => (bool) $this->is360SurveyStarted($a_appraisee_id, 0, $item["code"])
4606  );
4607  }
4608  }
4609  }
4610 
4611  return $res;
4612  }
$res
Definition: ltiservices.php:66
getSurveyCodesTableData(?array $ids=null, ?string $lang=null)
Fetches the data for the survey codes table.
is360SurveyStarted(int $appr_id, int $user_id, ?string $anonymous_code=null)
static _lookupName(int $a_user_id)
lookup user name
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
static _lookupEmail(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReminderEnd()

ilObjSurvey::getReminderEnd ( )

Definition at line 4990 of file class.ilObjSurvey.php.

References $reminder_end.

Referenced by checkReminder(), importObject(), and saveToDb().

4990  : ?ilDate
4991  {
4992  return $this->reminder_end;
4993  }
+ Here is the caller graph for this function:

◆ getReminderFrequency()

ilObjSurvey::getReminderFrequency ( )

Definition at line 5000 of file class.ilObjSurvey.php.

References $reminder_frequency.

Referenced by checkReminder(), importObject(), and saveToDb().

5000  : int
5001  {
5003  }
+ Here is the caller graph for this function:

◆ getReminderLastSent()

ilObjSurvey::getReminderLastSent ( )

Definition at line 5020 of file class.ilObjSurvey.php.

References $reminder_last_sent.

Referenced by checkReminder(), and saveToDb().

5020  : ?string
5021  {
5023  }
string $reminder_last_sent
+ Here is the caller graph for this function:

◆ getReminderMailTemplates()

ilObjSurvey::getReminderMailTemplates ( ?int &  $defaultTemplateId = null)

Definition at line 5546 of file class.ilObjSurvey.php.

References $DIC, $res, ilSurveyMailTemplateReminderContext\ID, and null.

Referenced by checkReminder(), and getReminderTemplate().

5548  : array {
5549  global $DIC;
5550 
5551  $res = array();
5552 
5553  $templateService = $DIC->mail()->textTemplates();
5554  foreach ($templateService->loadTemplatesForContextId(ilSurveyMailTemplateReminderContext::ID) as $tmpl) {
5555  $res[$tmpl->getTplId()] = $tmpl->getTitle();
5556  if (null !== $defaultTemplateId && $tmpl->isDefault()) {
5557  $defaultTemplateId = $tmpl->getTplId();
5558  }
5559  }
5560 
5561  return $res;
5562  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getReminderStart()

ilObjSurvey::getReminderStart ( )

Definition at line 4980 of file class.ilObjSurvey.php.

References $reminder_start.

Referenced by checkReminder(), importObject(), and saveToDb().

4980  : ?ilDate
4981  {
4982  return $this->reminder_start;
4983  }
+ Here is the caller graph for this function:

◆ getReminderStatus()

ilObjSurvey::getReminderStatus ( )

Definition at line 4970 of file class.ilObjSurvey.php.

References $reminder_status.

Referenced by checkReminder(), importObject(), and saveToDb().

4970  : bool
4971  {
4972  return $this->reminder_status;
4973  }
+ Here is the caller graph for this function:

◆ getReminderTarget()

ilObjSurvey::getReminderTarget ( )

◆ getReminderTemplate()

ilObjSurvey::getReminderTemplate ( bool  $selectDefault = false)

Definition at line 5033 of file class.ilObjSurvey.php.

References $reminder_tmpl, and getReminderMailTemplates().

Referenced by checkReminder(), importObject(), and saveToDb().

5035  : ?int {
5036  if ($selectDefault) {
5037  $defaultTemplateId = 0;
5038  $this->getReminderMailTemplates($defaultTemplateId);
5039 
5040  if ($defaultTemplateId > 0) {
5041  return $defaultTemplateId;
5042  }
5043  }
5044 
5045  return $this->reminder_tmpl;
5046  }
getReminderMailTemplates(?int &$defaultTemplateId=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelfEvaluationResults()

ilObjSurvey::getSelfEvaluationResults ( )

Definition at line 5598 of file class.ilObjSurvey.php.

References $mode_self_eval_results.

Referenced by ILIAS\Survey\Mode\SelfEvaluation\UIModifier\getSurveySettingsResults(), saveToDb(), and toXML().

5598  : int
5599  {
5601  }
+ Here is the caller graph for this function:

◆ getShowQuestionTitles()

ilObjSurvey::getShowQuestionTitles ( )

Definition at line 1161 of file class.ilObjSurvey.php.

References $display_question_titles.

Referenced by importObject(), saveToDb(), and toXML().

1161  : bool
1162  {
1163  return (bool) $this->display_question_titles;
1164  }
int $display_question_titles
+ Here is the caller graph for this function:

◆ getSkillService()

ilObjSurvey::getSkillService ( )

Definition at line 4852 of file class.ilObjSurvey.php.

References $mode_skill_service.

Referenced by closeAppraisee(), importObject(), saveToDb(), and toXML().

4852  : bool
4853  {
4855  }
+ Here is the caller graph for this function:

◆ getStartDate()

ilObjSurvey::getStartDate ( )

Definition at line 1183 of file class.ilObjSurvey.php.

References $start_date.

Referenced by checkReminder(), hasStarted(), importObject(), saveToDb(), and toXML().

1183  : string
1184  {
1185  return $this->start_date;
1186  }
+ Here is the caller graph for this function:

◆ getSurveyCodesForExport()

ilObjSurvey::getSurveyCodesForExport ( ?array  $a_codes = null,
?array  $a_ids = null 
)

Return a list of survey codes for file export, note: user_key needs to be null to export a record.

Parameters
?string[]$a_codes array of all survey codes that should be exported, if null...
?int[]$a_ids array of anonymous ids that should be exported
Returns
string comma separated list of survey codes an URLs for file export
Todo:
move to code manager
Exceptions
ilDateTimeException

Definition at line 3573 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObject\$lng, $params, $user, ilObject\getRefId(), getSurveyId(), IL_CAL_DATETIME, IL_CAL_UNIX, isSurveyCodeUsed(), and ilLanguage\txt().

3576  : string {
3577  $ilDB = $this->db;
3578  $ilUser = $this->user;
3579  $lng = $this->lng;
3580 
3581  $sql = "SELECT svy_anonymous.*, svy_finished.state" .
3582  " FROM svy_anonymous" .
3583  " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
3584  " WHERE svy_anonymous.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
3585  " AND svy_anonymous.user_key IS NULL";
3586 
3587  if ($a_codes) {
3588  $sql .= " AND " . $ilDB->in("svy_anonymous.survey_key", $a_codes, "", "text");
3589  } elseif ($a_ids) {
3590  $sql .= " AND " . $ilDB->in("svy_anonymous.anonymous_id", $a_ids, "", "text");
3591  }
3592 
3593  $export = array();
3594 
3595  // #14905
3596  $titles = array();
3597  $titles[] = '"' . $lng->txt("survey_code") . '"';
3598  $titles[] = '"' . $lng->txt("email") . '"';
3599  $titles[] = '"' . $lng->txt("lastname") . '"';
3600  $titles[] = '"' . $lng->txt("firstname") . '"';
3601  $titles[] = '"' . $lng->txt("create_date") . '"';
3602  $titles[] = '"' . $lng->txt("used") . '"';
3603  $titles[] = '"' . $lng->txt("mail_sent_short") . '"';
3604  $titles[] = '"' . $lng->txt("survey_code_url") . '"';
3605  $export[] = implode(";", $titles);
3606 
3607  $result = $ilDB->query($sql);
3608  $default_lang = $ilUser->getPref("survey_code_language");
3609  while ($row = $ilDB->fetchAssoc($result)) {
3610  $item = array();
3611  $item[] = $row["survey_key"];
3612 
3613  if ($row["externaldata"]) {
3614  $ext = unserialize((string) $row["externaldata"], ['allowed_classes' => false]);
3615  $item[] = $ext["email"];
3616  $item[] = $ext["lastname"];
3617  $item[] = $ext["firstname"];
3618  } else {
3619  $item[] = "";
3620  $item[] = "";
3621  $item[] = "";
3622  }
3623 
3624  // No relative (today, tomorrow...) dates in export.
3625  $date = new ilDateTime($row['tstamp'], IL_CAL_UNIX);
3626  $item[] = $date->get(IL_CAL_DATETIME);
3627 
3628  $item[] = ($this->isSurveyCodeUsed($row["survey_key"])) ? 1 : 0;
3629  $item[] = ($row["sent"]) ? 1 : 0;
3630 
3631  $params = array("accesscode" => $row["survey_key"]);
3632  if ($default_lang) {
3633  $params["lang"] = $default_lang;
3634  }
3635  $item[] = ilLink::_getLink($this->getRefId(), "svy", $params);
3636 
3637  $export[] = '"' . implode('";"', $item) . '"';
3638  }
3639  return implode("\n", $export);
3640  }
const IL_CAL_DATETIME
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
const IL_CAL_UNIX
isSurveyCodeUsed(string $code)
ilLanguage $lng
ilDBInterface $db
+ Here is the call graph for this function:

◆ getSurveyCodesTableData()

ilObjSurvey::getSurveyCodesTableData ( ?array  $ids = null,
?string  $lang = null 
)

Fetches the data for the survey codes table.

Parameters
?string$lang Language for the survey code URL
Todo:
move to code manager

Definition at line 3647 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $lang, $params, ilObject\getRefId(), getSurveyId(), and isSurveyCodeUsed().

Referenced by getRatersData().

3650  : array {
3651  $ilDB = $this->db;
3652 
3653  $codes = array();
3654 
3655  $sql = "SELECT svy_anonymous.*, svy_finished.state" .
3656  " FROM svy_anonymous" .
3657  " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
3658  " WHERE svy_anonymous.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") /*.
3659  " AND svy_anonymous.user_key IS NULL" */; // #15860
3660 
3661  if ($ids) {
3662  $sql .= " AND " . $ilDB->in("svy_anonymous.anonymous_id", $ids, "", "integer");
3663  }
3664 
3665  $sql .= " ORDER BY tstamp, survey_key ASC";
3666  $result = $ilDB->query($sql);
3667  if ($result->numRows() > 0) {
3668  while ($row = $ilDB->fetchAssoc($result)) {
3669  $href = "";
3670  $used = false;
3671  if ($this->isSurveyCodeUsed($row["survey_key"])) {
3672  $used = true;
3673  } else {
3674  $params = array("accesscode" => $row["survey_key"]);
3675  if ($lang) {
3676  $params["lang"] = $lang;
3677  }
3678  $href = ilLink::_getLink($this->getRefId(), "svy", $params);
3679  }
3680 
3681 
3682  $item = array(
3683  'id' => $row["anonymous_id"],
3684  'code' => $row["survey_key"],
3685  'date' => $row["tstamp"],
3686  'used' => $used,
3687  'sent' => $row['sent'],
3688  'href' => $href,
3689  'email' => '',
3690  'last_name' => '',
3691  'first_name' => ''
3692  );
3693 
3694  if ($row["externaldata"]) {
3695  $ext = unserialize((string) $row["externaldata"], ['allowed_classes' => false]);
3696  $item['email'] = $ext['email'] ?? "";
3697  $item['last_name'] = $ext['lastname'] ?? "";
3698  $item['first_name'] = $ext['firstname'] ?? "";
3699  }
3700 
3701  $codes[] = $item;
3702  }
3703  }
3704  return $codes;
3705  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
isSurveyCodeUsed(string $code)
ilDBInterface $db
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurveyFinishedIds()

ilObjSurvey::getSurveyFinishedIds ( )

Get run ids.

Todo:
move to run manager
Returns
int[]

Definition at line 2654 of file class.ilObjSurvey.php.

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

2654  : array
2655  {
2656  $ilDB = $this->db;
2657 
2658  $users = array();
2659  $result = $ilDB->queryF(
2660  "SELECT * FROM svy_finished WHERE survey_fi = %s",
2661  array('integer'),
2662  array($this->getSurveyId())
2663  );
2664  if ($result->numRows()) {
2665  while ($row = $ilDB->fetchAssoc($result)) {
2666  $users[] = (int) $row["finished_id"];
2667  }
2668  }
2669  return $users;
2670  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ getSurveyId()

ilObjSurvey::getSurveyId ( )

Definition at line 928 of file class.ilObjSurvey.php.

References $survey_id.

Referenced by ILIAS\Survey\Code\CodeManager\__construct(), ILIAS\Survey\Execution\RunManager\__construct(), addAppraisee(), addConstraintToQuestion(), addQuestionToBlock(), addRater(), closeAppraisee(), createQuestionblock(), deleteAllUserData(), deleteConstraints(), deleteSurveyCode(), deleteSurveyRecord(), finishSurvey(), fixSequenceStructure(), getActiveID(), getAppraiseesToRate(), getConstraints(), getExistingQuestions(), getExternalCodeRecipients(), ilSurveyParticipantsTableGUI\getItems(), getMaxSumScore(), getNotificationTargetUserIds(), getSurveyCodesForExport(), getSurveyCodesTableData(), getSurveyFinishedIds(), getSurveyPages(), getSurveyParticipants(), getSurveyQuestions(), ILIAS\Survey\Mode\Standard\UIModifier\getSurveySettingsResults(), getUserAccessCode(), getUserSurveyExecutionStatus(), importObject(), importSurveyCode(), insertQuestion(), insertQuestionblock(), is360SurveyStarted(), isAnonymizedParticipant(), isRater(), isSurveyCodeUnique(), isSurveyCodeUsed(), isSurveyFinishedByCode(), loadQuestionsFromDb(), openAllAppraisees(), removeConstraintsConcerningQuestion(), removeQuestionFromBlock(), removeQuestions(), removeSelectedSurveyResults(), saveCompletionStatus(), saveHeading(), saveQuestionsToDb(), saveToDb(), saveUserAccessCode(), sendCodes(), set360RaterSent(), setObligatoryStates(), ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm(), toXML(), and unfoldQuestionblocks().

928  : int
929  {
930  return $this->survey_id;
931  }
int $survey_id
A unique positive numerical ID which identifies the survey.
+ Here is the caller graph for this function:

◆ getSurveyPages()

ilObjSurvey::getSurveyPages ( )

Returns the survey pages in an array (a page contains one or more questions)

Todo:
move to survey question manager/repo, use dto

Definition at line 1911 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getConstraints(), and getSurveyId().

Referenced by getNextPage(), and toXML().

1911  : array
1912  {
1913  $ilDB = $this->db;
1914  // get questionblocks
1915  $all_questions = array();
1916  $result = $ilDB->queryF(
1917  "SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
1918  "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
1919  "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
1920  "ORDER BY svy_svy_qst.sequence",
1921  array('integer'),
1922  array($this->getSurveyId())
1923  );
1924  while ($row = $ilDB->fetchAssoc($result)) {
1925  $all_questions[$row["question_id"]] = $row;
1926  }
1927  // get all questionblocks
1928  $questionblocks = array();
1929  if (count($all_questions)) {
1930  $result = $ilDB->queryF(
1931  "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst " .
1932  "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
1933  "AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
1934  array('integer'),
1935  array($this->getSurveyId())
1936  );
1937  while ($row = $ilDB->fetchAssoc($result)) {
1938  $questionblocks[$row['question_fi']] = $row;
1939  }
1940  }
1941 
1942  $all_pages = array();
1943  $pageindex = -1;
1944  $currentblock = "";
1945  foreach ($all_questions as $question_id => $row) {
1946  $constraints = array();
1947  if (isset($questionblocks[$question_id])) {
1948  if (!$currentblock or ($currentblock != $questionblocks[$question_id]['questionblock_id'])) {
1949  $pageindex++;
1950  }
1951  $all_questions[$question_id]['page'] = $pageindex;
1952  $all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
1953  $all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
1954  $all_questions[$question_id]["questionblock_show_questiontext"] = $questionblocks[$question_id]['show_questiontext'];
1955  $all_questions[$question_id]["questionblock_show_blocktitle"] = $questionblocks[$question_id]['show_blocktitle'];
1956  $all_questions[$question_id]["questionblock_compress_view"] = $questionblocks[$question_id]['compress_view'];
1957  $currentblock = $questionblocks[$question_id]['questionblock_id'];
1958  } else {
1959  $pageindex++;
1960  $all_questions[$question_id]['page'] = $pageindex;
1961  $all_questions[$question_id]["questionblock_title"] = "";
1962  $all_questions[$question_id]["questionblock_id"] = "";
1963  $all_questions[$question_id]["questionblock_show_questiontext"] = 1;
1964  $all_questions[$question_id]["questionblock_show_blocktitle"] = 1;
1965  $all_questions[$question_id]["questionblock_compress_view"] = false;
1966  $currentblock = "";
1967  }
1968  $constraints = $this->getConstraints($question_id);
1969  $all_questions[$question_id]["constraints"] = $constraints;
1970  if (!isset($all_pages[$pageindex])) {
1971  $all_pages[$pageindex] = array();
1972  }
1973  $all_pages[$pageindex][] = $all_questions[$question_id];
1974  }
1975  // calculate position percentage for every page
1976  $max = count($all_pages);
1977  $counter = 1;
1978  foreach ($all_pages as $index => $block) {
1979  foreach ($block as $blockindex => $question) {
1980  $all_pages[$index][$blockindex]["position"] = $counter / $max;
1981  }
1982  $counter++;
1983  }
1984 
1985  return $all_pages;
1986  }
getConstraints(int $question_id)
Returns the constraints to a given question or questionblock.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurveyParticipants()

ilObjSurvey::getSurveyParticipants ( ?array  $finished_ids = null,
bool  $force_non_anonymous = false,
bool  $include_invites = false 
)
Todo:
move to run/participant manager/repo

Definition at line 451 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObjUser\_lookupFullname(), ilObjUser\_lookupName(), getSurveyId(), and getUserDataFromActiveId().

Referenced by ilSurveyParticipantsTableGUI\getItems().

455  : array {
456  $ilDB = $this->db;
457  $sql = "SELECT * FROM svy_finished" .
458  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer");
459  if ($finished_ids) {
460  $sql .= " AND " . $ilDB->in("finished_id", $finished_ids, "", "integer");
461  }
462 
463  $result = $ilDB->query($sql);
464  $participants = array();
465  if ($result->numRows() > 0) {
466  while ($row = $ilDB->fetchAssoc($result)) {
467  $userdata = $this->getUserDataFromActiveId($row["finished_id"], $force_non_anonymous);
468  $userdata["finished"] = (bool) $row["state"];
469  $userdata["finished_tstamp"] = $row["tstamp"];
470  $participants[$userdata["sortname"] . $userdata["active_id"]] = $userdata;
471  }
472  }
473  $participant_ids = array_column($participants, "usr_id");
474  if ($include_invites) {
475  foreach ($this->invitation_manager->getAllForSurvey($this->getSurveyId()) as $usr_id) {
476  if (!in_array($usr_id, $participant_ids)) {
477  $name = ilObjUser::_lookupName($usr_id);
478  $participants[$name["lastname"] . "," . $name["firstname"] . $usr_id] = [
479  "fullname" => ilObjUser::_lookupFullname($usr_id),
480  "sortname" => $name["lastname"] . "," . $name["firstname"],
481  "fistname" => $name["firstname"],
482  "lastname" => $name["lastname"],
483  "login" => $name["login"],
484  "gender" => "",
485  "usr_id" => $usr_id,
486  "finished" => false,
487  "finished_tstamp" => 0,
488  "invited" => true
489  ];
490  }
491  }
492  }
493  return $participants;
494  }
static _lookupFullname(int $a_user_id)
static _lookupName(int $a_user_id)
lookup user name
ilDBInterface $db
getUserDataFromActiveId(int $active_id, bool $force_non_anonymous=false)
Returns run information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurveyQuestions()

ilObjSurvey::getSurveyQuestions ( bool  $with_answers = false)

Returns the survey questions and questionblocks in an array.

Todo:
move to survey question manager/repo, use dto

Definition at line 1802 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, getConstraints(), and getSurveyId().

Referenced by getParticipantTextResults(), getUserSpecificResults(), SurveyConstraintsTableGUI\initItems(), and removeQuestions().

1804  : array {
1805  $ilDB = $this->db;
1806  // get questionblocks
1807  $all_questions = array();
1808  $result = $ilDB->queryF(
1809  "SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, " .
1810  "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
1811  "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
1812  "ORDER BY svy_svy_qst.sequence",
1813  array('integer'),
1814  array($this->getSurveyId())
1815  );
1816  while ($row = $ilDB->fetchAssoc($result)) {
1817  $add = true;
1818  if ($row["plugin"]) {
1819  $add = false;
1820  }
1821  if ($add) {
1822  $question = self::_instanciateQuestion($row["question_id"]);
1823  $questionrow = $question->getQuestionDataArray($row["question_id"]);
1824  foreach ($row as $key => $value) {
1825  $questionrow[$key] = $value;
1826  }
1827  $all_questions[$row["question_id"]] = $questionrow;
1828  $all_questions[$row["question_id"]]["usableForPrecondition"] = $question->usableForPrecondition();
1829  $all_questions[$row["question_id"]]["availableRelations"] = $question->getAvailableRelations();
1830  }
1831  }
1832  // get all questionblocks
1833  $questionblocks = array();
1834  if (count($all_questions)) {
1835  $result = $ilDB->queryF(
1836  "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
1837  "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
1838  "AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
1839  array('integer'),
1840  array($this->getSurveyId())
1841  );
1842  while ($row = $ilDB->fetchAssoc($result)) {
1843  $questionblocks[$row['question_fi']] = $row;
1844  }
1845  }
1846 
1847  foreach ($all_questions as $question_id => $row) {
1848  $constraints = $this->getConstraints($question_id);
1849  if (isset($questionblocks[$question_id])) {
1850  $all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
1851  $all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
1852  } else {
1853  $all_questions[$question_id]["questionblock_title"] = "";
1854  $all_questions[$question_id]["questionblock_id"] = "";
1855  }
1856  $all_questions[$question_id]["constraints"] = $constraints;
1857  if ($with_answers) {
1858  $answers = array();
1859  $result = $ilDB->queryF(
1860  "SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
1861  "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id " .
1862  "ORDER BY sequence ASC",
1863  array('integer'),
1864  array($question_id)
1865  );
1866  if ($result->numRows() > 0) {
1867  while ($data = $ilDB->fetchAssoc($result)) {
1868  $answers[] = $data["title"];
1869  }
1870  }
1871  $all_questions[$question_id]["answers"] = $answers;
1872  }
1873  }
1874  return $all_questions;
1875  }
getConstraints(int $question_id)
Returns the constraints to a given question or questionblock.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurveySkippedValue()

static ilObjSurvey::getSurveySkippedValue ( )
static

Definition at line 5530 of file class.ilObjSurvey.php.

References $DIC, ilObject\$lng, and ilLanguage\txt().

Referenced by ilSurveyResultsUserTableGUI\fillRow(), and SurveyQuestionEvaluation\getSkippedValue().

5530  : string
5531  {
5532  global $DIC;
5533 
5534  $lng = $DIC->language();
5535 
5536  // #13541
5537 
5538  $surveySetting = new ilSetting("survey");
5539  if (!$surveySetting->get("skipped_is_custom", false)) {
5540  return $lng->txt("skipped");
5541  } else {
5542  return $surveySetting->get("skipped_custom_value", "");
5543  }
5544  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurveysWithTutorResults()

static ilObjSurvey::getSurveysWithTutorResults ( )
static
Returns
int[]

Definition at line 5606 of file class.ilObjSurvey.php.

References $ilDB, ilObject\$log, $q, $res, ilLogger\debug(), ilLoggerFactory\getLogger(), and ILIAS\Repository\int().

5606  : array
5607  {
5608  global $ilDB;
5609 
5610  $res = array();
5611 
5613 
5614 
5615  $q = "SELECT obj_fi FROM svy_svy" .
5616  " WHERE tutor_res_cron IS NULL" .
5617  " AND tutor_res_status = " . $ilDB->quote(1, "integer") .
5618  " AND enddate < " . $ilDB->quote(date("Ymd000000"), "text");
5619 
5620  if (DEVMODE) {
5621  $q = "SELECT obj_fi FROM svy_svy" .
5622  " WHERE tutor_res_status = " . $ilDB->quote(1, "integer") .
5623  " AND enddate < " . $ilDB->quote(date("Ymd000000"), "text");
5624  }
5625 
5626  $set = $ilDB->query($q);
5627 
5628  $log->debug($q);
5629 
5630  while ($row = $ilDB->fetchAssoc($set)) {
5631  $res[] = (int) $row["obj_fi"];
5632  }
5633 
5634  return $res;
5635  }
$res
Definition: ltiservices.php:66
static getLogger(string $a_component_id)
Get component logger.
$q
Definition: shib_logout.php:21
ilLogger $log
debug(string $message, array $context=[])
+ Here is the call graph for this function:

◆ getTextblock()

ilObjSurvey::getTextblock ( int  $question_id)
Todo:
move to survey question manager

Definition at line 3407 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

Referenced by cloneTextblocks().

3409  : string {
3410  $ilDB = $this->db;
3411  $result = $ilDB->queryF(
3412  "SELECT * FROM svy_svy_qst WHERE question_fi = %s",
3413  array('integer'),
3414  array($question_id)
3415  );
3416  if ($row = $ilDB->fetchAssoc($result)) {
3417  return $row["heading"] ?? "";
3418  } else {
3419  return "";
3420  }
3421  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getTutorNotificationRecipients()

ilObjSurvey::getTutorNotificationRecipients ( )

Mail being sent to tutors after all participants have finished the survey?

Definition at line 5069 of file class.ilObjSurvey.php.

References $tutor_ntf_recipients.

Referenced by importObject(), saveToDb(), and sendTutorNotification().

5069  : array
5070  {
5072  }
array $tutor_ntf_recipients
+ Here is the caller graph for this function:

◆ getTutorNotificationStatus()

ilObjSurvey::getTutorNotificationStatus ( )

Definition at line 5053 of file class.ilObjSurvey.php.

References $tutor_ntf_status.

Referenced by checkTutorNotification(), importObject(), and saveToDb().

5053  : bool
5054  {
5055  return $this->tutor_ntf_status;
5056  }
+ Here is the caller graph for this function:

◆ getTutorNotificationTarget()

ilObjSurvey::getTutorNotificationTarget ( )

Group that is checked for the "all participants have finished" mail Either a) all members of a parent group/course or b) all users which have been invited (svy_invitation) (= task on dashboard)

Definition at line 5088 of file class.ilObjSurvey.php.

References $tutor_ntf_target.

Referenced by checkTutorNotification(), importObject(), and saveToDb().

5088  : int
5089  {
5090  return $this->tutor_ntf_target;
5091  }
+ Here is the caller graph for this function:

◆ getTutorResultsRecipients()

ilObjSurvey::getTutorResultsRecipients ( )

Definition at line 5108 of file class.ilObjSurvey.php.

References $tutor_res_recipients.

Referenced by importObject(), and saveToDb().

5108  : array
5109  {
5111  }
array $tutor_res_recipients
+ Here is the caller graph for this function:

◆ getTutorResultsStatus()

ilObjSurvey::getTutorResultsStatus ( )

Definition at line 5098 of file class.ilObjSurvey.php.

References $tutor_res_status.

Referenced by importObject(), and saveToDb().

5098  : bool
5099  {
5100  return $this->tutor_res_status;
5101  }
+ Here is the caller graph for this function:

◆ getUserAccessCode()

ilObjSurvey::getUserAccessCode ( int  $user_id)

Returns a survey access code that was saved for a registered user.

Parameters
int$user_idThe database id of the user
Returns
string The survey access code of the user
Todo:
move to code manager

Definition at line 3912 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3912  : string
3913  {
3914  $ilDB = $this->db;
3915  $access_code = "";
3916  $result = $ilDB->queryF(
3917  "SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
3918  array('integer','text'),
3919  array($this->getSurveyId(), md5($user_id))
3920  );
3921  if ($result->numRows()) {
3922  $row = $ilDB->fetchAssoc($result);
3923  $access_code = $row["survey_key"];
3924  }
3925  return $access_code;
3926  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ getUserData()

ilObjSurvey::getUserData ( array  $ids)

Returns a data of all users specified by id list.

Parameters
int[]$ids array of user id's
Returns
array The user data "usr_id, login, lastname, firstname, clientip" of the users with id as key
Todo:
use user service, remove direct access to usr_data table

Definition at line 4076 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

4078  : array {
4079  $ilDB = $this->db;
4080 
4081  if (count($ids) === 0) {
4082  return array();
4083  }
4084 
4085  $result = $ilDB->query("SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " . $ilDB->in('usr_id', $ids, false, 'integer') . " ORDER BY login");
4086  $result_array = array();
4087  while ($row = $ilDB->fetchAssoc($result)) {
4088  $result_array[$row["usr_id"]] = $row;
4089  }
4090  return $result_array;
4091  }
ilDBInterface $db

◆ getUserDataFromActiveId()

ilObjSurvey::getUserDataFromActiveId ( int  $active_id,
bool  $force_non_anonymous = false 
)

Returns run information.

Todo:
move to run manager/repo

Definition at line 2707 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, get360Mode(), ilObjUser\getFirstname(), ilObjUser\getFullname(), ilObjUser\getGender(), ilObjUser\getLastname(), ilObjUser\getLogin(), hasAnonymizedResults(), and ILIAS\Repository\lng().

Referenced by finishSurvey(), getEvaluationByUser(), and getSurveyParticipants().

2710  : array {
2711  $ilDB = $this->db;
2712 
2713  $surveySetting = new ilSetting("survey");
2714  $use_anonymous_id = $surveySetting->get("use_anonymous_id");
2715  $result = $ilDB->queryF(
2716  "SELECT * FROM svy_finished WHERE finished_id = %s",
2717  array('integer'),
2718  array($active_id)
2719  );
2720  $row = array();
2721  $foundrows = $result->numRows();
2722  if ($foundrows) {
2723  $row = $ilDB->fetchAssoc($result);
2724  }
2725  $name = ($use_anonymous_id) ? $row["anonymous_id"] : $this->lng->txt("anonymous");
2726  $userdata = array(
2727  "fullname" => $name,
2728  "sortname" => $name,
2729  "firstname" => "",
2730  "lastname" => "",
2731  "login" => "",
2732  "gender" => "",
2733  "active_id" => (string) $active_id
2734  );
2735  if ($foundrows) {
2736  if (($row["user_fi"] > 0) &&
2737  (($row["user_fi"] != ANONYMOUS_USER_ID &&
2738  !$this->hasAnonymizedResults() &&
2739  !$this->get360Mode()) || // 360° uses ANONYMIZE_CODE_ALL which is wrong - see ilObjSurveyGUI::afterSave()
2740  $force_non_anonymous)) {
2741  if (ilObjUser::_lookupLogin($row["user_fi"]) === '') {
2742  $userdata["fullname"] = $userdata["sortname"] = $this->lng->txt("deleted_user");
2743  } else {
2744  $user = new ilObjUser($row["user_fi"]);
2745  $userdata['usr_id'] = $row['user_fi'];
2746  $userdata["fullname"] = $user->getFullname();
2747  $gender = $user->getGender();
2748  if (strlen($gender) === 1) {
2749  $gender = $this->lng->txt("gender_$gender");
2750  }
2751  $userdata["gender"] = $gender;
2752  $userdata["firstname"] = $user->getFirstname();
2753  $userdata["lastname"] = $user->getLastname();
2754  $userdata["sortname"] = $user->getLastname() . ", " . $user->getFirstname();
2755  $userdata["login"] = $user->getLogin();
2756  }
2757  }
2758  if ($row["user_fi"] == 0 || $row["user_fi"] == ANONYMOUS_USER_ID) {
2759  $code = $this->code_manager->getByUserKey((string) $row["anonymous_id"]);
2760  if (!is_null($code) && $this->feature_config->usesAppraisees()) {
2761  $userdata["firstname"] = $code->getFirstName();
2762  $userdata["lastname"] = $code->getLastName();
2763  $userdata["sortname"] = $code->getLastName() . ", " . $code->getFirstName();
2764  }
2765  }
2766  }
2767  return $userdata;
2768  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
getFullname(int $a_max_strlen=0)
ilDBInterface $db
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserSettings()

ilObjSurvey::getUserSettings ( int  $usr_id,
string  $key 
)

Definition at line 675 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

678  : array {
679  $ilDB = $this->db;
680 
681  $result = $ilDB->queryF(
682  "SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
683  array('integer', 'text'),
684  array($usr_id, $key)
685  );
686  $found = array();
687  if ($result->numRows()) {
688  while ($row = $ilDB->fetchAssoc($result)) {
689  $found[$row['settings_id']] = $row;
690  }
691  }
692  return $found;
693  }
ilDBInterface $db

◆ getUserSpecificResults()

ilObjSurvey::getUserSpecificResults ( array  $finished_ids)

Calculates the evaluation data for the user specific results.

Parameters
int[]$finished_ids
Todo:
move to evaluation manager

Definition at line 2677 of file class.ilObjSurvey.php.

References $data, $user_id, SurveyQuestion\_getQuestionType(), SurveyQuestion\_includeClass(), SurveyQuestion\_instanciateQuestionEvaluation(), and getSurveyQuestions().

Referenced by getParticipantTextResults().

2679  : array {
2680  $evaluation = array();
2681 
2682  foreach (array_keys($this->getSurveyQuestions()) as $question_id) {
2683  // get question instance
2684  $question_type = SurveyQuestion::_getQuestionType($question_id);
2685  SurveyQuestion::_includeClass($question_type);
2686  $question = new $question_type();
2687  $question->loadFromDb($question_id);
2688 
2689  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($question_id, $finished_ids);
2690  $q_res = $q_eval->getResults();
2691 
2692  $data = array();
2693  foreach ($finished_ids as $user_id) {
2694  $data[$user_id] = $q_eval->parseUserSpecificResults($q_res, $user_id);
2695  }
2696 
2697  $evaluation[$question_id] = $data;
2698  }
2699 
2700  return $evaluation;
2701  }
getSurveyQuestions(bool $with_answers=false)
Returns the survey questions and questionblocks in an array.
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
static _instanciateQuestionEvaluation(int $question_id, ?array $a_finished_ids=null)
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserSurveyExecutionStatus()

ilObjSurvey::getUserSurveyExecutionStatus ( ?string  $a_code = null)

Get current user execution status.

Generates a code in svy_anonymous for logged in raters, if codes are used Generates a code for the anonymous user, if the survey is set to anonymous and no codes are used

Parameters
?string$a_code
Returns
array|null
Todo:
move to run manager

Definition at line 4699 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $res, $user, $user_id, ANONYMOUS_USER_ID, getAnonymize(), getSurveyId(), isAccessibleWithoutCode(), isRater(), and null.

4701  : ?array {
4702  $ilUser = $this->user;
4703  $ilDB = $this->db;
4704  $user_id = $ilUser->getId();
4705  // code is obligatory?
4706  if (!$this->isAccessibleWithoutCode()) {
4707  if (!$a_code) {
4708  // registered raters do not need code
4709  if ($this->feature_config->usesAppraisees() &&
4711  $this->isRater(0, $user_id)) {
4712  // auto-generate code
4713  $code = $this->data_manager->code("")
4714  ->withUserId($user_id);
4715  $this->code_manager->add($code);
4716  $a_code = $this->code_manager->getByUserId($user_id);
4717  } else {
4718  return null;
4719  }
4720  }
4721  } elseif ($user_id === ANONYMOUS_USER_ID ||
4722  $this->getAnonymize() === self::ANONYMIZE_FREEACCESS) {
4723  // self::ANONYMIZE_FREEACCESS: anonymized, no codes
4724  // or anonymous user when no codes are used
4725  if (!$a_code) {
4726  // auto-generate code
4727  $code = $this->data_manager->code("")
4728  ->withUserId($user_id);
4729  $code_id = $this->code_manager->add($code);
4730  $a_code = $this->code_manager->getByCodeId($code_id);
4731  }
4732  } else {
4733  $a_code = null;
4734  }
4735 
4736  $res = array();
4737 
4738  // get runs for user id / code
4739  $sql = "SELECT * FROM svy_finished" .
4740  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer");
4741  // if proper user id is given, use it or current code
4742  if ($user_id !== ANONYMOUS_USER_ID) {
4743  $sql .= " AND (user_fi = " . $ilDB->quote($user_id, "integer") .
4744  " OR anonymous_id = " . $ilDB->quote($a_code, "text") . ")";
4745  }
4746  // use anonymous code to find finished id(s)
4747  else {
4748  $sql .= " AND anonymous_id = " . $ilDB->quote($a_code, "text");
4749  }
4750  $set = $ilDB->query($sql);
4751  while ($row = $ilDB->fetchAssoc($set)) {
4752  $res[$row["finished_id"]] = array("appr_id" => $row["appr_id"],
4753  "user_id" => $row["user_fi"],
4754  "code" => $row["anonymous_id"],
4755  "finished" => (bool) $row["state"]);
4756  }
4757  return array("code" => $a_code, "runs" => $res);
4758  }
$res
Definition: ltiservices.php:66
const ANONYMOUS_USER_ID
Definition: constants.php:27
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
isRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
+ Here is the call graph for this function:

◆ getVariables()

ilObjSurvey::getVariables ( int  $question_id)

Returns all variables (answer options/scale values) of a question.

Todo:
move to (pool?) question manager/repo

Definition at line 2133 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2135  : array {
2136  $ilDB = $this->db;
2137 
2138  $result_array = array();
2139  $result = $ilDB->queryF(
2140  "SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN " .
2141  "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s " .
2142  "ORDER BY svy_variable.sequence",
2143  array('integer'),
2144  array($question_id)
2145  );
2146  while ($row = $ilDB->fetchObject($result)) {
2147  $result_array[$row->sequence] = $row;
2148  }
2149  return $result_array;
2150  }
ilDBInterface $db

◆ getWorkingtimeForParticipant()

ilObjSurvey::getWorkingtimeForParticipant ( int  $finished_id)
Todo:
move to run manager?

Definition at line 4144 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

4146  : int {
4147  $ilDB = $this->db;
4148 
4149  $result = $ilDB->queryF(
4150  "SELECT * FROM svy_times WHERE finished_fi = %s",
4151  array('integer'),
4152  array($finished_id)
4153  );
4154  $total = 0;
4155  while ($row = $ilDB->fetchAssoc($result)) {
4156  if ($row['left_page'] > 0 && $row['entered_page'] > 0) {
4157  $total += $row['left_page'] - $row['entered_page'];
4158  }
4159  }
4160  return $total;
4161  }
ilDBInterface $db

◆ hasAnonymizedResults()

ilObjSurvey::hasAnonymizedResults ( )

Definition at line 975 of file class.ilObjSurvey.php.

References getAnonymize().

Referenced by ILIAS\Survey\Mode\Standard\UIModifier\getSurveySettingsResults(), getUserDataFromActiveId(), and sendNotificationMail().

975  : bool
976  {
977  return ($this->getAnonymize() === self::ANONYMIZE_ON ||
978  $this->getAnonymize() === self::ANONYMIZE_FREEACCESS);
979  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAnonymousUserList()

ilObjSurvey::hasAnonymousUserList ( )

Definition at line 5525 of file class.ilObjSurvey.php.

References $anon_user_list.

Referenced by ILIAS\Survey\Mode\Standard\UIModifier\getSurveySettingsResults(), importObject(), saveToDb(), and toXML().

5525  : bool
5526  {
5527  return $this->anon_user_list;
5528  }
+ Here is the caller graph for this function:

◆ hasEnded()

ilObjSurvey::hasEnded ( )

Definition at line 1248 of file class.ilObjSurvey.php.

References getEndDate(), IL_CAL_TIMESTAMP, and IL_CAL_UNIX.

1248  : bool
1249  {
1250  $end = $this->getEndDate();
1251  if ($end) {
1252  $end_date = new ilDateTime($end, IL_CAL_TIMESTAMP);
1253  return ($end_date->get(IL_CAL_UNIX) < time());
1254  }
1255  return false;
1256  }
const IL_CAL_UNIX
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:

◆ hasMailConfirmation()

ilObjSurvey::hasMailConfirmation ( )

Definition at line 5515 of file class.ilObjSurvey.php.

References $mail_confirmation.

Referenced by importObject(), saveToDb(), and toXML().

5515  : bool
5516  {
5517  return $this->mail_confirmation;
5518  }
+ Here is the caller graph for this function:

◆ hasMailOwnResults()

ilObjSurvey::hasMailOwnResults ( )

Definition at line 5505 of file class.ilObjSurvey.php.

References $mail_own_results.

Referenced by importObject(), saveToDb(), and toXML().

5505  : bool
5506  {
5507  return $this->mail_own_results;
5508  }
+ Here is the caller graph for this function:

◆ hasQuestions()

ilObjSurvey::hasQuestions ( )

Definition at line 505 of file class.ilObjSurvey.php.

505  : bool
506  {
507  return count($this->questions);
508  }

◆ hasStarted()

ilObjSurvey::hasStarted ( )

Definition at line 1238 of file class.ilObjSurvey.php.

References getStartDate(), IL_CAL_TIMESTAMP, and IL_CAL_UNIX.

1238  : bool
1239  {
1240  $start = $this->getStartDate();
1241  if ($start) {
1242  $start_date = new ilDateTime($start, IL_CAL_TIMESTAMP);
1243  return ($start_date->get(IL_CAL_UNIX) < time());
1244  }
1245  return true;
1246  }
const IL_CAL_UNIX
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:

◆ hasViewOwnResults()

ilObjSurvey::hasViewOwnResults ( )

Definition at line 5495 of file class.ilObjSurvey.php.

References $view_own_results.

Referenced by saveToDb(), and toXML().

5495  : bool
5496  {
5497  return $this->view_own_results;
5498  }
+ Here is the caller graph for this function:

◆ importObject()

ilObjSurvey::importObject ( array  $file_info,
int  $svy_qpl_id 
)
Exceptions
ilException
ilImportException
ilInvalidSurveyImportFileException
Returns
string error
Todo:
move to export sub-service

Definition at line 3162 of file class.ilObjSurvey.php.

References ilObject\$db, ilObject\$error, $ilDB, ilCopyWizardOptions\_getInstance(), SurveyQuestion\_getOriginalId(), ilObject\cloneMetaData(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), getAnonymize(), getAuthor(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getImportDirectory(), getIntroduction(), getMailAddresses(), getMailNotification(), getMailParticipantData(), getMode(), ilObject\getOfflineStatus(), getOutro(), getReminderEnd(), getReminderFrequency(), getReminderStart(), getReminderStatus(), getReminderTarget(), getReminderTemplate(), getShowQuestionTitles(), getSkillService(), getStartDate(), getSurveyId(), getTutorNotificationRecipients(), getTutorNotificationStatus(), getTutorNotificationTarget(), getTutorResultsRecipients(), getTutorResultsStatus(), hasAnonymousUserList(), hasMailConfirmation(), hasMailOwnResults(), ILIAS\Repository\lng(), loadFromDb(), locateImportFiles(), and ilFileUtils\moveUploadedFile().

3165  : string {
3166  if ($svy_qpl_id < 1) {
3167  $svy_qpl_id = -1;
3168  }
3169  // check if file was uploaded
3170  $source = $file_info["tmp_name"];
3171  $error = "";
3172  if (($source === 'none') || (!$source) || $file_info["error"] > UPLOAD_ERR_OK) {
3173  $error = $this->lng->txt("import_no_file_selected");
3174  }
3175  // check correct file type
3176  $isXml = false;
3177  $isZip = false;
3178  if ((strcmp($file_info["type"], "text/xml") === 0) || (strcmp($file_info["type"], "application/xml") === 0)) {
3179  $this->svy_log->debug("isXML");
3180  $isXml = true;
3181  }
3182  // too many different mime-types, so we use the suffix
3183  $suffix = pathinfo($file_info["name"]);
3184  if (strcmp(strtolower($suffix["extension"]), "zip") === 0) {
3185  $this->svy_log->debug("isZip");
3186  $isZip = true;
3187  }
3188  if (!$isXml && !$isZip) {
3189  $error = $this->lng->txt("import_wrong_file_type");
3190  $this->svy_log->debug("Survey: Import error. Filetype was \"" . $file_info["type"] . "\"");
3191  }
3192  if ($error === '') {
3193  // import file as a survey
3194  $import_dir = $this->getImportDirectory();
3195  $import_subdir = "";
3196  $importfile = "";
3197  if ($isZip) {
3198  $importfile = $import_dir . "/" . $file_info["name"];
3199  ilFileUtils::moveUploadedFile($source, $file_info["name"], $importfile);
3200  $this->domain->resources()->zip()->unzipFile($importfile);
3201  $found = $this->locateImportFiles($import_dir);
3202  if (!((strlen($found["dir"]) > 0) && (strlen($found["xml"]) > 0))) {
3203  $error = $this->lng->txt("wrong_import_file_structure");
3204  return $error;
3205  }
3206  $importfile = $found["xml"];
3207  $import_subdir = $found["dir"];
3208  } else {
3209  $importfile = tempnam($import_dir, "survey_import");
3210  ilFileUtils::moveUploadedFile($source, $file_info["name"], $importfile);
3211  }
3212 
3213  $this->svy_log->debug("Import file = $importfile");
3214  $this->svy_log->debug("Import subdir = $import_subdir");
3215 
3216  $fh = fopen($importfile, 'rb');
3217  if (!$fh) {
3218  $error = $this->lng->txt("import_error_opening_file");
3219  return $error;
3220  }
3221  $xml = fread($fh, filesize($importfile));
3222  $result = fclose($fh);
3223  if (!$result) {
3224  $error = $this->lng->txt("import_error_closing_file");
3225  return $error;
3226  }
3227 
3228  $this->import_manager->clearMobs();
3229  if (strpos($xml, "questestinterop")) {
3230  throw new ilInvalidSurveyImportFileException("Unsupported survey version (< 3.8) found.");
3231  } else {
3232  $this->svy_log->debug("survey id = " . $this->getId());
3233  $this->svy_log->debug("question pool id = " . $svy_qpl_id);
3234 
3235  $imp = new ilImport();
3236  $config = $imp->getConfig("components/ILIAS/Survey");
3237  $config->setQuestionPoolID($svy_qpl_id);
3238  $imp->getMapping()->addMapping("components/ILIAS/Survey", "svy", 0, $this->getId());
3239  $imp->importFromDirectory($import_subdir, "svy", "components/ILIAS/Survey");
3240  $this->svy_log->debug("config(Modules/survey)->getQuestionPoolId =" . $config->getQuestionPoolID());
3241  }
3242  }
3243  return $error;
3244  }
Import class.
getImportDirectory()
get import directory of survey
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
ilErrorHandling $error
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
locateImportFiles(string $a_dir)
Locates the import directory and the xml file in a directory with an unzipped import file...
+ Here is the call graph for this function:

◆ importSurveyCode()

ilObjSurvey::importSurveyCode ( string  $a_anonymize_key,
int  $a_created,
array  $a_data 
)
Todo:
move to code manager

Definition at line 3740 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3744  : void {
3745  $ilDB = $this->db;
3746 
3747  $next_id = $ilDB->nextId('svy_anonymous');
3748  $ilDB->manipulateF(
3749  "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
3750  "VALUES (%s, %s, %s, %s, %s)",
3751  array('integer','text','integer','text','integer'),
3752  array($next_id, $a_anonymize_key, $this->getSurveyId(), serialize($a_data), $a_created)
3753  );
3754  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ initServices()

ilObjSurvey::initServices ( )
protected

Definition at line 194 of file class.ilObjSurvey.php.

References getMode(), ilObject\getRefId(), and ILIAS\Repository\user().

Referenced by __construct(), and read().

194  : void
195  {
196  if ($this->getRefId() > 0) {
197  $this->code_manager = $this
198  ->survey_service
199  ->domain()
200  ->code($this, $this->user->getId());
201  }
202  $this->feature_config = $this
203  ->survey_service
204  ->domain()
205  ->modeFeatureConfig($this->getMode());
206 
207  $this->data_manager = $this
208  ->survey_service
209  ->data();
210  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestion()

ilObjSurvey::insertQuestion ( int  $question_id)

Inserts a question in the survey and saves the relation to the database.

Todo:
move to survey question manager/repo

Definition at line 550 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, SurveyQuestion\_isComplete(), duplicateQuestionForSurvey(), getSurveyId(), isQuestionInSurvey(), loadQuestionsFromDb(), and saveCompletionStatus().

552  : bool {
553  $ilDB = $this->db;
554 
555  $this->svy_log->debug("insert question, id:" . $question_id);
556 
557  if (!SurveyQuestion::_isComplete($question_id)) {
558  $this->svy_log->debug("question is not complete");
559  return false;
560  } else {
561  // get maximum sequence index in test
562  $result = $ilDB->queryF(
563  "SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
564  array('integer'),
565  array($this->getSurveyId())
566  );
567  $sequence = $result->numRows();
568  $duplicate_id = $this->duplicateQuestionForSurvey($question_id);
569  $this->svy_log->debug("duplicate, id: " . $question_id . ", duplicate id: " . $duplicate_id);
570 
571  // check if question is not already in the survey, see #22018
572  if ($this->isQuestionInSurvey($duplicate_id)) {
573  return false;
574  }
575 
576  $next_id = $ilDB->nextId('svy_svy_qst');
577  $affectedRows = $ilDB->manipulateF(
578  "INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
579  array('integer', 'integer', 'integer', 'integer', 'integer'),
580  array($next_id, $this->getSurveyId(), $duplicate_id, $sequence, time())
581  );
582 
583  $this->svy_log->debug("added entry to svy_svy_qst, id: " . $next_id . ", question id: " . $duplicate_id . ", sequence: " . $sequence);
584 
585  $this->loadQuestionsFromDb();
586  $this->saveCompletionStatus();
587  return true;
588  }
589  }
duplicateQuestionForSurvey(int $question_id, bool $a_force=false)
Takes a question and creates a copy of the question for use in the survey.
static _isComplete(int $question_id)
Checks whether the question is complete or not.
isQuestionInSurvey(int $a_question_fi)
ilDBInterface $db
saveCompletionStatus()
Saves the completion status of the survey.
+ Here is the call graph for this function:

◆ insertQuestionblock()

ilObjSurvey::insertQuestionblock ( int  $questionblock_id)

Definition at line 609 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilObject\$title, createQuestionblock(), and getSurveyId().

611  : void {
612 
613  $sequence_manager = $this->survey_service->domain()->sequence(
614  $this->getSurveyId(),
615  $this
616  );
617 
618  $ilDB = $this->db;
619  $result = $ilDB->queryF(
620  "SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle," .
621  " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst" .
622  " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi" .
623  " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi" .
624  " AND svy_qblk.questionblock_id = %s" .
625  " ORDER BY svy_svy_qst.sequence",
626  array('integer'),
627  array($questionblock_id)
628  );
629  $questions = array();
630  $show_questiontext = false;
631  $show_blocktitle = false;
632  $title = "";
633  while ($row = $ilDB->fetchAssoc($result)) {
634  //$duplicate_id = $this->duplicateQuestionForSurvey($row["question_fi"]);
635  $duplicate_id = $sequence_manager->appendQuestion($row["question_fi"], true);
636  $questions[] = $duplicate_id;
637  $title = (string) $row["title"];
638  $show_questiontext = (bool) $row["show_questiontext"];
639  $show_blocktitle = (bool) $row["show_blocktitle"];
640  }
641  $this->createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions);
642  }
string $title
ilDBInterface $db
createQuestionblock(string $title, bool $show_questiontext, bool $show_blocktitle, array $questions, bool $compress_view=false)
+ Here is the call graph for this function:

◆ is360SurveyStarted()

ilObjSurvey::is360SurveyStarted ( int  $appr_id,
int  $user_id,
?string  $anonymous_code = null 
)
Todo:
move to appraisal manager

Definition at line 4667 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getSurveyId(), and null.

Referenced by getRatersData(), and sent360Reminders().

4671  : ?int {
4672  $ilDB = $this->db;
4673 
4674  $sql = "SELECT * FROM svy_finished" .
4675  " WHERE survey_fi =" . $ilDB->quote($this->getSurveyId(), "integer") .
4676  " AND appr_id = " . $ilDB->quote($appr_id, "integer");
4677  if ($user_id) {
4678  $sql .= " AND user_fi = " . $ilDB->quote($user_id, "integer");
4679  } else {
4680  $sql .= " AND anonymous_id = " . $ilDB->quote($anonymous_code, "text");
4681  }
4682  $result = $ilDB->query($sql);
4683  if ($result->numRows() === 0) {
4684  return null;
4685  } else {
4686  $row = $ilDB->fetchAssoc($result);
4687  return (int) $row["state"];
4688  }
4689  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAccessibleWithoutCode()

ilObjSurvey::isAccessibleWithoutCode ( )

Definition at line 968 of file class.ilObjSurvey.php.

References getAnonymize().

Referenced by getUserSurveyExecutionStatus().

968  : bool
969  {
970  return ($this->getAnonymize() === self::ANONYMIZE_OFF ||
971  $this->getAnonymize() === self::ANONYMIZE_FREEACCESS);
972  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActivationLimited()

ilObjSurvey::isActivationLimited ( )

Definition at line 1308 of file class.ilObjSurvey.php.

References $activation_limited.

Referenced by saveToDb().

1308  : bool
1309  {
1311  }
+ Here is the caller graph for this function:

◆ isAnonymizedParticipant()

ilObjSurvey::isAnonymizedParticipant ( string  $key)
Parameters
string$key(access code)
Todo:
move to participant manager

Definition at line 3552 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3552  : bool
3553  {
3554  $ilDB = $this->db;
3555 
3556  $result = $ilDB->queryF(
3557  "SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
3558  array('text','integer'),
3559  array($key, $this->getSurveyId())
3560  );
3561  return $result->numRows() === 1;
3562  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ isAppraisee()

ilObjSurvey::isAppraisee ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4390 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

Referenced by addAppraisee(), addRater(), getAppraiseesToRate(), and isRater().

4392  : bool {
4393  $ilDB = $this->db;
4394  $set = $ilDB->query("SELECT user_id" .
4395  " FROM svy_360_appr" .
4396  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4397  " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
4398  return (bool) $ilDB->numRows($set);
4399  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ isAppraiseeClosed()

ilObjSurvey::isAppraiseeClosed ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4404 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

Referenced by sent360Reminders().

4406  : bool {
4407  $ilDB = $this->db;
4408 
4409  $set = $ilDB->query("SELECT has_closed" .
4410  " FROM svy_360_appr" .
4411  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4412  " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
4413  $row = $ilDB->fetchAssoc($set);
4414  return (bool) ($row["has_closed"] ?? false);
4415  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ isComplete()

ilObjSurvey::isComplete ( )

Check if survey is complete for use.

Todo:
move to survey manager

Definition at line 500 of file class.ilObjSurvey.php.

References ilObject\getTitle().

Referenced by saveCompletionStatus(), and saveToDb().

500  : bool
501  {
502  return ($this->getTitle() && count($this->questions));
503  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHTML()

ilObjSurvey::isHTML ( string  $a_text)

Checks if a given string contains HTML or not.

Todo:
move to export sub-service

Definition at line 3995 of file class.ilObjSurvey.php.

Referenced by addMaterialTag().

3997  : bool {
3998  if (preg_match("/<[^>]*?>/", $a_text)) {
3999  return true;
4000  } else {
4001  return false;
4002  }
4003  }
+ Here is the caller graph for this function:

◆ isQuestionInAnyBlock()

ilObjSurvey::isQuestionInAnyBlock ( int  $a_question_fi)
Todo:
move to survey question manager/repo

Definition at line 1570 of file class.ilObjSurvey.php.

References $DIC, and $ilDB.

Referenced by addQuestionToBlock(), and createQuestionblock().

1572  : bool {
1573  global $DIC;
1574 
1575  $ilDB = $DIC->database();
1576 
1577  $set = $ilDB->query("SELECT * FROM svy_qblk_qst " .
1578  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
1579  " AND question_fi = " . $ilDB->quote($a_question_fi, "integer"));
1580  if ($rec = $ilDB->fetchAssoc($set)) {
1581  return true;
1582  }
1583  return false;
1584  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ isQuestionInSurvey()

ilObjSurvey::isQuestionInSurvey ( int  $a_question_fi)

Definition at line 592 of file class.ilObjSurvey.php.

References $DIC, and $ilDB.

Referenced by insertQuestion(), and saveQuestionsToDb().

594  : bool {
595  global $DIC;
596  //return false;
597  $ilDB = $DIC->database();
598 
599  $set = $ilDB->query("SELECT * FROM svy_svy_qst " .
600  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
601  " AND question_fi = " . $ilDB->quote($a_question_fi, "integer"));
602  if ($rec = $ilDB->fetchAssoc($set)) {
603  return true;
604  }
605  return false;
606  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ isRater()

ilObjSurvey::isRater ( int  $a_appraisee_id,
int  $a_user_id,
int  $a_anonymous_id = 0 
)
Todo:
move to appraisal manager

Definition at line 4509 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, get360SelfEvaluation(), getSurveyId(), and isAppraisee().

Referenced by addRater(), and getUserSurveyExecutionStatus().

4513  : bool {
4514  $ilDB = $this->db;
4515 
4516  // user is rater if already appraisee and active self-evaluation
4517  if ($this->isAppraisee($a_user_id) &&
4518  $this->get360SelfEvaluation() &&
4519  (!$a_appraisee_id || $a_appraisee_id === $a_user_id)) {
4520  return true;
4521  }
4522 
4523  // :TODO: should we get rid of code as well?
4524 
4525  $sql = "SELECT user_id" .
4526  " FROM svy_360_rater" .
4527  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4528  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
4529  " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer");
4530  if ($a_appraisee_id) {
4531  $sql .= " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer");
4532  }
4533  $set = $ilDB->query($sql);
4534  return (bool) $ilDB->numRows($set);
4535  }
isAppraisee(int $a_user_id)
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSurveyCodeUnique()

ilObjSurvey::isSurveyCodeUnique ( string  $code)
Todo:
move to code manager

Definition at line 3725 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3727  : bool {
3728  $ilDB = $this->db;
3729  $result = $ilDB->queryF(
3730  "SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
3731  array('integer','text'),
3732  array($this->getSurveyId(), $code)
3733  );
3734  return !(($result->numRows() > 0));
3735  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ isSurveyCodeUsed()

ilObjSurvey::isSurveyCodeUsed ( string  $code)
Todo:
move to code manager

Definition at line 3710 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

Referenced by getSurveyCodesForExport(), and getSurveyCodesTableData().

3712  : bool {
3713  $ilDB = $this->db;
3714  $result = $ilDB->queryF(
3715  "SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
3716  array('integer','text'),
3717  array($this->getSurveyId(), $code)
3718  );
3719  return $result->numRows() > 0;
3720  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSurveyFinishedByCode()

ilObjSurvey::isSurveyFinishedByCode ( string  $a_code)

Get if survey is finished for a specific anonymous user code.

Parameters
string$a_codeanonymous user code
Returns
bool
Todo:
move to run manager

Definition at line 3876 of file class.ilObjSurvey.php.

References getSurveyId().

Referenced by getExternalCodeRecipients().

3876  : bool
3877  {
3878  $result = $this->db->queryF(
3879  "SELECT state FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
3880  array('integer','text'),
3881  array($this->getSurveyId(), $a_code)
3882  );
3883 
3884  $row = $this->db->fetchAssoc($result);
3885 
3886  return $row['state'] ?? false;
3887  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUnusedCode()

ilObjSurvey::isUnusedCode ( string  $a_code,
int  $a_user_id 
)
Todo:
move to code manager

Definition at line 4781 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $user_id, ANONYMOUS_USER_ID, and ILIAS\Repository\int().

4784  : bool {
4785  $ilDB = $this->db;
4786 
4787  $set = $ilDB->query("SELECT user_fi FROM svy_finished" .
4788  " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4789  " AND anonymous_id = " . $ilDB->quote($a_code, "text"));
4790  $user_id = $ilDB->fetchAssoc($set);
4791  $user_id = (int) $user_id["user_fi"];
4792 
4793  if ($user_id && ($user_id !== $a_user_id || $user_id === ANONYMOUS_USER_ID)) {
4794  return false;
4795  }
4796  return true;
4797  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
ilDBInterface $db
+ Here is the call graph for this function:

◆ loadFromDb()

ilObjSurvey::loadFromDb ( )

Definition at line 981 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, ilRTE\_replaceMediaObjectImageSrc(), ilObject\getId(), ilObjectActivation\getItem(), IL_CAL_DATE, ILIAS\Repository\lng(), loadQuestionsFromDb(), null, set360Results(), set360SelfAppraisee(), set360SelfEvaluation(), set360SelfRaters(), setActivationEndDate(), setActivationLimited(), setActivationStartDate(), setActivationVisibility(), setAnonymize(), setAnonymousUserList(), setAuthor(), setCalculateSumScore(), setEndDate(), setEvaluationAccess(), setIntroduction(), setMailAddresses(), setMailConfirmation(), setMailNotification(), setMailOwnResults(), setMailParticipantData(), setMode(), setOutro(), setPoolUsage(), setReminderEnd(), setReminderFrequency(), setReminderLastSent(), setReminderStart(), setReminderStatus(), setReminderTarget(), setReminderTemplate(), setSelfEvaluationResults(), setShowQuestionTitles(), setSkillService(), setStartDate(), setSurveyId(), setTutorNotificationRecipients(), setTutorNotificationStatus(), setTutorNotificationTarget(), setTutorResultsRecipients(), setTutorResultsStatus(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by importObject(), and read().

981  : void
982  {
983  $ilDB = $this->db;
984  $result = $ilDB->queryF(
985  "SELECT * FROM svy_svy WHERE obj_fi = %s",
986  array('integer'),
987  array($this->getId())
988  );
989  if ($result->numRows() === 1) {
990  $data = $ilDB->fetchAssoc($result);
991  $this->setSurveyId($data["survey_id"]);
992  $this->setAuthor($data["author"] ?? "");
993  $this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc((string) $data["introduction"], 1));
994  if (strcmp($data["outro"], "survey_finished") === 0) {
995  $this->setOutro($this->lng->txt("survey_finished"));
996  } else {
997  $this->setOutro(ilRTE::_replaceMediaObjectImageSrc((string) $data["outro"], 1));
998  }
999  $this->setShowQuestionTitles((bool) $data["show_question_titles"]);
1000  $this->setStartDate((string) ($data["startdate"] ?? ""));
1001  $this->setEndDate((string) ($data["enddate"] ?? ""));
1002  $this->setAnonymize((int) $data["anonymize"]);
1003  $this->setEvaluationAccess($data["evaluation_access"] ?? "");
1004  $this->loadQuestionsFromDb();
1005  $this->setMailNotification((bool) $data['mailnotification']);
1006  $this->setMailAddresses((string) $data['mailaddresses']);
1007  $this->setMailParticipantData((string) $data['mailparticipantdata']);
1008  $this->setPoolUsage((bool) $data['pool_usage']);
1009  // Mode
1010  $this->setMode($data['mode']);
1011  // 360°
1012  $this->set360SelfEvaluation((bool) $data['mode_360_self_eval']);
1013  $this->set360SelfRaters((bool) $data['mode_360_self_rate']);
1014  $this->set360SelfAppraisee((bool) $data['mode_360_self_appr']);
1015  $this->set360Results((int) $data['mode_360_results']);
1016  // Mode self evaluated
1017  $this->setSelfEvaluationResults((int) $data['mode_self_eval_results']);
1018  // Competences
1019  $this->setSkillService((bool) $data['mode_skill_service']);
1020  // reminder/notification
1021  $this->setReminderStatus((bool) $data["reminder_status"]);
1022  $this->setReminderStart($data["reminder_start"] ? new ilDate($data["reminder_start"], IL_CAL_DATE) : null);
1023  $this->setReminderEnd($data["reminder_end"] ? new ilDate($data["reminder_end"], IL_CAL_DATE) : null);
1024  $this->setReminderFrequency((int) $data["reminder_frequency"]);
1025  $this->setReminderTarget((int) $data["reminder_target"]);
1026  $this->setReminderLastSent((string) $data["reminder_last_sent"]);
1027  $this->setReminderTemplate((int) $data["reminder_tmpl"]);
1028  $this->setTutorNotificationStatus($data["tutor_ntf_status"]);
1029  $this->setTutorNotificationRecipients(explode(";", $data["tutor_ntf_reci"] ?? ""));
1030  $this->setTutorNotificationTarget($data["tutor_ntf_target"]);
1031  $this->setTutorResultsStatus((bool) $data["tutor_res_status"]);
1032  $this->setTutorResultsRecipients(explode(";", $data["tutor_res_reci"] ?? ""));
1033 
1034  $this->setMailOwnResults((bool) $data["own_results_mail"]);
1035  $this->setMailConfirmation((bool) $data["confirmation_mail"]);
1036  $this->setCalculateSumScore((bool) $data["calculate_sum_score"]);
1037 
1038  $this->setAnonymousUserList((bool) $data["anon_user_list"]);
1039  }
1040 
1041  // moved activation to ilObjectActivation
1042  if (isset($this->ref_id) && $this->ref_id !== 0) {
1043  $activation = ilObjectActivation::getItem($this->ref_id);
1044  switch ($activation["timing_type"]) {
1046  $this->setActivationLimited(true);
1047  $this->setActivationStartDate($activation["timing_start"]);
1048  $this->setActivationEndDate($activation["timing_end"]);
1049  $this->setActivationVisibility($activation["visible"]);
1050  break;
1051 
1052  default:
1053  $this->setActivationLimited(false);
1054  break;
1055  }
1056  }
1057  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setTutorResultsRecipients(array $a_value)
setIntroduction(string $introduction="")
setReminderEnd(?ilDate $a_value=null)
setReminderFrequency(int $a_value)
setMailParticipantData(string $a_data)
Set preceding text (incl.
setEndDate(string $end_date="")
setSurveyId(int $survey_id)
setShowQuestionTitles(bool $a_show)
setAnonymize(int $a_anonymize)
set anonymize status
setReminderTemplate(?int $a_value)
setMailNotification(bool $a_notification)
Activate mail to tutors each time a participant finishes the survey.
setSelfEvaluationResults(int $a_value)
setMailConfirmation(bool $a_value)
set360Results(int $a_value)
setMailAddresses(string $a_addresses)
Set (Tutor) Recipients of "single participant has finished" mails.
setAuthor(string $author="")
setActivationStartDate(?int $starting_time=null)
setActivationVisibility(bool $a_value)
setTutorNotificationStatus(bool $a_value)
Activates mail being sent to tutors after all participants have finished the survey.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setOutro(string $outro="")
setReminderTarget(int $a_value)
setPoolUsage(bool $a_value)
setMailOwnResults(bool $a_value)
setCalculateSumScore(bool $a_val)
ilDBInterface $db
set360SelfRaters(bool $a_value)
setStartDate(string $start_date="")
setTutorNotificationRecipients(array $a_value)
Set tutor recipients for "all participants have finished" mail.
setTutorResultsStatus(bool $a_value)
set360SelfEvaluation(bool $a_value)
setReminderLastSent(?string $a_value)
set360SelfAppraisee(bool $a_value)
const IL_CAL_DATE
static getItem(int $ref_id)
setTutorNotificationTarget(int $a_value)
setActivationLimited(bool $a_value)
setEvaluationAccess(string $evaluation_access=self::EVALUATION_ACCESS_OFF)
setAnonymousUserList(bool $a_value)
setSkillService(bool $a_val)
setMode(int $a_value)
setReminderStatus(bool $a_value)
setReminderStart(?ilDate $a_value=null)
setActivationEndDate(?int $ending_time=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadQuestionsFromDb()

ilObjSurvey::loadQuestionsFromDb ( )

Definition at line 1059 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, and getSurveyId().

Referenced by insertQuestion(), and loadFromDb().

1059  : void
1060  {
1061  $ilDB = $this->db;
1062  $this->questions = array();
1063  $result = $ilDB->queryF(
1064  "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1065  array('integer'),
1066  array($this->getSurveyId())
1067  );
1068  while ($data = $ilDB->fetchAssoc($result)) {
1069  $this->questions[$data["sequence"]] = $data["question_fi"];
1070  }
1071  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadWorkingData()

ilObjSurvey::loadWorkingData ( int  $question_id,
int  $active_id 
)

Gets the given answer data of a question in a run.

Todo:
move to run(?) manager/repo

Definition at line 2293 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2296  : array {
2297  $ilDB = $this->db;
2298  $result_array = array();
2299  $result = $ilDB->queryF(
2300  "SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2301  array('integer','integer'),
2302  array($question_id, $active_id)
2303  );
2304  if ($result->numRows() >= 1) {
2305  while ($row = $ilDB->fetchAssoc($result)) {
2306  $result_array[] = $row;
2307  }
2308  }
2309  return $result_array;
2310  }
ilDBInterface $db

◆ locateImportFiles()

ilObjSurvey::locateImportFiles ( string  $a_dir)

Locates the import directory and the xml file in a directory with an unzipped import file.

Returns
array An associative array containing "dir" (import directory) and "xml" (xml file)
Todo:
move to export sub-service

Definition at line 3113 of file class.ilObjSurvey.php.

References null.

Referenced by importObject().

3115  : ?array {
3116  if (!is_dir($a_dir) || is_int(strpos($a_dir, ".."))) {
3117  return null;
3118  }
3119  $importDirectory = "";
3120  $xmlFile = "";
3121 
3122  $current_dir = opendir($a_dir);
3123  $files = array();
3124  while ($entryname = readdir($current_dir)) {
3125  $files[] = $entryname;
3126  }
3127 
3128  foreach ($files as $file) {
3129  if (is_dir($a_dir . "/" . $file) and ($file !== "." and $file !== "..")) {
3130  // found directory created by zip
3131  $importDirectory = $a_dir . "/" . $file;
3132  }
3133  }
3134  closedir($current_dir);
3135  if ($importDirectory !== '') {
3136  // find the xml file
3137  $current_dir = opendir($importDirectory);
3138  $files = array();
3139  while ($entryname = readdir($current_dir)) {
3140  $files[] = $entryname;
3141  }
3142  foreach ($files as $file) {
3143  if (is_file($importDirectory . "/" . $file) &&
3144  ($file !== "." && $file !== "..") &&
3145  (preg_match("/^[0-9]{10}__[0-9]+__(svy_)*[0-9]+\.[A-Za-z]{1,3}$/", $file) ||
3146  preg_match("/^[0-9]{10}__[0-9]+__(survey__)*[0-9]+\.[A-Za-z]{1,3}$/", $file))) {
3147  // found xml file
3148  $xmlFile = $importDirectory . "/" . $file;
3149  }
3150  }
3151  }
3152  return array("dir" => $importDirectory, "xml" => $xmlFile);
3153  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ modifyQuestionblock()

ilObjSurvey::modifyQuestionblock ( int  $questionblock_id,
string  $title,
bool  $show_questiontext,
bool  $show_blocktitle,
bool  $compress_view = false 
)
Todo:
move to survey question manager/repo

Definition at line 1740 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

1746  : void {
1747  $ilDB = $this->db;
1748  $ilDB->manipulateF(
1749  "UPDATE svy_qblk SET title = %s, show_questiontext = %s," .
1750  " show_blocktitle = %s, compress_view = %s WHERE questionblock_id = %s",
1751  array('text','text','text','integer', 'integer'),
1752  array($title, $show_questiontext, $show_blocktitle, $compress_view, $questionblock_id)
1753  );
1754  }
string $title
ilDBInterface $db

◆ moveQuestions()

ilObjSurvey::moveQuestions ( array  $move_questions,
int  $target_index,
int  $insert_mode 
)

Move questions and/or questionblocks to another position.

Parameters
array$move_questionsAn array with the question id's of the questions to move
int$target_indexThe question id of the target position
int$insert_mode0, if insert before the target position, 1 if insert after the target position
Todo:
move to survey question manager/repo

Definition at line 1368 of file class.ilObjSurvey.php.

References deleteConstraint(), getConstraints(), and saveQuestionsToDb().

Referenced by createQuestionblock().

1372  : void {
1373  $array_pos = array_search($target_index, $this->questions);
1374  $part1 = $part2 = [];
1375  if ($insert_mode === 0) {
1376  $part1 = array_slice($this->questions, 0, $array_pos);
1377  $part2 = array_slice($this->questions, $array_pos);
1378  } elseif ($insert_mode === 1) {
1379  $part1 = array_slice($this->questions, 0, $array_pos + 1);
1380  $part2 = array_slice($this->questions, $array_pos + 1);
1381  }
1382  $found = 0;
1383  foreach ($move_questions as $question_id) {
1384  if (!(!in_array($question_id, $part1))) {
1385  unset($part1[array_search($question_id, $part1)]);
1386  $found++;
1387  }
1388  if (!(!in_array($question_id, $part2))) {
1389  unset($part2[array_search($question_id, $part2)]);
1390  $found++;
1391  }
1392  }
1393  // sanity check: do not move questions if they have not be found in the array
1394  if ($found !== count($move_questions)) {
1395  return;
1396  }
1397  $part1 = array_values($part1);
1398  $part2 = array_values($part2);
1399  $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1400  foreach ($move_questions as $question_id) {
1401  $constraints = $this->getConstraints($question_id);
1402  foreach ($constraints as $idx => $constraint) {
1403  foreach ($part2 as $next_question_id) {
1404  if ($constraint["question"] == $next_question_id) {
1405  // constraint concerning a question that follows -> delete constraint
1406  $this->deleteConstraint($constraint["id"]);
1407  }
1408  }
1409  }
1410  }
1411  $this->saveQuestionsToDb();
1412  }
getConstraints(int $question_id)
Returns the constraints to a given question or questionblock.
deleteConstraint(int $constraint_id)
Deletes a single constraint.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openAllAppraisees()

ilObjSurvey::openAllAppraisees ( )
Todo:
move to appraisal manager

Definition at line 4913 of file class.ilObjSurvey.php.

References ilObject\$db, $DIC, $ilDB, getSurveyId(), and null.

4913  : void
4914  {
4915  $ilDB = $this->db;
4916 
4917  $ilDB->manipulate("UPDATE svy_360_appr" .
4918  " SET has_closed = " . $ilDB->quote(null, "integer") .
4919  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer"));
4920  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
+ Here is the call graph for this function:

◆ prepareTextareaOutput()

ilObjSurvey::prepareTextareaOutput ( string  $txt_output)

Prepares a string for a text area output in surveys.

Definition at line 3985 of file class.ilObjSurvey.php.

References ilLegacyFormElementsUtil\prepareTextareaOutput().

3987  : string {
3989  }
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ read()

ilObjSurvey::read ( )

Definition at line 250 of file class.ilObjSurvey.php.

References initServices(), and loadFromDb().

250  : void
251  {
252  parent::read();
253  $this->loadFromDb();
254  $this->initServices();
255  }
+ Here is the call graph for this function:

◆ removeConstraintsConcerningQuestion()

ilObjSurvey::removeConstraintsConcerningQuestion ( int  $question_id)

Remove constraints concerning a question with a given question_id.

Todo:
move to constraint manager/repo

Definition at line 1432 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

Referenced by removeQuestion().

1434  : void {
1435  $ilDB = $this->db;
1436  $result = $ilDB->queryF(
1437  "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1438  array('integer','integer'),
1439  array($question_id, $this->getSurveyId())
1440  );
1441  if ($result->numRows() > 0) {
1442  $remove_constraints = array();
1443  while ($row = $ilDB->fetchAssoc($result)) {
1444  $remove_constraints[] = $row["constraint_fi"];
1445  }
1446  $affectedRows = $ilDB->manipulateF(
1447  "DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1448  array('integer','integer'),
1449  array($question_id, $this->getSurveyId())
1450  );
1451  foreach ($remove_constraints as $key => $constraint_id) {
1452  $affectedRows = $ilDB->manipulateF(
1453  "DELETE FROM svy_constraint WHERE constraint_id = %s",
1454  array('integer'),
1455  array($constraint_id)
1456  );
1457  }
1458  }
1459  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestion()

ilObjSurvey::removeQuestion ( int  $question_id)
Todo:
move to survey question manager/repo

Definition at line 1417 of file class.ilObjSurvey.php.

References removeConstraintsConcerningQuestion().

Referenced by delete(), and removeQuestions().

1419  : void {
1420  $question = self::_instanciateQuestion($question_id);
1421  #20610 if no question found, do nothing.
1422  if ($question) {
1423  $question->delete($question_id);
1424  $this->removeConstraintsConcerningQuestion($question_id);
1425  }
1426  }
removeConstraintsConcerningQuestion(int $question_id)
Remove constraints concerning a question with a given question_id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionFromBlock()

ilObjSurvey::removeQuestionFromBlock ( int  $question_id,
int  $questionblock_id 
)
Todo:
move to survey question manager/repo

Definition at line 1531 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

1534  : void {
1535  $ilDB = $this->db;
1536 
1537  $ilDB->manipulateF(
1538  "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
1539  array('integer','integer','integer'),
1540  array($questionblock_id, $this->getSurveyId(), $question_id)
1541  );
1542  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ removeQuestions()

ilObjSurvey::removeQuestions ( array  $remove_questions,
array  $remove_questionblocks 
)
Parameters
int[]$remove_questions question ids of the questions to remove
int[]$remove_questionblocks questionblock ids of the questions blocks to remove
Todo:
move to survey question manager/repo

Definition at line 1466 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, getSurveyId(), getSurveyQuestions(), removeQuestion(), and saveQuestionsToDb().

1469  : void {
1470  $ilDB = $this->db;
1471 
1472  $block_sizes = array();
1473  foreach ($this->getSurveyQuestions() as $question_id => $data) {
1474  if (in_array($question_id, $remove_questions) or in_array($data["questionblock_id"], $remove_questionblocks)) {
1475  unset($this->questions[array_search($question_id, $this->questions)]);
1476  $this->removeQuestion($question_id);
1477  } elseif ($data["questionblock_id"]) {
1478  $block_sizes[$data["questionblock_id"]] = ($block_sizes[$data["questionblock_id"]] ?? 0) + 1;
1479  }
1480  }
1481 
1482  // blocks with just 1 question need to be deleted
1483  foreach ($block_sizes as $block_id => $size) {
1484  if ($size < 2) {
1485  $remove_questionblocks[] = $block_id;
1486  }
1487  }
1488 
1489  foreach (array_unique($remove_questionblocks) as $questionblock_id) {
1490  $affectedRows = $ilDB->manipulateF(
1491  "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1492  array('integer'),
1493  array($questionblock_id)
1494  );
1495  $affectedRows = $ilDB->manipulateF(
1496  "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1497  array('integer','integer'),
1498  array($questionblock_id, $this->getSurveyId())
1499  );
1500  }
1501 
1502  $this->questions = array_values($this->questions);
1503  $this->saveQuestionsToDb();
1504  }
getSurveyQuestions(bool $with_answers=false)
Returns the survey questions and questionblocks in an array.
ilDBInterface $db
removeQuestion(int $question_id)
+ Here is the call graph for this function:

◆ removeSelectedSurveyResults()

ilObjSurvey::removeSelectedSurveyResults ( array  $finished_ids)

Deletes the user data of a given array of survey participants.

Todo:
move to run manager/repo

Definition at line 400 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $user_id, ilObject\getId(), ilObjectLP\getInstance(), getSurveyId(), and ILIAS\Repository\int().

Referenced by deleteRater().

402  : void {
403  $ilDB = $this->db;
404 
405  $user_ids = [];
406 
407  foreach ($finished_ids as $finished_id) {
408  $result = $ilDB->queryF(
409  "SELECT finished_id, user_fi FROM svy_finished WHERE finished_id = %s",
410  array('integer'),
411  array($finished_id)
412  );
413  $row = $ilDB->fetchAssoc($result);
414  if ($row["user_fi"]) {
415  $user_ids[] = (int) $row["user_fi"];
416  }
417 
418  $affectedRows = $ilDB->manipulateF(
419  "DELETE FROM svy_answer WHERE active_fi = %s",
420  array('integer'),
421  array($row["finished_id"])
422  );
423 
424  $affectedRows = $ilDB->manipulateF(
425  "DELETE FROM svy_finished WHERE finished_id = %s",
426  array('integer'),
427  array($finished_id)
428  );
429 
430  $affectedRows = $ilDB->manipulateF(
431  "DELETE FROM svy_times WHERE finished_fi = %s",
432  array('integer'),
433  array($row["finished_id"])
434  );
435  }
436 
437  if (count($user_ids)) {
438  $lp_obj = ilObjectLP::getInstance($this->getId());
439  $lp_obj->resetLPDataForUserIds($user_ids);
440 
441  // remove invitations, if exist
442  foreach ($user_ids as $user_id) {
443  $this->invitation_manager->remove($this->getSurveyId(), $user_id);
444  }
445  }
446  }
ilDBInterface $db
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAuthorToMetadata()

ilObjSurvey::saveAuthorToMetadata ( string  $a_author = "")

Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be called for conversion of "old" surveys where the author hasn't been stored in the lifecycle metadata.

Definition at line 1136 of file class.ilObjSurvey.php.

References $user, ilObjUser\getFullname(), ilObject\getId(), and ilObject\getType().

Referenced by doCreateMetaData().

1138  : void {
1139  if ($a_author === '') {
1140  $ilUser = $this->user;
1141  $a_author = $ilUser->getFullname();
1142  }
1143  $this->domain->metadata()->saveAuthorsInLOMIfNoLifecycleSet(
1144  $this->getId(),
1145  0,
1146  $this->getType(),
1147  $a_author,
1148  );
1149  }
getFullname(int $a_max_strlen=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCompletionStatus()

ilObjSurvey::saveCompletionStatus ( )

Saves the completion status of the survey.

Todo:
move to survey manager/repo

Definition at line 514 of file class.ilObjSurvey.php.

References ilObject\$db, getSurveyId(), isComplete(), and ilDBInterface\manipulateF().

Referenced by insertQuestion().

514  : void
515  {
516  $db = $this->db;
517  if ($this->getSurveyId() > 0) {
518  $db->manipulateF(
519  "UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
520  array('text','integer','integer'),
521  array($this->isComplete(), time(), $this->getSurveyId())
522  );
523  }
524  }
manipulateF(string $query, array $types, array $values)
isComplete()
Check if survey is complete for use.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveHeading()

ilObjSurvey::saveHeading ( string  $heading,
int  $insertbefore 
)
Todo:
move to survey question manager
Parameters
string$heading
int$insertbeforequestion id which gets the heading (before)

Definition at line 3528 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, getSurveyId(), and null.

Referenced by cloneTextblocks().

3531  : void {
3532  $ilDB = $this->db;
3533  if ($heading) {
3534  $ilDB->manipulateF(
3535  "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3536  array('text','integer','integer'),
3537  array($heading, $this->getSurveyId(), $insertbefore)
3538  );
3539  } else {
3540  $ilDB->manipulateF(
3541  "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3542  array('text','integer','integer'),
3543  array(null, $this->getSurveyId(), $insertbefore)
3544  );
3545  }
3546  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestionsToDb()

ilObjSurvey::saveQuestionsToDb ( )

Definition at line 831 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, $q, getSurveyId(), isQuestionInSurvey(), and null.

Referenced by moveQuestions(), removeQuestions(), saveToDb(), and updateOrder().

831  : void
832  {
833  $ilDB = $this->db;
834 
835  $this->svy_log->debug("save questions");
836 
837  // gather old questions state
838  $old_questions = array();
839  $result = $ilDB->queryF(
840  "SELECT survey_question_id,question_fi,sequence" .
841  " FROM svy_svy_qst WHERE survey_fi = %s",
842  array('integer'),
843  array($this->getSurveyId())
844  );
845  while ($row = $ilDB->fetchAssoc($result)) {
846  $old_questions[$row["question_fi"]] = $row; // problem, as soon as duplicates exist, they will be hidden here
847  }
848 
849  // #15231 - diff with current questions state
850  $insert = $update = $delete = array();
851  foreach ($this->questions as $seq => $fi) {
852  if (!array_key_exists($fi, $old_questions)) { // really new fi IDs
853  $insert[] = $fi; // this should be ok, should not create duplicates here
854  } elseif ($old_questions[$fi]["sequence"] != $seq) { // we are updating one of the duplicates (if any)
855  $update[$fi] = $old_questions[$fi]["survey_question_id"];
856  }
857  // keep track of still relevant questions
858  unset($old_questions[$fi]); // deleting old question, if they are not in current array
859  }
860 
861  // delete obsolete question relations
862  if (count($old_questions)) {
863  $del_ids = array();
864  foreach ($old_questions as $fi => $old) {
865  $del_ids[] = $old["survey_question_id"];
866  }
867  $ilDB->manipulate($q = "DELETE FROM svy_svy_qst" .
868  " WHERE " . $ilDB->in("survey_question_id", $del_ids, "", "integer"));
869  $this->svy_log->debug("delete: " . $q);
870  }
871  unset($old_questions);
872 
873  // create/update question relations
874  foreach ($this->questions as $seq => $fi) {
875  if (in_array($fi, $insert)) {
876  // check if question is not already in the survey, see #22018
877  if (!$this->isQuestionInSurvey($fi)) {
878  $next_id = $ilDB->nextId('svy_svy_qst');
879  $ilDB->manipulateF(
880  "INSERT INTO svy_svy_qst" .
881  " (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp)" .
882  " VALUES (%s, %s, %s, %s, %s, %s)",
883  array('integer', 'integer', 'integer', 'text', 'integer', 'integer'),
884  array($next_id, $this->getSurveyId(), $fi, null, $seq, time())
885  );
886  $this->svy_log->debug("insert svy_svy_qst, id:" . $next_id . ", fi: " . $fi . ", seq:" . $seq);
887  }
888  } elseif (array_key_exists($fi, $update)) {
889  $ilDB->manipulate("UPDATE svy_svy_qst" .
890  " SET sequence = " . $ilDB->quote($seq, "integer") .
891  ", tstamp = " . $ilDB->quote(time(), "integer") .
892  " WHERE survey_question_id = " . $ilDB->quote($update[$fi], "integer"));
893  $this->svy_log->debug("update svy_svy_qst, id:" . $update[$fi] . ", fi: " . $fi . ", seq:" . $seq);
894  }
895  }
896  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
isQuestionInSurvey(int $a_question_fi)
ilDBInterface $db
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

ilObjSurvey::saveToDb ( )

Definition at line 696 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, ilRTE\_replaceMediaObjectImageSrc(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), getActivationEndDate(), getActivationStartDate(), getActivationVisibility(), getAnonymize(), getAuthor(), getCalculateSumScore(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getIntroduction(), ilObjectActivation\getItem(), getMailAddresses(), getMailNotification(), getMailParticipantData(), getMode(), getOutro(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderStart(), getReminderStatus(), getReminderTarget(), getReminderTemplate(), getSelfEvaluationResults(), getShowQuestionTitles(), getSkillService(), getStartDate(), getSurveyId(), getTutorNotificationRecipients(), getTutorNotificationStatus(), getTutorNotificationTarget(), getTutorResultsRecipients(), getTutorResultsStatus(), hasAnonymousUserList(), hasMailConfirmation(), hasMailOwnResults(), hasViewOwnResults(), IL_CAL_DATE, isActivationLimited(), isComplete(), saveQuestionsToDb(), setSurveyId(), ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

Referenced by checkReminder(), and createReference().

696  : void
697  {
698  $ilDB = $this->db;
699 
700  // date handling
701  $rmd_start = $this->getReminderStart();
702  if (is_object($rmd_start)) {
703  $rmd_start = $rmd_start->get(IL_CAL_DATE);
704  }
705  $rmd_end = $this->getReminderEnd();
706  if (is_object($rmd_end)) {
707  $rmd_end = $rmd_end->get(IL_CAL_DATE);
708  }
709  if ($this->getSurveyId() < 1) {
710  $next_id = $ilDB->nextId('svy_svy');
711  $affectedRows = $ilDB->insert("svy_svy", array(
712  "survey_id" => array("integer", $next_id),
713  "obj_fi" => array("integer", $this->getId()),
714  "author" => array("text", $this->getAuthor()),
715  "introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
716  "outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
717  "startdate" => array("text", $this->getStartDate()),
718  "enddate" => array("text", $this->getEndDate()),
719  "evaluation_access" => array("text", $this->getEvaluationAccess()),
720  "complete" => array("text", $this->isComplete()),
721  "created" => array("integer", time()),
722  "anonymize" => array("text", $this->getAnonymize()),
723  "show_question_titles" => array("text", $this->getShowQuestionTitles()),
724  "mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
725  "mailaddresses" => array('text', $this->getMailAddresses()),
726  "mailparticipantdata" => array('text', $this->getMailParticipantData()),
727  "tstamp" => array("integer", time()),
728  // Mode type
729  "mode" => array("integer", $this->getMode()),
730  // 360°
731  "mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
732  "mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
733  "mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
734  "mode_360_results" => array("integer", $this->get360Results()),
735  // competences
736  "mode_skill_service" => array("integer", (int) $this->getSkillService()),
737  // Self Evaluation Only
738  "mode_self_eval_results" => array("integer", self::RESULTS_SELF_EVAL_OWN),
739  // reminder/notification
740  "reminder_status" => array("integer", (int) $this->getReminderStatus()),
741  "reminder_start" => array("datetime", $rmd_start),
742  "reminder_end" => array("datetime", $rmd_end),
743  "reminder_frequency" => array("integer", $this->getReminderFrequency()),
744  "reminder_target" => array("integer", $this->getReminderTarget()),
745  "reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
746  "reminder_tmpl" => array("text", $this->getReminderTemplate(true)),
747  "tutor_ntf_status" => array("integer", (int) $this->getTutorNotificationStatus()),
748  "tutor_ntf_reci" => array("text", implode(";", $this->getTutorNotificationRecipients())),
749  "tutor_ntf_target" => array("integer", $this->getTutorNotificationTarget()),
750  "own_results_view" => array("integer", $this->hasViewOwnResults()),
751  "own_results_mail" => array("integer", $this->hasMailOwnResults()),
752  "tutor_res_status" => array("integer", (int) $this->getTutorResultsStatus()),
753  "tutor_res_reci" => array("text", implode(";", $this->getTutorResultsRecipients())),
754  "confirmation_mail" => array("integer", $this->hasMailConfirmation()),
755  "anon_user_list" => array("integer", $this->hasAnonymousUserList()),
756  "calculate_sum_score" => array("integer", $this->getCalculateSumScore())
757  ));
758  $this->setSurveyId($next_id);
759  } else {
760  $affectedRows = $ilDB->update("svy_svy", array(
761  "author" => array("text", $this->getAuthor()),
762  "introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
763  "outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
764  "startdate" => array("text", $this->getStartDate()),
765  "enddate" => array("text", $this->getEndDate()),
766  "evaluation_access" => array("text", $this->getEvaluationAccess()),
767  "complete" => array("text", $this->isComplete()),
768  "anonymize" => array("text", $this->getAnonymize()),
769  "show_question_titles" => array("text", $this->getShowQuestionTitles()),
770  "mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
771  "mailaddresses" => array('text', $this->getMailAddresses()),
772  "mailparticipantdata" => array('text', $this->getMailParticipantData()),
773  "tstamp" => array("integer", time()),
774  //MODE TYPE
775  "mode" => array("integer", $this->getMode()),
776  // 360°
777  "mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
778  "mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
779  "mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
780  "mode_360_results" => array("integer", $this->get360Results()),
781  // Competences
782  "mode_skill_service" => array("integer", (int) $this->getSkillService()),
783  // Self Evaluation Only
784  "mode_self_eval_results" => array("integer", $this->getSelfEvaluationResults()),
785  // reminder/notification
786  "reminder_status" => array("integer", $this->getReminderStatus()),
787  "reminder_start" => array("datetime", $rmd_start),
788  "reminder_end" => array("datetime", $rmd_end),
789  "reminder_frequency" => array("integer", $this->getReminderFrequency()),
790  "reminder_target" => array("integer", $this->getReminderTarget()),
791  "reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
792  "reminder_tmpl" => array("text", $this->getReminderTemplate()),
793  "tutor_ntf_status" => array("integer", $this->getTutorNotificationStatus()),
794  "tutor_ntf_reci" => array("text", implode(";", $this->getTutorNotificationRecipients())),
795  "tutor_ntf_target" => array("integer", $this->getTutorNotificationTarget()),
796  "own_results_view" => array("integer", $this->hasViewOwnResults()),
797  "own_results_mail" => array("integer", $this->hasMailOwnResults()),
798  "tutor_res_status" => array("integer", (int) $this->getTutorResultsStatus()),
799  "tutor_res_reci" => array("text", implode(";", $this->getTutorResultsRecipients())),
800  "confirmation_mail" => array("integer", $this->hasMailConfirmation()),
801  "anon_user_list" => array("integer", $this->hasAnonymousUserList()),
802  "calculate_sum_score" => array("integer", $this->getCalculateSumScore())
803  ), array(
804  "survey_id" => array("integer", $this->getSurveyId())
805  ));
806  }
807  if ($affectedRows) {
808  // save questions to db
809  $this->saveQuestionsToDb();
810  }
811 
812  // moved activation to ilObjectActivation
813  if ($this->ref_id) {
814  ilObjectActivation::getItem($this->ref_id);
815 
816  $item = new ilObjectActivation();
817  if (!$this->isActivationLimited()) {
818  $item->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
819  } else {
820  $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
821  $item->setTimingStart($this->getActivationStartDate());
822  $item->setTimingEnd($this->getActivationEndDate());
823  $item->toggleVisible($this->getActivationVisibility());
824  }
825 
826  $item->update($this->ref_id);
827  }
828  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getTutorNotificationTarget()
Group that is checked for the "all participants have finished" mail Either a) all members of a parent...
getMailParticipantData()
Preceding text (incl.
setSurveyId(int $survey_id)
isComplete()
Check if survey is complete for use.
getReminderTemplate(bool $selectDefault=false)
getTutorNotificationRecipients()
Mail being sent to tutors after all participants have finished the survey?
getMailNotification()
Send mail to tutors each time a participant finishes the survey?
ilDBInterface $db
const IL_CAL_DATE
static getItem(int $ref_id)
Class ilObjectActivation.
getMailAddresses()
(Tutor) Recipients of "single participant has finished" mails
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveUserAccessCode()

ilObjSurvey::saveUserAccessCode ( int  $user_id,
string  $access_code 
)

Saves a survey access code for a registered user to the database.

Parameters
int$user_idThe database id of the user
string$access_codeThe survey access code
Todo:
move to code manager

Definition at line 3934 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

3937  : void {
3938  $ilDB = $this->db;
3939 
3940  // not really sure what to do about ANONYMOUS_USER_ID
3941 
3942  $next_id = $ilDB->nextId('svy_anonymous');
3943  $affectedRows = $ilDB->manipulateF(
3944  "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) " .
3945  "VALUES (%s, %s, %s, %s, %s)",
3946  array('integer','text', 'integer', 'text', 'integer'),
3947  array($next_id, $access_code, $this->getSurveyId(), md5($user_id), time())
3948  );
3949  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ saveUserSettings()

ilObjSurvey::saveUserSettings ( int  $usr_id,
string  $key,
string  $title,
string  $value 
)

Definition at line 645 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

650  : void {
651  $ilDB = $this->db;
652 
653  $next_id = $ilDB->nextId('svy_settings');
654  $affectedRows = $ilDB->insert("svy_settings", array(
655  "settings_id" => array("integer", $next_id),
656  "usr_id" => array("integer", $usr_id),
657  "keyword" => array("text", $key),
658  "title" => array("text", $title),
659  "value" => array("clob", $value)
660  ));
661  }
string $title
ilDBInterface $db

◆ send360ReminderToUser()

ilObjSurvey::send360ReminderToUser ( int  $a_user_id,
array  $a_appraisee_ids 
)

Definition at line 5217 of file class.ilObjSurvey.php.

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilUserUtil\getNamePresentation(), ilObject\getRefId(), ilObject\getTitle(), ilLanguage\getUserLanguage(), null, and ilLanguage\txt().

Referenced by sent360Reminders().

5220  : void {
5221  $this->svy_log->debug("Send mail to:" . $a_user_id);
5222 
5223  $ntf = new ilSystemNotification();
5224  $ntf->setLangModules(array("svy", "survey"));
5225  $ntf->setRefId($this->getRefId());
5226  $ntf->setGotoLangId('url');
5227 
5228  // user specific language
5229  $lng = $ntf->getUserLanguage($a_user_id);
5230 
5231  $ntf->setIntroductionLangId("svy_user_added_rater_reminder_mail");
5232  $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_rater"));
5233 
5234  foreach ($a_appraisee_ids as $appraisee_id) {
5235  $ntf->addAdditionalInfo("survey_360_appraisee", ilUserUtil::getNamePresentation($appraisee_id, false, false, "", true));
5236  }
5237 
5238  // #10044
5239  $mail = new ilMail(ANONYMOUS_USER_ID);
5240  $mail->enqueue(
5241  ilObjUser::_lookupLogin($a_user_id),
5242  "",
5243  "",
5244  $subject,
5245  $ntf->composeAndGetMessage($a_user_id, null, "read", true),
5246  []
5247  );
5248  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUserLanguage()
Return language of user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendAppraiseeCloseNotification()

ilObjSurvey::sendAppraiseeCloseNotification ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4330 of file class.ilObjSurvey.php.

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilObject\getRefId(), ilObject\getTitle(), ilLanguage\getUserLanguage(), null, and ilLanguage\txt().

Referenced by closeAppraisee().

4332  : void {
4333  $ntf = new ilSystemNotification();
4334  $ntf->setLangModules(array("svy", "survey"));
4335  $ntf->setRefId($this->getRefId());
4336  $ntf->setGotoLangId('url');
4337 
4338  // user specific language
4339  $lng = $ntf->getUserLanguage($a_user_id);
4340 
4341  $ntf->setIntroductionLangId("svy_user_added_appraisee_close_mail");
4342  $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_appraisee"));
4343 
4344  // #10044
4345  $mail = new ilMail(ANONYMOUS_USER_ID);
4346  $mail->enqueue(
4347  ilObjUser::_lookupLogin($a_user_id),
4348  "",
4349  "",
4350  $subject,
4351  $ntf->composeAndGetMessage($a_user_id, null, "read", true),
4352  []
4353  );
4354  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUserLanguage()
Return language of user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendAppraiseeNotification()

ilObjSurvey::sendAppraiseeNotification ( int  $a_user_id)
Todo:
move to appraisal manager

Definition at line 4301 of file class.ilObjSurvey.php.

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilObject\getRefId(), ilObject\getTitle(), ilLanguage\getUserLanguage(), null, and ilLanguage\txt().

Referenced by addAppraisee().

4303  : void {
4304  $ntf = new ilSystemNotification();
4305  $ntf->setLangModules(array("svy", "survey"));
4306  $ntf->setRefId($this->getRefId());
4307  $ntf->setGotoLangId('url');
4308 
4309  // user specific language
4310  $lng = $ntf->getUserLanguage($a_user_id);
4311 
4312  $ntf->setIntroductionLangId("svy_user_added_appraisee_mail");
4313  $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_appraisee"));
4314 
4315  // #10044
4316  $mail = new ilMail(ANONYMOUS_USER_ID);
4317  $mail->enqueue(
4318  ilObjUser::_lookupLogin($a_user_id),
4319  "",
4320  "",
4321  $subject,
4322  $ntf->composeAndGetMessage($a_user_id, null, "read", true),
4323  []
4324  );
4325  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUserLanguage()
Return language of user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendCodes()

ilObjSurvey::sendCodes ( int  $not_sent,
string  $subject,
string  $message,
string  $lang 
)
Todo:
move to code manager

Definition at line 3759 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, $message, $url, ANONYMOUS_USER_ID, getExternalCodeRecipients(), ilObject\getRefId(), and getSurveyId().

3764  : void {
3765  /*
3766  * 0 = all
3767  * 1 = not sent
3768  * 2 = finished
3769  * 3 = not finished
3770  */
3771  $check_finished = ($not_sent > 1);
3772 
3773 
3774  $mail = new ilMail(ANONYMOUS_USER_ID);
3775  $recipients = $this->getExternalCodeRecipients($check_finished);
3776  foreach ($recipients as $data) {
3777  if ($data['email'] && $data['code']) {
3778  $do_send = false;
3779  switch ($not_sent) {
3780  case 1:
3781  $do_send = !(bool) $data['sent'];
3782  break;
3783 
3784  case 2:
3785  $do_send = $data['finished'];
3786  break;
3787 
3788  case 3:
3789  $do_send = !$data['finished'];
3790  break;
3791 
3792  default:
3793  $do_send = true;
3794  break;
3795  }
3796  if ($do_send) {
3797  // build text
3798  $messagetext = $message;
3799  $url = ilLink::_getLink(
3800  $this->getRefId(),
3801  "svy",
3802  array(
3803  "accesscode" => $data["code"],
3804  "lang" => $lang
3805  )
3806  );
3807  $messagetext = str_replace('[url]', $url, $messagetext);
3808  foreach ($data as $key => $value) {
3809  $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
3810  }
3811 
3812  // send mail
3813  $mail->enqueue(
3814  $data['email'], // to
3815  "", // cc
3816  "", // bcc
3817  $subject, // subject
3818  $messagetext, // message
3819  array() // attachments
3820  );
3821  }
3822  }
3823  }
3824 
3825  $ilDB = $this->db;
3826  $ilDB->manipulateF(
3827  "UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
3828  array('integer','integer'),
3829  array(1, $this->getSurveyId())
3830  );
3831  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
$url
Definition: shib_logout.php:66
ilDBInterface $db
$lang
Definition: xapiexit.php:25
getExternalCodeRecipients(bool $a_check_finished=false)
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ sendNotificationMail()

ilObjSurvey::sendNotificationMail ( int  $a_user_id,
string  $a_anonymize_id,
int  $a_appr_id = 0 
)

These mails are sent to tutors for each single participant that finishes a survey.

It includes the "additional participant data" text that can be set in the settings screen.

Exceptions
ilWACException

Definition at line 2390 of file class.ilObjSurvey.php.

References $data, $mailparticipantdata, $user_id, ilObjUser\_getUserData(), ilObjUser\_lookupId(), getActiveID(), ilUserUtil\getNamePresentation(), getParticipantTextResults(), ilObject\getRefId(), ilObjUser\getUserIdsByEmail(), hasAnonymizedResults(), and ILIAS\Repository\int().

2394  : void {
2395  // #12755
2396  $placeholders = array(
2397  "FIRST_NAME" => "firstname",
2398  "LAST_NAME" => "lastname",
2399  "LOGIN" => "login",
2400  // old style
2401  "firstname" => "firstname"
2402  );
2403 
2404  //mailaddresses is just text split by commas.
2405  //sendMail can send emails if it gets an user id or an email as first parameter.
2406  $recipients = explode(",", $this->mailaddresses ?? "");
2407  foreach ($recipients as $recipient) {
2408  // #11298
2409  $ntf = new ilSystemNotification();
2410  $ntf->setLangModules(array("survey"));
2411  $ntf->setRefId($this->getRefId());
2412  $ntf->setSubjectLangId('finished_mail_subject');
2413 
2414  $messagetext = $this->mailparticipantdata;
2415  $data = [];
2416  if (trim($messagetext ?? "")) {
2417  if (!$this->hasAnonymizedResults()) {
2418  $data = ilObjUser::_getUserData(array($a_user_id));
2419  $data = $data[0];
2420  }
2421  foreach ($placeholders as $key => $mapping) {
2422  if ($this->hasAnonymizedResults()) { // #16480
2423  $messagetext = str_replace('[' . $key . ']', '', $messagetext);
2424  } else {
2425  $messagetext = str_replace('[' . $key . ']', trim($data[$mapping] ?? ""), $messagetext);
2426  }
2427  }
2428  $ntf->setIntroductionDirect($messagetext);
2429  } else {
2430  $ntf->setIntroductionLangId('survey_notification_finished_introduction');
2431  }
2432 
2433  // 360°? add appraisee data
2434  if ($a_appr_id) {
2435  $ntf->addAdditionalInfo(
2436  'survey_360_appraisee',
2438  );
2439  }
2440 
2441  $active_id = $this->getActiveID($a_user_id, $a_anonymize_id, $a_appr_id);
2442  if ($active_id) { // 43908
2443  $ntf->addAdditionalInfo(
2444  'results',
2445  $this->getParticipantTextResults($active_id),
2446  true
2447  );
2448  }
2449 
2450  $ntf->setGotoLangId('survey_notification_tutor_link');
2451  $ntf->setReasonLangId('survey_notification_finished_reason');
2452 
2453  $recipient = trim($recipient ?? "");
2454  $user_id = (int) ilObjUser::_lookupId($recipient);
2455  if ($user_id > 0) {
2456  $ntf->sendMailAndReturnRecipients([$user_id]);
2457  } else {
2458  $user_ids = ilObjUser::getUserIdsByEmail($recipient);
2459  if (count($user_ids) > 0) {
2460  $ntf->sendMailAndReturnRecipients([current($user_ids)]);
2461  }
2462  }
2463  /* note: this block is replace by the single line above
2464  since the UI asks for account names and the "e-mail" fallback leads
2465  to strange issues like multiple mails. Also the test case has been
2466  adopted, see https://mantis.ilias.de/view.php?id=36327
2467  if (is_numeric($recipient)) {
2468  $lng = $ntf->getUserLanguage((int) $recipient);
2469  $ntf->sendMailAndReturnRecipients([(int) $recipient]);
2470  } else {
2471  $recipient = trim($recipient);
2472  $user_ids = ilObjUser::getUserIdsByEmail($recipient);
2473  if (empty($user_ids)) {
2474  $ntf->sendMailAndReturnRecipients([ilObjUser::_lookupId($recipient)]);
2475  } else {
2476  foreach ($user_ids as $user_id) {
2477  $lng = $ntf->getUserLanguage($user_id);
2478  $ntf->sendMailAndReturnRecipients(array($user_id));
2479  }
2480  }
2481  }*/
2482  }
2483  }
string $mailparticipantdata
static _lookupId($a_user_str)
static getUserIdsByEmail(string $a_email)
getParticipantTextResults(int $active_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
static _getUserData(array $a_internalids)
return user data for given user ids
getActiveID(int $user_id, string $anonymize_id, int $appr_id)
Get run id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ sendRaterNotification()

ilObjSurvey::sendRaterNotification ( int  $a_user_id,
int  $a_appraisee_id 
)
Todo:
move to appraisal manager

Definition at line 4359 of file class.ilObjSurvey.php.

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilUserUtil\getNamePresentation(), ilObject\getRefId(), ilObject\getTitle(), ilLanguage\getUserLanguage(), null, and ilLanguage\txt().

4362  : void {
4363  $ntf = new ilSystemNotification();
4364  $ntf->setLangModules(array("svy", "survey"));
4365  $ntf->setRefId($this->getRefId());
4366  $ntf->setGotoLangId('url');
4367 
4368  // user specific language
4369  $lng = $ntf->getUserLanguage($a_user_id);
4370 
4371  $ntf->setIntroductionLangId("svy_user_added_rater_mail");
4372  $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_rater"));
4373  $ntf->addAdditionalInfo("survey_360_appraisee", ilUserUtil::getNamePresentation($a_appraisee_id, false, false, "", true));
4374 
4375  // #10044
4376  $mail = new ilMail(ANONYMOUS_USER_ID);
4377  $mail->enqueue(
4378  ilObjUser::_lookupLogin($a_user_id),
4379  "",
4380  "",
4381  $subject,
4382  $ntf->composeAndGetMessage($a_user_id, null, "read", true),
4383  []
4384  );
4385  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUserLanguage()
Return language of user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:

◆ sendTutorNotification()

ilObjSurvey::sendTutorNotification ( )
protected

Send mail to tutors after all participants have finished the survey.

Definition at line 5284 of file class.ilObjSurvey.php.

References $message, $user_id, ilLanguageFactory\_getLanguageOfUser(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilObject\getRefId(), ilObject\getTitle(), and getTutorNotificationRecipients().

Referenced by checkTutorNotification().

5284  : void
5285  {
5286  $link = ilLink::_getStaticLink($this->getRefId(), "svy");
5287 
5288  // get tutors being set in the setting
5289  foreach ($this->getTutorNotificationRecipients() as $user_id) {
5290  // use language of recipient to compose message
5291  $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
5292  $ulng->loadLanguageModule('survey');
5293 
5294  $subject = sprintf($ulng->txt('survey_notification_tutor_subject'), $this->getTitle());
5295  $message = sprintf($ulng->txt('survey_notification_tutor_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
5296 
5297  $message .= $ulng->txt('survey_notification_tutor_body') . ":\n\n";
5298  $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
5299  $message .= "\n" . $ulng->txt('survey_notification_tutor_link') . ": " . $link;
5300 
5301  $mail_obj = new ilMail(ANONYMOUS_USER_ID);
5302  $mail_obj->appendInstallationSignature(true);
5303  $mail_obj->enqueue(
5304  ilObjUser::_lookupLogin($user_id),
5305  "",
5306  "",
5307  $subject,
5308  $message,
5309  array()
5310  );
5311  }
5312  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static _lookupFullname(int $a_user_id)
getTutorNotificationRecipients()
Mail being sent to tutors after all participants have finished the survey?
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
$message
Definition: xapiexit.php:31
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sent360Reminders()

ilObjSurvey::sent360Reminders ( )

Send 360 reminders.

Definition at line 5148 of file class.ilObjSurvey.php.

References $DIC, $id, ilObjUser\_lookupId(), ilRBACAccessHandler\checkAccessOfUser(), get360SelfAppraisee(), get360SelfEvaluation(), getAppraiseesData(), getRatersData(), getReminderTarget(), is360SurveyStarted(), isAppraiseeClosed(), and send360ReminderToUser().

Referenced by checkReminder().

5148  : void
5149  {
5150  global $DIC;
5151 
5152  $access = $DIC->access();
5153  // collect all open ratings
5154  $rater_ids = array();
5155  foreach ($this->getAppraiseesData() as $app) {
5156  $this->svy_log->debug("Handle appraisee " . $app['user_id']);
5157 
5158  if (!$this->isAppraiseeClosed($app['user_id'])) {
5159  $this->svy_log->debug("Check self evaluation, self: " . $this->get360SelfAppraisee() . ", target: " . $this->getReminderTarget());
5160 
5161  // self evaluation?
5162  if ($this->get360SelfEvaluation() &&
5163  in_array($this->getReminderTarget(), array(self::NOTIFICATION_APPRAISEES, self::NOTIFICATION_APPRAISEES_AND_RATERS))) {
5164  $this->svy_log->debug("...1");
5165  // did user already finished self evaluation?
5166  if (!$this->is360SurveyStarted((int) $app['user_id'], (int) $app['user_id'])) {
5167  $this->svy_log->debug("...2");
5168  if (!isset($rater_ids[$app['user_id']])) {
5169  $rater_ids[$app['user_id']] = array();
5170  }
5171  if (!isset($app["user_id"], $rater_ids[$app['user_id']])) {
5172  $rater_ids[$app['user_id']][] = $app["user_id"];
5173  }
5174  }
5175  }
5176 
5177  $this->svy_log->debug("Check raters.");
5178 
5179  // should raters be notified?
5180  if (
5181  in_array(
5182  $this->getReminderTarget(),
5183  array(self::NOTIFICATION_RATERS, self::NOTIFICATION_APPRAISEES_AND_RATERS),
5184  true
5185  )
5186  ) {
5187  foreach ($this->getRatersData($app['user_id']) as $rater) {
5188  $rater_id = 0;
5189  if ($rater["login"] !== "") {
5190  $rater_id = ilObjUser::_lookupId($rater["login"]);
5191  }
5192  if ($rater_id > 0) {
5193  // is rater not anonymous and did not rate yet?
5194  if (!($rater["anonymous_id"] ?? false) && !($rater["finished"] ?? false)) {
5195  if (!isset($rater_ids[$rater_id])) {
5196  $rater_ids[$rater_id] = array();
5197  }
5198  if (!in_array($app["user_id"], $rater_ids[$rater_id])) {
5199  $rater_ids[$rater_id][] = $app["user_id"];
5200  }
5201  }
5202  }
5203  }
5204  }
5205  }
5206  }
5207 
5208  $this->svy_log->debug("Found raters:" . count($rater_ids));
5209 
5210  foreach ($rater_ids as $id => $app) {
5211  if ($access->checkAccessOfUser((int) $id, "read", "", $this->getRefId())) {
5212  $this->send360ReminderToUser((int) $id, $app);
5213  }
5214  }
5215  }
is360SurveyStarted(int $appr_id, int $user_id, ?string $anonymous_code=null)
static _lookupId($a_user_str)
ilAccessHandler $access
global $DIC
Definition: shib_login.php:22
isAppraiseeClosed(int $a_user_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
send360ReminderToUser(int $a_user_id, array $a_appraisee_ids)
getRatersData(int $a_appraisee_id)
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sentReminderPlaceholders()

ilObjSurvey::sentReminderPlaceholders ( string  $a_message,
int  $a_user_id,
array  $a_context_params 
)
protected

Definition at line 5564 of file class.ilObjSurvey.php.

References $context, Vendor\Package\$e, ilLoggerFactory\getLogger(), ilMailTemplateContextService\getTemplateContextById(), and ilSurveyMailTemplateReminderContext\ID.

Referenced by checkReminder().

5568  : string {
5569  // see ilMail::replacePlaceholders()
5570  try {
5572 
5573  $user = new \ilObjUser($a_user_id);
5574 
5575  $a_message = $this->placeholder_resolver->resolve($context, $a_message, $user, $a_context_params);
5576  } catch (\Exception $e) {
5577  ilLoggerFactory::getLogger('mail')->error(__METHOD__ . ' has been called with invalid context.');
5578  }
5579 
5580  return $a_message;
5581  }
$context
Definition: webdav.php:31
static getLogger(string $a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set360RaterSent()

ilObjSurvey::set360RaterSent ( int  $a_appraisee_id,
int  $a_user_id,
int  $a_anonymous_id,
?int  $a_tstamp = null 
)
Todo:
move to appraisal manager

Definition at line 4860 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

4865  : void {
4866  $ilDB = $this->db;
4867 
4868  if (!$a_tstamp) {
4869  $a_tstamp = time();
4870  }
4871 
4872  $ilDB->manipulate("UPDATE svy_360_rater" .
4873  " SET mail_sent = " . $ilDB->quote($a_tstamp, "integer") .
4874  " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
4875  " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer") .
4876  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
4877  " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer"));
4878  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ set360Results()

ilObjSurvey::set360Results ( int  $a_value)

Definition at line 4262 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), ILIAS\Survey\Mode\IndividualFeedback\UIModifier\setValuesFromForm(), and ILIAS\Survey\Mode\Feedback360\UIModifier\setValuesFromForm().

4262  : void
4263  {
4264  $this->mode_360_results = $a_value;
4265  }
+ Here is the caller graph for this function:

◆ set360SelfAppraisee()

ilObjSurvey::set360SelfAppraisee ( bool  $a_value)

Definition at line 4242 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4242  : void
4243  {
4244  $this->mode_360_self_appr = $a_value;
4245  }
+ Here is the caller graph for this function:

◆ set360SelfEvaluation()

ilObjSurvey::set360SelfEvaluation ( bool  $a_value)

Definition at line 4232 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\Feedback360\UIModifier\setValuesFromForm().

4232  : void
4233  {
4234  $this->mode_360_self_eval = $a_value;
4235  }
+ Here is the caller graph for this function:

◆ set360SelfRaters()

ilObjSurvey::set360SelfRaters ( bool  $a_value)

Definition at line 4252 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4252  : void
4253  {
4254  $this->mode_360_self_rate = $a_value;
4255  }
+ Here is the caller graph for this function:

◆ setActivationEndDate()

ilObjSurvey::setActivationEndDate ( ?int  $ending_time = null)

Definition at line 5474 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5476  : void {
5477  $this->activation_ending_time = $ending_time;
5478  }
+ Here is the caller graph for this function:

◆ setActivationLimited()

ilObjSurvey::setActivationLimited ( bool  $a_value)

Definition at line 1313 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

1313  : void
1314  {
1315  $this->activation_limited = $a_value;
1316  }
+ Here is the caller graph for this function:

◆ setActivationStartDate()

ilObjSurvey::setActivationStartDate ( ?int  $starting_time = null)

Definition at line 5468 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5470  : void {
5471  $this->activation_starting_time = $starting_time;
5472  }
+ Here is the caller graph for this function:

◆ setActivationVisibility()

ilObjSurvey::setActivationVisibility ( bool  $a_value)

Definition at line 1297 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

1299  : void {
1300  $this->activation_visibility = $a_value;
1301  }
+ Here is the caller graph for this function:

◆ setAnonymize()

ilObjSurvey::setAnonymize ( int  $a_anonymize)

set anonymize status

Definition at line 936 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm().

936  : void
937  {
938  switch ($a_anonymize) {
939  case self::ANONYMIZE_OFF:
940  case self::ANONYMIZE_ON:
941  case self::ANONYMIZE_FREEACCESS:
942  case self::ANONYMIZE_CODE_ALL:
943  $this->anonymize = $a_anonymize;
944  break;
945  default:
946  $this->anonymize = self::ANONYMIZE_OFF;
947  break;
948  }
949  }
+ Here is the caller graph for this function:

◆ setAnonymousUserList()

ilObjSurvey::setAnonymousUserList ( bool  $a_value)

Definition at line 5520 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm().

5520  : void
5521  {
5522  $this->anon_user_list = $a_value;
5523  }
+ Here is the caller graph for this function:

◆ setAuthor()

ilObjSurvey::setAuthor ( string  $author = "")

Definition at line 1125 of file class.ilObjSurvey.php.

References $author.

Referenced by loadFromDb().

1127  : void {
1128  $this->author = $author;
1129  }
string $author
A text representation of the authors name.
+ Here is the caller graph for this function:

◆ setCalculateSumScore()

ilObjSurvey::setCalculateSumScore ( bool  $a_val)

Definition at line 956 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm().

958  : void {
959  $this->calculate_sum_score = $a_val;
960  }
+ Here is the caller graph for this function:

◆ setEndDate()

ilObjSurvey::setEndDate ( string  $end_date = "")
Parameters
string$end_date(YYYYMMDDHHMMSS)

Definition at line 1232 of file class.ilObjSurvey.php.

References $end_date.

Referenced by loadFromDb().

1234  : void {
1235  $this->end_date = $end_date;
1236  }
+ Here is the caller graph for this function:

◆ setEndDateAndTime()

ilObjSurvey::setEndDateAndTime ( string  $end_date,
string  $end_time 
)
Parameters
string$end_date(YYYY-MM-DD)
string$end_time(HH:MM:SS)

Definition at line 1262 of file class.ilObjSurvey.php.

References Vendor\Package\$d.

1265  : void {
1266  $y = '';
1267  $m = '';
1268  $d = '';
1269  $h = '';
1270  $i = '';
1271  $s = '';
1272  if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches)) {
1273  $y = $matches[1];
1274  $m = $matches[2];
1275  $d = $matches[3];
1276  }
1277  if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches)) {
1278  $h = $matches[1];
1279  $i = $matches[2];
1280  $s = $matches[3];
1281  }
1282  $this->end_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
1283  }

◆ setEvaluationAccess()

ilObjSurvey::setEvaluationAccess ( string  $evaluation_access = self::EVALUATION_ACCESS_OFF)

Definition at line 1291 of file class.ilObjSurvey.php.

References $evaluation_access.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\Standard\UIModifier\setValuesFromForm().

1293  : void {
1294  $this->evaluation_access = $evaluation_access;
1295  }
string $evaluation_access
+ Here is the caller graph for this function:

◆ setIntroduction()

ilObjSurvey::setIntroduction ( string  $introduction = "")

Definition at line 1171 of file class.ilObjSurvey.php.

References $introduction.

Referenced by loadFromDb().

1173  : void {
1174  $this->introduction = $introduction;
1175  }
+ Here is the caller graph for this function:

◆ setMailAddresses()

ilObjSurvey::setMailAddresses ( string  $a_addresses)

Set (Tutor) Recipients of "single participant has finished" mails.

Definition at line 4120 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4120  : void
4121  {
4122  $this->mailaddresses = $a_addresses;
4123  }
+ Here is the caller graph for this function:

◆ setMailConfirmation()

ilObjSurvey::setMailConfirmation ( bool  $a_value)

Definition at line 5510 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5510  : void
5511  {
5512  $this->mail_confirmation = $a_value;
5513  }
+ Here is the caller graph for this function:

◆ setMailNotification()

ilObjSurvey::setMailNotification ( bool  $a_notification)

Activate mail to tutors each time a participant finishes the survey.

Definition at line 4104 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4104  : void
4105  {
4106  $this->mailnotification = $a_notification;
4107  }
+ Here is the caller graph for this function:

◆ setMailOwnResults()

ilObjSurvey::setMailOwnResults ( bool  $a_value)

Definition at line 5500 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5500  : void
5501  {
5502  $this->mail_own_results = $a_value;
5503  }
+ Here is the caller graph for this function:

◆ setMailParticipantData()

ilObjSurvey::setMailParticipantData ( string  $a_data)

Set preceding text (incl.

placeholders) for "single participant has finished" mails

Definition at line 4136 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4136  : void
4137  {
4138  $this->mailparticipantdata = $a_data;
4139  }
+ Here is the caller graph for this function:

◆ setMode()

ilObjSurvey::setMode ( int  $a_value)

Definition at line 5583 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5583  : void
5584  {
5585  $this->mode = $a_value;
5586  }
+ Here is the caller graph for this function:

◆ setObligatoryStates()

ilObjSurvey::setObligatoryStates ( array  $obligatory_questions)

Sets the obligatory states for questions in a survey from the questions form.

Parameters
array$obligatory_questionskey is question id, value should be bool value
Todo:
move to survey question manager/repo

Definition at line 1882 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

1884  : void {
1885  $ilDB = $this->db;
1886  $result = $ilDB->queryF(
1887  "SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
1888  array('integer'),
1889  array($this->getSurveyId())
1890  );
1891  if ($result->numRows()) {
1892  while ($row = $ilDB->fetchAssoc($result)) {
1893  if (!array_key_exists($row["question_fi"], $obligatory_questions)) {
1894  $obligatory_questions[$row["question_fi"]] = 0;
1895  }
1896  }
1897  }
1898  // set the obligatory states in the database
1899  foreach ($obligatory_questions as $question_fi => $obligatory) {
1900  // #12420
1901  $ilDB->manipulate("UPDATE svy_question" .
1902  " SET obligatory = " . $ilDB->quote($obligatory, "integer") .
1903  " WHERE question_id = " . $ilDB->quote($question_fi, "integer"));
1904  }
1905  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ setOutro()

ilObjSurvey::setOutro ( string  $outro = "")

Definition at line 1177 of file class.ilObjSurvey.php.

References $outro.

Referenced by loadFromDb().

1179  : void {
1180  $this->outro = $outro;
1181  }
+ Here is the caller graph for this function:

◆ setPage()

ilObjSurvey::setPage ( int  $finished_id,
int  $page_id 
)

Sets the number of the active survey page.

Parameters
int$finished_idid of the active user
int$page_idindex of the page
Todo:
move to run manager/repo

Definition at line 2371 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2374  : void {
2375  $ilDB = $this->db;
2376 
2377  $ilDB->manipulateF(
2378  "UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
2379  array('integer','integer'),
2380  array(($page_id) ?: 0, $finished_id)
2381  );
2382  }
ilDBInterface $db

◆ setPoolUsage()

ilObjSurvey::setPoolUsage ( bool  $a_value)

Definition at line 4177 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4177  : void
4178  {
4179  $this->pool_usage = $a_value;
4180  }
+ Here is the caller graph for this function:

◆ setReminderEnd()

ilObjSurvey::setReminderEnd ( ?ilDate  $a_value = null)

Definition at line 4995 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4995  : void
4996  {
4997  $this->reminder_end = $a_value;
4998  }
+ Here is the caller graph for this function:

◆ setReminderFrequency()

ilObjSurvey::setReminderFrequency ( int  $a_value)

Definition at line 5005 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5005  : void
5006  {
5007  $this->reminder_frequency = $a_value;
5008  }
+ Here is the caller graph for this function:

◆ setReminderLastSent()

ilObjSurvey::setReminderLastSent ( ?string  $a_value)

Definition at line 5025 of file class.ilObjSurvey.php.

References null.

Referenced by checkReminder(), and loadFromDb().

5025  : void
5026  {
5027  if ($a_value == "") {
5028  $a_value = null;
5029  }
5030  $this->reminder_last_sent = $a_value;
5031  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setReminderStart()

ilObjSurvey::setReminderStart ( ?ilDate  $a_value = null)

Definition at line 4985 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4985  : void
4986  {
4987  $this->reminder_start = $a_value;
4988  }
+ Here is the caller graph for this function:

◆ setReminderStatus()

ilObjSurvey::setReminderStatus ( bool  $a_value)

Definition at line 4975 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4975  : void
4976  {
4977  $this->reminder_status = $a_value;
4978  }
+ Here is the caller graph for this function:

◆ setReminderTarget()

ilObjSurvey::setReminderTarget ( int  $a_value)

Definition at line 5015 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), ILIAS\Survey\Mode\IndividualFeedback\UIModifier\setValuesFromForm(), and ILIAS\Survey\Mode\Feedback360\UIModifier\setValuesFromForm().

5015  : void
5016  {
5017  $this->reminder_target = $a_value;
5018  }
+ Here is the caller graph for this function:

◆ setReminderTemplate()

ilObjSurvey::setReminderTemplate ( ?int  $a_value)

Definition at line 5048 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5048  : void
5049  {
5050  $this->reminder_tmpl = $a_value;
5051  }
+ Here is the caller graph for this function:

◆ setSelfEvaluationResults()

ilObjSurvey::setSelfEvaluationResults ( int  $a_value)

Definition at line 5593 of file class.ilObjSurvey.php.

Referenced by loadFromDb(), and ILIAS\Survey\Mode\SelfEvaluation\UIModifier\setValuesFromForm().

5593  : void
5594  {
5595  $this->mode_self_eval_results = $a_value;
5596  }
+ Here is the caller graph for this function:

◆ setShowQuestionTitles()

ilObjSurvey::setShowQuestionTitles ( bool  $a_show)

Definition at line 1166 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

1166  : void
1167  {
1168  $this->display_question_titles = $a_show;
1169  }
+ Here is the caller graph for this function:

◆ setSkillService()

ilObjSurvey::setSkillService ( bool  $a_val)

Definition at line 4847 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

4847  : void
4848  {
4849  $this->mode_skill_service = $a_val;
4850  }
+ Here is the caller graph for this function:

◆ setStartDate()

ilObjSurvey::setStartDate ( string  $start_date = "")
Parameters
string$start_date(YYYYMMDDHHMMSS)

Definition at line 1191 of file class.ilObjSurvey.php.

References $start_date.

Referenced by loadFromDb().

1193  : void {
1194  $this->start_date = $start_date;
1195  }
+ Here is the caller graph for this function:

◆ setStartDateAndTime()

ilObjSurvey::setStartDateAndTime ( string  $start_date,
string  $start_time 
)
Parameters
string$start_date(YYYY-MM-DD)
string$start_time(HH:MM:SS)

Definition at line 1201 of file class.ilObjSurvey.php.

References Vendor\Package\$d.

1204  : void {
1205  $y = '';
1206  $m = '';
1207  $d = '';
1208  $h = '';
1209  $i = '';
1210  $s = '';
1211  if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches)) {
1212  $y = $matches[1];
1213  $m = $matches[2];
1214  $d = $matches[3];
1215  }
1216  if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches)) {
1217  $h = $matches[1];
1218  $i = $matches[2];
1219  $s = $matches[3];
1220  }
1221  $this->start_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
1222  }

◆ setSurveyId()

ilObjSurvey::setSurveyId ( int  $survey_id)

Definition at line 4064 of file class.ilObjSurvey.php.

References $survey_id.

Referenced by loadFromDb(), and saveToDb().

4064  : void
4065  {
4066  $this->survey_id = $survey_id;
4067  }
int $survey_id
A unique positive numerical ID which identifies the survey.
+ Here is the caller graph for this function:

◆ setTutorNotificationRecipients()

ilObjSurvey::setTutorNotificationRecipients ( array  $a_value)

Set tutor recipients for "all participants have finished" mail.

Definition at line 5077 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5077  : void
5078  {
5079  $this->tutor_ntf_recipients = $a_value;
5080  }
+ Here is the caller graph for this function:

◆ setTutorNotificationStatus()

ilObjSurvey::setTutorNotificationStatus ( bool  $a_value)

Activates mail being sent to tutors after all participants have finished the survey.

Definition at line 5061 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5061  : void
5062  {
5063  $this->tutor_ntf_status = $a_value;
5064  }
+ Here is the caller graph for this function:

◆ setTutorNotificationTarget()

ilObjSurvey::setTutorNotificationTarget ( int  $a_value)

Definition at line 5093 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5093  : void
5094  {
5095  $this->tutor_ntf_target = $a_value;
5096  }
+ Here is the caller graph for this function:

◆ setTutorResultsRecipients()

ilObjSurvey::setTutorResultsRecipients ( array  $a_value)

Definition at line 5113 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5113  : void
5114  {
5115  $this->tutor_res_recipients = $a_value;
5116  }
+ Here is the caller graph for this function:

◆ setTutorResultsStatus()

ilObjSurvey::setTutorResultsStatus ( bool  $a_value)

Definition at line 5103 of file class.ilObjSurvey.php.

Referenced by loadFromDb().

5103  : void
5104  {
5105  $this->tutor_res_status = $a_value;
5106  }
+ Here is the caller graph for this function:

◆ setViewOwnResults()

ilObjSurvey::setViewOwnResults ( bool  $a_value)

Definition at line 5490 of file class.ilObjSurvey.php.

5490  : void
5491  {
5492  $this->view_own_results = $a_value;
5493  }

◆ toXML()

ilObjSurvey::toXML ( )

Returns a QTI xml representation of the survey.

Todo:
move to export sub-service

Definition at line 2926 of file class.ilObjSurvey.php.

References addMaterialTag(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), getAnonymize(), getAuthor(), ilObject\getDescription(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getIntroduction(), getMode(), ilObject\getOfflineStatus(), getOutro(), getSelfEvaluationResults(), getShowQuestionTitles(), getSkillService(), getStartDate(), getSurveyId(), getSurveyPages(), ilObject\getTitle(), hasAnonymousUserList(), hasMailConfirmation(), hasMailOwnResults(), hasViewOwnResults(), ILIAS\Repository\int(), and null.

2926  : string
2927  {
2928  $a_xml_writer = new ilXmlWriter();
2929  // set xml header
2930  $a_xml_writer->xmlHeader();
2931  $attrs = array(
2932  "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
2933  "xsi:noNamespaceSchemaLocation" => "https://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
2934  );
2935  $a_xml_writer->xmlStartTag("surveyobject", $attrs);
2936  $attrs = array(
2937  "id" => $this->getSurveyId(),
2938  "title" => $this->getTitle()
2939  );
2940  $a_xml_writer->xmlStartTag("survey", $attrs);
2941 
2942  $a_xml_writer->xmlElement("description", null, $this->getDescription());
2943  $a_xml_writer->xmlElement("author", null, $this->getAuthor());
2944  $a_xml_writer->xmlStartTag("objectives");
2945  $attrs = array(
2946  "label" => "introduction"
2947  );
2948  $this->addMaterialTag($a_xml_writer, $this->getIntroduction(), true, true, $attrs);
2949  $attrs = array(
2950  "label" => "outro"
2951  );
2952  $this->addMaterialTag($a_xml_writer, $this->getOutro(), true, true, $attrs);
2953  $a_xml_writer->xmlEndTag("objectives");
2954 
2955  if ($this->getAnonymize()) {
2956  $attribs = array("enabled" => "1");
2957  } else {
2958  $attribs = array("enabled" => "0");
2959  }
2960  $a_xml_writer->xmlElement("anonymisation", $attribs);
2961  $a_xml_writer->xmlStartTag("restrictions");
2962  if ($this->getAnonymize() === 2) {
2963  $attribs = array("type" => "free");
2964  } else {
2965  $attribs = array("type" => "restricted");
2966  }
2967  $a_xml_writer->xmlElement("access", $attribs);
2968  if ($this->getStartDate()) {
2969  $attrs = array("type" => "date");
2970  preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches);
2971  $a_xml_writer->xmlElement("startingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5]));
2972  }
2973  if ($this->getEndDate()) {
2974  $attrs = array("type" => "date");
2975  preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches);
2976  $a_xml_writer->xmlElement("endingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5]));
2977  }
2978  $a_xml_writer->xmlEndTag("restrictions");
2979 
2980  // constraints
2981  $pages = $this->getSurveyPages();
2982  $hasconstraints = false;
2983  foreach ($pages as $question_array) {
2984  foreach ($question_array as $question) {
2985  if (count($question["constraints"])) {
2986  $hasconstraints = true;
2987  }
2988  }
2989  }
2990 
2991  if ($hasconstraints) {
2992  $a_xml_writer->xmlStartTag("constraints");
2993  foreach ($pages as $question_array) {
2994  foreach ($question_array as $question) {
2995  if (count($question["constraints"])) {
2996  // found constraints
2997  foreach ($question["constraints"] as $constraint) {
2998  $attribs = array(
2999  "sourceref" => $question["question_id"],
3000  "destref" => $constraint["question"],
3001  "relation" => $constraint["short"],
3002  "value" => $constraint["value"],
3003  "conjunction" => $constraint["conjunction"]
3004  );
3005  $a_xml_writer->xmlElement("constraint", $attribs);
3006  }
3007  }
3008  }
3009  }
3010  $a_xml_writer->xmlEndTag("constraints");
3011  }
3012 
3013  // add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
3014  $a_xml_writer->xmlStartTag("metadata");
3015 
3016  $custom_properties = array();
3017  $custom_properties["evaluation_access"] = $this->getEvaluationAccess();
3018  $custom_properties["status"] = !$this->getOfflineStatus();
3019  $custom_properties["display_question_titles"] = $this->getShowQuestionTitles();
3020 
3021  $custom_properties["own_results_view"] = (int) $this->hasViewOwnResults();
3022  $custom_properties["own_results_mail"] = (int) $this->hasMailOwnResults();
3023  $custom_properties["confirmation_mail"] = (int) $this->hasMailConfirmation();
3024 
3025  $custom_properties["anon_user_list"] = (int) $this->hasAnonymousUserList();
3026  $custom_properties["mode"] = $this->getMode();
3027  $custom_properties["mode_360_self_eval"] = (int) $this->get360SelfEvaluation();
3028  $custom_properties["mode_360_self_rate"] = (int) $this->get360SelfRaters();
3029  $custom_properties["mode_360_self_appr"] = (int) $this->get360SelfAppraisee();
3030  $custom_properties["mode_360_results"] = $this->get360Results();
3031  $custom_properties["mode_skill_service"] = (int) $this->getSkillService();
3032  $custom_properties["mode_self_eval_results"] = $this->getSelfEvaluationResults();
3033 
3034 
3035  // :TODO: skills?
3036 
3037  // reminder/tutor notification are (currently?) not exportable
3038 
3039  foreach ($custom_properties as $label => $value) {
3040  $a_xml_writer->xmlStartTag("metadatafield");
3041  $a_xml_writer->xmlElement("fieldlabel", null, $label);
3042  $a_xml_writer->xmlElement("fieldentry", null, $value);
3043  $a_xml_writer->xmlEndTag("metadatafield");
3044  }
3045 
3046  $a_xml_writer->xmlEndTag("metadata");
3047  $a_xml_writer->xmlEndTag("survey");
3048 
3049  $attribs = array("id" => $this->getId());
3050  $a_xml_writer->xmlStartTag("surveyquestions", $attribs);
3051  // add questionblock descriptions
3052  foreach ($pages as $question_array) {
3053  if (count($question_array) > 1) {
3054  $attribs = array("id" => $question_array[0]["question_id"]);
3055  $attribs = array(
3056  "showQuestiontext" => $question_array[0]["questionblock_show_questiontext"],
3057  "showBlocktitle" => $question_array[0]["questionblock_show_blocktitle"],
3058  "compressView" => $question_array[0]["questionblock_compress_view"]
3059  );
3060  $a_xml_writer->xmlStartTag("questionblock", $attribs);
3061  if (strlen($question_array[0]["questionblock_title"])) {
3062  $a_xml_writer->xmlElement("questionblocktitle", null, $question_array[0]["questionblock_title"]);
3063  }
3064  }
3065  foreach ($question_array as $question) {
3066  if (strlen($question["heading"] ?? "")) {
3067  $a_xml_writer->xmlElement("textblock", null, $question["heading"]);
3068  }
3069  $questionObject = self::_instanciateQuestion($question["question_id"]);
3070  //questionObject contains all the fields from the database. (loadFromDb)
3071  //we don't need the value from svy_qst_oblig table, we already have the values from svy_question table.
3072  //if ($questionObject !== FALSE) $questionObject->insertXML($a_xml_writer, FALSE, $obligatory_states[$question["question_id"]]);
3073  if ($questionObject !== false) {
3074  $questionObject->insertXML($a_xml_writer, false);
3075  }
3076  }
3077  if (count($question_array) > 1) {
3078  $a_xml_writer->xmlEndTag("questionblock");
3079  }
3080  }
3081 
3082  $a_xml_writer->xmlEndTag("surveyquestions");
3083  $a_xml_writer->xmlEndTag("surveyobject");
3084  $xml = $a_xml_writer->xmlDumpMem(false);
3085  return $xml;
3086  }
getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addMaterialTag(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true, ?array $attribs=null)
Creates an XML material tag from a plain text or xhtml text.
+ Here is the call graph for this function:

◆ unfoldQuestionblocks()

ilObjSurvey::unfoldQuestionblocks ( array  $questionblocks)
Parameters
int[]$questionblocks question block ids
Todo:
move to survey question manager/repo

Definition at line 1510 of file class.ilObjSurvey.php.

References ilObject\$db, $ilDB, and getSurveyId().

1512  : void {
1513  $ilDB = $this->db;
1514  foreach ($questionblocks as $index) {
1515  $affectedRows = $ilDB->manipulateF(
1516  "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1517  array('integer'),
1518  array($index)
1519  );
1520  $affectedRows = $ilDB->manipulateF(
1521  "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1522  array('integer','integer'),
1523  array($index, $this->getSurveyId())
1524  );
1525  }
1526  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ update()

ilObjSurvey::update (   $a_upload = false)

Definition at line 228 of file class.ilObjSurvey.php.

References ilObject\updateMetaData().

228  : bool
229  {
230  if (!$a_upload) {
231  $this->updateMetaData();
232  }
233 
234  if (!parent::update()) {
235  return false;
236  }
237 
238  // put here object specific stuff
239 
240  return true;
241  }
+ Here is the call graph for this function:

◆ updateCode()

ilObjSurvey::updateCode ( int  $a_id,
string  $a_email,
string  $a_last_name,
string  $a_first_name,
int  $a_sent 
)
Todo:
move to code manager

Definition at line 4185 of file class.ilObjSurvey.php.

References $data, ilObject\$db, $ilDB, and ilUtil\is_email().

4191  : bool {
4192  $ilDB = $this->db;
4193 
4194  $a_email = trim($a_email);
4195 
4196  // :TODO:
4197  if (($a_email && !ilUtil::is_email($a_email)) || $a_email === "") {
4198  return false;
4199  }
4200 
4201  $data = array("email" => $a_email,
4202  "lastname" => trim($a_last_name),
4203  "firstname" => trim($a_first_name));
4204 
4205  $fields = array(
4206  "externaldata" => array("text", serialize($data)),
4207  "sent" => array("integer", $a_sent)
4208  );
4209 
4210  $ilDB->update(
4211  "svy_anonymous",
4212  $fields,
4213  array("anonymous_id" => array("integer", $a_id))
4214  );
4215 
4216  return true;
4217  }
static is_email(string $a_email, ?ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
ilDBInterface $db
+ Here is the call graph for this function:

◆ updateConjunctionForQuestions()

ilObjSurvey::updateConjunctionForQuestions ( array  $questions,
int  $conjunction 
)
Todo:
move to constraint manager/repo

Definition at line 2224 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2227  : void {
2228  $ilDB = $this->db;
2229  foreach ($questions as $question_id) {
2230  $ilDB->manipulateF(
2231  "UPDATE svy_constraint SET conjunction = %s " .
2232  "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2233  array('integer','integer'),
2234  array($conjunction, $question_id)
2235  );
2236  }
2237  }
ilDBInterface $db

◆ updateConstraint()

ilObjSurvey::updateConstraint ( int  $precondition_id,
int  $if_question_id,
int  $relation,
float  $value,
int  $conjunction 
)
Todo:
move to constraint manager/repo

Definition at line 2205 of file class.ilObjSurvey.php.

References ilObject\$db, and $ilDB.

2211  : void {
2212  $ilDB = $this->db;
2213  $ilDB->manipulateF(
2214  "UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s " .
2215  "WHERE constraint_id = %s",
2216  array('integer','integer','float','integer','integer'),
2217  array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2218  );
2219  }
$relation
ilDBInterface $db

◆ updateOrder()

ilObjSurvey::updateOrder ( array  $a_order)

Definition at line 4163 of file class.ilObjSurvey.php.

References saveQuestionsToDb().

4165  : void {
4166  if (count($this->questions) === count($a_order)) {
4167  $this->questions = array_flip($a_order);
4168  $this->saveQuestionsToDb();
4169  }
4170  }
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjSurvey::$access
protected

Definition at line 69 of file class.ilObjSurvey.php.

Referenced by checkReminder().

◆ $activation_ending_time

int ilObjSurvey::$activation_ending_time = null
protected

Definition at line 106 of file class.ilObjSurvey.php.

Referenced by getActivationEndDate().

◆ $activation_limited

bool ilObjSurvey::$activation_limited = false
protected

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

Referenced by isActivationLimited().

◆ $activation_starting_time

int ilObjSurvey::$activation_starting_time = null
protected

Definition at line 105 of file class.ilObjSurvey.php.

Referenced by getActivationStartDate().

◆ $activation_visibility

bool ilObjSurvey::$activation_visibility = false
protected

Definition at line 104 of file class.ilObjSurvey.php.

Referenced by getActivationVisibility().

◆ $anon_user_list

bool ilObjSurvey::$anon_user_list = false
protected

Definition at line 133 of file class.ilObjSurvey.php.

Referenced by hasAnonymousUserList().

◆ $anonymize

int ilObjSurvey::$anonymize = 0

Definition at line 93 of file class.ilObjSurvey.php.

Referenced by getAnonymize().

◆ $author

string ilObjSurvey::$author = ""

A text representation of the authors name.

The name of the author must not necessary be the name of the owner.

Definition at line 81 of file class.ilObjSurvey.php.

Referenced by setAuthor().

◆ $calculate_sum_score

bool ilObjSurvey::$calculate_sum_score = false
protected

Definition at line 71 of file class.ilObjSurvey.php.

Referenced by getCalculateSumScore().

◆ $code_manager

ILIAS Survey Code CodeManager ilObjSurvey::$code_manager
protected

Definition at line 139 of file class.ilObjSurvey.php.

◆ $data_manager

ILIAS Survey InternalDataService ilObjSurvey::$data_manager
protected

Definition at line 140 of file class.ilObjSurvey.php.

◆ $display_question_titles

int ilObjSurvey::$display_question_titles = 0

Definition at line 95 of file class.ilObjSurvey.php.

Referenced by getShowQuestionTitles().

◆ $domain

InternalDomainService ilObjSurvey::$domain
protected

Definition at line 64 of file class.ilObjSurvey.php.

◆ $end_date

string ilObjSurvey::$end_date = ""

Definition at line 89 of file class.ilObjSurvey.php.

Referenced by getEndDate(), and setEndDate().

◆ $evaluation_access

string ilObjSurvey::$evaluation_access = self::EVALUATION_ACCESS_OFF

Definition at line 85 of file class.ilObjSurvey.php.

Referenced by getEvaluationAccess(), and setEvaluationAccess().

◆ $feature_config

Mode FeatureConfig ilObjSurvey::$feature_config
protected

Definition at line 141 of file class.ilObjSurvey.php.

◆ $import_manager

ILIAS SurveyQuestionPool Export ImportManager ilObjSurvey::$import_manager
protected

Definition at line 142 of file class.ilObjSurvey.php.

◆ $introduction

string ilObjSurvey::$introduction = ""

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

Referenced by getIntroduction(), and setIntroduction().

◆ $invitation_manager

Participants InvitationsManager ilObjSurvey::$invitation_manager
protected

Definition at line 137 of file class.ilObjSurvey.php.

◆ $mail_confirmation

bool ilObjSurvey::$mail_confirmation = false
protected

Definition at line 131 of file class.ilObjSurvey.php.

Referenced by hasMailConfirmation().

◆ $mail_own_results

bool ilObjSurvey::$mail_own_results = false
protected

Definition at line 130 of file class.ilObjSurvey.php.

Referenced by hasMailOwnResults().

◆ $mailaddresses

string ilObjSurvey::$mailaddresses = ""

Definition at line 100 of file class.ilObjSurvey.php.

Referenced by getMailAddresses().

◆ $mailnotification

bool ilObjSurvey::$mailnotification = false

Definition at line 99 of file class.ilObjSurvey.php.

Referenced by getMailNotification().

◆ $mailparticipantdata

string ilObjSurvey::$mailparticipantdata = ""

Definition at line 101 of file class.ilObjSurvey.php.

Referenced by getMailParticipantData(), and sendNotificationMail().

◆ $mode

int ilObjSurvey::$mode = 0
protected

Definition at line 134 of file class.ilObjSurvey.php.

Referenced by getMode().

◆ $mode_360_results

int ilObjSurvey::$mode_360_results = 0
protected

Definition at line 112 of file class.ilObjSurvey.php.

Referenced by get360Results().

◆ $mode_360_self_appr

bool ilObjSurvey::$mode_360_self_appr = false
protected

Definition at line 110 of file class.ilObjSurvey.php.

Referenced by get360SelfAppraisee().

◆ $mode_360_self_eval

bool ilObjSurvey::$mode_360_self_eval = false
protected

Definition at line 109 of file class.ilObjSurvey.php.

Referenced by get360SelfEvaluation().

◆ $mode_360_self_rate

bool ilObjSurvey::$mode_360_self_rate = false
protected

Definition at line 111 of file class.ilObjSurvey.php.

Referenced by get360SelfRaters().

◆ $mode_self_eval_results

int ilObjSurvey::$mode_self_eval_results = 0
protected

Definition at line 135 of file class.ilObjSurvey.php.

Referenced by getSelfEvaluationResults().

◆ $mode_skill_service

bool ilObjSurvey::$mode_skill_service = false
protected

Definition at line 113 of file class.ilObjSurvey.php.

Referenced by getSkillService().

◆ $outro

string ilObjSurvey::$outro = ""

Definition at line 83 of file class.ilObjSurvey.php.

Referenced by getOutro(), and setOutro().

◆ $placeholder_resolver

ilMailTemplatePlaceholderResolver ilObjSurvey::$placeholder_resolver
protected

Definition at line 143 of file class.ilObjSurvey.php.

◆ $plugin_admin

ilPluginAdmin ilObjSurvey::$plugin_admin
protected

Definition at line 70 of file class.ilObjSurvey.php.

◆ $pool_usage

bool ilObjSurvey::$pool_usage = false

Definition at line 102 of file class.ilObjSurvey.php.

Referenced by getPoolUsage().

◆ $questions

array ilObjSurvey::$questions = []

Definition at line 91 of file class.ilObjSurvey.php.

◆ $reminder_end

ilDate ilObjSurvey::$reminder_end = null
protected

Definition at line 118 of file class.ilObjSurvey.php.

Referenced by getReminderEnd().

◆ $reminder_frequency

int ilObjSurvey::$reminder_frequency = 0
protected

Definition at line 119 of file class.ilObjSurvey.php.

Referenced by getReminderFrequency().

◆ $reminder_last_sent

string ilObjSurvey::$reminder_last_sent = null
protected

Definition at line 121 of file class.ilObjSurvey.php.

Referenced by getReminderLastSent().

◆ $reminder_start

ilDate ilObjSurvey::$reminder_start = null
protected

Definition at line 117 of file class.ilObjSurvey.php.

Referenced by getReminderStart().

◆ $reminder_status

bool ilObjSurvey::$reminder_status = false
protected

Definition at line 116 of file class.ilObjSurvey.php.

Referenced by getReminderStatus().

◆ $reminder_target

int ilObjSurvey::$reminder_target = 0
protected

Definition at line 120 of file class.ilObjSurvey.php.

Referenced by getReminderTarget().

◆ $reminder_tmpl

int ilObjSurvey::$reminder_tmpl = null
protected

Definition at line 122 of file class.ilObjSurvey.php.

Referenced by getReminderTemplate().

◆ $start_date

string ilObjSurvey::$start_date = ""

Definition at line 87 of file class.ilObjSurvey.php.

Referenced by getStartDate(), and setStartDate().

◆ $survey_id

int ilObjSurvey::$survey_id = 0

A unique positive numerical ID which identifies the survey.

This is the primary key from a database table.

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

Referenced by getQuestionblocksTable(), getSurveyId(), and setSurveyId().

◆ $survey_service

ILIAS Survey InternalService ilObjSurvey::$survey_service
protected

Definition at line 138 of file class.ilObjSurvey.php.

◆ $surveyCodeSecurity

bool ilObjSurvey::$surveyCodeSecurity = false

Definition at line 97 of file class.ilObjSurvey.php.

◆ $svy_log

ilLogger ilObjSurvey::$svy_log
protected

Definition at line 66 of file class.ilObjSurvey.php.

◆ $tutor_ntf_recipients

array ilObjSurvey::$tutor_ntf_recipients = []
protected

Definition at line 124 of file class.ilObjSurvey.php.

Referenced by getTutorNotificationRecipients().

◆ $tutor_ntf_status

bool ilObjSurvey::$tutor_ntf_status = false
protected

Definition at line 123 of file class.ilObjSurvey.php.

Referenced by getTutorNotificationStatus().

◆ $tutor_ntf_target

int ilObjSurvey::$tutor_ntf_target = 0
protected

Definition at line 125 of file class.ilObjSurvey.php.

Referenced by getTutorNotificationTarget().

◆ $tutor_res_recipients

array ilObjSurvey::$tutor_res_recipients = []
protected

Definition at line 127 of file class.ilObjSurvey.php.

Referenced by getTutorResultsRecipients().

◆ $tutor_res_status

bool ilObjSurvey::$tutor_res_status = false
protected

Definition at line 126 of file class.ilObjSurvey.php.

Referenced by getTutorResultsStatus().

◆ $user

ilObjUser ilObjSurvey::$user
protected

◆ $view_own_results

bool ilObjSurvey::$view_own_results = false
protected

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

Referenced by hasViewOwnResults().

◆ ANONYMIZE_CODE_ALL

const ilObjSurvey::ANONYMIZE_CODE_ALL = 3

◆ ANONYMIZE_FREEACCESS

const ilObjSurvey::ANONYMIZE_FREEACCESS = 2

◆ ANONYMIZE_OFF

const ilObjSurvey::ANONYMIZE_OFF = 0

◆ ANONYMIZE_ON

const ilObjSurvey::ANONYMIZE_ON = 1

◆ EVALUATION_ACCESS_ALL

const ilObjSurvey::EVALUATION_ACCESS_ALL = "1"

◆ EVALUATION_ACCESS_OFF

const ilObjSurvey::EVALUATION_ACCESS_OFF = "0"

◆ EVALUATION_ACCESS_PARTICIPANTS

const ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS = "2"

◆ MODE_360

◆ MODE_IND_FEEDB

◆ MODE_SELF_EVAL

◆ MODE_STANDARD

const ilObjSurvey::MODE_STANDARD = 0

Definition at line 45 of file class.ilObjSurvey.php.

Referenced by ilObjSurveyGUI\getTabs().

◆ NOTIFICATION_APPRAISEES

◆ NOTIFICATION_APPRAISEES_AND_RATERS

◆ NOTIFICATION_INVITED_USERS

const ilObjSurvey::NOTIFICATION_INVITED_USERS = 2

◆ NOTIFICATION_PARENT_COURSE

const ilObjSurvey::NOTIFICATION_PARENT_COURSE = 1

◆ NOTIFICATION_RATERS

◆ PRINT_HIDE_LABELS

const ilObjSurvey::PRINT_HIDE_LABELS = 1

◆ PRINT_SHOW_LABELS

const ilObjSurvey::PRINT_SHOW_LABELS = 3

◆ QUESTIONTITLES_HIDDEN

const ilObjSurvey::QUESTIONTITLES_HIDDEN = 0

Definition at line 37 of file class.ilObjSurvey.php.

◆ QUESTIONTITLES_VISIBLE

const ilObjSurvey::QUESTIONTITLES_VISIBLE = 1

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

◆ RESULTS_360_ALL

◆ RESULTS_360_NONE

◆ RESULTS_360_OWN

◆ RESULTS_SELF_EVAL_ALL

◆ RESULTS_SELF_EVAL_NONE

const ilObjSurvey::RESULTS_SELF_EVAL_NONE = 0

◆ RESULTS_SELF_EVAL_OWN

const ilObjSurvey::RESULTS_SELF_EVAL_OWN = 1

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