ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjSurvey Class Reference

Class ilObjSurvey. More...

+ Inheritance diagram for ilObjSurvey:
+ Collaboration diagram for ilObjSurvey:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 create ($a_upload=false)
 create survey object More...
 
 createMetaData ()
 Create meta data entry. More...
 
 update ($a_upload=false)
 update object data More...
 
 createReference ()
 creates reference for object More...
 
 read ()
 read object data from db into object @access public More...
 
 addQuestion ($question_id)
 Adds a question to the survey (used in importer!) More...
 
 delete ()
 delete object and all related data More...
 
 deleteSurveyRecord ()
 Deletes the survey from the database. More...
 
 deleteAllUserData ($reset_LP=true)
 Deletes all user data of a survey. More...
 
 removeSelectedSurveyResults ($finished_ids)
 Deletes the user data of a given array of survey participants. More...
 
getSurveyParticipants ($finished_ids=null, $force_non_anonymous=false, $include_invites=false)
 
 isComplete ()
 Returns 1, if a survey is complete for use. More...
 
 saveCompletionStatus ()
 Saves the completion status of the survey. More...
 
 duplicateQuestionForSurvey ($question_id, $a_force=false)
 Takes a question and creates a copy of the question for use in the survey. More...
 
 insertQuestion ($question_id)
 Inserts a question in the survey and saves the relation to the database The question is appended to the end (last question) @access public. More...
 
 isQuestionInSurvey ($a_question_fi)
 Check if a question is already in the survey. More...
 
 insertQuestionblock ($questionblock_id)
 Inserts a questionblock in the survey and saves the relation to the database. More...
 
 saveUserSettings ($usr_id, $key, $title, $value)
 
 deleteUserSettings ($id)
 
 getUserSettings ($usr_id, $key)
 
 saveToDb ()
 Saves a survey object to a database. More...
 
 saveQuestionsToDb ()
 Saves the survey questions to the database. More...
 
 getAnonymousId ($id)
 Checks for an anomyous survey id in the database an returns the id. More...
 
 getQuestionGUI ($questiontype, $question_id)
 Returns a question gui object to a given questiontype and question id. More...
 
 getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 getSurveyId ()
 Returns the survey database id. More...
 
 setAnonymize ($a_anonymize)
 set anonymize status More...
 
 getAnonymize ()
 get anonymize status More...
 
 setCalculateSumScore (bool $a_val)
 Set calculate sum score. More...
 
 getCalculateSumScore ()
 Get calculate sum score. More...
 
 isAccessibleWithoutCode ()
 Checks if the survey is accessable without a survey code. More...
 
 hasAnonymizedResults ()
 Checks if the survey results are to be anonymized. More...
 
 loadFromDb ()
 Loads a survey object from a database. More...
 
 loadQuestionsFromDb ()
 Loads the survey questions from the database. More...
 
 fixSequenceStructure ()
 Remove duplicate sequence entries, see #22018. More...
 
 setAuthor ($author="")
 Sets the authors name of the ilObjSurvey object. More...
 
 saveAuthorToMetadata ($a_author="")
 Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be called for conversion of "old" tests where the author hasn't been stored in the lifecycle metadata. More...
 
 getAuthor ()
 Gets the authors name of the ilObjSurvey object. More...
 
 getShowQuestionTitles ()
 Gets the status of the display_question_titles attribute. More...
 
 setShowQuestionTitles ($a_show)
 Sets the status of the display_question_titles attribute. More...
 
 showQuestionTitles ()
 Sets the question titles visible during the query. More...
 
 hideQuestionTitles ()
 Sets the question titles hidden during the query. More...
 
 setIntroduction ($introduction="")
 Sets the introduction text. More...
 
 setOutro ($outro="")
 Sets the outro text. More...
 
 getStartDate ()
 Gets the start date of the survey. More...
 
 canStartSurvey ($anonymous_id=null, $a_no_rbac=false)
 Checks if the survey can be started. More...
 
 setStartDate ($start_date="")
 Sets the start date of the survey. More...
 
 setStartDateAndTime ($start_date="", $start_time)
 Sets the start date of the survey. More...
 
 getEndDate ()
 Gets the end date of the survey. More...
 
 setEndDate ($end_date="")
 Sets the end date of the survey. More...
 
 setEndDateAndTime ($end_date="", $end_time)
 Sets the end date of the survey. More...
 
 getEvaluationAccess ()
 Gets the learners evaluation access. More...
 
 setEvaluationAccess ($evaluation_access=self::EVALUATION_ACCESS_OFF)
 Sets the learners evaluation access. More...
 
 setActivationVisibility ($a_value)
 
 getActivationVisibility ()
 
 isActivationLimited ()
 
 setActivationLimited ($a_value)
 
 getIntroduction ()
 Gets the introduction text. More...
 
 getOutro ()
 Gets the outro text. More...
 
getExistingQuestions ()
 Gets the question id's of the questions which are already in the survey. More...
 
getQuestionpoolTitles ($could_be_offline=false, $showPath=false)
 Get the titles of all available survey question pools. More...
 
 moveQuestions ($move_questions, $target_index, $insert_mode)
 Move questions and/or questionblocks to another position. More...
 
 removeQuestion ($question_id)
 Remove a question from the survey. More...
 
 removeConstraintsConcerningQuestion ($question_id)
 Remove constraints concerning a question with a given question_id. More...
 
 removeQuestions ($remove_questions, $remove_questionblocks)
 Remove questions from the survey. More...
 
 unfoldQuestionblocks ($questionblocks)
 Unfolds question blocks of a question pool. More...
 
 removeQuestionFromBlock ($question_id, $questionblock_id)
 
 addQuestionToBlock ($question_id, $questionblock_id)
 
 isQuestionInAnyBlock ($a_question_fi)
 Is question already in a block? More...
 
getQuestionblockQuestions ($questionblock_id)
 Returns the question titles of all questions of a question block. More...
 
getQuestionblockQuestionIds ($questionblock_id)
 Returns the question id's of all questions of a question block. More...
 
 createQuestionblock ($title, $show_questiontext, $show_blocktitle, $questions, $compress_view=false)
 Creates a question block for the survey. More...
 
 modifyQuestionblock ($questionblock_id, $title, $show_questiontext, $show_blocktitle, $compress_view=false)
 Modifies a question block. More...
 
 deleteConstraints ($question_id)
 Deletes the constraints for a question. More...
 
 deleteConstraint ($constraint_id)
 Deletes a constraint of a question. More...
 
getSurveyQuestions ($with_answers=false)
 Returns the survey questions and questionblocks in an array. More...
 
 setObligatoryStates ($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 ($active_page_question_id, $direction)
 Returns the next "page" of a running test. More...
 
getAvailableQuestionpools ($use_obj_id=false, $could_be_offline=false, $showPath=false, $permission="read")
 Returns the available question pools for the active user. More...
 
 getPrecondition ($id)
 Returns a precondition with a given id. More...
 
 getConstraints ($question_id)
 Returns the constraints to a given question or questionblock. More...
 
getVariables ($question_id)
 Returns all variables of a question. More...
 
 addConstraint ($if_question_id, $relation, $value, $conjunction)
 Adds a constraint. More...
 
 addConstraintToQuestion ($to_question_id, $constraint_id)
 Adds a constraint to a question. More...
 
 updateConstraint ($precondition_id, $if_question_id, $relation, $value, $conjunction)
 Updates a precondition. More...
 
 updateConjunctionForQuestions ($questions, $conjunction)
 
 getAllRelations ($short_as_key=false)
 Returns all available relations. More...
 
 deleteWorkingData ($question_id, $active_id)
 Deletes the working data of a question in the database. More...
 
 loadWorkingData ($question_id, $active_id)
 Gets the working data of question from the database. More...
 
 startSurvey ($user_id, $anonymous_id, $appraisee_id)
 Starts the survey creating an entry in the database. More...
 
 finishSurvey ($finished_id)
 Finishes the survey creating an entry in the database. More...
 
 setPage ($finished_id, $page_id)
 Sets the number of the active survey page. More...
 
 sendNotificationMail ($a_user_id, $a_anonymize_id, $a_appr_id)
 
 isSurveyStarted ($user_id, $anonymize_id, $appr_id=0)
 Checks if a user already started a survey. More...
 
 getActiveID ($user_id, $anonymize_id, $appr_id)
 Checks if a user already started a survey. More...
 
 getLastActivePage ($active_id)
 Returns the question id of the last active page a user visited in a survey. More...
 
 checkConstraint ($constraint_data, $working_data)
 Checks if a constraint is valid. More...
 
getSurveyFinishedIds ()
 Get the finished id's of all survey participants. More...
 
 getUserSpecificResults ($finished_ids)
 Calculates the evaluation data for the user specific results. More...
 
 getUserDataFromActiveId ($active_id, $force_non_anonymous=false)
 Returns the user information from an active_id (survey_finished.finished_id) More...
 
getEvaluationByUser ($questions, $active_id)
 Calculates the evaluation data for a given user or anonymous id. More...
 
 getQuestionsTable ($arrFilter)
 Calculates the data for the output of the question browser. More...
 
 getQuestionblocksTable ($arrFilter)
 Calculates the data for the output of the questionblock browser. More...
 
 toXML ()
 Returns a QTI xml representation of the survey. More...
 
 locateImportFiles ($a_dir)
 Locates the import directory and the xml file in a directory with an unzipped import file. More...
 
 importObject ($file_info, $svy_qpl_id)
 Imports a survey from XML into the ILIAS database. More...
 
 getTextblock ($question_id)
 
 cloneTextblocks ($mapping)
 Clones the textblocks of survey questions. More...
 
 createExportDirectory ()
 creates data directory for export files (data_dir/svy_data/svy_<id>/export, depending on data directory that is set in ILIAS setup/ini) More...
 
 getExportDirectory ()
 get export directory of survey More...
 
 createImportDirectory ()
 creates data directory for import files (data_dir/svy_data/svy_<id>/import, depending on data directory that is set in ILIAS setup/ini) More...
 
 getImportDirectory ()
 get import directory of survey More...
 
 saveHeading ($heading="", $insertbefore)
 
 isAnonymousKey ($key)
 
 bindSurveyCodeToUser ($user_id, $code)
 
 isAnonymizedParticipant ($key)
 
 checkSurveyCode ($code)
 
 getSurveyCodesForExport (array $a_codes=null, array $a_ids=null)
 Returns a list of survey codes for file export. More...
 
 getSurveyCodesTableData (array $ids=null, $lang=null)
 Fetches the data for the survey codes table. More...
 
 isSurveyCodeUsed ($code)
 
 isSurveyCodeUnique ($code)
 
 createSurveyCodes ($nrOfCodes)
 
 importSurveyCode ($a_anonymize_key, $a_created, $a_data)
 
 createSurveyCodesForExternalData ($data)
 
 sendCodes ($not_sent, $subject, $message, $lang)
 
 getExternalCodeRecipients ($a_check_finished=false)
 
 isSurveyFinishedByCode ($a_code)
 Get if survey is finished for an specific anonymous user code. More...
 
 deleteSurveyCode ($survey_code)
 Deletes a given survey access code. More...
 
 getUserAccessCode ($user_id)
 Returns a survey access code that was saved for a registered user. More...
 
 saveUserAccessCode ($user_id, $access_code)
 Saves a survey access code for a registered user to the database. More...
 
 createNewAccessCode ()
 Returns a new, unused survey access code. More...
 
 getLastAccess ($finished_id)
 
 prepareTextareaOutput ($txt_output)
 Prepares a string for a text area output in surveys. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 addMaterialTag (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true, $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...
 
 processPrintoutput2FO ($print_output)
 Convert a print output to XSL-FO. More...
 
 deliverPDFfromFO ($fo)
 Delivers a PDF file from a XSL-FO string. More...
 
 isPluginActive ($a_pname)
 Checks whether or not a question plugin with a given name is active. More...
 
 setSurveyId ($survey_id)
 Sets the survey id. More...
 
getUserData ($ids)
 Returns a data of all users specified by id list. More...
 
 getMailNotification ()
 
 setMailNotification ($a_notification)
 
 getMailAddresses ()
 
 setMailAddresses ($a_addresses)
 
 getMailParticipantData ()
 
 setMailParticipantData ($a_data)
 
 setStartTime ($finished_id, $first_question)
 
 setEndTime ($finished_id)
 
 getWorkingtimeForParticipant ($finished_id)
 
 setTemplate ($template_id)
 
 getTemplate ()
 
 updateOrder (array $a_order)
 
 getPoolUsage ()
 
 setPoolUsage ($a_value)
 
 isPoolActive ()
 Get current pool status. More...
 
 applySettingsTemplate ($template_id)
 Apply settings template. More...
 
 updateCode ($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
 
 get360Mode ()
 
 set360SelfEvaluation ($a_value)
 
 get360SelfEvaluation ()
 
 set360SelfAppraisee ($a_value)
 
 get360SelfAppraisee ()
 
 set360SelfRaters ($a_value)
 
 get360SelfRaters ()
 
 set360Results ($a_value)
 
 get360Results ()
 
 addAppraisee ($a_user_id)
 
 sendAppraiseeNotification ($a_user_id)
 Send appraisee notification. More...
 
 sendAppraiseeCloseNotification ($a_user_id)
 Send appraisee notification. More...
 
 sendRaterNotification ($a_user_id, $a_appraisee_id)
 Send rater notification. More...
 
 isAppraisee ($a_user_id)
 
 isAppraiseeClosed ($a_user_id)
 
 deleteAppraisee ($a_user_id)
 
 getAppraiseesData ()
 
 addRater ($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
 
 isRater ($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
 
 deleteRater ($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
 
 getRatersData ($a_appraisee_id)
 
 getAppraiseesToRate ($a_user_id, $a_anonymous_id=null)
 
 getAnonymousIdByCode ($a_code)
 
 is360SurveyStarted ($appr_id, $user_id, $anonymous_code=null)
 
 getUserSurveyExecutionStatus ($a_code=null)
 
 findCodeForUser ($a_user_id)
 
 isUnusedCode ($a_code, $a_user_id)
 
 getFinishedIdsForAppraiseeId ($a_appr_id, $a_exclude_appraisee=false)
 
 getFinishedIdForAppraiseeIdAndRaterId ($a_appr_id, $a_rat_id)
 Get finished id for an appraisee and a rater. More...
 
 getFinishedIdsForSelfEval ($a_user_id)
 
 setSkillService ($a_val)
 Set skill service. More...
 
 getSkillService ()
 Get skill service. More...
 
 set360RaterSent ($a_appraisee_id, $a_user_id, $a_anonymous_id, $a_tstamp=null)
 
 closeAppraisee ($a_user_id)
 
 openAllAppraisees ()
 
 getReminderStatus ()
 
 setReminderStatus ($a_value)
 
 getReminderStart ()
 
 setReminderStart (ilDate $a_value=null)
 
 getReminderEnd ()
 
 setReminderEnd (ilDate $a_value=null)
 
 getReminderFrequency ()
 
 setReminderFrequency ($a_value)
 
 getReminderTarget ()
 
 setReminderTarget ($a_value)
 
 getReminderLastSent ()
 
 setReminderLastSent ($a_value)
 
 getReminderTemplate ($selectDefault=false)
 
 setReminderTemplate ($a_value)
 
 getTutorNotificationStatus ()
 
 setTutorNotificationStatus ($a_value)
 
 getTutorNotificationRecipients ()
 
 setTutorNotificationRecipients (array $a_value)
 
 getTutorNotificationTarget ()
 
 setTutorNotificationTarget ($a_value)
 
 getTutorResultsStatus ()
 
 setTutorResultsStatus ($a_value)
 
 getTutorResultsRecipients ()
 
 setTutorResultsRecipients (array $a_value)
 
 sent360Reminders ()
 Send 360 reminders. More...
 
 send360ReminderToUser ($a_user_id, $a_appraisee_ids)
 Send rater notification. More...
 
 getNotificationTargetUserIds ($a_use_invited)
 
 checkReminder ()
 
 setActivationStartDate ($starting_time=null)
 
 setActivationEndDate ($ending_time=null)
 
 getActivationStartDate ()
 
 getActivationEndDate ()
 
 setViewOwnResults ($a_value)
 
 hasViewOwnResults ()
 
 setMailOwnResults ($a_value)
 
 hasMailOwnResults ()
 
 setMailConfirmation ($a_value)
 
 hasMailConfirmation ()
 
 setAnonymousUserList ($a_value)
 
 hasAnonymousUserList ()
 
 setMode ($a_value)
 
 getMode ()
 
 setSelfEvaluationResults ($a_value)
 
 getSelfEvaluationResults ()
 
 sendTutorResults ()
 
 getMaxSumScore ()
 Get max sum score. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _getQuestionblock ($questionblock_id)
 Returns the database row for a given question block. More...
 
static _addQuestionblock ($title="", $owner=0, $show_questiontext=true, $show_blocktitle=false, $compress_view=false)
 Adds a questionblock to the database. More...
 
static _getConstraints ($survey_id)
 Returns the constraints to a given question or questionblock. More...
 
static _hasDatasets ($survey_id)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static validateExternalRaterCode ($a_ref_id, $a_code)
 
static getSurveySkippedValue ()
 
static getSurveysWithTutorResults ()
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

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
 
 $survey_id
 
 $author
 
 $introduction
 
 $outro
 
 $evaluation_access
 
 $start_date
 
 $end_date
 
 $questions
 
 $anonymize
 
 $display_question_titles
 
 $surveyCodeSecurity
 
 $mailnotification
 
 $mailaddresses
 
 $mailparticipantdata
 
 $template_id
 
 $pool_usage
 
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
 
const MODE_STANDARD = 0
 
const MODE_360 = 1
 
const MODE_SELF_EVAL = 2
 
const RESULTS_SELF_EVAL_NONE = 0
 
const RESULTS_SELF_EVAL_OWN = 1
 
const RESULTS_SELF_EVAL_ALL = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 getParticipantTextResults ($active_id)
 
 checkTutorNotification ()
 
 sendTutorNotification ()
 
 sentReminderPlaceholders ($a_message, $a_user_id, array $a_context_params)
 

Protected Attributes

 $svy_log
 
 $user
 
 $access
 
 $plugin_admin
 
 $calculate_sum_score = false
 
 $log
 
 $activation_visibility
 
 $activation_starting_time
 
 $activation_ending_time
 
 $mode_360_self_eval
 
 $mode_360_self_appr
 
 $mode_360_self_rate
 
 $mode_360_results
 
 $mode_skill_service
 
 $reminder_status
 
 $reminder_start
 
 $reminder_end
 
 $reminder_frequency
 
 $reminder_target
 
 $reminder_last_sent
 
 $reminder_tmpl
 
 $tutor_ntf_status
 
 $tutor_ntf_recipients
 
 $tutor_ntf_target
 
 $tutor_res_status
 
 $tutor_res_recipients
 
 $view_own_results
 
 $mail_own_results
 
 $mail_confirmation
 
 $anon_user_list
 
 $mode
 
 $mode_self_eval_results
 
 $invitation_manager
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

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

213 {
214 global $DIC;
215
216 $this->user = $DIC->user();
217 $this->lng = $DIC->language();
218 $this->db = $DIC->database();
219 $this->access = $DIC->access();
220 $this->plugin_admin = $DIC["ilPluginAdmin"];
221 $this->tree = $DIC->repositoryTree();
222 $ilUser = $DIC->user();
223 $lng = $DIC->language();
224
225 $this->type = "svy";
226 $this->survey_id = -1;
227 $this->introduction = "";
228 $this->outro = $lng->txt("survey_finished");
229 $this->author = $ilUser->getFullname();
230 $this->evaluation_access = self::EVALUATION_ACCESS_OFF;
231 $this->questions = array();
232 $this->anonymize = self::ANONYMIZE_OFF;
233 $this->display_question_titles = self::QUESTIONTITLES_VISIBLE;
234 $this->surveyCodeSecurity = true;
235 $this->template_id = null;
236 $this->pool_usage = true;
237 $this->mode = self::MODE_STANDARD;
238 $this->mode_self_eval_results = self::RESULTS_SELF_EVAL_OWN;
239
240 $this->invitation_manager = new Participants\InvitationsManager();
241
242 parent::__construct($a_id, $a_call_by_reference);
243 $this->svy_log = ilLoggerFactory::getLogger("svy");
244 }
user()
Definition: user.php:4
static getLogger($a_component_id)
Get component logger.
const QUESTIONTITLES_VISIBLE
const EVALUATION_ACCESS_OFF
const RESULTS_SELF_EVAL_OWN
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, $ilUser, ilObject\$lng, ILIAS\GlobalScreen\Provider\__construct(), ANONYMIZE_OFF, EVALUATION_ACCESS_OFF, ilLoggerFactory\getLogger(), MODE_STANDARD, QUESTIONTITLES_VISIBLE, RESULTS_SELF_EVAL_OWN, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _addQuestionblock()

static ilObjSurvey::_addQuestionblock (   $title = "",
  $owner = 0,
  $show_questiontext = true,
  $show_blocktitle = false,
  $compress_view = false 
)
static

Adds a questionblock to the database.

Parameters
string$titleThe questionblock title
integer$ownerThe database id of the owner
Returns
integer The database id of the newly created questionblock @access public

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

1994 {
1995 global $DIC;
1996
1997 $ilDB = $DIC->database();
1998 $next_id = $ilDB->nextId('svy_qblk');
1999 $ilDB->manipulateF(
2000 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
2001 " show_blocktitle, owner_fi, tstamp, compress_view) " .
2002 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
2003 array('integer','text','integer','integer','integer','integer','integer'),
2004 array($next_id, $title, $show_questiontext, $show_blocktitle, $owner, time(),$compress_view)
2005 );
2006 return $next_id;
2007 }
global $ilDB

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

◆ _getConstraints()

static ilObjSurvey::_getConstraints (   $survey_id)
static

Returns the constraints to a given question or questionblock.

@access public

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

2416 {
2417 global $DIC;
2418
2419 $ilDB = $DIC->database();
2420 $result_array = array();
2421 $result = $ilDB->queryF(
2422 "SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* " .
2423 "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id " .
2424 "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2425 array('integer'),
2426 array($survey_id)
2427 );
2428 while ($row = $ilDB->fetchAssoc($result)) {
2429 array_push($result_array, array("id" => $row["constraint_id"], "for_question" => $row["for_question"], "question" => $row["question_fi"], "short" => $row["shortname"], "long" => $row["longname"], "relation_id" => $row["relation_id"], "value" => $row["value"], 'conjunction' => $row['conjunction']));
2430 }
2431 return $result_array;
2432 }
$result

References $DIC, $ilDB, $result, and $survey_id.

◆ _getQuestionblock()

static ilObjSurvey::_getQuestionblock (   $questionblock_id)
static

Returns the database row for a given question block.

Parameters
integer$questionblock_idThe database id of the question block
Returns
array The database row of the question block @access public

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

1972 {
1973 global $DIC;
1974
1975 $ilDB = $DIC->database();
1976 $result = $ilDB->queryF(
1977 "SELECT * FROM svy_qblk WHERE questionblock_id = %s",
1978 array('integer'),
1979 array($questionblock_id)
1980 );
1981 $row = $ilDB->fetchAssoc($result);
1982 return $row;
1983 }

References $DIC, $ilDB, and $result.

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

+ Here is the caller graph for this function:

◆ _hasDatasets()

static ilObjSurvey::_hasDatasets (   $survey_id)
static

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

2959 {
2960 global $DIC;
2961
2962 $ilDB = $DIC->database();
2963
2964 $result = $ilDB->queryF(
2965 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
2966 array('integer'),
2967 array($survey_id)
2968 );
2969 return ($result->numRows()) ? true : false;
2970 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References $DIC, $ilDB, $result, $survey_id, and true.

Referenced by ilSurveyConstraintsGUI\constraintsObject(), ilSurveySyncTableGUI\importData(), ilObjSurveyGUI\initPropertiesForm(), ilSurveyEditorGUI\questionsObject(), ilSurveyPageGUI\renderPage(), ilObjSurveyGUI\savePropertiesObject(), and ilSurveyConstraintsGUI\validateConstraintForEdit().

+ Here is the caller graph for this function:

◆ _instanciateQuestion()

static ilObjSurvey::_instanciateQuestion (   $question_id)
static

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

Parameters
integer$question_idThe question id
Returns
object The question instance @access public

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

3438 {
3439 if ($question_id < 1) {
3440 return false;
3441 }
3442 $question_type = SurveyQuestion::_getQuestionType($question_id);
3443 if (strlen($question_type) == 0) {
3444 return false;
3445 }
3446 SurveyQuestion::_includeClass($question_type);
3447 $question = new $question_type();
3448 $question->loadFromDb($question_id);
3449 return $question;
3450 }
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.

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

Referenced by ilSurveyEditorGUI\copyQuestionsToPoolObject(), ilSurveyEditorGUI\executeCopyQuestionsToPoolObject(), getSurveyQuestions(), ilSurveyPageGUI\paste(), removeQuestion(), and toXML().

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

◆ addAppraisee()

ilObjSurvey::addAppraisee (   $a_user_id)

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

4948 {
4949 global $DIC;
4950
4951 $ilDB = $DIC->database();
4952 $access = $DIC->access();
4953
4954 if (!$this->isAppraisee($a_user_id) &&
4955 $a_user_id != ANONYMOUS_USER_ID) {
4956 $fields = array(
4957 "obj_id" => array("integer", $this->getSurveyId()),
4958 "user_id" => array("integer", $a_user_id)
4959 );
4960 $ilDB->insert("svy_360_appr", $fields);
4961
4962 // send notification and add to desktop
4963 if ($access->checkAccessOfUser($a_user_id, "read", "", $this->getRefId())) {
4964 $this->sendAppraiseeNotification($a_user_id);
4965 }
4966 }
4967 }
isAppraisee($a_user_id)
getSurveyId()
Returns the survey database id.
sendAppraiseeNotification($a_user_id)
Send appraisee notification.
const ANONYMOUS_USER_ID
Definition: constants.php:25

References $access, $DIC, $ilDB, ANONYMOUS_USER_ID, getSurveyId(), isAppraisee(), and sendAppraiseeNotification().

+ Here is the call graph for this function:

◆ addConstraint()

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

Adds a constraint.

Parameters
integer$if_question_idThe question id of the question which defines a precondition
integer$relationThe database id of the relation
mixed$valueThe value compared with the relation @access public

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

2467 {
2468 $ilDB = $this->db;
2469
2470 $next_id = $ilDB->nextId('svy_constraint');
2471 $affectedRows = $ilDB->manipulateF(
2472 "INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES " .
2473 "(%s, %s, %s, %s, %s)",
2474 array('integer','integer','integer','float', 'integer'),
2475 array($next_id, $if_question_id, $relation, $value, $conjunction)
2476 );
2477 if ($affectedRows) {
2478 return $next_id;
2479 } else {
2480 return null;
2481 }
2482 }

References ilObject\$db, and $ilDB.

◆ addConstraintToQuestion()

ilObjSurvey::addConstraintToQuestion (   $to_question_id,
  $constraint_id 
)

Adds a constraint to a question.

Parameters
integer$to_question_idThe question id of the question where to add the constraint
integer$constraint_idThe id of the constraint

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

2492 {
2493 $ilDB = $this->db;
2494
2495 $next_id = $ilDB->nextId('svy_qst_constraint');
2496 $affectedRows = $ilDB->manipulateF(
2497 "INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, " .
2498 "constraint_fi) VALUES (%s, %s, %s, %s)",
2499 array('integer','integer','integer','integer'),
2500 array($next_id, $this->getSurveyId(), $to_question_id, $constraint_id)
2501 );
2502 }

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

+ Here is the call graph for this function:

◆ addMaterialTag()

ilObjSurvey::addMaterialTag ( $a_xml_writer,
  $a_material,
  $close_material_tag = true,
  $add_mobs = true,
  $attribs = null 
)

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

Parameters
object$a_xml_writerReference to the ILIAS XML writer
string$a_materialplain text or html text containing the material
Returns
string XML material tag @access public

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

4488 {
4489 $a_xml_writer->xmlStartTag("material", $attribs);
4490 $attrs = array(
4491 "type" => "text/plain"
4492 );
4493 if ($this->isHTML($a_material)) {
4494 $attrs["type"] = "text/xhtml";
4495 }
4496 $mattext = ilRTE::_replaceMediaObjectImageSrc($a_material, 0);
4497 $a_xml_writer->xmlElement("mattext", $attrs, $mattext);
4498
4499 if ($add_mobs) {
4500 $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->getId());
4501 foreach ($mobs as $mob) {
4502 $mob_id = "il_" . IL_INST_ID . "_mob_" . $mob;
4503 if (strpos($mattext, $mob_id) !== false) {
4504 $mob_obj = new ilObjMediaObject($mob);
4505 $imgattrs = array(
4506 "label" => $mob_id,
4507 "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle(),
4508 "type" => "svy:html",
4509 "id" => $this->getId()
4510 );
4511 $a_xml_writer->xmlElement("matimage", $imgattrs, null);
4512 }
4513 }
4514 }
4515 if ($close_material_tag) {
4516 $a_xml_writer->xmlEndTag("material");
4517 }
4518 }
Class ilObjMediaObject.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
isHTML($a_text)
Checks if a given string contains HTML or not.
getId()
get object id @access public
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
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:38
$mobs
Definition: imgupload.php:54

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), ilObject\getId(), IL_INST_ID, and isHTML().

Referenced by toXML().

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

◆ addQuestion()

ilObjSurvey::addQuestion (   $question_id)

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

Parameters
integer$question_idThe question id of the question @access public

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

315 {
316 array_push($this->questions, $question_id);
317 }

◆ addQuestionToBlock()

ilObjSurvey::addQuestionToBlock (   $question_id,
  $questionblock_id 
)

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

1859 {
1860 $ilDB = $this->db;
1861
1862 // see #22018
1863 if (!$this->isQuestionInAnyBlock($question_id)) {
1864 $next_id = $ilDB->nextId('svy_qblk_qst');
1865 $affectedRows = $ilDB->manipulateF(
1866 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1867 "question_fi) VALUES (%s, %s, %s, %s)",
1868 array('integer', 'integer', 'integer', 'integer'),
1869 array($next_id, $this->getSurveyId(), $questionblock_id, $question_id)
1870 );
1871
1872 $this->deleteConstraints($question_id); // #13713
1873 }
1874 }
deleteConstraints($question_id)
Deletes the constraints for a question.
isQuestionInAnyBlock($a_question_fi)
Is question already in a block?

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

+ Here is the call graph for this function:

◆ addRater()

ilObjSurvey::addRater (   $a_appraisee_id,
  $a_user_id,
  $a_anonymous_id = 0 
)

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

5133 {
5134 global $DIC;
5135
5136 $ilDB = $DIC->database();
5137 $access = $DIC->access();
5138
5139 if ($this->isAppraisee($a_appraisee_id) &&
5140 !$this->isRater($a_appraisee_id, $a_user_id, $a_anonymous_id)) {
5141 $fields = array(
5142 "obj_id" => array("integer", $this->getSurveyId()),
5143 "appr_id" => array("integer", $a_appraisee_id),
5144 "user_id" => array("integer", $a_user_id),
5145 "anonymous_id" => array("integer", $a_anonymous_id)
5146 );
5147 $ilDB->insert("svy_360_rater", $fields);
5148
5149 // send notification and add to desktop
5150 if ($access->checkAccessOfUser($a_user_id, "read", "", $this->getRefId())) {
5151 $this->sendRaterNotification($a_user_id, $a_appraisee_id);
5152 }
5153 }
5154 }
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
sendRaterNotification($a_user_id, $a_appraisee_id)
Send rater notification.

References $access, $DIC, $ilDB, getSurveyId(), isAppraisee(), isRater(), and sendRaterNotification().

+ Here is the call graph for this function:

◆ applySettingsTemplate()

ilObjSurvey::applySettingsTemplate (   $template_id)

Apply settings template.

Parameters
int$template_id

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

4797 {
4798 if (!$template_id) {
4799 return;
4800 }
4801
4802 $template = new ilSettingsTemplate($template_id);
4803 $template_settings = $template->getSettings();
4804 //ilUtil::dumpVar($template_settings); exit;
4805 if ($template_settings) {
4806 if ($template_settings["show_question_titles"] !== null) {
4807 if ($template_settings["show_question_titles"]["value"]) {
4808 $this->setShowQuestionTitles(true);
4809 } else {
4810 $this->setShowQuestionTitles(false);
4811 }
4812 }
4813
4814 if ($template_settings["use_pool"] !== null) {
4815 if ($template_settings["use_pool"]["value"]) {
4816 $this->setPoolUsage(true);
4817 } else {
4818 $this->setPoolUsage(false);
4819 }
4820 }
4821
4822
4823 /* see #0021719
4824 if($template_settings["anonymization_options"]["value"])
4825 {
4826 $anon_map = array('personalized' => self::ANONYMIZE_OFF,
4827 'anonymize_with_code' => self::ANONYMIZE_ON,
4828 'anonymize_without_code' => self::ANONYMIZE_FREEACCESS);
4829 $this->setAnonymize($anon_map[$template_settings["anonymization_options"]["value"]]);
4830 }*/
4831
4832 // see #0021719 and ilObjectSurveyGUI::savePropertiesObject
4833 $this->setEvaluationAccess($template_settings["evaluation_access"]["value"]);
4834 $codes = (bool) $template_settings["acc_codes"]["value"];
4835 $anon = (bool) $template_settings["anonymization_options"]["value"];
4836 if (!$anon) {
4837 if (!$codes) {
4839 } else {
4841 }
4842 } else {
4843 if ($codes) {
4845 } else {
4847 }
4848
4849 $this->setAnonymousUserList($_POST["anon_list"]);
4850 }
4851
4852
4853
4854 /* other settings: not needed here
4855 * - enabled_end_date
4856 * - enabled_start_date
4857 * - rte_switch
4858 */
4859 }
4860
4861 $this->setTemplate($template_id);
4862 $this->saveToDb();
4863 }
$_POST["username"]
setShowQuestionTitles($a_show)
Sets the status of the display_question_titles attribute.
saveToDb()
Saves a survey object to a database.
setAnonymousUserList($a_value)
const ANONYMIZE_FREEACCESS
setEvaluationAccess($evaluation_access=self::EVALUATION_ACCESS_OFF)
Sets the learners evaluation access.
setPoolUsage($a_value)
const ANONYMIZE_CODE_ALL
setTemplate($template_id)
setAnonymize($a_anonymize)
set anonymize status
Settings template application class.

References $_POST, $template_id, ANONYMIZE_CODE_ALL, ANONYMIZE_FREEACCESS, ANONYMIZE_OFF, ANONYMIZE_ON, saveToDb(), setAnonymize(), setAnonymousUserList(), setEvaluationAccess(), setPoolUsage(), setShowQuestionTitles(), and setTemplate().

+ Here is the call graph for this function:

◆ bindSurveyCodeToUser()

ilObjSurvey::bindSurveyCodeToUser (   $user_id,
  $code 
)

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

3969 {
3970 $ilDB = $this->db;
3971
3972 if ($user_id == ANONYMOUS_USER_ID) {
3973 return;
3974 }
3975
3976 if ($this->checkSurveyCode($code)) {
3977 $ilDB->manipulate("UPDATE svy_anonymous" .
3978 " SET user_key = " . $ilDB->quote(md5($user_id), "text") .
3979 " WHERE survey_key = " . $ilDB->quote($code, "text"));
3980 }
3981 }

References ilObject\$db, $ilDB, ANONYMOUS_USER_ID, and checkSurveyCode().

+ 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
boolean TRUE if the survey is anonymized and the survey code may be shown in the export file
Author
Helmut Schottmüller

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

4529 {
4530 if ($this->getAnonymize() != self::ANONYMIZE_OFF) {
4531 if ($this->surveyCodeSecurity == false) {
4532 return true;
4533 }
4534 }
4535 return false;
4536 }
getAnonymize()
get anonymize status

References getAnonymize().

+ Here is the call graph for this function:

◆ canStartSurvey()

ilObjSurvey::canStartSurvey (   $anonymous_id = null,
  $a_no_rbac = false 
)

Checks if the survey can be started.

Returns
array An array containing the following keys: result (boolean) and messages (array) @access public

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

1420 {
1421 $ilAccess = $this->access;
1422
1423 $result = true;
1424 $messages = array();
1425 $edit_settings = false;
1426 // check start date
1427 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches)) {
1428 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1429 $now = time();
1430 if ($now < $epoch_time) {
1431 array_push($messages, $this->lng->txt('start_date_not_reached') . ' (' .
1433 $result = false;
1434 $edit_settings = true;
1435 }
1436 }
1437 // check end date
1438 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches)) {
1439 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1440 $now = time();
1441 if ($now > $epoch_time) {
1442 array_push($messages, $this->lng->txt('end_date_reached') . ' (' .
1444 $result = false;
1445 $edit_settings = true;
1446 }
1447 }
1448
1449 // check online status
1450 if ($this->getOfflineStatus()) {
1451 array_push($messages, $this->lng->txt("survey_is_offline"));
1452 $result = false;
1453 $edit_settings = true;
1454 }
1455 // check rbac permissions
1456 if (!$a_no_rbac && !$ilAccess->checkAccess("read", "", $this->ref_id)) {
1457 array_push($messages, $this->lng->txt("cannot_participate_survey"));
1458 $result = false;
1459 }
1460 /*
1461 // 2. check previous access
1462 if (!$result["error"])
1463 {
1464 $ilUser = $this->user;
1465 $survey_started = $this->isSurveyStarted($ilUser->getId(), $anonymous_id);
1466 if ($survey_started === 1)
1467 {
1468 array_push($messages, $this->lng->txt("already_completed_survey"));
1469 $result = FALSE;
1470 }
1471 }
1472 */
1473 return array(
1474 "result" => $result,
1475 "messages" => $messages,
1476 "edit_settings" => $edit_settings
1477 );
1478 }
const IL_CAL_TIMESTAMP
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
getEndDate()
Gets the end date of the survey.
getStartDate()
Gets the start date of the survey.
getOfflineStatus()
Get offline status.
$messages
Definition: xapiexit.php:5

References $access, $messages, $result, ilDatePresentation\formatDate(), getEndDate(), ilObject\getOfflineStatus(), getStartDate(), and IL_CAL_TIMESTAMP.

+ Here is the call graph for this function:

◆ checkConstraint()

ilObjSurvey::checkConstraint (   $constraint_data,
  $working_data 
)

Checks if a constraint is valid.

Parameters
array$constraint_dataThe database row containing the constraint data
array$working_dataThe user input of the related question
Returns
boolean true if the constraint is valid, otherwise false @access public

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

2902 {
2903 if (!is_array($working_data) || count($working_data) == 0) {
2904 return 0;
2905 }
2906
2907 if ((count($working_data) == 1) and (strcmp($working_data[0]["value"], "") == 0)) {
2908 return 0;
2909 }
2910
2911 $found = false;
2912 foreach ($working_data as $data) {
2913 switch ($constraint_data["short"]) {
2914 case "<":
2915 if ($data["value"] < $constraint_data["value"]) {
2916 $found = true;
2917 }
2918 break;
2919
2920 case "<=":
2921 if ($data["value"] <= $constraint_data["value"]) {
2922 $found = true;
2923 }
2924 break;
2925
2926 case "=":
2927 if ($data["value"] == $constraint_data["value"]) {
2928 $found = true;
2929 }
2930 break;
2931
2932 case "<>":
2933 if ($data["value"] <> $constraint_data["value"]) {
2934 $found = true;
2935 }
2936 break;
2937
2938 case ">=":
2939 if ($data["value"] >= $constraint_data["value"]) {
2940 $found = true;
2941 }
2942 break;
2943
2944 case ">":
2945 if ($data["value"] > $constraint_data["value"]) {
2946 $found = true;
2947 }
2948 break;
2949 }
2950 if ($found) {
2951 break;
2952 }
2953 }
2954
2955 return (int) $found;
2956 }
$data
Definition: storeScorm.php:23

References $data.

◆ checkReminder()

ilObjSurvey::checkReminder ( )

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

5855 {
5856 $ilDB = $this->db;
5857 $ilAccess = $this->access;
5858
5859 $now = time();
5860 $now_with_format = date("YmdHis", $now);
5861 $today = date("Y-m-d");
5862
5863 $this->svy_log->debug("Check status and dates.");
5864
5865 // object settings / participation period
5866 if (
5867 $this->getOfflineStatus() ||
5868 !$this->getReminderStatus() ||
5869 ($this->getStartDate() && $now_with_format < $this->getStartDate()) ||
5870 ($this->getEndDate() && $now_with_format > $this->getEndDate())) {
5871 return false;
5872 }
5873
5874 // reminder period
5875 $start = $this->getReminderStart();
5876 if ($start) {
5877 $start = $start->get(IL_CAL_DATE);
5878 }
5879 $end = $this->getReminderEnd();
5880 if ($end) {
5881 $end = $end->get(IL_CAL_DATE);
5882 }
5883 if ($today < $start ||
5884 ($end && $today > $end)) {
5885 return false;
5886 }
5887
5888 $this->svy_log->debug("Check access period.");
5889
5890 // object access period
5891 $item_data = ilObjectActivation::getItem($this->getRefId());
5892 if ($item_data["timing_type"] == ilObjectActivation::TIMINGS_ACTIVATION &&
5893 ($now < $item_data["timing_start"] ||
5894 $now > $item_data["timing_end"])) {
5895 return false;
5896 }
5897
5898 $this->svy_log->debug("Check frequency.");
5899
5900 // check frequency
5901 $cut = new ilDate($today, IL_CAL_DATE);
5902 $cut->increment(IL_CAL_DAY, $this->getReminderFrequency() * -1);
5903 if (!$this->getReminderLastSent() ||
5904 $cut->get(IL_CAL_DATE) >= substr($this->getReminderLastSent(), 0, 10)) {
5905 $missing_ids = array();
5906
5907 if (!$this->get360Mode()) {
5908 $this->svy_log->debug("Entering survey mode.");
5909
5910 // #16871
5911 $user_ids = $this->getNotificationTargetUserIds(($this->getReminderTarget() == self::NOTIFICATION_INVITED_USERS));
5912 if ($user_ids) {
5913 // gather participants who already finished
5914 $finished_ids = array();
5915 $set = $ilDB->query("SELECT user_fi FROM svy_finished" .
5916 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5917 " AND state = " . $ilDB->quote(1, "text") .
5918 " AND " . $ilDB->in("user_fi", $user_ids, "", "integer"));
5919 while ($row = $ilDB->fetchAssoc($set)) {
5920 $finished_ids[] = $row["user_fi"];
5921 }
5922
5923 // some users missing out?
5924 $missing_ids = array_diff($user_ids, $finished_ids);
5925 if ($missing_ids) {
5926 foreach ($missing_ids as $idx => $user_id) {
5927 // should be able to participate
5928 if (!$ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId())) {
5929 unset($missing_ids[$idx]);
5930 }
5931 }
5932 }
5933 if ($missing_ids) {
5934 $this->sentReminder($missing_ids);
5935 }
5936 }
5937 } else {
5938 $this->svy_log->debug("Entering 360 mode.");
5939
5940 $this->sent360Reminders();
5941 }
5942
5943
5944 $this->setReminderLastSent($today);
5945 $this->saveToDb();
5946
5947 return sizeof($missing_ids);
5948 }
5949
5950 return false;
5951 }
const IL_CAL_DATE
const IL_CAL_DAY
Class for single dates.
setReminderLastSent($a_value)
getNotificationTargetUserIds($a_use_invited)
sent360Reminders()
Send 360 reminders.
static getItem($a_ref_id)
Get item data.
getRefId()
get reference id @access public

References $access, ilObject\$db, $ilDB, get360Mode(), getEndDate(), ilObjectActivation\getItem(), getNotificationTargetUserIds(), ilObject\getOfflineStatus(), ilObject\getRefId(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderStart(), getReminderStatus(), getReminderTarget(), getStartDate(), IL_CAL_DATE, IL_CAL_DAY, saveToDb(), sent360Reminders(), setReminderLastSent(), and ilObjectActivation\TIMINGS_ACTIVATION.

+ Here is the call graph for this function:

◆ checkSurveyCode()

ilObjSurvey::checkSurveyCode (   $code)

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

3996 {
3997 if ($this->isAnonymousKey($code)) {
3998 if ($this->isSurveyStarted("", $code) == 1) {
3999 return false;
4000 } else {
4001 return true;
4002 }
4003 } else {
4004 return false;
4005 }
4006 }
isSurveyStarted($user_id, $anonymize_id, $appr_id=0)
Checks if a user already started a survey.

References isAnonymousKey(), and isSurveyStarted().

Referenced by bindSurveyCodeToUser().

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

◆ checkTutorNotification()

ilObjSurvey::checkTutorNotification ( )
protected

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

5684 {
5685 $ilDB = $this->db;
5686
5687 if ($this->getTutorNotificationStatus()) {
5688 $user_ids = $this->getNotificationTargetUserIds(($this->getTutorNotificationTarget() == self::NOTIFICATION_INVITED_USERS));
5689 if ($user_ids) {
5690 $set = $ilDB->query("SELECT COUNT(*) numall FROM svy_finished" .
5691 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5692 " AND state = " . $ilDB->quote(1, "integer") .
5693 " AND " . $ilDB->in("user_fi", $user_ids, "", "integer"));
5694 $row = $ilDB->fetchAssoc($set);
5695 if ($row["numall"] == sizeof($user_ids)) {
5696 $this->sendTutorNotification();
5697 }
5698 }
5699 }
5700 }

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

Referenced by finishSurvey().

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

◆ cloneTextblocks()

ilObjSurvey::cloneTextblocks (   $mapping)

Clones the textblocks of survey questions.

@access public

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

3844 {
3845 foreach ($mapping as $original_id => $new_id) {
3846 $textblock = $this->getTextblock($original_id);
3847 $this->saveHeading(ilUtil::stripSlashes($textblock, true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("survey")), $new_id);
3848 }
3849 }
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
saveHeading($heading="", $insertbefore)
getTextblock($question_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ closeAppraisee()

ilObjSurvey::closeAppraisee (   $a_user_id)

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

5486 {
5487 global $DIC;
5488
5489 $ilDB = $DIC->database();
5490 $user = $DIC->user();
5491
5492 // close the appraisee
5493 $ilDB->manipulate("UPDATE svy_360_appr" .
5494 " SET has_closed = " . $ilDB->quote(time(), "integer") .
5495 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5496 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
5497
5498 // write competences
5499 $skmg_set = new ilSkillManagementSettings();
5500 if ($this->getSkillService() && $skmg_set->isActivated()) {
5501 $sskill = new ilSurveySkill($this);
5502 $sskill->writeAndAddAppraiseeSkills($a_user_id);
5503 }
5504
5505 // send notification
5506 if ($user->getId() != $a_user_id) {
5507 $this->sendAppraiseeCloseNotification($a_user_id);
5508 }
5509 }
getSkillService()
Get skill service.
sendAppraiseeCloseNotification($a_user_id)
Send appraisee notification.
Skill/Competence handling in surveys.

References $DIC, $ilDB, $user, getSkillService(), and sendAppraiseeCloseNotification().

+ Here is the call graph for this function:

◆ create()

ilObjSurvey::create (   $a_upload = false)

create survey object

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

250 {
251 parent::create();
252 if (!$a_upload) {
253 $this->createMetaData();
254 }
255 $this->setOfflineStatus(true);
256 $this->update($a_upload);
257 }
createMetaData()
Create meta data entry.
setOfflineStatus($a_status)
Set offline status.
update()
update object in db

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

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjSurvey::createExportDirectory ( )

creates data directory for export files (data_dir/svy_data/svy_<id>/export, depending on data directory that is set in ILIAS setup/ini)

Exceptions
ilSurveyException

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

3859 {
3860 $svy_data_dir = ilUtil::getDataDir() . "/svy_data";
3861 ilUtil::makeDir($svy_data_dir);
3862 if (!is_writable($svy_data_dir)) {
3863 throw new ilSurveyException("Survey Data Directory (" . $svy_data_dir . ") not writeable.");
3864 }
3865
3866 // create learning module directory (data_dir/lm_data/lm_<id>)
3867 $svy_dir = $svy_data_dir . "/svy_" . $this->getId();
3868 ilUtil::makeDir($svy_dir);
3869 if (!@is_dir($svy_dir)) {
3870 throw new ilSurveyException("Creation of Survey Directory failed.");
3871 }
3872 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
3873 $export_dir = $svy_dir . "/export";
3874 ilUtil::makeDir($export_dir);
3875 if (!@is_dir($export_dir)) {
3876 throw new ilSurveyException("Creation of Export Directory failed.");
3877 }
3878 }
Survey exception class.
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

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

+ Here is the call graph for this function:

◆ createImportDirectory()

ilObjSurvey::createImportDirectory ( )

creates data directory for import files (data_dir/svy_data/svy_<id>/import, depending on data directory that is set in ILIAS setup/ini)

Exceptions
ilSurveyException

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

3898 {
3899 $svy_data_dir = ilUtil::getDataDir() . "/svy_data";
3900 ilUtil::makeDir($svy_data_dir);
3901
3902 if (!is_writable($svy_data_dir)) {
3903 throw new ilSurveyException("Survey Data Directory (" . $svy_data_dir . ") not writeable.");
3904 }
3905
3906 // create test directory (data_dir/svy_data/svy_<id>)
3907 $svy_dir = $svy_data_dir . "/svy_" . $this->getId();
3908 ilUtil::makeDir($svy_dir);
3909 if (!@is_dir($svy_dir)) {
3910 throw new ilSurveyException("Creation of Survey Directory failed.");
3911 }
3912
3913 // create import subdirectory (data_dir/svy_data/svy_<id>/import)
3914 $import_dir = $svy_dir . "/import";
3915 ilUtil::makeDir($import_dir);
3916 if (!@is_dir($import_dir)) {
3917 throw new ilSurveyException("Creation of Import Directory failed.");
3918 }
3919 }

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

+ Here is the call graph for this function:

◆ createMetaData()

ilObjSurvey::createMetaData ( )

Create meta data entry.

@access public

Reimplemented from ilObject.

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

265 {
266 parent::createMetaData();
267 $this->saveAuthorToMetadata();
268 }
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...

References saveAuthorToMetadata().

Referenced by create().

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

◆ createNewAccessCode()

ilObjSurvey::createNewAccessCode ( )

Returns a new, unused survey access code.

Returns
string A new survey access code

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

4410 {
4411 // create a 5 character code
4412 $codestring = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4413 mt_srand();
4414 $code = "";
4415 for ($i = 1; $i <= 5; $i++) {
4416 $index = mt_rand(0, strlen($codestring) - 1);
4417 $code .= substr($codestring, $index, 1);
4418 }
4419 // verify it against the database
4420 while (!$this->isSurveyCodeUnique($code)) {
4421 $code = $this->createNewAccessCode();
4422 }
4423 return $code;
4424 }
createNewAccessCode()
Returns a new, unused survey access code.
$index
Definition: metadata.php:128
$i
Definition: metadata.php:24

References $i, $index, createNewAccessCode(), and isSurveyCodeUnique().

Referenced by createNewAccessCode(), createSurveyCodes(), createSurveyCodesForExternalData(), and getUserSurveyExecutionStatus().

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

◆ createQuestionblock()

ilObjSurvey::createQuestionblock (   $title,
  $show_questiontext,
  $show_blocktitle,
  $questions,
  $compress_view = false 
)

Creates a question block for the survey.

Parameters
string$titleThe title of the question block
array$questionsAn array with the database id's of the question block questions @access public

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

2017 {
2018 $ilDB = $this->db;
2019
2020 // if the selected questions are not in a continous selection, move all questions of the
2021 // questionblock at the position of the first selected question
2022 $this->moveQuestions($questions, $questions[0], 0);
2023
2024 // now save the question block
2026 $next_id = $ilDB->nextId('svy_qblk');
2027 $affectedRows = $ilDB->manipulateF(
2028 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
2029 " show_blocktitle, owner_fi, tstamp, compress_view) VALUES (%s, %s, %s, %s, %s, %s, %s)",
2030 array('integer','text','text','text','integer','integer','integer'),
2031 array($next_id, $title, $show_questiontext, $show_blocktitle, $ilUser->getId(), time(), $compress_view)
2032 );
2033 if ($affectedRows) {
2034 $questionblock_id = $next_id;
2035 foreach ($questions as $index) {
2036 if (!$this->isQuestionInAnyBlock($index)) {
2037 $next_id = $ilDB->nextId('svy_qblk_qst'); // #22018
2038 $affectedRows = $ilDB->manipulateF(
2039 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
2040 "question_fi) VALUES (%s, %s, %s, %s)",
2041 array('integer', 'integer', 'integer', 'integer'),
2042 array($next_id, $this->getSurveyId(), $questionblock_id, $index)
2043 );
2044 $this->deleteConstraints($index);
2045 }
2046 }
2047 }
2048 }
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions and/or questionblocks to another position.

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

Referenced by insertQuestionblock().

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

◆ createReference()

ilObjSurvey::createReference ( )

creates reference for object

@access public

Returns
integer reference_id of object

Reimplemented from ilObject.

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

292 {
293 $result = parent::createReference();
294 $this->saveToDb();
295 return $result;
296 }

References $result, and saveToDb().

+ Here is the call graph for this function:

◆ createSurveyCodes()

ilObjSurvey::createSurveyCodes (   $nrOfCodes)

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

4170 {
4171 $ilDB = $this->db;
4172
4173 $res = array();
4174
4175 for ($i = 0; $i < $nrOfCodes; $i++) {
4176 $next_id = $ilDB->nextId('svy_anonymous');
4177 $ilDB->manipulateF(
4178 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, tstamp) " .
4179 "VALUES (%s, %s, %s, %s)",
4180 array('integer','text','integer','integer'),
4181 array($next_id, $this->createNewAccessCode(), $this->getSurveyId(), time())
4182 );
4183 $res[] = $next_id;
4184 }
4185
4186 return $res;
4187 }
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ createSurveyCodesForExternalData()

ilObjSurvey::createSurveyCodesForExternalData (   $data)

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

4203 {
4204 $ilDB = $this->db;
4205
4206 $ids = array();
4207 foreach ($data as $dataset) {
4208 $anonymize_key = $this->createNewAccessCode();
4209 $next_id = $ilDB->nextId('svy_anonymous');
4210 $affectedRows = $ilDB->manipulateF(
4211 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
4212 "VALUES (%s, %s, %s, %s, %s)",
4213 array('integer','text','integer','text','integer'),
4214 array($next_id, $anonymize_key, $this->getSurveyId(), serialize($dataset), time())
4215 );
4216 $ids[] = $next_id;
4217 }
4218 return $ids;
4219 }

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

+ Here is the call graph for this function:

◆ delete()

ilObjSurvey::delete ( )

delete object and all related data

@access public

Returns
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilObject.

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

326 {
327 if ($this->countReferences() == 1) {
328 $this->deleteMetaData();
329
330 // Delete all survey questions, constraints and materials
331 foreach ($this->questions as $question_id) {
332 $this->removeQuestion($question_id);
333 }
334 $this->deleteSurveyRecord();
335
337 }
338
339 $remove = parent::delete();
340
341 // always call parent delete function first!!
342 if (!$remove) {
343 return false;
344 }
345 return true;
346 }
removeQuestion($question_id)
Remove a question from the survey.
getImportDirectory()
get import directory of survey
deleteSurveyRecord()
Deletes the survey from the database.
deleteMetaData()
delete meta data entry
countReferences()
count references of object
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References ilObject\countReferences(), ilUtil\delDir(), ilObject\deleteMetaData(), deleteSurveyRecord(), getImportDirectory(), and removeQuestion().

+ Here is the call graph for this function:

◆ deleteAllUserData()

ilObjSurvey::deleteAllUserData (   $reset_LP = true)

Deletes all user data of a survey.

@access public

Parameters
bool$reset_LPnotice that the LP can only be reset it the determining components still exist

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

414 {
416
417 $result = $ilDB->queryF(
418 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
419 array('integer'),
420 array($this->getSurveyId())
421 );
422 $active_array = array();
423 while ($row = $ilDB->fetchAssoc($result)) {
424 array_push($active_array, $row["finished_id"]);
425 }
426
427 $affectedRows = $ilDB->manipulateF(
428 "DELETE FROM svy_finished WHERE survey_fi = %s",
429 array('integer'),
430 array($this->getSurveyId())
431 );
432
433 foreach ($active_array as $active_fi) {
434 $affectedRows = $ilDB->manipulateF(
435 "DELETE FROM svy_answer WHERE active_fi = %s",
436 array('integer'),
437 array($active_fi)
438 );
439 $affectedRows = $ilDB->manipulateF(
440 "DELETE FROM svy_times WHERE finished_fi = %s",
441 array('integer'),
442 array($active_fi)
443 );
444 }
445
446 if ($reset_LP) {
447 $lp_obj = ilObjectLP::getInstance($this->getId());
448 $lp_obj->resetLPDataForCompleteObject();
449 }
450 }
static getInstance($a_obj_id)

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

Referenced by deleteSurveyRecord().

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

◆ deleteAppraisee()

ilObjSurvey::deleteAppraisee (   $a_user_id)

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

5084 {
5085 $ilDB = $this->db;
5086
5087 $ilDB->manipulate("DELETE FROM svy_360_appr" .
5088 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5089 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
5090
5091 $set = $ilDB->query("SELECT user_id" .
5092 " FROM svy_360_rater" .
5093 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5094 " AND appr_id = " . $ilDB->quote($a_user_id, "integer"));
5095 while ($row = $ilDB->fetchAssoc($set)) {
5096 $this->deleteRater($a_user_id, $row["user_id"]);
5097 }
5098 // appraisee will not be part of raters table
5099 if ($this->get360SelfEvaluation()) {
5100 $this->deleteRater($a_user_id, $a_user_id);
5101 }
5102 }
deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)

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

+ Here is the call graph for this function:

◆ deleteConstraint()

ilObjSurvey::deleteConstraint (   $constraint_id)

Deletes a constraint of a question.

Parameters
integer$constraint_idThe database id of the constraint
integer$question_idThe database id of the question @access public

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

2099 {
2100 $ilDB = $this->db;
2101 $affectedRows = $ilDB->manipulateF(
2102 "DELETE FROM svy_constraint WHERE constraint_id = %s",
2103 array('integer'),
2104 array($constraint_id)
2105 );
2106 $affectedRows = $ilDB->manipulateF(
2107 "DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
2108 array('integer'),
2109 array($constraint_id)
2110 );
2111 }

References ilObject\$db, and $ilDB.

Referenced by deleteConstraints(), and moveQuestions().

+ Here is the caller graph for this function:

◆ deleteConstraints()

ilObjSurvey::deleteConstraints (   $question_id)

Deletes the constraints for a question.

Parameters
integer$question_idThe database id of the question @access public

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

2075 {
2076 $ilDB = $this->db;
2077 $result = $ilDB->queryF(
2078 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
2079 array('integer','integer'),
2080 array($question_id, $this->getSurveyId())
2081 );
2082 $constraints = array();
2083 while ($row = $ilDB->fetchAssoc($result)) {
2084 array_push($constraints, $row["constraint_fi"]);
2085 }
2086 foreach ($constraints as $constraint_id) {
2087 $this->deleteConstraint($constraint_id);
2088 }
2089 }
deleteConstraint($constraint_id)
Deletes a constraint of a question.

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

Referenced by addQuestionToBlock(), and createQuestionblock().

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

◆ deleteRater()

ilObjSurvey::deleteRater (   $a_appraisee_id,
  $a_user_id,
  $a_anonymous_id = 0 
)

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

5182 {
5183 $ilDB = $this->db;
5184
5185 $finished_id = $this->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_user_id);
5186 if ($finished_id) {
5187 $this->removeSelectedSurveyResults(array($finished_id));
5188 }
5189
5190 $ilDB->manipulate("DELETE FROM svy_360_rater" .
5191 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5192 " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer") .
5193 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
5194 " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer"));
5195 }
getFinishedIdForAppraiseeIdAndRaterId($a_appr_id, $a_rat_id)
Get finished id for an appraisee and a rater.
removeSelectedSurveyResults($finished_ids)
Deletes the user data of a given array of survey participants.

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

Referenced by deleteAppraisee().

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

◆ deleteSurveyCode()

ilObjSurvey::deleteSurveyCode (   $survey_code)

Deletes a given survey access code.

Parameters
string$survey_codeThe survey code that should be deleted

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

4349 {
4350 $ilDB = $this->db;
4351
4352 if (strlen($survey_code) > 0) {
4353 $affectedRows = $ilDB->manipulateF(
4354 "DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4355 array('integer', 'text'),
4356 array($this->getSurveyId(), $survey_code)
4357 );
4358 }
4359 }

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

+ Here is the call graph for this function:

◆ deleteSurveyRecord()

ilObjSurvey::deleteSurveyRecord ( )

Deletes the survey from the database.

@access public

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

354 {
356
357 $affectedRows = $ilDB->manipulateF(
358 "DELETE FROM svy_svy WHERE survey_id = %s",
359 array('integer'),
360 array($this->getSurveyId())
361 );
362
363 $result = $ilDB->queryF(
364 "SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
365 array('integer'),
366 array($this->getSurveyId())
367 );
368 $questionblocks = array();
369 while ($row = $ilDB->fetchAssoc($result)) {
370 array_push($questionblocks, $row["questionblock_fi"]);
371 }
372 if (count($questionblocks)) {
373 $affectedRows = $ilDB->manipulate("DELETE FROM svy_qblk WHERE " . $ilDB->in('questionblock_id', $questionblocks, false, 'integer'));
374 }
375 $affectedRows = $ilDB->manipulateF(
376 "DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
377 array('integer'),
378 array($this->getSurveyId())
379 );
380 $this->deleteAllUserData(false);
381
382 $affectedRows = $ilDB->manipulateF(
383 "DELETE FROM svy_anonymous WHERE survey_fi = %s",
384 array('integer'),
385 array($this->getSurveyId())
386 );
387
388 // delete export files
389 $svy_data_dir = ilUtil::getDataDir() . "/svy_data";
390 $directory = $svy_data_dir . "/svy_" . $this->getId();
391 if (is_dir($directory)) {
392 ilUtil::delDir($directory);
393 }
394
395 $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->getId());
396 // remaining usages are not in text anymore -> delete them
397 // and media objects (note: delete method of ilObjMediaObject
398 // checks whether object is used in another context; if yes,
399 // the object is not deleted!)
400 foreach ($mobs as $mob) {
401 ilObjMediaObject::_removeUsage($mob, "svy:html", $this->getId());
402 $mob_obj = new ilObjMediaObject($mob);
403 $mob_obj->delete();
404 }
405 }
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
deleteAllUserData($reset_LP=true)
Deletes all user data of a survey.

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

Referenced by delete().

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

◆ deleteUserSettings()

ilObjSurvey::deleteUserSettings (   $id)

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

718 {
720
721 $affectedRows = $ilDB->manipulateF(
722 "DELETE FROM svy_settings WHERE settings_id = %s",
723 array('integer'),
724 array($id)
725 );
726 return $affectedRows;
727 }

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

◆ deleteWorkingData()

ilObjSurvey::deleteWorkingData (   $question_id,
  $active_id 
)

Deletes the working data of a question in the database.

Parameters
integer$question_idThe database id of the question
integer$active_idThe active id of the user who worked through the question @access public

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

2580 {
2581 $ilDB = $this->db;
2582
2583 $affectedRows = $ilDB->manipulateF(
2584 "DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2585 array('integer','integer'),
2586 array($question_id, $active_id)
2587 );
2588 }

References ilObject\$db, and $ilDB.

◆ deliverPDFfromFO()

ilObjSurvey::deliverPDFfromFO (   $fo)

Delivers a PDF file from a XSL-FO string.

Parameters
string$foThe XSL-FO string @access public

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

4603 {
4604 $ilLog = $this->svy_log;
4605
4606 $fo_file = ilUtil::ilTempnam() . ".fo";
4607 $fp = fopen($fo_file, "w");
4608 fwrite($fp, $fo);
4609 fclose($fp);
4610
4611 try {
4612 $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($fo);
4613 ilUtil::deliverData($pdf_base64->scalar, ilUtil::getASCIIFilename($this->getTitle()) . ".pdf", "application/pdf");
4614 return true;
4615 } catch (Exception $e) {
4616 $ilLog->write(__METHOD__ . ': ' . $e->getMessage());
4617 return false;
4618 }
4619 }
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename

References Vendor\Package\$e, $svy_log, ilUtil\deliverData(), ilRpcClientFactory\factory(), ilUtil\getASCIIFilename(), and ilUtil\ilTempnam().

+ Here is the call graph for this function:

◆ duplicateQuestionForSurvey()

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

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

Parameters
integer$question_idThe database id of the question
Returns
integer The database id of the copied question @access public

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

589 {
591
592 $questiontype = $this->getQuestionType($question_id);
593 $question_gui = $this->getQuestionGUI($questiontype, $question_id);
594
595 // check if question is a pool question at all, if not do nothing
596 if ($this->getId() == $question_gui->object->getObjId() && !$a_force) {
597 return $question_id;
598 }
599
600 $duplicate_id = $question_gui->object->duplicate(true, "", "", "", $this->getId());
601 return $duplicate_id;
602 }
getQuestionType($question_id)
Returns the question type of a question with a given id.
getQuestionGUI($questiontype, $question_id)
Returns a question gui object to a given questiontype and question id.

References $ilUser, $user, ilObject\getId(), getQuestionGUI(), and getQuestionType().

Referenced by insertQuestion(), and insertQuestionblock().

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

◆ findCodeForUser()

ilObjSurvey::findCodeForUser (   $a_user_id)

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

5367 {
5368 $ilDB = $this->db;
5369
5370 if ($a_user_id != ANONYMOUS_USER_ID) {
5371 $set = $ilDB->query("SELECT sf.anonymous_id FROM svy_finished sf" .
5372 " WHERE sf.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5373 " AND sf.user_fi = " . $ilDB->quote($a_user_id, "integer"));
5374 $a_code = $ilDB->fetchAssoc($set);
5375 return $a_code["anonymous_id"];
5376 }
5377 }

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

◆ finishSurvey()

ilObjSurvey::finishSurvey (   $finished_id)

Finishes the survey creating an entry in the database.

Parameters
integer$user_idThe database id of the user who finishes the survey @access public

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

2653 {
2654 $ilDB = $this->db;
2655
2656 $ilDB->manipulateF(
2657 "UPDATE svy_finished SET state = %s, tstamp = %s" .
2658 " WHERE survey_fi = %s AND finished_id = %s",
2659 array('text','integer','integer','integer'),
2660 array(1, time(), $this->getSurveyId(), $finished_id)
2661 );
2662
2663 // self eval writes skills on finishing
2664 if ($this->getMode() == ilObjSurvey::MODE_SELF_EVAL) {
2665 $user = $this->getUserDataFromActiveId($finished_id);
2666 $sskill = new ilSurveySkill($this);
2667 $sskill->writeAndAddSelfEvalSkills($user['usr_id']);
2668 }
2669
2670 $this->checkTutorNotification();
2671 }
getUserDataFromActiveId($active_id, $force_non_anonymous=false)
Returns the user information from an active_id (survey_finished.finished_id)

References ilObject\$db, $ilDB, $user, checkTutorNotification(), getMode(), getSurveyId(), getUserDataFromActiveId(), and MODE_SELF_EVAL.

+ Here is the call graph for this function:

◆ fixSequenceStructure()

ilObjSurvey::fixSequenceStructure ( )

Remove duplicate sequence entries, see #22018.

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

1213 {
1214 global $DIC;
1215
1216 $ilDB = $DIC->database();
1217 //return;
1218 // we keep all survey question ids with their lowest sequence
1219 $result = $ilDB->queryF(
1220 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1221 array('integer'),
1222 array($this->getSurveyId())
1223 );
1224
1225 // step 1: find duplicates -> $to_delete_ids
1226 $fis = array();
1227 $to_delete_ids = array();
1228 while ($data = $ilDB->fetchAssoc($result)) {
1229 if (in_array($data["question_fi"], $fis)) { // found a duplicate
1230 $to_delete_ids[] = $data["survey_question_id"];
1231 } else {
1232 $fis[] = $data["question_fi"];
1233 }
1234 }
1235
1236 // step 2: we delete the duplicates
1237 if (count($to_delete_ids) > 0) {
1238 $ilDB->manipulate($q = "DELETE FROM svy_svy_qst" .
1239 " WHERE " . $ilDB->in("survey_question_id", $to_delete_ids, false, "integer") .
1240 " AND survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer"));
1241 $this->svy_log->debug("delete: " . $q);
1242
1243 $ilDB->manipulate($q = "DELETE FROM svy_qblk_qst " .
1244 " WHERE " . $ilDB->in("question_fi", $fis, true, "integer") .
1245 " AND survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer"));
1246 $this->svy_log->debug("delete: " . $q);
1247 }
1248
1249 // step 3: we fix the sequence
1250 $set = $ilDB->query("SELECT * FROM svy_svy_qst " .
1251 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") . " ORDER BY sequence");
1252 $seq = 0;
1253 while ($rec = $ilDB->fetchAssoc($set)) {
1254 $ilDB->manipulate(
1255 $q = "UPDATE svy_svy_qst SET " .
1256 " sequence = " . $ilDB->quote($seq++, "integer") .
1257 " WHERE survey_question_id = " . $ilDB->quote($rec["survey_question_id"], "integer")
1258 );
1259 $this->svy_log->debug("update: " . $q);
1260 }
1261 }

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

+ Here is the call graph for this function:

◆ get360Mode()

ilObjSurvey::get360Mode ( )

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

4900 {
4901 if ($this->getMode() == ilObjSurvey::MODE_360) {
4902 return true;
4903 }
4904 return false;
4905 }

References getMode(), and MODE_360.

Referenced by checkReminder(), getUserDataFromActiveId(), and getUserSurveyExecutionStatus().

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

◆ get360Results()

ilObjSurvey::get360Results ( )

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

4943 {
4944 return (int) $this->mode_360_results;
4945 }

References $mode_360_results.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ get360SelfAppraisee()

ilObjSurvey::get360SelfAppraisee ( )

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

4923 {
4924 return (bool) $this->mode_360_self_appr;
4925 }

References $mode_360_self_appr.

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

+ Here is the caller graph for this function:

◆ get360SelfEvaluation()

ilObjSurvey::get360SelfEvaluation ( )

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

4913 {
4914 return (bool) $this->mode_360_self_eval;
4915 }

References $mode_360_self_eval.

Referenced by deleteAppraisee(), getAppraiseesToRate(), isRater(), saveToDb(), sent360Reminders(), and toXML().

+ Here is the caller graph for this function:

◆ get360SelfRaters()

ilObjSurvey::get360SelfRaters ( )

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

4933 {
4934 return (bool) $this->mode_360_self_rate;
4935 }

References $mode_360_self_rate.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getActivationEndDate()

ilObjSurvey::getActivationEndDate ( )

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

6021 {
6022 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : null;
6023 }

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getActivationStartDate()

ilObjSurvey::getActivationStartDate ( )

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

6016 {
6017 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : null;
6018 }

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getActivationVisibility()

ilObjSurvey::getActivationVisibility ( )

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

1604 {
1606 }

References $activation_visibility.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getActiveID()

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

Checks if a user already started a survey.

Parameters
integer$user_idThe database id of the user
Returns
mixed false, if the user has not started the survey, 0 if the user has started the survey but not finished it, 1 if the user has finished the survey @access public

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

2841 {
2842 $ilDB = $this->db;
2843
2844 // see self::isSurveyStarted()
2845
2846 // #15031 - should not matter if code was used by registered or anonymous (each code must be unique)
2847 if ($anonymize_id) {
2848 $result = $ilDB->queryF(
2849 "SELECT finished_id FROM svy_finished" .
2850 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2851 array('integer','text','integer'),
2852 array($this->getSurveyId(), $anonymize_id, $appr_id)
2853 );
2854 } else {
2855 $result = $ilDB->queryF(
2856 "SELECT finished_id FROM svy_finished" .
2857 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
2858 array('integer','integer','integer'),
2859 array($this->getSurveyId(), $user_id, $appr_id)
2860 );
2861 }
2862 if ($result->numRows() == 0) {
2863 return false;
2864 } else {
2865 $row = $ilDB->fetchAssoc($result);
2866 return $row["finished_id"];
2867 }
2868 }

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

Referenced by sendNotificationMail().

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

◆ getAllRelations()

ilObjSurvey::getAllRelations (   $short_as_key = false)

Returns all available relations.

@access public

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

2544 {
2545 $ilDB = $this->db;
2546
2547 // #7987
2548 $custom_order = array("equal", "not_equal", "less", "less_or_equal", "more", "more_or_equal");
2549 $custom_order = array_flip($custom_order);
2550
2551 $result_array = array();
2552 $result = $ilDB->query("SELECT * FROM svy_relation");
2553 while ($row = $ilDB->fetchAssoc($result)) {
2554 if ($short_as_key) {
2555 $result_array[$row["shortname"]] = array("short" => $row["shortname"], "long" => $row["longname"], "id" => $row["relation_id"], "order" => $custom_order[$row["longname"]]);
2556 } else {
2557 $result_array[$row["relation_id"]] = array("short" => $row["shortname"], "long" => $row["longname"], "order" => $custom_order[$row["longname"]]);
2558 }
2559 }
2560
2561 $result_array = ilUtil::sortArray($result_array, "order", "ASC", true, true);
2562 foreach ($result_array as $idx => $item) {
2563 unset($result_array[$idx]["order"]);
2564 }
2565
2566 return $result_array;
2567 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

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

+ Here is the call graph for this function:

◆ getAnonymize()

ilObjSurvey::getAnonymize ( )

get anonymize status

Returns
integer status

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

1060 {
1061 return ($this->anonymize) ? $this->anonymize : 0;
1062 }

Referenced by canExportSurveyCode(), getUserSurveyExecutionStatus(), hasAnonymizedResults(), isAccessibleWithoutCode(), saveToDb(), startSurvey(), and toXML().

+ Here is the caller graph for this function:

◆ getAnonymousId()

ilObjSurvey::getAnonymousId (   $id)

Checks for an anomyous survey id in the database an returns the id.

Parameters
string$idA survey access code
Returns
object Anonymous survey id if found, empty string otherwise @access public

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

972 {
974 $result = $ilDB->queryF(
975 "SELECT anonymous_id FROM svy_finished WHERE anonymous_id = %s",
976 array('text'),
977 array($id)
978 );
979 if ($result->numRows()) {
980 $row = $ilDB->fetchAssoc($result);
981 return $row["anonymous_id"];
982 } else {
983 return "";
984 }
985 }

References ilObject\$db, ilObject\$id, $ilDB, and $result.

◆ getAnonymousIdByCode()

ilObjSurvey::getAnonymousIdByCode (   $a_code)

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

5279 {
5280 $ilDB = $this->db;
5281
5282 $set = $ilDB->query("SELECT anonymous_id FROM svy_anonymous" .
5283 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5284 " AND survey_key = " . $ilDB->quote($a_code, "text"));
5285 $res = $ilDB->fetchAssoc($set);
5286 return $res["anonymous_id"];
5287 }

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

◆ getAppraiseesData()

ilObjSurvey::getAppraiseesData ( )

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

5105 {
5106 $ilDB = $this->db;
5107
5108 $res = array();
5109
5110 $set = $ilDB->query("SELECT * FROM svy_360_appr" .
5111 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer"));
5112 while ($row = $ilDB->fetchAssoc($set)) {
5113 $name = ilObjUser::_lookupName($row["user_id"]);
5114 $name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
5115 $name["name"] = $name["lastname"] . ", " . $name["firstname"];
5116 $res[$row["user_id"]] = $name;
5117
5118 $finished = 0;
5119 $raters = $this->getRatersData($row["user_id"]);
5120 foreach ($raters as $rater) {
5121 if ($rater["finished"]) {
5122 $finished++;
5123 }
5124 }
5125 $res[$row["user_id"]]["finished"] = $finished . "/" . sizeof($raters);
5126 $res[$row["user_id"]]["closed"] = $row["has_closed"];
5127 }
5128
5129 return $res;
5130 }
getRatersData($a_appraisee_id)
static _lookupEmail($a_user_id)
Lookup email.
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:230

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

Referenced by sent360Reminders().

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

◆ getAppraiseesToRate()

ilObjSurvey::getAppraiseesToRate (   $a_user_id,
  $a_anonymous_id = null 
)

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

5249 {
5250 $ilDB = $this->db;
5251
5252 $res = array();
5253
5254 $sql = "SELECT appr_id FROM svy_360_rater" .
5255 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer");
5256
5257 if ($a_user_id) {
5258 $sql .= " AND user_id = " . $ilDB->quote($a_user_id, "integer");
5259 } else {
5260 $sql .= " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer");
5261 }
5262
5263 $set = $ilDB->query($sql);
5264 while ($row = $ilDB->fetchAssoc($set)) {
5265 $res[] = $row["appr_id"];
5266 }
5267
5268 // user may evaluate himself if already appraisee
5269 if ($this->get360SelfEvaluation() &&
5270 $this->isAppraisee($a_user_id) &&
5271 !in_array($a_user_id, $res)) {
5272 $res[] = $a_user_id;
5273 }
5274
5275 return $res;
5276 }

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

+ Here is the call graph for this function:

◆ getAuthor()

ilObjSurvey::getAuthor ( )

Gets the authors name of the ilObjSurvey object.

Returns
string The string containing the name of the test author @access public
See also
$author

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

1314 {
1315 $author = array();
1316 $md = new ilMD($this->getId(), 0, $this->getType());
1317 $md_life = &$md->getLifecycle();
1318 if ($md_life) {
1319 $ids = &$md_life->getContributeIds();
1320 foreach ($ids as $id) {
1321 $md_cont = &$md_life->getContribute($id);
1322 if (strcmp($md_cont->getRole(), "Author") == 0) {
1323 $entids = &$md_cont->getEntityIds();
1324 foreach ($entids as $entid) {
1325 $md_ent = &$md_cont->getEntity($entid);
1326 array_push($author, $md_ent->getEntity());
1327 }
1328 }
1329 }
1330 }
1331 return join(",", $author);
1332 }
getType()
get object type @access public

References $author, ilObject\$id, ilObject\getId(), and ilObject\getType().

Referenced by saveToDb(), and toXML().

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

◆ getAvailableQuestionpools()

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

Returns the available question pools for the active user.

Returns
array The available question pools @access public

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

2353 {
2354 return ilObjSurveyQuestionPool::_getAvailableQuestionpools($use_obj_id, $could_be_offline, $showPath, $permission);
2355 }
static _getAvailableQuestionpools($use_object_id=false, $could_be_offline=false, $showPath=false, $permission="read")
Returns the available question pools for the active user.

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

Referenced by getQuestionsTable().

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

◆ getCalculateSumScore()

ilObjSurvey::getCalculateSumScore ( )

Get calculate sum score.

Returns
bool calculate sum score

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

1077 : bool
1078 {
1080 }

References $calculate_sum_score.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getConstraints()

ilObjSurvey::getConstraints (   $question_id)

Returns the constraints to a given question or questionblock.

@access public

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

2387 {
2388 $ilDB = $this->db;
2389
2390 $result_array = array();
2391 $result = $ilDB->queryF(
2392 "SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation " .
2393 "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2394 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s " .
2395 "AND svy_qst_constraint.survey_fi = %s",
2396 array('integer','integer'),
2397 array($question_id, $this->getSurveyId())
2398 );
2399 while ($row = $ilDB->fetchAssoc($result)) {
2400 $question_type = SurveyQuestion::_getQuestionType($row["question_fi"]);
2401 SurveyQuestion::_includeClass($question_type);
2402 $question = new $question_type();
2403 $question->loadFromDb($row["question_fi"]);
2404 $valueoutput = $question->getPreconditionValueOutput($row["value"]);
2405 array_push($result_array, array("id" => $row["constraint_id"], "question" => $row["question_fi"], "short" => $row["shortname"], "long" => $row["longname"], "value" => $row["value"], "conjunction" => $row["conjunction"], "valueoutput" => $valueoutput));
2406 }
2407 return $result_array;
2408 }

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

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

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

◆ getEndDate()

ilObjSurvey::getEndDate ( )

Gets the end date of the survey.

Returns
string Survey end date (YYYY-MM-DD) @access public
See also
$end_date

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

1529 {
1530 return (strlen($this->end_date)) ? $this->end_date : null;
1531 }

Referenced by canStartSurvey(), checkReminder(), saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getEvaluationAccess()

ilObjSurvey::getEvaluationAccess ( )

Gets the learners evaluation access.

Returns
integer The evaluation access @access public
See also
$evaluation_access

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

1582 {
1583 return ($this->evaluation_access) ? $this->evaluation_access : self::EVALUATION_ACCESS_OFF;
1584 }

References EVALUATION_ACCESS_OFF.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getEvaluationByUser()

& ilObjSurvey::getEvaluationByUser (   $questions,
  $active_id 
)

Calculates the evaluation data for a given user or anonymous id.

Parameters
array$questionsAn array containing all relevant information on the survey's questions
integer$user_idThe database id of the user
string$anonymous_idThe unique anonymous id for an anonymous survey
Returns
array An array containing the evaluation parameters for the user @access public

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

3098 {
3099 $ilDB = $this->db;
3100
3101 // collect all answers
3102 $answers = array();
3103 $result = $ilDB->queryF(
3104 "SELECT * FROM svy_answer WHERE active_fi = %s",
3105 array('integer'),
3106 array($active_id)
3107 );
3108 while ($row = $ilDB->fetchAssoc($result)) {
3109 if (!is_array($answers[$row["question_fi"]])) {
3110 $answers[$row["question_fi"]] = array();
3111 }
3112 array_push($answers[$row["question_fi"]], $row);
3113 }
3114 $userdata = $this->getUserDataFromActiveId($active_id);
3115 $resultset = array(
3116 "name" => $userdata["fullname"],
3117 "firstname" => $userdata["firstname"],
3118 "lastname" => $userdata["lastname"],
3119 "login" => $userdata["login"],
3120 "gender" => $userdata["gender"],
3121 "answers" => array()
3122 );
3123 foreach ($questions as $key => $question) {
3124 if (array_key_exists($key, $answers)) {
3125 $resultset["answers"][$key] = $answers[$key];
3126 } else {
3127 $resultset["answers"][$key] = array();
3128 }
3129 sort($resultset["answers"][$key]);
3130 }
3131 return $resultset;
3132 }

References ilObject\$db, $ilDB, $questions, $result, and getUserDataFromActiveId().

+ 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
array The questions of the survey @access public

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

1649 {
1650 $ilDB = $this->db;
1651 $existing_questions = array();
1652 $result = $ilDB->queryF(
1653 "SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1654 "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1655 array('integer'),
1656 array($this->getSurveyId())
1657 );
1658 while ($data = $ilDB->fetchAssoc($result)) {
1659 if ($data["original_id"]) {
1660 array_push($existing_questions, $data["original_id"]);
1661 }
1662 }
1663 return $existing_questions;
1664 }

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

Referenced by getQuestionsTable().

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

◆ getExportDirectory()

ilObjSurvey::getExportDirectory ( )

get export directory of survey

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

3884 {
3885 $export_dir = ilUtil::getDataDir() . "/svy_data" . "/svy_" . $this->getId() . "/export";
3886
3887 return $export_dir;
3888 }

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

+ Here is the call graph for this function:

◆ getExternalCodeRecipients()

ilObjSurvey::getExternalCodeRecipients (   $a_check_finished = false)

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

4293 {
4294 $ilDB = $this->db;
4295 $result = $ilDB->queryF(
4296 "SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
4297 array('integer'),
4298 array($this->getSurveyId())
4299 );
4300 $res = array();
4301 while ($row = $ilDB->fetchAssoc($result)) {
4302 if (!$row['externaldata']) {
4303 continue;
4304 }
4305
4306 $externaldata = unserialize($row['externaldata']);
4307 if (!$externaldata['email']) {
4308 continue;
4309 }
4310
4311 $externaldata['code'] = $row['code'];
4312 $externaldata['sent'] = $row['sent'];
4313
4314 if ($a_check_finished) {
4315 #23294
4316 //$externaldata['finished'] = $this->isSurveyCodeUsed($row['code']);
4317 $externaldata['finished'] = $this->isSurveyFinishedByCode($row['code']);
4318 }
4319
4320 array_push($res, $externaldata);
4321 }
4322 return $res;
4323 }
isSurveyFinishedByCode($a_code)
Get if survey is finished for an specific anonymous user code.

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

Referenced by sendCodes().

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

◆ getFinishedIdForAppraiseeIdAndRaterId()

ilObjSurvey::getFinishedIdForAppraiseeIdAndRaterId (   $a_appr_id,
  $a_rat_id 
)

Get finished id for an appraisee and a rater.

Parameters
int$a_appraisee_idappraisee id
int$a_rater_idrater id
Returns
int finished id

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

5422 {
5423 $ilDB = $this->db;
5424
5425 $set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished" .
5426 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5427 " AND appr_id = " . $ilDB->quote($a_appr_id, "integer") .
5428 " AND user_fi = " . $ilDB->quote($a_rat_id, "integer"));
5429 $row = $ilDB->fetchAssoc($set);
5430 return $row["finished_id"];
5431 }

References ilObject\$db, and $ilDB.

Referenced by deleteRater().

+ Here is the caller graph for this function:

◆ getFinishedIdsForAppraiseeId()

ilObjSurvey::getFinishedIdsForAppraiseeId (   $a_appr_id,
  $a_exclude_appraisee = false 
)

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

5396 {
5397 $ilDB = $this->db;
5398
5399 $res = array();
5400
5401 $set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished" .
5402 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5403 " AND appr_id = " . $ilDB->quote($a_appr_id, "integer"));
5404 while ($row = $ilDB->fetchAssoc($set)) {
5405 if ($a_exclude_appraisee && $row["user_fi"] == $a_appr_id) {
5406 continue;
5407 }
5408 $res[] = $row["finished_id"];
5409 }
5410
5411 return $res;
5412 }

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

◆ getFinishedIdsForSelfEval()

ilObjSurvey::getFinishedIdsForSelfEval (   $a_user_id)

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

5433 : array
5434 {
5435 $ilDB = $this->db;
5436
5437 $finished_ids = [];
5438 $set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished" .
5439 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5440 " AND user_fi = " . $ilDB->quote($a_user_id, "integer"));
5441 if ($row = $ilDB->fetchAssoc($set)) {
5442 $finished_ids[] = (int) $row["finished_id"];
5443 }
5444 return $finished_ids;
5445 }

References ilObject\$db, and $ilDB.

◆ getImportDirectory()

ilObjSurvey::getImportDirectory ( )

get import directory of survey

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

3925 {
3926 $import_dir = ilUtil::getDataDir() . "/svy_data" .
3927 "/svy_" . $this->getId() . "/import";
3928 if (!is_dir($import_dir)) {
3929 ilUtil::makeDirParents($import_dir);
3930 }
3931 if (@is_dir($import_dir)) {
3932 return $import_dir;
3933 } else {
3934 return false;
3935 }
3936 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

Referenced by delete(), and importObject().

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

◆ getIntroduction()

ilObjSurvey::getIntroduction ( )

Gets the introduction text.

Returns
string The introduction of the survey object @access public
See also
$introduction

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

1626 {
1627 return (strlen($this->introduction)) ? $this->introduction : null;
1628 }

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

+ Here is the caller graph for this function:

◆ getLastAccess()

ilObjSurvey::getLastAccess (   $finished_id)

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

4427 {
4428 $ilDB = $this->db;
4429
4430 $result = $ilDB->queryF(
4431 "SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
4432 array('integer'),
4433 array($finished_id)
4434 );
4435 if ($result->numRows()) {
4436 $row = $ilDB->fetchAssoc($result);
4437 return $row["tstamp"];
4438 } else {
4439 $result = $ilDB->queryF(
4440 "SELECT tstamp FROM svy_finished WHERE finished_id = %s",
4441 array('integer'),
4442 array($finished_id)
4443 );
4444 if ($result->numRows()) {
4445 $row = $ilDB->fetchAssoc($result);
4446 return $row["tstamp"];
4447 }
4448 }
4449 return "";
4450 }

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

◆ getLastActivePage()

ilObjSurvey::getLastActivePage (   $active_id)

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

Parameters
integer$active_idThe active id of the user
Returns
mixed Empty string if the user has not worked through a page, question id of the last page otherwise @access public

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

2878 {
2879 $ilDB = $this->db;
2880 $result = $ilDB->queryF(
2881 "SELECT lastpage FROM svy_finished WHERE finished_id = %s",
2882 array('integer'),
2883 array($active_id)
2884 );
2885 if ($result->numRows() == 0) {
2886 return "";
2887 } else {
2888 $row = $ilDB->fetchAssoc($result);
2889 return ($row["lastpage"]) ? $row["lastpage"] : '';
2890 }
2891 }

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

◆ getMailAddresses()

ilObjSurvey::getMailAddresses ( )

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

4680 {
4681 return $this->mailaddresses;
4682 }

References $mailaddresses.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getMailNotification()

ilObjSurvey::getMailNotification ( )

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

4670 {
4672 }

References $mailnotification.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getMailParticipantData()

ilObjSurvey::getMailParticipantData ( )

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

4690 {
4692 }

References $mailparticipantdata.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getMaxSumScore()

ilObjSurvey::getMaxSumScore ( )

Get max sum score.

Returns
int

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

6276 : int
6277 {
6278 $sum_score = 0;
6280 $sum_score += call_user_func([$c, "getMaxSumScore"], $this->getSurveyId());
6281 }
6282 return $sum_score;
6283 }
static _getQuestionClasses()
Get question classes.
$c
Definition: cli.php:37

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

+ Here is the call graph for this function:

◆ getMode()

ilObjSurvey::getMode ( )

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

6126 {
6127 return $this->mode;
6128 }

References $mode.

Referenced by finishSurvey(), get360Mode(), saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getNextPage()

ilObjSurvey::getNextPage (   $active_page_question_id,
  $direction 
)

Returns the next "page" of a running test.

Parameters
integer$active_page_question_idThe database id of one of the questions on that page
integer$directionThe direction of the next page (-1 = previous page, 1 = next page)
Returns
mixed An array containing the question id's of the questions on the next page if there is a next page, 0 if the next page is before the start page, 1 if the next page is after the last page @access public

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

2319 {
2320 $foundpage = -1;
2321 $pages = &$this->getSurveyPages();
2322 if (strcmp($active_page_question_id, "") == 0) {
2323 return $pages[0];
2324 }
2325 foreach ($pages as $key => $question_array) {
2326 foreach ($question_array as $question) {
2327 if ($active_page_question_id == $question["question_id"]) {
2328 $foundpage = $key;
2329 }
2330 }
2331 }
2332 if ($foundpage == -1) {
2333 // error: page not found
2334 } else {
2335 $foundpage += $direction;
2336 if ($foundpage < 0) {
2337 return 0;
2338 }
2339 if ($foundpage >= count($pages)) {
2340 return 1;
2341 }
2342 return $pages[$foundpage];
2343 }
2344 }
& getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)

References getSurveyPages().

+ Here is the call graph for this function:

◆ getNotificationTargetUserIds()

ilObjSurvey::getNotificationTargetUserIds (   $a_use_invited)

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

5804 {
5806
5807 if ((bool) $a_use_invited) {
5808 $user_ids = $this->invitation_manager->getAllForSurvey($this->getSurveyId());
5809 } else {
5810 $parent_grp_ref_id = $tree->checkForParentType($this->getRefId(), "grp");
5811 if ($parent_grp_ref_id) {
5812 $part = new ilGroupParticipants(ilObject::_lookupObjId($parent_grp_ref_id));
5813 $user_ids = $part->getMembers();
5814 } else {
5815 $parent_crs_ref_id = $tree->checkForParentType($this->getRefId(), "crs");
5816 if ($parent_crs_ref_id) {
5817 $part = new ilCourseParticipants(ilObject::_lookupObjId($parent_crs_ref_id));
5818 $user_ids = $part->getMembers();
5819 }
5820 }
5821 }
5822 return $user_ids;
5823 }
static _lookupObjId($a_id)

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

Referenced by checkReminder(), and checkTutorNotification().

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

◆ getOutro()

ilObjSurvey::getOutro ( )

Gets the outro text.

Returns
string The outro of the survey object @access public
See also
$outro

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

1638 {
1639 return (strlen($this->outro)) ? $this->outro : null;
1640 }

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

+ Here is the caller graph for this function:

◆ getParticipantTextResults()

ilObjSurvey::getParticipantTextResults (   $active_id)
protected

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

2772 {
2773 $textresult = "";
2774 $userResults = &$this->getUserSpecificResults(array($active_id));
2775 $questions = &$this->getSurveyQuestions(true);
2776 $questioncounter = 1;
2777 foreach ($questions as $question_id => $question_data) {
2778 $textresult .= $questioncounter++ . ". " . $question_data["title"] . "\n";
2779 $found = $userResults[$question_id][$active_id];
2780 $text = "";
2781 if (is_array($found)) {
2782 $text = implode("\n", $found);
2783 } else {
2784 $text = $found;
2785 }
2786 if (strlen($text) == 0) {
2788 }
2789 $text = str_replace("<br />", "\n", $text);
2790 $textresult .= $text . "\n\n";
2791 }
2792 return $textresult;
2793 }
& getSurveyQuestions($with_answers=false)
Returns the survey questions and questionblocks in an array.
getUserSpecificResults($finished_ids)
Calculates the evaluation data for the user specific results.
static getSurveySkippedValue()

References $questions, getSurveyQuestions(), getSurveySkippedValue(), and getUserSpecificResults().

Referenced by sendNotificationMail().

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

◆ getPoolUsage()

ilObjSurvey::getPoolUsage ( )

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

4762 {
4763 return $this->pool_usage;
4764 }

References $pool_usage.

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

+ Here is the caller graph for this function:

◆ getPrecondition()

ilObjSurvey::getPrecondition (   $id)

Returns a precondition with a given id.

@access public

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

2363 {
2364 $ilDB = $this->db;
2365
2366 $result_array = array();
2367 $result = $ilDB->queryF(
2368 "SELECT svy_constraint.*, svy_relation.*, svy_qst_constraint.question_fi ref_question_fi FROM svy_qst_constraint, svy_constraint, " .
2369 "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2370 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2371 array('integer'),
2372 array($id)
2373 );
2374 $pc = array();
2375 if ($result->numRows()) {
2376 $pc = $ilDB->fetchAssoc($result);
2377 }
2378 return $pc;
2379 }

References ilObject\$db, ilObject\$id, $ilDB, and $result.

◆ getQuestionblockQuestionIds()

& ilObjSurvey::getQuestionblockQuestionIds (   $questionblock_id)

Returns the question id's of all questions of a question block.

Returns
array The id's of the the question block questions @access public

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

1942 {
1943 $ilDB = $this->db;
1944
1945 // we need a correct order here, see #22011
1946 $result = $ilDB->queryF(
1947 "SELECT a.question_fi FROM svy_qblk_qst a JOIN svy_svy_qst b ON (a.question_fi = b.question_fi) " .
1948 " WHERE a.questionblock_fi = %s ORDER BY b.sequence",
1949 array("integer"),
1950 array($questionblock_id)
1951 );
1952 $ids = array();
1953 if ($result->numRows()) {
1954 while ($data = $ilDB->fetchAssoc($result)) {
1955 if (!in_array($data['question_fi'], $ids)) { // no duplicates, see #22018
1956 array_push($ids, $data['question_fi']);
1957 }
1958 }
1959 }
1960
1961 return $ids;
1962 }

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

◆ getQuestionblockQuestions()

& ilObjSurvey::getQuestionblockQuestions (   $questionblock_id)

Returns the question titles of all questions of a question block.

Returns
array The titles of the the question block questions @access public

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

1905 {
1906 $ilDB = $this->db;
1907 $titles = array();
1908 $result = $ilDB->queryF(
1909 "SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM " .
1910 "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
1911 "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
1912 array('integer'),
1913 array($questionblock_id)
1914 );
1915 $survey_id = "";
1916 while ($row = $ilDB->fetchAssoc($result)) {
1917 $titles[$row["question_fi"]] = $row["title"];
1918 $survey_id = $row["survey_fi"];
1919 }
1920 $result = $ilDB->queryF(
1921 "SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1922 array('integer'),
1923 array($survey_id)
1924 );
1925 $resultarray = array();
1926 $counter = 1;
1927 while ($row = $ilDB->fetchAssoc($result)) {
1928 if (array_key_exists($row["question_fi"], $titles)) {
1929 $resultarray[$counter++] = $titles[$row["question_fi"]];
1930 }
1931 }
1932 return $resultarray;
1933 }

References ilObject\$db, $ilDB, $result, and $survey_id.

Referenced by getQuestionblocksTable().

+ Here is the caller graph for this function:

◆ getQuestionblocksTable()

ilObjSurvey::getQuestionblocksTable (   $arrFilter)

Calculates the data for the output of the questionblock browser.

@access public

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

3208 {
3210 $ilDB = $this->db;
3211
3212 $where = "";
3213 if (is_array($arrFilter)) {
3214 if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'])) {
3215 $where .= " AND " . $ilDB->like('svy_qblk.title', 'text', "%%" . $arrFilter['title'] . "%%");
3216 }
3217 }
3218
3219 $query_result = $ilDB->query("SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE " .
3220 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi " .
3221 "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, " .
3222 "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
3223 $rows = array();
3224 if ($query_result->numRows()) {
3225 $survey_ref_ids = ilUtil::_getObjectsByOperations("svy", "write");
3226 $surveytitles = array();
3227 foreach ($survey_ref_ids as $survey_ref_id) {
3228 $survey_id = ilObject::_lookupObjId($survey_ref_id);
3230 }
3231 while ($row = $ilDB->fetchAssoc($query_result)) {
3232 $questions_array = &$this->getQuestionblockQuestions($row["questionblock_id"]);
3233 $counter = 1;
3234 foreach ($questions_array as $key => $value) {
3235 $questions_array[$key] = "$counter. $value";
3236 $counter++;
3237 }
3238 if (strlen($surveytitles[$row["obj_fi"]])) { // only questionpools which are not in trash
3239 $rows[$row["questionblock_id"]] = array(
3240 "questionblock_id" => $row["questionblock_id"],
3241 "title" => $row["title"],
3242 "svy" => $surveytitles[$row["obj_fi"]],
3243 "contains" => join(", ", $questions_array),
3244 "owner" => $row["owner_fi"]
3245 );
3246 }
3247 }
3248 }
3249 return $rows;
3250 }
& getQuestionblockQuestions($questionblock_id)
Returns the question titles of all questions of a question block.
static _lookupTitle($a_id)
lookup object title
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
$rows
Definition: xhr_table.php:10

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

+ Here is the call graph for this function:

◆ getQuestionGUI()

ilObjSurvey::getQuestionGUI (   $questiontype,
  $question_id 
)

Returns a question gui object to a given questiontype and question id.

Returns
object Resulting question gui object @access public

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

994 {
995 return SurveyQuestionGUI::_getQuestionGUI($questiontype, $question_id);
996 }
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.

References SurveyQuestionGUI\_getQuestionGUI().

Referenced by duplicateQuestionForSurvey().

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

◆ getQuestionpoolTitles()

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

Get the titles of all available survey question pools.

Returns
array An array of survey question pool titles @access public

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

1673 {
1674 return ilObjSurveyQuestionPool::_getAvailableQuestionpools($use_object_id = true, $could_be_offline, $showPath);
1675 }

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

+ Here is the call graph for this function:

◆ getQuestionsTable()

ilObjSurvey::getQuestionsTable (   $arrFilter)

Calculates the data for the output of the question browser.

@access public

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

3140 {
3142 $ilDB = $this->db;
3143 $where = "";
3144 if (is_array($arrFilter)) {
3145 if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'])) {
3146 $where .= " AND " . $ilDB->like('svy_question.title', 'text', "%%" . $arrFilter['title'] . "%%");
3147 }
3148 if (array_key_exists('description', $arrFilter) && strlen($arrFilter['description'])) {
3149 $where .= " AND " . $ilDB->like('svy_question.description', 'text', "%%" . $arrFilter['description'] . "%%");
3150 }
3151 if (array_key_exists('author', $arrFilter) && strlen($arrFilter['author'])) {
3152 $where .= " AND " . $ilDB->like('svy_question.author', 'text', "%%" . $arrFilter['author'] . "%%");
3153 }
3154 if (array_key_exists('type', $arrFilter) && strlen($arrFilter['type'])) {
3155 $where .= " AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter['type'], 'text');
3156 }
3157 if (array_key_exists('spl', $arrFilter) && strlen($arrFilter['spl'])) {
3158 $where .= " AND svy_question.obj_fi = " . $ilDB->quote($arrFilter['spl'], 'integer');
3159 }
3160 }
3161
3162 $spls = &$this->getAvailableQuestionpools($use_obj_id = true, $could_be_offline = false, $showPath = false);
3163 $forbidden = "";
3164 $forbidden = " AND " . $ilDB->in('svy_question.obj_fi', array_keys($spls), false, 'integer');
3165 $forbidden .= " AND svy_question.complete = " . $ilDB->quote("1", 'text');
3166 $existing = "";
3167 $existing_questions = &$this->getExistingQuestions();
3168 if (count($existing_questions)) {
3169 $existing = " AND " . $ilDB->in('svy_question.question_id', $existing_questions, true, 'integer');
3170 }
3171
3173
3174 $query_result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id" .
3175 " FROM svy_question, svy_qtype, object_reference" .
3176 " WHERE svy_question.original_id IS NULL" . $forbidden . $existing .
3177 " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0" .
3178 " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
3179
3180 $rows = array();
3181 if ($query_result->numRows()) {
3182 while ($row = $ilDB->fetchAssoc($query_result)) {
3183 if (array_key_exists('spl_txt', $arrFilter) && strlen($arrFilter['spl_txt'])) {
3184 if (!stristr($spls[$row["obj_fi"]], $arrFilter['spl_txt'])) {
3185 continue;
3186 }
3187 }
3188
3189 $row['ttype'] = $trans[$row['type_tag']];
3190 if ($row["plugin"]) {
3191 if ($this->isPluginActive($row["type_tag"])) {
3192 array_push($rows, $row);
3193 }
3194 } else {
3195 array_push($rows, $row);
3196 }
3197 }
3198 }
3199 return $rows;
3200 }
& getExistingQuestions()
Gets the question id's of the questions which are already in the survey.
isPluginActive($a_pname)
Checks whether or not a question plugin with a given name is active.
& getAvailableQuestionpools($use_obj_id=false, $could_be_offline=false, $showPath=false, $permission="read")
Returns the available question pools for the active user.

References ilObject\$db, $ilDB, $ilUser, $rows, $user, ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), getAvailableQuestionpools(), getExistingQuestions(), and isPluginActive().

+ Here is the call graph for this function:

◆ getQuestionType()

ilObjSurvey::getQuestionType (   $question_id)

Returns the question type of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question type string @access private

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

1006 {
1007 $ilDB = $this->db;
1008 if ($question_id < 1) {
1009 return -1;
1010 }
1011 $result = $ilDB->queryF(
1012 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
1013 "svy_question.questiontype_fi = svy_qtype.questiontype_id",
1014 array('integer'),
1015 array($question_id)
1016 );
1017 if ($result->numRows() == 1) {
1018 $data = $ilDB->fetchAssoc($result);
1019 return $data["type_tag"];
1020 } else {
1021 return "";
1022 }
1023 }

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

Referenced by duplicateQuestionForSurvey().

+ Here is the caller graph for this function:

◆ getRatersData()

ilObjSurvey::getRatersData (   $a_appraisee_id)

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

5198 {
5199 $ilDB = $this->db;
5200
5201 $res = $anonymous_ids = array();
5202
5203 $set = $ilDB->query("SELECT * FROM svy_360_rater" .
5204 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5205 " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer"));
5206 while ($row = $ilDB->fetchAssoc($set)) {
5207 if ($row["anonymous_id"]) {
5208 $res["a" . $row["anonymous_id"]] = array(
5209 "lastname" => "unknown code " . $row["anonymous_id"],
5210 "sent" => $row["mail_sent"],
5211 "finished" => null
5212 );
5213 $anonymous_ids[] = $row["anonymous_id"];
5214 } else {
5215 $name = ilObjUser::_lookupName($row["user_id"]);
5216 $name["name"] = $name["lastname"] . ", " . $name["firstname"];
5217 $name["user_id"] = "u" . $name["user_id"];
5218 $name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
5219 $name["sent"] = $row["mail_sent"];
5220 $name["finished"] = (bool) $this->is360SurveyStarted($a_appraisee_id, $row["user_id"]);
5221 $res["u" . $row["user_id"]] = $name;
5222 }
5223 }
5224
5225 if (sizeof($anonymous_ids)) {
5226 $data = $this->getSurveyCodesTableData($anonymous_ids);
5227 foreach ($data as $item) {
5228 if (isset($res["a" . $item["id"]])) {
5229 $res["a" . $item["id"]] = array(
5230 "user_id" => "a" . $item["id"],
5231 "lastname" => $item["last_name"],
5232 "firstname" => $item["first_name"],
5233 "name" => $item["last_name"] . ", " . $item["first_name"],
5234 "login" => "",
5235 "email" => $item["email"],
5236 "code" => $item["code"],
5237 "href" => $item["href"],
5238 "sent" => $res["a" . $item["id"]]["sent"],
5239 "finished" => (bool) $this->is360SurveyStarted($a_appraisee_id, null, $item["code"])
5240 );
5241 }
5242 }
5243 }
5244
5245 return $res;
5246 }
is360SurveyStarted($appr_id, $user_id, $anonymous_code=null)
getSurveyCodesTableData(array $ids=null, $lang=null)
Fetches the data for the survey codes table.

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

Referenced by getAppraiseesData(), and sent360Reminders().

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

◆ getReminderEnd()

ilObjSurvey::getReminderEnd ( )

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

5571 {
5572 return $this->reminder_end;
5573 }

References $reminder_end.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

◆ getReminderFrequency()

ilObjSurvey::getReminderFrequency ( )

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

5581 {
5583 }

References $reminder_frequency.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

◆ getReminderLastSent()

ilObjSurvey::getReminderLastSent ( )

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

5601 {
5603 }

References $reminder_last_sent.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

◆ getReminderStart()

ilObjSurvey::getReminderStart ( )

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

5561 {
5562 return $this->reminder_start;
5563 }

References $reminder_start.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

◆ getReminderStatus()

ilObjSurvey::getReminderStatus ( )

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

5551 {
5552 return (bool) $this->reminder_status;
5553 }

References $reminder_status.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

◆ getReminderTarget()

ilObjSurvey::getReminderTarget ( )

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

5591 {
5593 }

References $reminder_target.

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

+ Here is the caller graph for this function:

◆ getReminderTemplate()

ilObjSurvey::getReminderTemplate (   $selectDefault = false)
Parameters
bool$selectDefault
Returns
mixed

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

5615 {
5616 if ($selectDefault) {
5617 $defaultTemplateId = 0;
5618 $this->getReminderMailTemplates($defaultTemplateId);
5619
5620 if ($defaultTemplateId > 0) {
5621 return $defaultTemplateId;
5622 }
5623 }
5624
5625 return $this->reminder_tmpl;
5626 }

References $reminder_tmpl.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getSelfEvaluationResults()

ilObjSurvey::getSelfEvaluationResults ( )

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

6136 {
6138 }

References $mode_self_eval_results.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getShowQuestionTitles()

ilObjSurvey::getShowQuestionTitles ( )

Gets the status of the display_question_titles attribute.

Returns
integer The status of the display_question_titles attribute
See also
$display_question_titles

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

1341 {
1342 return ($this->display_question_titles) ? 1 : 0;
1343 }

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getSkillService()

ilObjSurvey::getSkillService ( )

Get skill service.

Returns
bool activate skill service

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

5465 {
5467 }

References $mode_skill_service.

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

+ Here is the caller graph for this function:

◆ getStartDate()

ilObjSurvey::getStartDate ( )

Gets the start date of the survey.

Returns
string Survey start date (YYYY-MM-DD) @access public
See also
$start_date

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

1409 {
1410 return (strlen($this->start_date)) ? $this->start_date : null;
1411 }

Referenced by canStartSurvey(), checkReminder(), saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ getSurveyCodesForExport()

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

Returns a list of survey codes for file export.

Parameters
array$a_arrayAn array of all survey codes that should be exported
Returns
string A comma separated list of survey codes an URLs for file export @access public

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

4016 {
4017 $ilDB = $this->db;
4019 $lng = $this->lng;
4020
4021 $sql = "SELECT svy_anonymous.*, svy_finished.state" .
4022 " FROM svy_anonymous" .
4023 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
4024 " WHERE svy_anonymous.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
4025 " AND svy_anonymous.user_key IS NULL";
4026
4027 if ($a_codes) {
4028 $sql .= " AND " . $ilDB->in("svy_anonymous.survey_key", $a_codes, "", "text");
4029 } elseif ($a_ids) {
4030 $sql .= " AND " . $ilDB->in("svy_anonymous.anonymous_id", $a_ids, "", "text");
4031 }
4032
4033 $export = array();
4034
4035 // #14905
4036 $titles = array();
4037 $titles[] = '"' . $lng->txt("survey_code") . '"';
4038 $titles[] = '"' . $lng->txt("email") . '"';
4039 $titles[] = '"' . $lng->txt("lastname") . '"';
4040 $titles[] = '"' . $lng->txt("firstname") . '"';
4041 $titles[] = '"' . $lng->txt("create_date") . '"';
4042 $titles[] = '"' . $lng->txt("used") . '"';
4043 $titles[] = '"' . $lng->txt("mail_sent_short") . '"';
4044 $titles[] = '"' . $lng->txt("survey_code_url") . '"';
4045 $export[] = implode(";", $titles);
4046
4047 $result = $ilDB->query($sql);
4048 $default_lang = $ilUser->getPref("survey_code_language");
4049 while ($row = $ilDB->fetchAssoc($result)) {
4050 $item = array();
4051 $item[] = $row["survey_key"];
4052
4053 if ($row["externaldata"]) {
4054 $ext = unserialize($row["externaldata"]);
4055 $item[] = $ext["email"];
4056 $item[] = $ext["lastname"];
4057 $item[] = $ext["firstname"];
4058 } else {
4059 $item[] = "";
4060 $item[] = "";
4061 $item[] = "";
4062 }
4063
4064 // No relative (today, tomorrow...) dates in export.
4065 $date = new ilDateTime($row['tstamp'], IL_CAL_UNIX);
4066 $item[] = $date->get(IL_CAL_DATETIME);
4067
4068 $item[] = ($this->isSurveyCodeUsed($row["survey_key"])) ? 1 : 0;
4069 $item[] = ($row["sent"]) ? 1 : 0;
4070
4071 $params = array("accesscode" => $row["survey_key"]);
4072 if ($default_lang) {
4073 $params["lang"] = $default_lang;
4074 }
4075 $item[] = ilLink::_getLink($this->getRefId(), "svy", $params);
4076
4077 $export[] = '"' . implode('";"', $item) . '"';
4078 }
4079 return implode("\n", $export);
4080 }
const IL_CAL_UNIX
const IL_CAL_DATETIME

References ilObject\$db, $ilDB, $ilUser, ilObject\$lng, $result, $user, ilLink\_getLink(), ilObject\getRefId(), getSurveyId(), IL_CAL_DATETIME, IL_CAL_UNIX, and isSurveyCodeUsed().

+ Here is the call graph for this function:

◆ getSurveyCodesTableData()

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

Fetches the data for the survey codes table.

Parameters
string$langLanguage for the survey code URL
Returns
array The requested data @access public

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

4090 {
4091 $ilDB = $this->db;
4092
4093 $codes = array();
4094
4095 $sql = "SELECT svy_anonymous.*, svy_finished.state" .
4096 " FROM svy_anonymous" .
4097 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
4098 " WHERE svy_anonymous.survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") /*.
4099 " AND svy_anonymous.user_key IS NULL" */; // #15860
4100
4101 if ($ids) {
4102 $sql .= " AND " . $ilDB->in("svy_anonymous.anonymous_id", $ids, "", "integer");
4103 }
4104
4105 $sql .= " ORDER BY tstamp, survey_key ASC";
4106 $result = $ilDB->query($sql);
4107 if ($result->numRows() > 0) {
4108 while ($row = $ilDB->fetchAssoc($result)) {
4109 $href = "";
4110 $used = false;
4111 if ($this->isSurveyCodeUsed($row["survey_key"])) {
4112 $used = true;
4113 } else {
4114 $params = array("accesscode" => $row["survey_key"]);
4115 if ($lang) {
4116 $params["lang"] = $lang;
4117 }
4118 $href = ilLink::_getLink($this->getRefId(), "svy", $params);
4119 }
4120
4121
4122 $item = array(
4123 'id' => $row["anonymous_id"],
4124 'code' => $row["survey_key"],
4125 'date' => $row["tstamp"],
4126 'used' => $used,
4127 'sent' => $row['sent'],
4128 'href' => $href,
4129 'email' => '',
4130 'last_name' => '',
4131 'first_name' => ''
4132 );
4133
4134 if ($row["externaldata"]) {
4135 $ext = unserialize($row["externaldata"]);
4136 $item['email'] = $ext['email'];
4137 $item['last_name'] = $ext['lastname'];
4138 $item['first_name'] = $ext['firstname'];
4139 }
4140
4141 array_push($codes, $item);
4142 }
4143 }
4144 return $codes;
4145 }
$lang
Definition: xapiexit.php:8

References ilObject\$db, $ilDB, $lang, $result, ilLink\_getLink(), ilObject\getRefId(), getSurveyId(), and isSurveyCodeUsed().

Referenced by getRatersData().

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

◆ getSurveyFinishedIds()

& ilObjSurvey::getSurveyFinishedIds ( )

Get the finished id's of all survey participants.

Returns
array An array containing finished_id's of all survey participants @access public

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

2979 {
2980 $ilDB = $this->db;
2981 $ilLog = $this->svy_log;
2982
2983 $users = array();
2984 $result = $ilDB->queryF(
2985 "SELECT * FROM svy_finished WHERE survey_fi = %s",
2986 array('integer'),
2987 array($this->getSurveyId())
2988 );
2989 if ($result->numRows()) {
2990 while ($row = $ilDB->fetchAssoc($result)) {
2991 array_push($users, $row["finished_id"]);
2992 }
2993 }
2994 return $users;
2995 }

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

+ Here is the call graph for this function:

◆ getSurveyId()

◆ getSurveyPages()

& ilObjSurvey::getSurveyPages ( )

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

@access public

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

2232 {
2233 $ilDB = $this->db;
2234 // get questionblocks
2235 $all_questions = array();
2236 $result = $ilDB->queryF(
2237 "SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
2238 "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2239 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2240 "ORDER BY svy_svy_qst.sequence",
2241 array('integer'),
2242 array($this->getSurveyId())
2243 );
2244 while ($row = $ilDB->fetchAssoc($result)) {
2245 $all_questions[$row["question_id"]] = $row;
2246 }
2247 // get all questionblocks
2248 $questionblocks = array();
2249 if (count($all_questions)) {
2250 $result = $ilDB->queryF(
2251 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst " .
2252 "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2253 "AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
2254 array('integer'),
2255 array($this->getSurveyId())
2256 );
2257 while ($row = $ilDB->fetchAssoc($result)) {
2258 $questionblocks[$row['question_fi']] = $row;
2259 }
2260 }
2261
2262 $all_pages = array();
2263 $pageindex = -1;
2264 $currentblock = "";
2265 foreach ($all_questions as $question_id => $row) {
2266 $constraints = array();
2267 if (isset($questionblocks[$question_id])) {
2268 if (!$currentblock or ($currentblock != $questionblocks[$question_id]['questionblock_id'])) {
2269 $pageindex++;
2270 }
2271 $all_questions[$question_id]['page'] = $pageindex;
2272 $all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
2273 $all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
2274 $all_questions[$question_id]["questionblock_show_questiontext"] = $questionblocks[$question_id]['show_questiontext'];
2275 $all_questions[$question_id]["questionblock_show_blocktitle"] = $questionblocks[$question_id]['show_blocktitle'];
2276 $all_questions[$question_id]["questionblock_compress_view"] = $questionblocks[$question_id]['compress_view'];
2277 $currentblock = $questionblocks[$question_id]['questionblock_id'];
2278 $constraints = $this->getConstraints($question_id);
2279 $all_questions[$question_id]["constraints"] = $constraints;
2280 } else {
2281 $pageindex++;
2282 $all_questions[$question_id]['page'] = $pageindex;
2283 $all_questions[$question_id]["questionblock_title"] = "";
2284 $all_questions[$question_id]["questionblock_id"] = "";
2285 $all_questions[$question_id]["questionblock_show_questiontext"] = 1;
2286 $all_questions[$question_id]["questionblock_show_blocktitle"] = 1;
2287 $all_questions[$question_id]["questionblock_compress_view"] = false;
2288 $currentblock = "";
2289 $constraints = $this->getConstraints($question_id);
2290 $all_questions[$question_id]["constraints"] = $constraints;
2291 }
2292 if (!isset($all_pages[$pageindex])) {
2293 $all_pages[$pageindex] = array();
2294 }
2295 array_push($all_pages[$pageindex], $all_questions[$question_id]);
2296 }
2297 // calculate position percentage for every page
2298 $max = count($all_pages);
2299 $counter = 1;
2300 foreach ($all_pages as $index => $block) {
2301 foreach ($block as $blockindex => $question) {
2302 $all_pages[$index][$blockindex]["position"] = $counter / $max;
2303 }
2304 $counter++;
2305 }
2306
2307 return $all_pages;
2308 }
getConstraints($question_id)
Returns the constraints to a given question or questionblock.

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

Referenced by getNextPage(), and toXML().

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

◆ getSurveyParticipants()

& ilObjSurvey::getSurveyParticipants (   $finished_ids = null,
  $force_non_anonymous = false,
  $include_invites = false 
)

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

501 {
503
504 $sql = "SELECT * FROM svy_finished" .
505 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer");
506 if ($finished_ids) {
507 $sql .= " AND " . $ilDB->in("finished_id", $finished_ids, "", "integer");
508 }
509
510 $result = $ilDB->query($sql);
511 $participants = array();
512 if ($result->numRows() > 0) {
513 while ($row = $ilDB->fetchAssoc($result)) {
514 $userdata = $this->getUserDataFromActiveId($row["finished_id"], $force_non_anonymous);
515 $userdata["finished"] = (bool) $row["state"];
516 $userdata["finished_tstamp"] = $row["tstamp"];
517 $participants[$userdata["sortname"] . $userdata["active_id"]] = $userdata;
518 }
519 }
520 $participant_ids = array_column($participants, "usr_id");
521 if ($include_invites) {
522 foreach ($this->invitation_manager->getAllForSurvey($this->getSurveyId()) as $usr_id) {
523 if (!in_array($usr_id, $participant_ids)) {
524 $name = ilObjUser::_lookupName($usr_id);
525 $participants[$name["lastname"] . "," . $name["firstname"] . $usr_id] = [
526 "fullname" => ilObjUser::_lookupFullname($usr_id),
527 "sortname" => $name["lastname"] . "," . $name["firstname"],
528 "fistname" => $name["firstname"],
529 "lastname" => $name["lastname"],
530 "login" => $name["login"],
531 "gender" => "",
532 "usr_id" => $usr_id,
533 "finished" => false,
534 "finished_tstamp" => 0,
535 "invited" => true
536 ];
537 }
538 }
539 }
540
541 return $participants;
542 }
static _lookupFullname($a_user_id)
Lookup Full Name.

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

Referenced by ilSurveyParticipantsTableGUI\getItems().

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

◆ getSurveyQuestions()

& ilObjSurvey::getSurveyQuestions (   $with_answers = false)

Returns the survey questions and questionblocks in an array.

@access public

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

2119 {
2120 $ilDB = $this->db;
2121 // get questionblocks
2122 $all_questions = array();
2123 $result = $ilDB->queryF(
2124 "SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, " .
2125 "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2126 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2127 "ORDER BY svy_svy_qst.sequence",
2128 array('integer'),
2129 array($this->getSurveyId())
2130 );
2131 while ($row = $ilDB->fetchAssoc($result)) {
2132 $add = true;
2133 if ($row["plugin"]) {
2134 if (!$this->isPluginActive($row["type_tag"])) {
2135 $add = false;
2136 }
2137 }
2138 if ($add) {
2139 $question = self::_instanciateQuestion($row["question_id"]);
2140 $questionrow = $question->getQuestionDataArray($row["question_id"]);
2141 foreach ($row as $key => $value) {
2142 $questionrow[$key] = $value;
2143 }
2144 $all_questions[$row["question_id"]] = $questionrow;
2145 $all_questions[$row["question_id"]]["usableForPrecondition"] = $question->usableForPrecondition();
2146 $all_questions[$row["question_id"]]["availableRelations"] = $question->getAvailableRelations();
2147 }
2148 }
2149 // get all questionblocks
2150 $questionblocks = array();
2151 if (count($all_questions)) {
2152 $result = $ilDB->queryF(
2153 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
2154 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2155 "AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
2156 array('integer'),
2157 array($this->getSurveyId())
2158 );
2159 while ($row = $ilDB->fetchAssoc($result)) {
2160 $questionblocks[$row['question_fi']] = $row;
2161 }
2162 }
2163
2164 foreach ($all_questions as $question_id => $row) {
2165 $constraints = $this->getConstraints($question_id);
2166 if (isset($questionblocks[$question_id])) {
2167 $all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
2168 $all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
2169 $all_questions[$question_id]["constraints"] = $constraints;
2170 } else {
2171 $all_questions[$question_id]["questionblock_title"] = "";
2172 $all_questions[$question_id]["questionblock_id"] = "";
2173 $all_questions[$question_id]["constraints"] = $constraints;
2174 }
2175 if ($with_answers) {
2176 $answers = array();
2177 $result = $ilDB->queryF(
2178 "SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
2179 "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id " .
2180 "ORDER BY sequence ASC",
2181 array('integer'),
2182 array($question_id)
2183 );
2184 if ($result->numRows() > 0) {
2185 while ($data = $ilDB->fetchAssoc($result)) {
2186 array_push($answers, $data["title"]);
2187 }
2188 }
2189 $all_questions[$question_id]["answers"] = $answers;
2190 }
2191 }
2192 return $all_questions;
2193 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.

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

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

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

◆ getSurveySkippedValue()

static ilObjSurvey::getSurveySkippedValue ( )
static

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

6066 {
6067 global $DIC;
6068
6069 $lng = $DIC->language();
6070
6071 // #13541
6072
6073 $surveySetting = new ilSetting("survey");
6074 if (!$surveySetting->get("skipped_is_custom", false)) {
6075 return $lng->txt("skipped");
6076 } else {
6077 return $surveySetting->get("skipped_custom_value", "");
6078 }
6079 }
ILIAS Setting Class.

References $DIC, and ilObject\$lng.

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

+ Here is the caller graph for this function:

◆ getSurveysWithTutorResults()

static ilObjSurvey::getSurveysWithTutorResults ( )
static

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

6141 {
6142 global $ilDB;
6143
6144 $res = array();
6145
6147
6148
6149 $q = "SELECT obj_fi FROM svy_svy" .
6150 " WHERE tutor_res_cron IS NULL" .
6151 " AND tutor_res_status = " . $ilDB->quote(1, "integer") .
6152 " AND enddate < " . $ilDB->quote(date("Ymd000000"), "text");
6153
6154 if (DEVMODE) {
6155 $q = "SELECT obj_fi FROM svy_svy" .
6156 " WHERE tutor_res_status = " . $ilDB->quote(1, "integer") .
6157 " AND enddate < " . $ilDB->quote(date("Ymd000000"), "text");
6158 }
6159
6160 $set = $ilDB->query($q);
6161
6162 $log->debug($q);
6163
6164 while ($row = $ilDB->fetchAssoc($set)) {
6165 $res[] = $row["obj_fi"];
6166 }
6167
6168 return $res;
6169 }

References $ilDB, $log, $res, and ilLoggerFactory\getLogger().

Referenced by ilSurveyCronNotification\run().

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

◆ getTemplate()

ilObjSurvey::getTemplate ( )

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

4749 {
4750 return $this->template_id;
4751 }

References $template_id.

Referenced by isPoolActive(), and saveToDb().

+ Here is the caller graph for this function:

◆ getTextblock()

ilObjSurvey::getTextblock (   $question_id)

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

3823 {
3824 $ilDB = $this->db;
3825 $result = $ilDB->queryF(
3826 "SELECT * FROM svy_svy_qst WHERE question_fi = %s",
3827 array('integer'),
3828 array($question_id)
3829 );
3830 if ($result->numRows()) {
3831 $row = $ilDB->fetchAssoc($result);
3832 return $row["heading"];
3833 } else {
3834 return "";
3835 }
3836 }

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

Referenced by cloneTextblocks().

+ Here is the caller graph for this function:

◆ getTutorNotificationRecipients()

ilObjSurvey::getTutorNotificationRecipients ( )

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

5644 {
5646 }

References $tutor_ntf_recipients.

Referenced by saveToDb(), and sendTutorNotification().

+ Here is the caller graph for this function:

◆ getTutorNotificationStatus()

ilObjSurvey::getTutorNotificationStatus ( )

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

5634 {
5635 return (bool) $this->tutor_ntf_status;
5636 }

References $tutor_ntf_status.

Referenced by checkTutorNotification(), and saveToDb().

+ Here is the caller graph for this function:

◆ getTutorNotificationTarget()

ilObjSurvey::getTutorNotificationTarget ( )

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

5654 {
5656 }

References $tutor_ntf_target.

Referenced by checkTutorNotification(), and saveToDb().

+ Here is the caller graph for this function:

◆ getTutorResultsRecipients()

ilObjSurvey::getTutorResultsRecipients ( )

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

5674 {
5676 }

References $tutor_res_recipients.

Referenced by saveToDb(), and sendTutorResults().

+ Here is the caller graph for this function:

◆ getTutorResultsStatus()

ilObjSurvey::getTutorResultsStatus ( )

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

5664 {
5665 return (bool) $this->tutor_res_status;
5666 }

References $tutor_res_status.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ getUserAccessCode()

ilObjSurvey::getUserAccessCode (   $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

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

4368 {
4369 $ilDB = $this->db;
4370 $access_code = "";
4371 $result = $ilDB->queryF(
4372 "SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
4373 array('integer','text'),
4374 array($this->getSurveyId(), md5($user_id))
4375 );
4376 if ($result->numRows()) {
4377 $row = $ilDB->fetchAssoc($result);
4378 $access_code = $row["survey_key"];
4379 }
4380 return $access_code;
4381 }

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

+ Here is the call graph for this function:

◆ getUserData()

& ilObjSurvey::getUserData (   $ids)

Returns a data of all users specified by id list.

Parameters
$idsarray of user id's
Returns
array The user data "usr_id, login, lastname, firstname, clientip" of the users with id as key

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

4654 {
4655 $ilDB = $this->db;
4656
4657 if (!is_array($ids) || count($ids) == 0) {
4658 return array();
4659 }
4660
4661 $result = $ilDB->query("SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " . $ilDB->in('usr_id', $ids, false, 'integer') . " ORDER BY login");
4662 $result_array = array();
4663 while ($row = $ilDB->fetchAssoc($result)) {
4664 $result_array[$row["usr_id"]] = $row;
4665 }
4666 return $result_array;
4667 }

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

◆ getUserDataFromActiveId()

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

Returns the user information from an active_id (survey_finished.finished_id)

Parameters
integer$active_idThe active id of the user
Returns
array An array containing the user data @access public

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

3036 {
3037 $ilDB = $this->db;
3038
3039 $surveySetting = new ilSetting("survey");
3040 $use_anonymous_id = $surveySetting->get("use_anonymous_id");
3041 $result = $ilDB->queryF(
3042 "SELECT * FROM svy_finished WHERE finished_id = %s",
3043 array('integer'),
3044 array($active_id)
3045 );
3046 $row = array();
3047 $foundrows = $result->numRows();
3048 if ($foundrows) {
3049 $row = $ilDB->fetchAssoc($result);
3050 }
3051 $name = ($use_anonymous_id) ? $row["anonymous_id"] : $this->lng->txt("anonymous");
3052 $userdata = array(
3053 "fullname" => $name,
3054 "sortname" => $name,
3055 "firstname" => "",
3056 "lastname" => "",
3057 "login" => "",
3058 "gender" => "",
3059 "active_id" => "$active_id"
3060 );
3061 if ($foundrows) {
3062 if (($row["user_fi"] > 0) &&
3063 (($row["user_fi"] != ANONYMOUS_USER_ID &&
3064 !$this->hasAnonymizedResults() &&
3065 !$this->get360Mode()) || // 360° uses ANONYMIZE_CODE_ALL which is wrong - see ilObjSurveyGUI::afterSave()
3066 (bool) $force_non_anonymous)) {
3067 if (strlen(ilObjUser::_lookupLogin($row["user_fi"])) == 0) {
3068 $userdata["fullname"] = $userdata["sortname"] = $this->lng->txt("deleted_user");
3069 } else {
3070 $user = new ilObjUser($row["user_fi"]);
3071 $userdata['usr_id'] = $row['user_fi'];
3072 $userdata["fullname"] = $user->getFullname();
3073 $gender = $user->getGender();
3074 if (strlen($gender) == 1) {
3075 $gender = $this->lng->txt("gender_$gender");
3076 }
3077 $userdata["gender"] = $gender;
3078 $userdata["firstname"] = $user->getFirstname();
3079 $userdata["lastname"] = $user->getLastname();
3080 $userdata["sortname"] = $user->getLastname() . ", " . $user->getFirstname();
3081 $userdata["login"] = $user->getLogin();
3082 }
3083 }
3084 }
3085 return $userdata;
3086 }
hasAnonymizedResults()
Checks if the survey results are to be anonymized.
static _lookupLogin($a_user_id)
lookup login

References ilObject\$db, $ilDB, $name, $result, $user, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, get360Mode(), and hasAnonymizedResults().

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

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

◆ getUserSettings()

ilObjSurvey::getUserSettings (   $usr_id,
  $key 
)

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

730 {
732
733 $result = $ilDB->queryF(
734 "SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
735 array('integer', 'text'),
736 array($usr_id, $key)
737 );
738 $found = array();
739 if ($result->numRows()) {
740 while ($row = $ilDB->fetchAssoc($result)) {
741 $found[$row['settings_id']] = $row;
742 }
743 }
744 return $found;
745 }

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

◆ getUserSpecificResults()

ilObjSurvey::getUserSpecificResults (   $finished_ids)

Calculates the evaluation data for the user specific results.

Returns
array An array containing the user specific results @access public

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

3004 {
3005 $evaluation = array();
3006
3007 foreach (array_keys($this->getSurveyQuestions()) as $question_id) {
3008 // get question instance
3009 $question_type = SurveyQuestion::_getQuestionType($question_id);
3010 SurveyQuestion::_includeClass($question_type);
3011 $question = new $question_type();
3012 $question->loadFromDb($question_id);
3013
3014 $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($question_id, $finished_ids);
3015 $q_res = $q_eval->getResults();
3016
3017 $data = array();
3018 foreach ($finished_ids as $user_id) {
3019 $data[$user_id] = $q_eval->parseUserSpecificResults($q_res, $user_id);
3020 }
3021
3022 $evaluation[$question_id] = $data;
3023 }
3024
3025 return $evaluation;
3026 }
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.

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

Referenced by getParticipantTextResults().

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

◆ getUserSurveyExecutionStatus()

ilObjSurvey::getUserSurveyExecutionStatus (   $a_code = null)

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

5311 {
5313 $ilDB = $this->db;
5314
5315 $user_id = $ilUser->getId();
5316
5317 // code is obligatory?
5318 if (!$this->isAccessibleWithoutCode()) {
5319 if (!$a_code) {
5320 // registered raters do not need code
5321 if ($this->get360Mode() &&
5322 $user_id != ANONYMOUS_USER_ID &&
5323 $this->isRater(0, $user_id)) {
5324 // auto-generate code
5325 $a_code = $this->createNewAccessCode();
5326 $this->saveUserAccessCode($user_id, $a_code);
5327 } else {
5328 return null;
5329 }
5330 }
5331 } elseif ($user_id == ANONYMOUS_USER_ID ||
5332 $this->getAnonymize() == self::ANONYMIZE_FREEACCESS) {
5333 if (!$a_code) {
5334 // auto-generate code
5335 $a_code = $this->createNewAccessCode();
5336 $this->saveUserAccessCode($user_id, $a_code);
5337 }
5338 } else {
5339 $a_code = null;
5340 }
5341
5342 $res = array();
5343
5344 $sql = "SELECT * FROM svy_finished" .
5345 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer");
5346 // if proper user id is given, use it or current code
5347 if ($user_id != ANONYMOUS_USER_ID) {
5348 $sql .= " AND (user_fi = " . $ilDB->quote($user_id, "integer") .
5349 " OR anonymous_id = " . $ilDB->quote($a_code, "text") . ")";
5350 }
5351 // use anonymous code to find finished id(s)
5352 else {
5353 $sql .= " AND anonymous_id = " . $ilDB->quote($a_code, "text");
5354 }
5355 $set = $ilDB->query($sql);
5356 while ($row = $ilDB->fetchAssoc($set)) {
5357 $res[$row["finished_id"]] = array("appr_id" => $row["appr_id"],
5358 "user_id" => $row["user_fi"],
5359 "code" => $row["anonymous_id"],
5360 "finished" => (bool) $row["state"]);
5361 }
5362
5363 return array("code" => $a_code, "runs" => $res);
5364 }
isAccessibleWithoutCode()
Checks if the survey is accessable without a survey code.
saveUserAccessCode($user_id, $access_code)
Saves a survey access code for a registered user to the database.

References ilObject\$db, $ilDB, $ilUser, $res, $user, ANONYMOUS_USER_ID, createNewAccessCode(), get360Mode(), getAnonymize(), getSurveyId(), isAccessibleWithoutCode(), isRater(), and saveUserAccessCode().

+ Here is the call graph for this function:

◆ getVariables()

& ilObjSurvey::getVariables (   $question_id)

Returns all variables of a question.

@access public

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

2441 {
2442 $ilDB = $this->db;
2443
2444 $result_array = array();
2445 $result = $ilDB->queryF(
2446 "SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN " .
2447 "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s " .
2448 "ORDER BY svy_variable.sequence",
2449 array('integer'),
2450 array($question_id)
2451 );
2452 while ($row = $ilDB->fetchObject($result)) {
2453 $result_array[$row->sequence] = $row;
2454 }
2455 return $result_array;
2456 }

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

◆ getWorkingtimeForParticipant()

ilObjSurvey::getWorkingtimeForParticipant (   $finished_id)

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

4726 {
4727 $ilDB = $this->db;
4728
4729 $result = $ilDB->queryF(
4730 "SELECT * FROM svy_times WHERE finished_fi = %s",
4731 array('integer'),
4732 array($finished_id)
4733 );
4734 $total = 0;
4735 while ($row = $ilDB->fetchAssoc($result)) {
4736 if ($row['left_page'] > 0 && $row['entered_page'] > 0) {
4737 $total += $row['left_page'] - $row['entered_page'];
4738 }
4739 }
4740 return $total;
4741 }
$total
Definition: Utf8Test.php:87

References ilObject\$db, $ilDB, $result, and $total.

◆ hasAnonymizedResults()

ilObjSurvey::hasAnonymizedResults ( )

Checks if the survey results are to be anonymized.

Returns
boolean status

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

1099 {
1100 return ($this->getAnonymize() == self::ANONYMIZE_ON ||
1101 $this->getAnonymize() == self::ANONYMIZE_FREEACCESS);
1102 }

References getAnonymize().

Referenced by getUserDataFromActiveId(), and sendNotificationMail().

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

◆ hasAnonymousUserList()

ilObjSurvey::hasAnonymousUserList ( )

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

6061 {
6062 return $this->anon_user_list;
6063 }

References $anon_user_list.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ hasMailConfirmation()

ilObjSurvey::hasMailConfirmation ( )

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

6051 {
6053 }

References $mail_confirmation.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ hasMailOwnResults()

ilObjSurvey::hasMailOwnResults ( )

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

6041 {
6043 }

References $mail_own_results.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ hasViewOwnResults()

ilObjSurvey::hasViewOwnResults ( )

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

6031 {
6033 }

References $view_own_results.

Referenced by saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ hideQuestionTitles()

ilObjSurvey::hideQuestionTitles ( )

Sets the question titles hidden during the query.

@access public

See also
$display_question_titles

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

1374 {
1375 $this->display_question_titles = 0;
1376 }

◆ importObject()

ilObjSurvey::importObject (   $file_info,
  $svy_qpl_id 
)

Imports a survey from XML into the ILIAS database.

Parameters
$file_info
$svy_qpl_id
Returns
string
Exceptions
ilFileUtilsException
ilInvalidSurveyImportFileException

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

3508 {
3509 if ($svy_qpl_id < 1) {
3510 $svy_qpl_id = -1;
3511 }
3512 // check if file was uploaded
3513 $source = $file_info["tmp_name"];
3514 $error = "";
3515 if (($source == 'none') || (!$source) || $file_info["error"] > UPLOAD_ERR_OK) {
3516 $error = $this->lng->txt("import_no_file_selected");
3517 }
3518 // check correct file type
3519 $isXml = false;
3520 $isZip = false;
3521 if ((strcmp($file_info["type"], "text/xml") == 0) || (strcmp($file_info["type"], "application/xml") == 0)) {
3522 $this->svy_log->debug("isXML");
3523 $isXml = true;
3524 }
3525 // too many different mime-types, so we use the suffix
3526 $suffix = pathinfo($file_info["name"]);
3527 if (strcmp(strtolower($suffix["extension"]), "zip") == 0) {
3528 $this->svy_log->debug("isZip");
3529 $isZip = true;
3530 }
3531 if (!$isXml && !$isZip) {
3532 $error = $this->lng->txt("import_wrong_file_type");
3533 $this->svy_log->debug("Survey: Import error. Filetype was \"" . $file_info["type"] . "\"");
3534 }
3535 if (strlen($error) == 0) {
3536 // import file as a survey
3537 $import_dir = $this->getImportDirectory();
3538 $import_subdir = "";
3539 $importfile = "";
3540 if ($isZip) {
3541 $importfile = $import_dir . "/" . $file_info["name"];
3542 ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
3543 ilUtil::unzip($importfile);
3544 $found = $this->locateImportFiles($import_dir);
3545 if (!((strlen($found["dir"]) > 0) && (strlen($found["xml"]) > 0))) {
3546 $error = $this->lng->txt("wrong_import_file_structure");
3547 return $error;
3548 }
3549 $importfile = $found["xml"];
3550 $import_subdir = $found["dir"];
3551 } else {
3552 $importfile = tempnam($import_dir, "survey_import");
3553 ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
3554 }
3555
3556 $this->svy_log->debug("Import file = $importfile");
3557 $this->svy_log->debug("Import subdir = $import_subdir");
3558
3559 $fh = fopen($importfile, "r");
3560 if (!$fh) {
3561 $error = $this->lng->txt("import_error_opening_file");
3562 return $error;
3563 }
3564 $xml = fread($fh, filesize($importfile));
3565 $result = fclose($fh);
3566 if (!$result) {
3567 $error = $this->lng->txt("import_error_closing_file");
3568 return $error;
3569 }
3570
3571 unset($_SESSION["import_mob_xhtml"]);
3572 if (strpos($xml, "questestinterop")) {
3573 throw new ilInvalidSurveyImportFileException("Unsupported survey version (< 3.8) found.");
3574 } else {
3575 $this->svy_log->debug("survey id = " . $this->getId());
3576 $this->svy_log->debug("question pool id = " . $svy_qpl_id);
3577
3578 $imp = new ilImport();
3579 $config = $imp->getConfig("Modules/Survey");
3580 $config->setQuestionPoolID($svy_qpl_id);
3581 $imp->getMapping()->addMapping("Modules/Survey", "svy", 0, $this->getId());
3582 $imp->importFromDirectory($import_subdir, "svy", "Modules/Survey");
3583 $this->svy_log->debug("config(Modules/survey)->getQuestionPoolId =" . $config->getQuestionPoolID());
3584 return "";
3585
3586 //old code
3587 $import = new SurveyImportParser($svy_qpl_id, "", true);
3588 $import->setSurveyObject($this);
3589 $import->setXMLContent($xml);
3590 $import->startParsing();
3591 }
3592
3593 if (is_array($_SESSION["import_mob_xhtml"])) {
3594 foreach ($_SESSION["import_mob_xhtml"] as $mob) {
3595 $importfile = $import_subdir . "/" . $mob["uri"];
3596 if (file_exists($importfile)) {
3597 if (!$mob["type"]) {
3598 $mob["type"] = "svy:html";
3599 }
3600
3601 $media_object = ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, false);
3602
3603 // survey mob
3604 if ($mob["type"] == "svy:html") {
3605 ilObjMediaObject::_saveUsage($media_object->getId(), "svy:html", $this->getId());
3606 $this->setIntroduction(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()));
3607 $this->setOutro(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getOutro()));
3608 }
3609 // question mob
3610 elseif ($import->questions[$mob["id"]]) {
3611 $new_qid = $import->questions[$mob["id"]];
3612 ilObjMediaObject::_saveUsage($media_object->getId(), $mob["type"], $new_qid);
3613 $new_question = SurveyQuestion::_instanciateQuestion($new_qid);
3614 $qtext = $new_question->getQuestiontext();
3615 $qtext = ilRTE::_replaceMediaObjectImageSrc($qtext, 0);
3616 $qtext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $qtext);
3617 $qtext = ilRTE::_replaceMediaObjectImageSrc($qtext, 1);
3618 $new_question->setQuestiontext($qtext);
3619 $new_question->saveToDb();
3620
3621 // also fix existing original in pool
3622 if ($new_question->getOriginalId()) {
3623 $pool_question = SurveyQuestion::_instanciateQuestion($new_question->getOriginalId());
3624 $pool_question->setQuestiontext($qtext);
3625 $pool_question->saveToDb();
3626 }
3627 }
3628 } else {
3629 $ilLog = $this->svy_log;
3630 $ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
3631 }
3632 }
3635 $this->saveToDb();
3636 }
3637
3638 // delete import directory
3640 }
3641 return $error;
3642 }
$_SESSION["AccountId"]
Survey Question Import Parser.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
Import class.
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
static _saveTempFileAsMediaObject($name, $tmp_name, $upload=true)
Create new media object and update page in db and return new media object.
setIntroduction($introduction="")
Sets the introduction text.
getOutro()
Gets the outro text.
setOutro($outro="")
Sets the outro text.
locateImportFiles($a_dir)
Locates the import directory and the xml file in a directory with an unzipped import file.
getIntroduction()
Gets the introduction text.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
$source
Definition: metadata.php:76
$xml
Definition: metadata.php:332

References $_SESSION, $config, ilObject\$error, $result, $source, $svy_log, $xml, SurveyQuestion\_instanciateQuestion(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilObjMediaObject\_saveUsage(), ilUtil\delDir(), ilObject\getId(), getImportDirectory(), getIntroduction(), getOutro(), IL_INST_ID, locateImportFiles(), ilUtil\moveUploadedFile(), saveToDb(), setIntroduction(), setOutro(), and ilUtil\unzip().

+ Here is the call graph for this function:

◆ importSurveyCode()

ilObjSurvey::importSurveyCode (   $a_anonymize_key,
  $a_created,
  $a_data 
)

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

4190 {
4191 $ilDB = $this->db;
4192
4193 $next_id = $ilDB->nextId('svy_anonymous');
4194 $ilDB->manipulateF(
4195 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
4196 "VALUES (%s, %s, %s, %s, %s)",
4197 array('integer','text','integer','text','integer'),
4198 array($next_id, $a_anonymize_key, $this->getSurveyId(), serialize($a_data), $a_created)
4199 );
4200 }

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

+ Here is the call graph for this function:

◆ insertQuestion()

ilObjSurvey::insertQuestion (   $question_id)

Inserts a question in the survey and saves the relation to the database The question is appended to the end (last question) @access public.

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

610 {
612
613 $this->svy_log->debug("insert question, id:" . $question_id);
614
615 if (!SurveyQuestion::_isComplete($question_id)) {
616 $this->svy_log->debug("question is not complete");
617 return false;
618 } else {
619 // get maximum sequence index in test
620 // @todo: refactor this
621 $result = $ilDB->queryF(
622 "SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
623 array('integer'),
624 array($this->getSurveyId())
625 );
626 $sequence = $result->numRows();
627 $duplicate_id = $this->duplicateQuestionForSurvey($question_id);
628 $this->svy_log->debug("duplicate, id: " . $question_id . ", duplicate id: " . $duplicate_id);
629
630 // check if question is not already in the survey, see #22018
631 if ($this->isQuestionInSurvey($duplicate_id)) {
632 return false;
633 }
634
635 $next_id = $ilDB->nextId('svy_svy_qst');
636 $affectedRows = $ilDB->manipulateF(
637 "INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
638 array('integer', 'integer', 'integer', 'integer', 'integer'),
639 array($next_id, $this->getSurveyId(), $duplicate_id, $sequence, time())
640 );
641
642 $this->svy_log->debug("added entry to svy_svy_qst, id: " . $next_id . ", question id: " . $duplicate_id . ", sequence: " . $sequence);
643
644 $this->loadQuestionsFromDb();
645 return true;
646 }
647 }
static _isComplete($question_id)
Checks whether the question is complete or not.
loadQuestionsFromDb()
Loads the survey questions from the database.
duplicateQuestionForSurvey($question_id, $a_force=false)
Takes a question and creates a copy of the question for use in the survey.
isQuestionInSurvey($a_question_fi)
Check if a question is already in the survey.

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

+ Here is the call graph for this function:

◆ insertQuestionblock()

ilObjSurvey::insertQuestionblock (   $questionblock_id)

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

@access public

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

678 {
680 $result = $ilDB->queryF(
681 "SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle," .
682 " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst" .
683 " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi" .
684 " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi" .
685 " AND svy_qblk.questionblock_id = %s" .
686 " ORDER BY svy_svy_qst.sequence",
687 array('integer'),
688 array($questionblock_id)
689 );
690 $questions = array();
691 $show_questiontext = 0;
692 $show_blocktitle = 0;
693 while ($row = $ilDB->fetchAssoc($result)) {
694 $duplicate_id = $this->duplicateQuestionForSurvey($row["question_fi"]);
695 array_push($questions, $duplicate_id);
696 $title = $row["title"];
697 $show_questiontext = $row["show_questiontext"];
698 $show_blocktitle = $row["show_blocktitle"];
699 }
700 $this->createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions);
701 }
createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions, $compress_view=false)
Creates a question block for the survey.

References ilObject\$db, $ilDB, $questions, $result, ilObject\$title, createQuestionblock(), and duplicateQuestionForSurvey().

+ Here is the call graph for this function:

◆ is360SurveyStarted()

ilObjSurvey::is360SurveyStarted (   $appr_id,
  $user_id,
  $anonymous_code = null 
)

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

5290 {
5291 $ilDB = $this->db;
5292
5293 $sql = "SELECT * FROM svy_finished" .
5294 " WHERE survey_fi =" . $ilDB->quote($this->getSurveyId(), "integer") .
5295 " AND appr_id = " . $ilDB->quote($appr_id, "integer");
5296 if ($user_id) {
5297 $sql .= " AND user_fi = " . $ilDB->quote($user_id, "integer");
5298 } else {
5299 $sql .= " AND anonymous_id = " . $ilDB->quote($anonymous_code, "text");
5300 }
5301 $result = $ilDB->query($sql);
5302 if ($result->numRows() == 0) {
5303 return false;
5304 } else {
5305 $row = $ilDB->fetchAssoc($result);
5306 return (int) $row["state"];
5307 }
5308 }

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

Referenced by getRatersData(), and sent360Reminders().

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

◆ isAccessibleWithoutCode()

ilObjSurvey::isAccessibleWithoutCode ( )

Checks if the survey is accessable without a survey code.

Returns
boolean status

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

1088 {
1089 return ($this->getAnonymize() == self::ANONYMIZE_OFF ||
1090 $this->getAnonymize() == self::ANONYMIZE_FREEACCESS);
1091 }

References getAnonymize().

Referenced by getUserSurveyExecutionStatus().

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

◆ isActivationLimited()

ilObjSurvey::isActivationLimited ( )

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

1609 {
1610 return (bool) $this->activation_limited;
1611 }

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ isAnonymizedParticipant()

ilObjSurvey::isAnonymizedParticipant (   $key)

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

3984 {
3985 $ilDB = $this->db;
3986
3987 $result = $ilDB->queryF(
3988 "SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
3989 array('text','integer'),
3990 array($key, $this->getSurveyId())
3991 );
3992 return ($result->numRows() == 1) ? true : false;
3993 }

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

+ Here is the call graph for this function:

◆ isAnonymousKey()

ilObjSurvey::isAnonymousKey (   $key)

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

3957 {
3958 $ilDB = $this->db;
3959
3960 $result = $ilDB->queryF(
3961 "SELECT anonymous_id FROM svy_anonymous WHERE survey_key = %s AND survey_fi = %s",
3962 array('text','integer'),
3963 array($key, $this->getSurveyId())
3964 );
3965 return ($result->numRows() == 1) ? true : false;
3966 }

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

Referenced by checkSurveyCode().

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

◆ isAppraisee()

ilObjSurvey::isAppraisee (   $a_user_id)

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

5061 {
5062 $ilDB = $this->db;
5063
5064 $set = $ilDB->query("SELECT user_id" .
5065 " FROM svy_360_appr" .
5066 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5067 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
5068 return (bool) $ilDB->numRows($set);
5069 }

References ilObject\$db, and $ilDB.

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

+ Here is the caller graph for this function:

◆ isAppraiseeClosed()

ilObjSurvey::isAppraiseeClosed (   $a_user_id)

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

5072 {
5073 $ilDB = $this->db;
5074
5075 $set = $ilDB->query("SELECT has_closed" .
5076 " FROM svy_360_appr" .
5077 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5078 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
5079 $row = $ilDB->fetchAssoc($set);
5080 return $row["has_closed"];
5081 }

References ilObject\$db, and $ilDB.

Referenced by sent360Reminders().

+ Here is the caller graph for this function:

◆ isComplete()

ilObjSurvey::isComplete ( )

Returns 1, if a survey is complete for use.

Returns
boolean 1, if the survey is complete for use, otherwise 0 @access public

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

551 {
552 if (($this->getTitle()) and (count($this->questions))) {
553 return 1;
554 } else {
555 return 0;
556 }
557 }
getTitle()
get object title @access public

References ilObject\getTitle().

Referenced by saveCompletionStatus(), and saveToDb().

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

◆ isHTML()

ilObjSurvey::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean @access public

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

4471 {
4472 if (preg_match("/<[^>]*?>/", $a_text)) {
4473 return true;
4474 } else {
4475 return false;
4476 }
4477 }

Referenced by addMaterialTag().

+ Here is the caller graph for this function:

◆ isPluginActive()

ilObjSurvey::isPluginActive (   $a_pname)

Checks whether or not a question plugin with a given name is active.

Parameters
string$a_pnameThe plugin name @access public

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

4628 {
4629 $ilPluginAdmin = $this->plugin_admin;
4630 if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "SurveyQuestionPool", "svyq", $a_pname)) {
4631 return true;
4632 } else {
4633 return false;
4634 }
4635 }
const IL_COMP_MODULE

References $plugin_admin, and IL_COMP_MODULE.

Referenced by getQuestionsTable(), and getSurveyQuestions().

+ Here is the caller graph for this function:

◆ isPoolActive()

ilObjSurvey::isPoolActive ( )

Get current pool status.

Returns
bool

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

4777 {
4778 $use_pool = (bool) $this->getPoolUsage();
4779 $template_settings = $this->getTemplate();
4780 if ($template_settings) {
4781 $template_settings = new ilSettingsTemplate($template_settings);
4782 $template_settings = $template_settings->getSettings();
4783 $template_settings = $template_settings["use_pool"];
4784 if ($template_settings && $template_settings["hide"]) {
4785 $use_pool = (bool) $template_settings["value"];
4786 }
4787 }
4788 return $use_pool;
4789 }

References getPoolUsage(), and getTemplate().

+ Here is the call graph for this function:

◆ isQuestionInAnyBlock()

ilObjSurvey::isQuestionInAnyBlock (   $a_question_fi)

Is question already in a block?

Parameters
int$a_question_fiquestion id as in svy_question
Returns
bool

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

1883 {
1884 global $DIC;
1885
1886 $ilDB = $DIC->database();
1887
1888 $set = $ilDB->query("SELECT * FROM svy_qblk_qst " .
1889 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
1890 " AND question_fi = " . $ilDB->quote($a_question_fi, "integer"));
1891 if ($rec = $ilDB->fetchAssoc($set)) {
1892 return true;
1893 }
1894 return false;
1895 }

References $DIC, and $ilDB.

Referenced by addQuestionToBlock(), and createQuestionblock().

+ Here is the caller graph for this function:

◆ isQuestionInSurvey()

ilObjSurvey::isQuestionInSurvey (   $a_question_fi)

Check if a question is already in the survey.

Parameters
questionid (as primary key from svy_question table)
Returns
bool

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

656 {
657 global $DIC;
658 //return false;
659 $ilDB = $DIC->database();
660
661 $set = $ilDB->query("SELECT * FROM svy_svy_qst " .
662 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
663 " AND question_fi = " . $ilDB->quote($a_question_fi, "integer"));
664 if ($rec = $ilDB->fetchAssoc($set)) {
665 return true;
666 }
667 return false;
668 }

References $DIC, and $ilDB.

Referenced by insertQuestion(), and saveQuestionsToDb().

+ Here is the caller graph for this function:

◆ isRater()

ilObjSurvey::isRater (   $a_appraisee_id,
  $a_user_id,
  $a_anonymous_id = 0 
)

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

5157 {
5158 $ilDB = $this->db;
5159
5160 // user is rater if already appraisee and active self-evaluation
5161 if ($this->isAppraisee($a_user_id) &&
5162 $this->get360SelfEvaluation() &&
5163 (!$a_appraisee_id || $a_appraisee_id == $a_user_id)) {
5164 return true;
5165 }
5166
5167 // :TODO: should we get rid of code as well?
5168
5169 $sql = "SELECT user_id" .
5170 " FROM svy_360_rater" .
5171 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5172 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
5173 " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer");
5174 if ($a_appraisee_id) {
5175 $sql .= " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer");
5176 }
5177 $set = $ilDB->query($sql);
5178 return (bool) $ilDB->numRows($set);
5179 }

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

Referenced by addRater(), and getUserSurveyExecutionStatus().

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

◆ isSurveyCodeUnique()

ilObjSurvey::isSurveyCodeUnique (   $code)

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

4159 {
4160 $ilDB = $this->db;
4161 $result = $ilDB->queryF(
4162 "SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4163 array('integer','text'),
4164 array($this->getSurveyId(), $code)
4165 );
4166 return ($result->numRows() > 0) ? false : true;
4167 }

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

Referenced by createNewAccessCode().

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

◆ isSurveyCodeUsed()

ilObjSurvey::isSurveyCodeUsed (   $code)

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

4148 {
4149 $ilDB = $this->db;
4150 $result = $ilDB->queryF(
4151 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4152 array('integer','text'),
4153 array($this->getSurveyId(), $code)
4154 );
4155 return ($result->numRows() > 0) ? true : false;
4156 }

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

Referenced by getSurveyCodesForExport(), and getSurveyCodesTableData().

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

◆ isSurveyFinishedByCode()

ilObjSurvey::isSurveyFinishedByCode (   $a_code)

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

Parameters
$a_codeanonymous user code
Returns
bool

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

4331 {
4332 $result = $this->db->queryF(
4333 "SELECT state FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4334 array('integer','text'),
4335 array($this->getSurveyId(), $a_code)
4336 );
4337
4338 $row = $this->db->fetchAssoc($result);
4339
4340 return $row['state'];
4341 }

References $result, and getSurveyId().

Referenced by getExternalCodeRecipients().

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

◆ isSurveyStarted()

ilObjSurvey::isSurveyStarted (   $user_id,
  $anonymize_id,
  $appr_id = 0 
)

Checks if a user already started a survey.

Parameters
integer$user_idThe database id of the user
Returns
mixed false, if the user has not started the survey, 0 if the user has started the survey but not finished it, 1 if the user has finished the survey @access public

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

2803 {
2804 $ilDB = $this->db;
2805
2806 // #15031 - should not matter if code was used by registered or anonymous (each code must be unique)
2807 if ($anonymize_id) {
2808 $result = $ilDB->queryF(
2809 "SELECT * FROM svy_finished" .
2810 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2811 array('integer','text','integer'),
2812 array($this->getSurveyId(), $anonymize_id, $appr_id)
2813 );
2814 } else {
2815 $result = $ilDB->queryF(
2816 "SELECT * FROM svy_finished" .
2817 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
2818 array('integer','integer','integer'),
2819 array($this->getSurveyId(), $user_id, $appr_id)
2820 );
2821 }
2822 if ($result->numRows() == 0) {
2823 return false;
2824 } else {
2825 $row = $ilDB->fetchAssoc($result);
2826 // yes, we are doing it this way
2827 $_SESSION["finished_id"][$this->getId()] = $row["finished_id"];
2828
2829 return (int) $row["state"];
2830 }
2831 }

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

Referenced by checkSurveyCode().

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

◆ isUnusedCode()

ilObjSurvey::isUnusedCode (   $a_code,
  $a_user_id 
)

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

5380 {
5381 $ilDB = $this->db;
5382
5383 $set = $ilDB->query("SELECT user_fi FROM svy_finished" .
5384 " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") .
5385 " AND anonymous_id = " . $ilDB->quote($a_code, "text"));
5386 $user_id = $ilDB->fetchAssoc($set);
5387 $user_id = $user_id["user_fi"];
5388
5389 if ($user_id && ($user_id != $a_user_id || $user_id == ANONYMOUS_USER_ID)) {
5390 return false;
5391 }
5392 return true;
5393 }

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

◆ loadFromDb()

ilObjSurvey::loadFromDb ( )

Loads a survey object from a database.

@access public

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

1110 {
1111 $ilDB = $this->db;
1112 $result = $ilDB->queryF(
1113 "SELECT * FROM svy_svy WHERE obj_fi = %s",
1114 array('integer'),
1115 array($this->getId())
1116 );
1117 if ($result->numRows() == 1) {
1118 $data = $ilDB->fetchAssoc($result);
1119 $this->setSurveyId($data["survey_id"]);
1120 $this->setAuthor($data["author"]);
1121 $this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($data["introduction"], 1));
1122 if (strcmp($data["outro"], "survey_finished") == 0) {
1123 $this->setOutro($this->lng->txt("survey_finished"));
1124 } else {
1126 }
1127 $this->setShowQuestionTitles($data["show_question_titles"]);
1128 $this->setStartDate($data["startdate"]);
1129 $this->setEndDate($data["enddate"]);
1130 $this->setAnonymize($data["anonymize"]);
1131 $this->setEvaluationAccess($data["evaluation_access"]);
1132 $this->loadQuestionsFromDb();
1133 $this->setMailNotification($data['mailnotification']);
1134 $this->setMailAddresses($data['mailaddresses']);
1135 $this->setMailParticipantData($data['mailparticipantdata']);
1136 $this->setTemplate($data['template_id']);
1137 $this->setPoolUsage($data['pool_usage']);
1138 // Mode
1139 $this->setMode($data['mode']);
1140 // 360°
1141 $this->set360SelfEvaluation($data['mode_360_self_eval']);
1142 $this->set360SelfRaters($data['mode_360_self_rate']);
1143 $this->set360SelfAppraisee($data['mode_360_self_appr']);
1144 $this->set360Results($data['mode_360_results']);
1145 // Mode self evaluated
1146 $this->setSelfEvaluationResults($data['mode_self_eval_results']);
1147 // Competences
1148 $this->setSkillService($data['mode_skill_service']);
1149 // reminder/notification
1150 $this->setReminderStatus($data["reminder_status"]);
1151 $this->setReminderStart($data["reminder_start"] ? new ilDate($data["reminder_start"], IL_CAL_DATE) : null);
1152 $this->setReminderEnd($data["reminder_end"] ? new ilDate($data["reminder_end"], IL_CAL_DATE) : null);
1153 $this->setReminderFrequency($data["reminder_frequency"]);
1154 $this->setReminderTarget($data["reminder_target"]);
1155 $this->setReminderLastSent($data["reminder_last_sent"]);
1156 $this->setReminderTemplate($data["reminder_tmpl"]);
1157 $this->setTutorNotificationStatus($data["tutor_ntf_status"]);
1158 $this->setTutorNotificationRecipients(explode(";", $data["tutor_ntf_reci"]));
1159 $this->setTutorNotificationTarget($data["tutor_ntf_target"]);
1160 $this->setTutorResultsStatus($data["tutor_res_status"]);
1161 $this->setTutorResultsRecipients(explode(";", $data["tutor_res_reci"]));
1162
1163 $this->setViewOwnResults($data["own_results_view"]);
1164 $this->setMailOwnResults($data["own_results_mail"]);
1165 $this->setMailConfirmation($data["confirmation_mail"]);
1166 $this->setCalculateSumScore($data["calculate_sum_score"]);
1167
1168 $this->setAnonymousUserList($data["anon_user_list"]);
1169 }
1170
1171 // moved activation to ilObjectActivation
1172 if ($this->ref_id) {
1173 $activation = ilObjectActivation::getItem($this->ref_id);
1174 switch ($activation["timing_type"]) {
1176 $this->setActivationLimited(true);
1177 $this->setActivationStartDate($activation["timing_start"]);
1178 $this->setActivationEndDate($activation["timing_end"]);
1179 $this->setActivationVisibility($activation["visible"]);
1180 break;
1181
1182 default:
1183 $this->setActivationLimited(false);
1184 break;
1185 }
1186 }
1187 }
setAuthor($author="")
Sets the authors name of the ilObjSurvey object.
setActivationVisibility($a_value)
setTutorResultsStatus($a_value)
setTutorNotificationStatus($a_value)
setActivationStartDate($starting_time=null)
setMailOwnResults($a_value)
setActivationLimited($a_value)
setTutorNotificationTarget($a_value)
setMailAddresses($a_addresses)
setSkillService($a_val)
Set skill service.
setSelfEvaluationResults($a_value)
setActivationEndDate($ending_time=null)
setTutorResultsRecipients(array $a_value)
setSurveyId($survey_id)
Sets the survey id.
setReminderStart(ilDate $a_value=null)
setMailConfirmation($a_value)
setMailNotification($a_notification)
setReminderTemplate($a_value)
setMailParticipantData($a_data)
set360Results($a_value)
setViewOwnResults($a_value)
setStartDate($start_date="")
Sets the start date of the survey.
set360SelfEvaluation($a_value)
setTutorNotificationRecipients(array $a_value)
setReminderTarget($a_value)
setCalculateSumScore(bool $a_val)
Set calculate sum score.
setReminderStatus($a_value)
set360SelfAppraisee($a_value)
setReminderEnd(ilDate $a_value=null)
setEndDate($end_date="")
Sets the end date of the survey.
setReminderFrequency($a_value)
set360SelfRaters($a_value)

References $data, ilObject\$db, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), ilObject\getId(), ilObjectActivation\getItem(), IL_CAL_DATE, loadQuestionsFromDb(), 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(), setTemplate(), setTutorNotificationRecipients(), setTutorNotificationStatus(), setTutorNotificationTarget(), setTutorResultsRecipients(), setTutorResultsStatus(), setViewOwnResults(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by read().

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

◆ loadQuestionsFromDb()

ilObjSurvey::loadQuestionsFromDb ( )

Loads the survey questions from the database.

@access public

See also
$questions

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

1196 {
1197 $ilDB = $this->db;
1198 $this->questions = array();
1199 $result = $ilDB->queryF(
1200 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1201 array('integer'),
1202 array($this->getSurveyId())
1203 );
1204 while ($data = $ilDB->fetchAssoc($result)) {
1205 $this->questions[$data["sequence"]] = $data["question_fi"];
1206 }
1207 }

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

Referenced by insertQuestion(), and loadFromDb().

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

◆ loadWorkingData()

ilObjSurvey::loadWorkingData (   $question_id,
  $active_id 
)

Gets the working data of question from the database.

Parameters
integer$question_idThe database id of the question
integer$active_idThe active id of the user who worked through the question
Returns
array The resulting database dataset as an array @access public

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

2599 {
2600 $ilDB = $this->db;
2601 $result_array = array();
2602 $result = $ilDB->queryF(
2603 "SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2604 array('integer','integer'),
2605 array($question_id, $active_id)
2606 );
2607 if ($result->numRows() >= 1) {
2608 while ($row = $ilDB->fetchAssoc($result)) {
2609 array_push($result_array, $row);
2610 }
2611 return $result_array;
2612 } else {
2613 return $result_array;
2614 }
2615 }

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

◆ locateImportFiles()

ilObjSurvey::locateImportFiles (   $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) @access private

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

3459 {
3460 if (!is_dir($a_dir) || is_int(strpos($a_dir, ".."))) {
3461 return;
3462 }
3463 $importDirectory = "";
3464 $xmlFile = "";
3465
3466 $current_dir = opendir($a_dir);
3467 $files = array();
3468 while ($entryname = readdir($current_dir)) {
3469 $files[] = $entryname;
3470 }
3471
3472 foreach ($files as $file) {
3473 if (is_dir($a_dir . "/" . $file) and ($file != "." and $file != "..")) {
3474 // found directory created by zip
3475 $importDirectory = $a_dir . "/" . $file;
3476 }
3477 }
3478 closedir($current_dir);
3479 if (strlen($importDirectory)) {
3480 // find the xml file
3481 $current_dir = opendir($importDirectory);
3482 $files = array();
3483 while ($entryname = readdir($current_dir)) {
3484 $files[] = $entryname;
3485 }
3486 foreach ($files as $file) {
3487 if (@is_file($importDirectory . "/" . $file) &&
3488 ($file != "." && $file != "..") &&
3489 (preg_match("/^[0-9]{10}__[0-9]+__(svy_)*[0-9]+\.[A-Za-z]{1,3}$/", $file) ||
3490 preg_match("/^[0-9]{10}__[0-9]+__(survey__)*[0-9]+\.[A-Za-z]{1,3}$/", $file))) {
3491 // found xml file
3492 $xmlFile = $importDirectory . "/" . $file;
3493 }
3494 }
3495 }
3496 return array("dir" => $importDirectory, "xml" => $xmlFile);
3497 }

Referenced by importObject().

+ Here is the caller graph for this function:

◆ modifyQuestionblock()

ilObjSurvey::modifyQuestionblock (   $questionblock_id,
  $title,
  $show_questiontext,
  $show_blocktitle,
  $compress_view = false 
)

Modifies a question block.

Parameters
integer$questionblock_idThe database id of the question block
string$titleThe title of the question block @access public

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

2058 {
2059 $ilDB = $this->db;
2060 $affectedRows = $ilDB->manipulateF(
2061 "UPDATE svy_qblk SET title = %s, show_questiontext = %s," .
2062 " show_blocktitle = %s, compress_view = %s WHERE questionblock_id = %s",
2063 array('text','text','text','integer', 'integer'),
2064 array($title, $show_questiontext, $show_blocktitle, $compress_view, $questionblock_id)
2065 );
2066 }

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

◆ moveQuestions()

ilObjSurvey::moveQuestions (   $move_questions,
  $target_index,
  $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
integer$target_indexThe question id of the target position
integer$insert_mode0, if insert before the target position, 1 if insert after the target position @access public

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

1686 {
1687 $this->svy_log->debug("move_questions: " . print_r($move_questions, true) .
1688 ", target_index: " . $target_index . ", insert_mode: " . $insert_mode);
1689 $array_pos = array_search($target_index, $this->questions);
1690 if ($insert_mode == 0) {
1691 $part1 = array_slice($this->questions, 0, $array_pos);
1692 $part2 = array_slice($this->questions, $array_pos);
1693 } elseif ($insert_mode == 1) {
1694 $part1 = array_slice($this->questions, 0, $array_pos + 1);
1695 $part2 = array_slice($this->questions, $array_pos + 1);
1696 }
1697 $found = 0;
1698 foreach ($move_questions as $question_id) {
1699 if (!(array_search($question_id, $part1) === false)) {
1700 unset($part1[array_search($question_id, $part1)]);
1701 $found++;
1702 }
1703 if (!(array_search($question_id, $part2) === false)) {
1704 unset($part2[array_search($question_id, $part2)]);
1705 $found++;
1706 }
1707 }
1708 // sanity check: do not move questions if they have not be found in the array
1709 if ($found != count($move_questions)) {
1710 return;
1711 }
1712 $part1 = array_values($part1);
1713 $part2 = array_values($part2);
1714 $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1715 foreach ($move_questions as $question_id) {
1716 $constraints = $this->getConstraints($question_id);
1717 foreach ($constraints as $idx => $constraint) {
1718 foreach ($part2 as $next_question_id) {
1719 if ($constraint["question"] == $next_question_id) {
1720 // constraint concerning a question that follows -> delete constraint
1721 $this->deleteConstraint($constraint["id"]);
1722 }
1723 }
1724 }
1725 }
1726 $this->saveQuestionsToDb();
1727 }
saveQuestionsToDb()
Saves the survey questions to the database.

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

Referenced by createQuestionblock().

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

◆ openAllAppraisees()

ilObjSurvey::openAllAppraisees ( )

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

5512 {
5513 $ilDB = $this->db;
5514
5515 $ilDB->manipulate("UPDATE svy_360_appr" .
5516 " SET has_closed = " . $ilDB->quote(null, "integer") .
5517 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer"));
5518 }

References ilObject\$db, and $ilDB.

◆ prepareTextareaOutput()

ilObjSurvey::prepareTextareaOutput (   $txt_output)

Prepares a string for a text area output in surveys.

Parameters
string$txt_outputString which should be prepared for output @access public

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

4459 {
4460 return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
4461 }
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...

References ilUtil\prepareTextareaOutput().

+ Here is the call graph for this function:

◆ processPrintoutput2FO()

ilObjSurvey::processPrintoutput2FO (   $print_output)

Convert a print output to XSL-FO.

Parameters
string$print_outputThe print output
Returns
string XSL-FO code @access public

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

4546 {
4547 if (extension_loaded("tidy")) {
4548 $config = array(
4549 "indent" => false,
4550 "output-xml" => true,
4551 "numeric-entities" => true
4552 );
4553 $tidy = new tidy();
4554 $tidy->parseString($print_output, $config, 'utf8');
4555 $tidy->cleanRepair();
4556 $print_output = tidy_get_output($tidy);
4557 $print_output = preg_replace("/^.*?(<html)/", "\\1", $print_output);
4558 } else {
4559 $print_output = str_replace("&nbsp;", "&#160;", $print_output);
4560 $print_output = str_replace("&otimes;", "X", $print_output);
4561
4562 // #17680 - metric questions use &#160; in print view
4563 $print_output = str_replace("&gt;", "~|gt|~", $print_output); // see #21550
4564 $print_output = str_replace("&lt;", "~|lt|~", $print_output);
4565 $print_output = str_replace("&#160;", "~|nbsp|~", $print_output);
4566 $print_output = preg_replace('/&(?!amp)/', '&amp;', $print_output);
4567 $print_output = str_replace("~|nbsp|~", "&#160;", $print_output);
4568 $print_output = str_replace("~|gt|~", "&gt;", $print_output);
4569 $print_output = str_replace("~|lt|~", "&lt;", $print_output);
4570 }
4571 $xsl = file_get_contents("./Modules/Survey/xml/question2fo.xsl");
4572
4573 // additional font support
4574 $xsl = str_replace(
4575 'font-family="Helvetica, unifont"',
4576 'font-family="' . $GLOBALS['ilSetting']->get('rpc_pdf_font', 'Helvetica, unifont') . '"',
4577 $xsl
4578 );
4579 $args = array( '/_xml' => $print_output, '/_xsl' => $xsl );
4580 $xh = xslt_create();
4581 $params = array();
4582 try {
4583 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
4584 } catch (Exception $e) {
4585 $this->svy_log->error("Print XSLT failed:");
4586 $this->svy_log->error("Content: " . $print_output);
4587 $this->svy_log->error("Xsl: " . $xsl);
4588 throw ($e);
4589 }
4590 xslt_error($xh);
4591 xslt_free($xh);
4592
4593 return $output;
4594 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()

References $config, Vendor\Package\$e, $GLOBALS, xslt_create(), xslt_error(), and xslt_free().

+ Here is the call graph for this function:

◆ read()

ilObjSurvey::read ( )

read object data from db into object @access public

Reimplemented from ilObject.

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

303 {
304 parent::read();
305 $this->loadFromDb();
306 }
loadFromDb()
Loads a survey object from a database.

References loadFromDb().

+ Here is the call graph for this function:

◆ removeConstraintsConcerningQuestion()

ilObjSurvey::removeConstraintsConcerningQuestion (   $question_id)

Remove constraints concerning a question with a given question_id.

Parameters
integer$question_idThe database id of the question @access public

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

1752 {
1753 $ilDB = $this->db;
1754 $result = $ilDB->queryF(
1755 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1756 array('integer','integer'),
1757 array($question_id, $this->getSurveyId())
1758 );
1759 if ($result->numRows() > 0) {
1760 $remove_constraints = array();
1761 while ($row = $ilDB->fetchAssoc($result)) {
1762 array_push($remove_constraints, $row["constraint_fi"]);
1763 }
1764 $affectedRows = $ilDB->manipulateF(
1765 "DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1766 array('integer','integer'),
1767 array($question_id, $this->getSurveyId())
1768 );
1769 foreach ($remove_constraints as $key => $constraint_id) {
1770 $affectedRows = $ilDB->manipulateF(
1771 "DELETE FROM svy_constraint WHERE constraint_id = %s",
1772 array('integer'),
1773 array($constraint_id)
1774 );
1775 }
1776 }
1777 }

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

Referenced by removeQuestion().

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

◆ removeQuestion()

ilObjSurvey::removeQuestion (   $question_id)

Remove a question from the survey.

Parameters
integer$question_idThe database id of the question @access public

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

1736 {
1737 $question = self::_instanciateQuestion($question_id);
1738 #20610 if no question found, do nothing.
1739 if ($question) {
1740 $question->delete($question_id);
1741 $this->removeConstraintsConcerningQuestion($question_id);
1742 }
1743 }
removeConstraintsConcerningQuestion($question_id)
Remove constraints concerning a question with a given question_id.

References _instanciateQuestion(), and removeConstraintsConcerningQuestion().

Referenced by delete(), and removeQuestions().

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

◆ removeQuestionFromBlock()

ilObjSurvey::removeQuestionFromBlock (   $question_id,
  $questionblock_id 
)

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

1848 {
1849 $ilDB = $this->db;
1850
1851 $affectedRows = $ilDB->manipulateF(
1852 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
1853 array('integer','integer','integer'),
1854 array($questionblock_id, $this->getSurveyId(), $question_id)
1855 );
1856 }

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

+ Here is the call graph for this function:

◆ removeQuestions()

ilObjSurvey::removeQuestions (   $remove_questions,
  $remove_questionblocks 
)

Remove questions from the survey.

Parameters
array$remove_questionsAn array with the question id's of the questions to remove
array$remove_questionblocksAn array with the questionblock id's of the questions blocks to remove @access public

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

1787 {
1788 $ilDB = $this->db;
1789
1790 $block_sizes = array();
1791 foreach ($this->getSurveyQuestions() as $question_id => $data) {
1792 if (in_array($question_id, $remove_questions) or in_array($data["questionblock_id"], $remove_questionblocks)) {
1793 unset($this->questions[array_search($question_id, $this->questions)]);
1794 $this->removeQuestion($question_id);
1795 } elseif ($data["questionblock_id"]) {
1796 $block_sizes[$data["questionblock_id"]]++;
1797 }
1798 }
1799
1800 // blocks with just 1 question need to be deleted
1801 foreach ($block_sizes as $block_id => $size) {
1802 if ($size < 2) {
1803 $remove_questionblocks[] = $block_id;
1804 }
1805 }
1806
1807 foreach (array_unique($remove_questionblocks) as $questionblock_id) {
1808 $affectedRows = $ilDB->manipulateF(
1809 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1810 array('integer'),
1811 array($questionblock_id)
1812 );
1813 $affectedRows = $ilDB->manipulateF(
1814 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1815 array('integer','integer'),
1816 array($questionblock_id, $this->getSurveyId())
1817 );
1818 }
1819
1820 $this->questions = array_values($this->questions);
1821 $this->saveQuestionsToDb();
1822 }
$size
Definition: RandomTest.php:84

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

+ Here is the call graph for this function:

◆ removeSelectedSurveyResults()

ilObjSurvey::removeSelectedSurveyResults (   $finished_ids)

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

@access public

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

458 {
460
461 $user_ids = array();
462
463 foreach ($finished_ids as $finished_id) {
464 $result = $ilDB->queryF(
465 "SELECT finished_id, user_fi FROM svy_finished WHERE finished_id = %s",
466 array('integer'),
467 array($finished_id)
468 );
469 $row = $ilDB->fetchAssoc($result);
470
471 if ($row["user_fi"]) {
472 $user_ids[] = (int) $row["user_fi"];
473 }
474
475 $affectedRows = $ilDB->manipulateF(
476 "DELETE FROM svy_answer WHERE active_fi = %s",
477 array('integer'),
478 array($row["finished_id"])
479 );
480
481 $affectedRows = $ilDB->manipulateF(
482 "DELETE FROM svy_finished WHERE finished_id = %s",
483 array('integer'),
484 array($finished_id)
485 );
486
487 $affectedRows = $ilDB->manipulateF(
488 "DELETE FROM svy_times WHERE finished_fi = %s",
489 array('integer'),
490 array($row["finished_id"])
491 );
492 }
493
494 if (sizeof($user_ids)) {
495 $lp_obj = ilObjectLP::getInstance($this->getId());
496 $lp_obj->resetLPDataForUserIds($user_ids);
497 }
498 }

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

Referenced by deleteRater().

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

◆ saveAuthorToMetadata()

ilObjSurvey::saveAuthorToMetadata (   $a_author = "")

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

Parameters
string$a_authorA string containing the name of the test author @access private
See also
$author

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

1286 {
1287 $md = new ilMD($this->getId(), 0, $this->getType());
1288 $md_life = &$md->getLifecycle();
1289 if (!$md_life) {
1290 if (strlen($a_author) == 0) {
1292 $a_author = $ilUser->getFullname();
1293 }
1294
1295 $md_life = &$md->addLifecycle();
1296 $md_life->save();
1297 $con = &$md_life->addContribute();
1298 $con->setRole("Author");
1299 $con->save();
1300 $ent = &$con->addEntity();
1301 $ent->setEntity($a_author);
1302 $ent->save();
1303 }
1304 }

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

Referenced by createMetaData().

+ 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.

@access public

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

565 {
567
568 $complete = 0;
569 if ($this->isComplete()) {
570 $complete = 1;
571 }
572 if ($this->getSurveyId() > 0) {
573 $affectedRows = $ilDB->manipulateF(
574 "UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
575 array('text','integer','integer'),
576 array($this->isComplete(), time(), $this->getSurveyId())
577 );
578 }
579 }
isComplete()
Returns 1, if a survey is complete for use.

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

+ Here is the call graph for this function:

◆ saveHeading()

ilObjSurvey::saveHeading (   $heading = "",
  $insertbefore 
)

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

3939 {
3940 $ilDB = $this->db;
3941 if ($heading) {
3942 $affectedRows = $ilDB->manipulateF(
3943 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3944 array('text','integer','integer'),
3945 array($heading, $this->getSurveyId(), $insertbefore)
3946 );
3947 } else {
3948 $affectedRows = $ilDB->manipulateF(
3949 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3950 array('text','integer','integer'),
3951 array(null, $this->getSurveyId(), $insertbefore)
3952 );
3953 }
3954 }

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

Referenced by cloneTextblocks().

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

◆ saveQuestionsToDb()

ilObjSurvey::saveQuestionsToDb ( )

Saves the survey questions to the database.

@access public

See also
$questions

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

898 {
900
901 $this->svy_log->debug("save questions");
902
903 // gather old questions state
904 $old_questions = array();
905 $result = $ilDB->queryF(
906 "SELECT survey_question_id,question_fi,sequence" .
907 " FROM svy_svy_qst WHERE survey_fi = %s",
908 array('integer'),
909 array($this->getSurveyId())
910 );
911 while ($row = $ilDB->fetchAssoc($result)) {
912 $old_questions[$row["question_fi"]] = $row; // problem, as soon as duplicates exist, they will be hidden here
913 }
914
915 // #15231 - diff with current questions state
916 $insert = $update = $delete = array();
917 foreach ($this->questions as $seq => $fi) {
918 if (!array_key_exists($fi, $old_questions)) { // really new fi IDs
919 $insert[] = $fi; // this should be ok, should not create duplicates here
920 } elseif ($old_questions[$fi]["sequence"] != $seq) { // we are updating one of the duplicates (if any)
921 $update[$fi] = $old_questions[$fi]["survey_question_id"];
922 }
923 // keep track of still relevant questions
924 unset($old_questions[$fi]); // deleting old question, if they are not in current array
925 }
926
927 // delete obsolete question relations
928 if (sizeof($old_questions)) {
929 $del_ids = array();
930 foreach ($old_questions as $fi => $old) {
931 $del_ids[] = $old["survey_question_id"];
932 }
933 $ilDB->manipulate($q = "DELETE FROM svy_svy_qst" .
934 " WHERE " . $ilDB->in("survey_question_id", $del_ids, "", "integer"));
935 $this->svy_log->debug("delete: " . $q);
936 }
937 unset($old_questions);
938
939 // create/update question relations
940 foreach ($this->questions as $seq => $fi) {
941 if (in_array($fi, $insert)) {
942 // check if question is not already in the survey, see #22018
943 if (!$this->isQuestionInSurvey($fi)) {
944 $next_id = $ilDB->nextId('svy_svy_qst');
945 $ilDB->manipulateF(
946 "INSERT INTO svy_svy_qst" .
947 " (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp)" .
948 " VALUES (%s, %s, %s, %s, %s, %s)",
949 array('integer', 'integer', 'integer', 'text', 'integer', 'integer'),
950 array($next_id, $this->getSurveyId(), $fi, null, $seq, time())
951 );
952 $this->svy_log->debug("insert svy_svy_qst, id:" . $next_id . ", fi: " . $fi . ", seq:" . $seq);
953 }
954 } elseif (array_key_exists($fi, $update)) {
955 $ilDB->manipulate("UPDATE svy_svy_qst" .
956 " SET sequence = " . $ilDB->quote($seq, "integer") .
957 ", tstamp = " . $ilDB->quote(time(), "integer") .
958 " WHERE survey_question_id = " . $ilDB->quote($update[$fi], "integer"));
959 $this->svy_log->debug("update svy_svy_qst, id:" . $update[$fi] . ", fi: " . $fi . ", seq:" . $seq);
960 }
961 }
962 }

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

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

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

◆ saveToDb()

ilObjSurvey::saveToDb ( )

Saves a survey object to a database.

@access public

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

753 {
755
756 // date handling
757 $rmd_start = $this->getReminderStart();
758 if (is_object($rmd_start)) {
759 $rmd_start = $rmd_start->get(IL_CAL_DATE);
760 }
761 $rmd_end = $this->getReminderEnd();
762 if (is_object($rmd_end)) {
763 $rmd_end = $rmd_end->get(IL_CAL_DATE);
764 }
765
766 if ($this->getSurveyId() < 1) {
767 $next_id = $ilDB->nextId('svy_svy');
768 $affectedRows = $ilDB->insert("svy_svy", array(
769 "survey_id" => array("integer", $next_id),
770 "obj_fi" => array("integer", $this->getId()),
771 "author" => array("text", $this->getAuthor()),
772 "introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
773 "outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
774 "startdate" => array("text", $this->getStartDate()),
775 "enddate" => array("text", $this->getEndDate()),
776 "evaluation_access" => array("text", $this->getEvaluationAccess()),
777 "complete" => array("text", $this->isComplete()),
778 "created" => array("integer", time()),
779 "anonymize" => array("text", $this->getAnonymize()),
780 "show_question_titles" => array("text", $this->getShowQuestionTitles()),
781 "mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
782 "mailaddresses" => array('text', strlen($this->getMailAddresses()) ? $this->getMailAddresses() : null),
783 "mailparticipantdata" => array('text', strlen($this->getMailParticipantData()) ? $this->getMailParticipantData() : null),
784 "tstamp" => array("integer", time()),
785 "template_id" => array("integer", $this->getTemplate()),
786 "pool_usage" => array("integer", $this->getPoolUsage()),
787 // Mode type
788 "mode" => array("integer", $this->getMode()),
789 // 360°
790 "mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
791 "mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
792 "mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
793 "mode_360_results" => array("integer", $this->get360Results()),
794 // competences
795 "mode_skill_service" => array("integer", (int) $this->getSkillService()),
796 // Self Evaluation Only
797 "mode_self_eval_results" => array("integer", ilObjSurvey::RESULTS_SELF_EVAL_OWN),
798 // reminder/notification
799 "reminder_status" => array("integer", (int) $this->getReminderStatus()),
800 "reminder_start" => array("datetime", $rmd_start),
801 "reminder_end" => array("datetime", $rmd_end),
802 "reminder_frequency" => array("integer", (int) $this->getReminderFrequency()),
803 "reminder_target" => array("integer", (int) $this->getReminderTarget()),
804 "reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
805 "reminder_tmpl" => array("text", $this->getReminderTemplate(true)),
806 "tutor_ntf_status" => array("integer", (int) $this->getTutorNotificationStatus()),
807 "tutor_ntf_reci" => array("text", implode(";", (array) $this->getTutorNotificationRecipients())),
808 "tutor_ntf_target" => array("integer", (int) $this->getTutorNotificationTarget()),
809 "own_results_view" => array("integer", $this->hasViewOwnResults()),
810 "own_results_mail" => array("integer", $this->hasMailOwnResults()),
811 "tutor_res_status" => array("integer", (int) $this->getTutorResultsStatus()),
812 "tutor_res_reci" => array("text", implode(";", (array) $this->getTutorResultsRecipients())),
813 "confirmation_mail" => array("integer", $this->hasMailConfirmation()),
814 "anon_user_list" => array("integer", $this->hasAnonymousUserList()),
815 "calculate_sum_score" => array("integer", $this->getCalculateSumScore())
816 ));
817 $this->setSurveyId($next_id);
818 } else {
819 $affectedRows = $ilDB->update("svy_svy", array(
820 "author" => array("text", $this->getAuthor()),
821 "introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
822 "outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
823 "startdate" => array("text", $this->getStartDate()),
824 "enddate" => array("text", $this->getEndDate()),
825 "evaluation_access" => array("text", $this->getEvaluationAccess()),
826 "complete" => array("text", $this->isComplete()),
827 "anonymize" => array("text", $this->getAnonymize()),
828 "show_question_titles" => array("text", $this->getShowQuestionTitles()),
829 "mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
830 "mailaddresses" => array('text', strlen($this->getMailAddresses()) ? $this->getMailAddresses() : null),
831 "mailparticipantdata" => array('text', strlen($this->getMailParticipantData()) ? $this->getMailParticipantData() : null),
832 "tstamp" => array("integer", time()),
833 "template_id" => array("integer", $this->getTemplate()),
834 "pool_usage" => array("integer", $this->getPoolUsage()),
835 //MODE TYPE
836 "mode" => array("integer", $this->getMode()),
837 // 360°
838 "mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
839 "mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
840 "mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
841 "mode_360_results" => array("integer", $this->get360Results()),
842 // Competences
843 "mode_skill_service" => array("integer", (int) $this->getSkillService()),
844 // Self Evaluation Only
845 "mode_self_eval_results" => array("integer", $this->getSelfEvaluationResults()),
846 // reminder/notification
847 "reminder_status" => array("integer", $this->getReminderStatus()),
848 "reminder_start" => array("datetime", $rmd_start),
849 "reminder_end" => array("datetime", $rmd_end),
850 "reminder_frequency" => array("integer", $this->getReminderFrequency()),
851 "reminder_target" => array("integer", $this->getReminderTarget()),
852 "reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
853 "reminder_tmpl" => array("text", $this->getReminderTemplate()),
854 "tutor_ntf_status" => array("integer", $this->getTutorNotificationStatus()),
855 "tutor_ntf_reci" => array("text", implode(";", (array) $this->getTutorNotificationRecipients())),
856 "tutor_ntf_target" => array("integer", $this->getTutorNotificationTarget()),
857 "own_results_view" => array("integer", $this->hasViewOwnResults()),
858 "own_results_mail" => array("integer", $this->hasMailOwnResults()),
859 "tutor_res_status" => array("integer", (int) $this->getTutorResultsStatus()),
860 "tutor_res_reci" => array("text", implode(";", (array) $this->getTutorResultsRecipients())),
861 "confirmation_mail" => array("integer", $this->hasMailConfirmation()),
862 "anon_user_list" => array("integer", $this->hasAnonymousUserList()),
863 "calculate_sum_score" => array("integer", $this->getCalculateSumScore())
864 ), array(
865 "survey_id" => array("integer", $this->getSurveyId())
866 ));
867 }
868 if ($affectedRows) {
869 // save questions to db
870 $this->saveQuestionsToDb();
871 }
872
873 // moved activation to ilObjectActivation
874 if ($this->ref_id) {
875 ilObjectActivation::getItem($this->ref_id);
876
877 $item = new ilObjectActivation;
878 if (!$this->isActivationLimited()) {
880 } else {
881 $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
882 $item->setTimingStart($this->getActivationStartDate());
883 $item->setTimingEnd($this->getActivationEndDate());
884 $item->toggleVisible($this->getActivationVisibility());
885 }
886
887 $item->update($this->ref_id);
888 }
889 }
getCalculateSumScore()
Get calculate sum score.
getReminderTemplate($selectDefault=false)
getEvaluationAccess()
Gets the learners evaluation access.
getAuthor()
Gets the authors name of the ilObjSurvey object.
getShowQuestionTitles()
Gets the status of the display_question_titles attribute.
Class ilObjectActivation.
setTimingType($a_type)
Set timing type.

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(), getPoolUsage(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderStart(), getReminderStatus(), getReminderTarget(), getReminderTemplate(), getSelfEvaluationResults(), getShowQuestionTitles(), getSkillService(), getStartDate(), getSurveyId(), getTemplate(), getTutorNotificationRecipients(), getTutorNotificationStatus(), getTutorNotificationTarget(), getTutorResultsRecipients(), getTutorResultsStatus(), hasAnonymousUserList(), hasMailConfirmation(), hasMailOwnResults(), hasViewOwnResults(), IL_CAL_DATE, isActivationLimited(), isComplete(), RESULTS_SELF_EVAL_OWN, saveQuestionsToDb(), setSurveyId(), ilObjectActivation\setTimingType(), ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

Referenced by applySettingsTemplate(), checkReminder(), createReference(), and importObject().

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

◆ saveUserAccessCode()

ilObjSurvey::saveUserAccessCode (   $user_id,
  $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

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

4390 {
4391 $ilDB = $this->db;
4392
4393 // not really sure what to do about ANONYMOUS_USER_ID
4394
4395 $next_id = $ilDB->nextId('svy_anonymous');
4396 $affectedRows = $ilDB->manipulateF(
4397 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) " .
4398 "VALUES (%s, %s, %s, %s, %s)",
4399 array('integer','text', 'integer', 'text', 'integer'),
4400 array($next_id, $access_code, $this->getSurveyId(), md5($user_id), time())
4401 );
4402 }

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

Referenced by getUserSurveyExecutionStatus().

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

◆ saveUserSettings()

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

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

704 {
706
707 $next_id = $ilDB->nextId('svy_settings');
708 $affectedRows = $ilDB->insert("svy_settings", array(
709 "settings_id" => array("integer", $next_id),
710 "usr_id" => array("integer", $usr_id),
711 "keyword" => array("text", $key),
712 "title" => array("text", $title),
713 "value" => array("clob", $value)
714 ));
715 }

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

◆ send360ReminderToUser()

ilObjSurvey::send360ReminderToUser (   $a_user_id,
  $a_appraisee_ids 
)

Send rater notification.

Parameters
int$a_user_iduser id

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

5772 {
5773 $this->svy_log->debug("Send mail to:" . $a_user_id);
5774
5775 $ntf = new ilSystemNotification();
5776 $ntf->setLangModules(array("svy", "survey"));
5777 $ntf->setRefId($this->getRefId());
5778 $ntf->setGotoLangId('url');
5779
5780 // user specific language
5781 $lng = $ntf->getUserLanguage($a_user_id);
5782
5783 $ntf->setIntroductionLangId("svy_user_added_360_rater_reminder_mail");
5784 $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_360_rater"));
5785
5786 foreach ($a_appraisee_ids as $appraisee_id) {
5787 $ntf->addAdditionalInfo("survey_360_appraisee", ilUserUtil::getNamePresentation($appraisee_id, false, false, "", true));
5788 }
5789
5790 // #10044
5791 $mail = new ilMail(ANONYMOUS_USER_ID);
5792 $mail->enqueue(
5793 ilObjUser::_lookupLogin($a_user_id),
5794 null,
5795 null,
5796 $subject,
5797 $ntf->composeAndGetMessage($a_user_id, null, "read", true),
5798 []
5799 );
5800 }
Wrapper classes for system notifications.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

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

Referenced by sent360Reminders().

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

◆ sendAppraiseeCloseNotification()

ilObjSurvey::sendAppraiseeCloseNotification (   $a_user_id)

Send appraisee notification.

Parameters
int$a_user_iduser id

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

5005 {
5006 $ntf = new ilSystemNotification();
5007 $ntf->setLangModules(array("svy", "survey"));
5008 $ntf->setRefId($this->getRefId());
5009 $ntf->setGotoLangId('url');
5010
5011 // user specific language
5012 $lng = $ntf->getUserLanguage($a_user_id);
5013
5014 $ntf->setIntroductionLangId("svy_user_added_360_appraisee_close_mail");
5015 $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_360_appraisee"));
5016
5017 // #10044
5018 $mail = new ilMail(ANONYMOUS_USER_ID);
5019 $mail->enqueue(
5020 ilObjUser::_lookupLogin($a_user_id),
5021 null,
5022 null,
5023 $subject,
5024 $ntf->composeAndGetMessage($a_user_id, null, "read", true),
5025 []
5026 );
5027 }

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilObject\getRefId(), and ilObject\getTitle().

Referenced by closeAppraisee().

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

◆ sendAppraiseeNotification()

ilObjSurvey::sendAppraiseeNotification (   $a_user_id)

Send appraisee notification.

Parameters
int$a_user_iduser id

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

4975 {
4976 $ntf = new ilSystemNotification();
4977 $ntf->setLangModules(array("svy", "survey"));
4978 $ntf->setRefId($this->getRefId());
4979 $ntf->setGotoLangId('url');
4980
4981 // user specific language
4982 $lng = $ntf->getUserLanguage($a_user_id);
4983
4984 $ntf->setIntroductionLangId("svy_user_added_360_appraisee_mail");
4985 $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_360_appraisee"));
4986
4987 // #10044
4988 $mail = new ilMail(ANONYMOUS_USER_ID);
4989 $mail->enqueue(
4990 ilObjUser::_lookupLogin($a_user_id),
4991 null,
4992 null,
4993 $subject,
4994 $ntf->composeAndGetMessage($a_user_id, null, "read", true),
4995 []
4996 );
4997 }

References ilObject\$lng, ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilObject\getRefId(), and ilObject\getTitle().

Referenced by addAppraisee().

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

◆ sendCodes()

ilObjSurvey::sendCodes (   $not_sent,
  $subject,
  $message,
  $lang 
)

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

4222 {
4223 global $DIC;
4224 /*
4225 * 0 = all
4226 * 1 = not sent
4227 * 2 = finished
4228 * 3 = not finished
4229 */
4230 $check_finished = ($not_sent > 1);
4231
4232
4233 $mail = new ilMail(ANONYMOUS_USER_ID);
4234 $recipients = $this->getExternalCodeRecipients($check_finished);
4235 foreach ($recipients as $data) {
4236 if ($data['email'] && $data['code']) {
4237 $do_send = false;
4238 switch ((int) $not_sent) {
4239 case 1:
4240 $do_send = !(bool) $data['sent'];
4241 break;
4242
4243 case 2:
4244 $do_send = $data['finished'];
4245 break;
4246
4247 case 3:
4248 $do_send = !$data['finished'];
4249 break;
4250
4251 default:
4252 $do_send = true;
4253 break;
4254 }
4255 if ($do_send) {
4256 // build text
4257 $messagetext = $message;
4259 $this->getRefId(),
4260 "svy",
4261 array(
4262 "accesscode" => $data["code"],
4263 "lang" => $lang
4264 )
4265 );
4266 $messagetext = str_replace('[url]', $url, $messagetext);
4267 foreach ($data as $key => $value) {
4268 $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
4269 }
4270
4271 // send mail
4272 $mail->enqueue(
4273 $data['email'], // to
4274 "", // cc
4275 "", // bcc
4276 $subject, // subject
4277 $messagetext, // message
4278 array() // attachments
4279 );
4280 }
4281 }
4282 }
4283
4284 $ilDB = $this->db;
4285 $ilDB->manipulateF(
4286 "UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
4287 array('integer','integer'),
4288 array(1, $this->getSurveyId())
4289 );
4290 }
getExternalCodeRecipients($a_check_finished=false)
$url
$message
Definition: xapiexit.php:14

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

+ Here is the call graph for this function:

◆ sendNotificationMail()

ilObjSurvey::sendNotificationMail (   $a_user_id,
  $a_anonymize_id,
  $a_appr_id 
)
Parameters
$a_user_iduser who did the survey
$a_anonymize_id
$a_appr_id

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

2697 {
2698 // #12755
2699 $placeholders = array(
2700 "FIRST_NAME" => "firstname",
2701 "LAST_NAME" => "lastname",
2702 "LOGIN" => "login",
2703 // old style
2704 "firstname" => "firstname"
2705 );
2706
2707 //mailaddresses is just text split by commas.
2708 //sendMail can send emails if it gets an user id or an email as first parameter.
2709 $recipients = preg_split('/,/', $this->mailaddresses);
2710 foreach ($recipients as $recipient) {
2711 // #11298
2712 $ntf = new ilSystemNotification();
2713 $ntf->setLangModules(array("survey"));
2714 $ntf->setRefId($this->getRefId());
2715 $ntf->setSubjectLangId('finished_mail_subject');
2716
2717 $messagetext = $this->mailparticipantdata;
2718 if (trim($messagetext)) {
2719 if (!$this->hasAnonymizedResults()) {
2720 $data = ilObjUser::_getUserData(array($a_user_id));
2721 $data = $data[0];
2722 }
2723 foreach ($placeholders as $key => $mapping) {
2724 if ($this->hasAnonymizedResults()) { // #16480
2725 $messagetext = str_replace('[' . $key . ']', '', $messagetext);
2726 } else {
2727 $messagetext = str_replace('[' . $key . ']', trim($data[$mapping]), $messagetext);
2728 }
2729 }
2730 $ntf->setIntroductionDirect($messagetext);
2731 } else {
2732 $ntf->setIntroductionLangId('survey_notification_finished_introduction');
2733 }
2734
2735 // 360°? add appraisee data
2736 if ($a_appr_id) {
2737 $ntf->addAdditionalInfo(
2738 'survey_360_appraisee',
2740 );
2741 }
2742
2743 $active_id = $this->getActiveID($a_user_id, $a_anonymize_id, $a_appr_id);
2744 $ntf->addAdditionalInfo(
2745 'results',
2746 $this->getParticipantTextResults($active_id),
2747 true
2748 );
2749
2750 $ntf->setGotoLangId('survey_notification_tutor_link');
2751 $ntf->setReasonLangId('survey_notification_finished_reason');
2752
2753 if (is_numeric($recipient)) {
2754 $lng = $ntf->getUserLanguage($recipient);
2755 $ntf->sendMail(array($recipient), null, null);
2756 } else {
2757 $recipient = trim($recipient);
2758 $user_ids = ilObjUser::getUserIdsByEmail($recipient);
2759 if (empty($user_ids)) {
2760 $ntf->sendMail(array($recipient), null, null);
2761 } else {
2762 foreach ($user_ids as $user_id) {
2763 $lng = $ntf->getUserLanguage($user_id);
2764 $ntf->sendMail(array($user_id), null, null);
2765 }
2766 }
2767 }
2768 }
2769 }
getParticipantTextResults($active_id)
getActiveID($user_id, $anonymize_id, $appr_id)
Checks if a user already started a survey.
static _getUserData($a_internalids)
return user data for given user ids
static getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.

References $data, ilObject\$lng, $mailparticipantdata, ilObjUser\_getUserData(), getActiveID(), ilUserUtil\getNamePresentation(), getParticipantTextResults(), ilObject\getRefId(), ilObjUser\getUserIdsByEmail(), and hasAnonymizedResults().

+ Here is the call graph for this function:

◆ sendRaterNotification()

ilObjSurvey::sendRaterNotification (   $a_user_id,
  $a_appraisee_id 
)

Send rater notification.

Parameters
int$a_user_iduser id

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

5035 {
5036 $ntf = new ilSystemNotification();
5037 $ntf->setLangModules(array("svy", "survey"));
5038 $ntf->setRefId($this->getRefId());
5039 $ntf->setGotoLangId('url');
5040
5041 // user specific language
5042 $lng = $ntf->getUserLanguage($a_user_id);
5043
5044 $ntf->setIntroductionLangId("svy_user_added_360_rater_mail");
5045 $subject = str_replace("%1", $this->getTitle(), $lng->txt("svy_user_added_360_rater"));
5046 $ntf->addAdditionalInfo("survey_360_appraisee", ilUserUtil::getNamePresentation($a_appraisee_id, false, false, "", true));
5047
5048 // #10044
5049 $mail = new ilMail(ANONYMOUS_USER_ID);
5050 $mail->enqueue(
5051 ilObjUser::_lookupLogin($a_user_id),
5052 null,
5053 null,
5054 $subject,
5055 $ntf->composeAndGetMessage($a_user_id, null, "read", true),
5056 []
5057 );
5058 }

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

Referenced by addRater().

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

◆ sendTutorNotification()

ilObjSurvey::sendTutorNotification ( )
protected

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

5826 {
5827 $link = ilLink::_getStaticLink($this->getRefId(), "svy");
5828
5829 foreach ($this->getTutorNotificationRecipients() as $user_id) {
5830 // use language of recipient to compose message
5831 $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
5832 $ulng->loadLanguageModule('survey');
5833
5834 $subject = sprintf($ulng->txt('survey_notification_tutor_subject'), $this->getTitle());
5835 $message = sprintf($ulng->txt('survey_notification_tutor_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
5836
5837 $message .= $ulng->txt('survey_notification_tutor_body') . ":\n\n";
5838 $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
5839 $message .= "\n" . $ulng->txt('survey_notification_tutor_link') . ": " . $link;
5840
5841 $mail_obj = new ilMail(ANONYMOUS_USER_ID);
5842 $mail_obj->appendInstallationSignature(true);
5843 $mail_obj->enqueue(
5844 ilObjUser::_lookupLogin($user_id),
5845 "",
5846 "",
5847 $subject,
5848 $message,
5849 array()
5850 );
5851 }
5852 }
static _getLanguageOfUser($a_usr_id)
Get language object of user.

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

Referenced by checkTutorNotification().

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

◆ sendTutorResults()

ilObjSurvey::sendTutorResults ( )

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

6172 {
6173 global $ilCtrl, $ilDB;
6174
6176
6177 include_once "./Services/Mail/classes/class.ilMail.php";
6178 include_once "./Services/User/classes/class.ilObjUser.php";
6179 include_once "./Services/Language/classes/class.ilLanguageFactory.php";
6180 include_once "./Services/User/classes/class.ilUserUtil.php";
6181
6182 include_once "./Services/Link/classes/class.ilLink.php";
6183 $link = ilLink::_getStaticLink($this->getRefId(), "svy");
6184
6185 // somehow needed in cron-calls
6186 //$ilCtrl->setTargetScript("ilias.php");
6187 //$ilCtrl->initBaseClass("ilobjsurveygui");
6188
6189 // yeah, I know...
6190 $old_ref_id = $_GET["ref_id"];
6191 $old_base_class = $_GET["baseClass"];
6192 $_GET["ref_id"] = $this->getRefId();
6193 $ilCtrl->setTargetScript("ilias.php");
6194 $_GET["baseClass"] = "ilObjSurveyGUI";
6195
6196 $ilCtrl->setParameterByClass("ilSurveyEvaluationGUI", "ref_id", $this->getRefId());
6197
6198 try {
6199 $gui = new ilSurveyEvaluationGUI($this);
6200 $html = $gui->evaluation(1, true, true);
6201 } catch (Exception $exception) {
6202 $_GET["ref_id"] = $old_ref_id;
6203 $_GET["baseClass"] = $old_base_class;
6204 throw $exception;
6205 }
6206 $_GET["ref_id"] = $old_ref_id;
6207 $_GET["baseClass"] = $old_base_class;
6208
6209 $html = preg_replace("/\?dummy\=[0-9]+/", "", $html);
6210 $html = preg_replace("/\?vers\=[0-9A-Za-z\-]+/", "", $html);
6211 $html = str_replace('.css$Id$', ".css", $html);
6212 $html = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $html);
6213 $html = preg_replace("/href=\"\\.\\//ims", "href=\"" . ILIAS_HTTP_PATH . "/", $html);
6214
6215 $log->debug("--pdf start, ref id " . $this->getRefId());
6216 $log->debug("html length: " . strlen($html));
6217 $log->debug("html (first 1000 chars): " . substr($html, 0, 1000));
6218 //echo $html; exit;
6219 $pdf_factory = new ilHtmlToPdfTransformerFactory();
6220 $attachment_filename = "survey_" . $this->getRefId() . "_" . (new DateTimeImmutable('now'))->format('Ymd_His') . ".pdf";
6221 $pdf = $pdf_factory->deliverPDFFromHTMLString(
6222 $html,
6223 $attachment_filename,
6225 "Survey",
6226 "Results"
6227 );
6228 $log->debug("--pdf end");
6229
6230 if (!$pdf ||
6231 !file_exists($pdf)) {
6232 return false;
6233 }
6234
6235 // prepare mail attachment
6236 require_once 'Services/Mail/classes/class.ilFileDataMail.php';
6237 $mail_data = new ilFileDataMail(ANONYMOUS_USER_ID);
6238 $mail_data->copyAttachmentFile($pdf, $attachment_filename);
6239
6240 foreach ($this->getTutorResultsRecipients() as $user_id) {
6241 // use language of recipient to compose message
6242 $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
6243 $ulng->loadLanguageModule('survey');
6244
6245 $subject = sprintf($ulng->txt('survey_results_tutor_subject'), $this->getTitle());
6246 $message = sprintf($ulng->txt('survey_notification_tutor_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
6247
6248 $message .= $ulng->txt('survey_results_tutor_body') . ":\n\n";
6249 $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
6250 $message .= "\n" . $ulng->txt('survey_notification_tutor_link') . ": " . $link;
6251
6252 $mail_obj = new ilMail(ANONYMOUS_USER_ID);
6253 $mail_obj->appendInstallationSignature(true);
6254 $log->debug("send mail to user id: " . $user_id . ",login: " . ilObjUser::_lookupLogin($user_id));
6255 $mail_obj->enqueue(
6256 ilObjUser::_lookupLogin($user_id),
6257 "",
6258 "",
6259 $subject,
6260 $message,
6261 array($attachment_filename)
6262 );
6263 }
6264
6265 $ilDB->manipulate("UPDATE svy_svy" .
6266 " SET tutor_res_cron = " . $ilDB->quote(1, "integer") .
6267 " WHERE survey_id = " . $ilDB->quote($this->getSurveyId(), "integer"));
6268
6269 return true;
6270 }
$_GET["client_id"]
Class ilFileDataMail.
Class ilHtmlToPdfTransformerFactory.
Survey evaluation graphical output.

References $_GET, $ilDB, $log, $message, ilLanguageFactory\_getLanguageOfUser(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObjUser\_lookupLogin(), ANONYMOUS_USER_ID, ilLoggerFactory\getLogger(), ilObject\getRefId(), ilObject\getTitle(), getTutorResultsRecipients(), and ilHtmlToPdfTransformerFactory\PDF_OUTPUT_FILE.

+ Here is the call graph for this function:

◆ sent360Reminders()

ilObjSurvey::sent360Reminders ( )

Send 360 reminders.

Parameters

return

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

5709 {
5710 global $DIC;
5711
5712 $access = $DIC->access();
5713
5714 // collect all open ratings
5715 $rater_ids = array();
5716 foreach ($this->getAppraiseesData() as $app) {
5717 $this->svy_log->debug("Handle appraisee " . $app['user_id']);
5718
5719 if (!$this->isAppraiseeClosed($app['user_id'])) {
5720 $this->svy_log->debug("Check self evaluation, self: " . $this->get360SelfAppraisee() . ", target: " . $this->getReminderTarget());
5721
5722 // self evaluation?
5723 if ($this->get360SelfEvaluation() &&
5725 $this->svy_log->debug("...1");
5726 // did user already finished self evaluation?
5727 if (!$this->is360SurveyStarted($app['user_id'], $app['user_id'])) {
5728 $this->svy_log->debug("...2");
5729 if (!is_array($rater_ids[$app['user_id']])) {
5730 $rater_ids[$app['user_id']] = array();
5731 }
5732 if (!in_array($app["user_id"], $rater_ids[$app['user_id']])) {
5733 $rater_ids[$app['user_id']][] = $app["user_id"];
5734 }
5735 }
5736 }
5737
5738 $this->svy_log->debug("Check raters.");
5739
5740 // should raters be notified?
5742 foreach ($this->getRatersData($app['user_id']) as $rater) {
5743 // is rater not anonymous and did not rate yet?
5744 if (!$rater["anonymous_id"] && !$rater["finished"]) {
5745 if (!is_array($rater_ids[$rater["user_id"]])) {
5746 $rater_ids[$rater["user_id"]] = array();
5747 }
5748 if (!in_array($app["user_id"], $rater_ids[$rater["user_id"]])) {
5749 $rater_ids[$rater["user_id"]][] = $app["user_id"];
5750 }
5751 }
5752 }
5753 }
5754 }
5755 }
5756
5757 $this->svy_log->debug("Found raters:" . count($rater_ids));
5758
5759 foreach ($rater_ids as $id => $app) {
5760 if ($access->checkAccessOfUser($id, "read", "", $this->getRefId())) {
5761 $this->send360ReminderToUser($id, $app);
5762 }
5763 }
5764 }
const NOTIFICATION_APPRAISEES_AND_RATERS
send360ReminderToUser($a_user_id, $a_appraisee_ids)
Send rater notification.
const NOTIFICATION_APPRAISEES
isAppraiseeClosed($a_user_id)
$app
Definition: cli.php:38

References $access, $app, $DIC, ilObject\$id, get360SelfAppraisee(), get360SelfEvaluation(), getAppraiseesData(), getRatersData(), getReminderTarget(), is360SurveyStarted(), isAppraiseeClosed(), NOTIFICATION_APPRAISEES, NOTIFICATION_APPRAISEES_AND_RATERS, NOTIFICATION_RATERS, and send360ReminderToUser().

Referenced by checkReminder().

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

◆ sentReminderPlaceholders()

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

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

6104 {
6105 // see ilMail::replacePlaceholders()
6106 try {
6108
6109 $user = new \ilObjUser($a_user_id);
6110
6111 $processor = new \ilMailTemplatePlaceholderResolver($context, $a_message);
6112 $a_message = $processor->resolve($user, $a_context_params);
6113 } catch (\Exception $e) {
6114 ilLoggerFactory::getLogger('mail')->error(__METHOD__ . ' has been called with invalid context.');
6115 }
6116
6117 return $a_message;
6118 }
$context
Definition: webdav.php:26

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

+ Here is the call graph for this function:

◆ set360RaterSent()

ilObjSurvey::set360RaterSent (   $a_appraisee_id,
  $a_user_id,
  $a_anonymous_id,
  $a_tstamp = null 
)

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

5470 {
5471 $ilDB = $this->db;
5472
5473 if (!$a_tstamp) {
5474 $a_tstamp = time();
5475 }
5476
5477 $ilDB->manipulate("UPDATE svy_360_rater" .
5478 " SET mail_sent = " . $ilDB->quote($a_tstamp, "integer") .
5479 " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") .
5480 " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer") .
5481 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
5482 " AND anonymous_id = " . $ilDB->quote($a_anonymous_id, "integer"));
5483 }

References ilObject\$db, and $ilDB.

◆ set360Results()

ilObjSurvey::set360Results (   $a_value)

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

4938 {
4939 $this->mode_360_results = (int) $a_value;
4940 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ set360SelfAppraisee()

ilObjSurvey::set360SelfAppraisee (   $a_value)

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

4918 {
4919 $this->mode_360_self_appr = (bool) $a_value;
4920 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ set360SelfEvaluation()

ilObjSurvey::set360SelfEvaluation (   $a_value)

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

4908 {
4909 $this->mode_360_self_eval = (bool) $a_value;
4910 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ set360SelfRaters()

ilObjSurvey::set360SelfRaters (   $a_value)

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

4928 {
4929 $this->mode_360_self_rate = (bool) $a_value;
4930 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setActivationEndDate()

ilObjSurvey::setActivationEndDate (   $ending_time = null)

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

6011 {
6012 $this->activation_ending_time = $ending_time;
6013 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setActivationLimited()

ilObjSurvey::setActivationLimited (   $a_value)

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

1614 {
1615 $this->activation_limited = (bool) $a_value;
1616 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setActivationStartDate()

ilObjSurvey::setActivationStartDate (   $starting_time = null)

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

6006 {
6007 $this->activation_starting_time = $starting_time;
6008 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setActivationVisibility()

ilObjSurvey::setActivationVisibility (   $a_value)

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

1599 {
1600 $this->activation_visibility = (bool) $a_value;
1601 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setAnonymize()

ilObjSurvey::setAnonymize (   $a_anonymize)

set anonymize status

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

1040 {
1041 switch ($a_anonymize) {
1043 case self::ANONYMIZE_ON:
1046 $this->anonymize = $a_anonymize;
1047 break;
1048 default:
1049 $this->anonymize = self::ANONYMIZE_OFF;
1050 break;
1051 }
1052 }

References ANONYMIZE_CODE_ALL, ANONYMIZE_FREEACCESS, ANONYMIZE_OFF, and ANONYMIZE_ON.

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setAnonymousUserList()

ilObjSurvey::setAnonymousUserList (   $a_value)

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

6056 {
6057 $this->anon_user_list = (bool) $a_value;
6058 }

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setAuthor()

ilObjSurvey::setAuthor (   $author = "")

Sets the authors name of the ilObjSurvey object.

Parameters
string$authorA string containing the name of the test author @access public
See also
$author

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

1272 {
1273 $this->author = $author;
1274 }

References $author.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setCalculateSumScore()

ilObjSurvey::setCalculateSumScore ( bool  $a_val)

Set calculate sum score.

Parameters
bool$a_valcalculate sum score

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

1069 {
1070 $this->calculate_sum_score = $a_val;
1071 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setEndDate()

ilObjSurvey::setEndDate (   $end_date = "")

Sets the end date of the survey.

Parameters
string$end_dateSurvey end date (YYYYMMDDHHMMSS) @access public
See also
$end_date

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

1541 {
1542 $this->end_date = $end_date;
1543 }

References $end_date.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setEndDateAndTime()

ilObjSurvey::setEndDateAndTime (   $end_date = "",
  $end_time 
)

Sets the end date of the survey.

Parameters
string$end_dateSurvey end date (YYYY-MM-DD)
string$end_timeSurvey end time (HH:MM:SS) @access public
See also
$start_date

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

1554 {
1555 $y = '';
1556 $m = '';
1557 $d = '';
1558 $h = '';
1559 $i = '';
1560 $s = '';
1561 if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches)) {
1562 $y = $matches[1];
1563 $m = $matches[2];
1564 $d = $matches[3];
1565 }
1566 if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches)) {
1567 $h = $matches[1];
1568 $i = $matches[2];
1569 $s = $matches[3];
1570 }
1571 $this->end_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
1572 }
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $d, $end_date, and $i.

◆ setEndTime()

ilObjSurvey::setEndTime (   $finished_id)

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

4714 {
4715 $ilDB = $this->db;
4716 $time = time();
4717 $affectedRows = $ilDB->manipulateF(
4718 "UPDATE svy_times SET left_page = %s WHERE finished_fi = %s AND entered_page = %s",
4719 array('integer', 'integer', 'integer'),
4720 array($time, $finished_id, $_SESSION['svy_entered_page'])
4721 );
4722 unset($_SESSION['svy_entered_page']);
4723 }

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

◆ setEvaluationAccess()

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

Sets the learners evaluation access.

Parameters
integer$evaluation_accessThe evaluation access @access public
See also
$evaluation_access

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

1594 {
1595 $this->evaluation_access = ($evaluation_access) ? $evaluation_access : self::EVALUATION_ACCESS_OFF;
1596 }

References $evaluation_access.

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setIntroduction()

ilObjSurvey::setIntroduction (   $introduction = "")

Sets the introduction text.

Parameters
string$introductionA string containing the introduction
See also
$introduction

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

1385 {
1386 $this->introduction = $introduction;
1387 }

References $introduction.

Referenced by importObject(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setMailAddresses()

ilObjSurvey::setMailAddresses (   $a_addresses)

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

4685 {
4686 $this->mailaddresses = $a_addresses;
4687 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMailConfirmation()

ilObjSurvey::setMailConfirmation (   $a_value)

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

6046 {
6047 $this->mail_confirmation = (bool) $a_value;
6048 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMailNotification()

ilObjSurvey::setMailNotification (   $a_notification)

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

4675 {
4676 $this->mailnotification = ($a_notification) ? true : false;
4677 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMailOwnResults()

ilObjSurvey::setMailOwnResults (   $a_value)

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

6036 {
6037 $this->mail_own_results = (bool) $a_value;
6038 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMailParticipantData()

ilObjSurvey::setMailParticipantData (   $a_data)

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

4695 {
4696 $this->mailparticipantdata = $a_data;
4697 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMode()

ilObjSurvey::setMode (   $a_value)

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

6121 {
6122 $this->mode = $a_value;
6123 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setObligatoryStates()

ilObjSurvey::setObligatoryStates (   $obligatory_questions)

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

Parameters
array$obligatory_questionsThe questions which should be set obligatory from the questions form, the remaining questions should be setted not obligatory @access public

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

2202 {
2203 $ilDB = $this->db;
2204 $result = $ilDB->queryF(
2205 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
2206 array('integer'),
2207 array($this->getSurveyId())
2208 );
2209 if ($result->numRows()) {
2210 while ($row = $ilDB->fetchAssoc($result)) {
2211 if (!array_key_exists($row["question_fi"], $obligatory_questions)) {
2212 $obligatory_questions[$row["question_fi"]] = 0;
2213 }
2214 }
2215 }
2216
2217 // set the obligatory states in the database
2218 foreach ($obligatory_questions as $question_fi => $obligatory) {
2219 // #12420
2220 $ilDB->manipulate("UPDATE svy_question" .
2221 " SET obligatory = " . $ilDB->quote($obligatory, "integer") .
2222 " WHERE question_id = " . $ilDB->quote($question_fi, "integer"));
2223 }
2224 }

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

+ Here is the call graph for this function:

◆ setOutro()

ilObjSurvey::setOutro (   $outro = "")

Sets the outro text.

Parameters
string$outroA string containing the outro
See also
$outro

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

1396 {
1397 $this->outro = $outro;
1398 }

References $outro.

Referenced by importObject(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setPage()

ilObjSurvey::setPage (   $finished_id,
  $page_id 
)

Sets the number of the active survey page.

Parameters
integer$finished_idThe database id of the active user
integer$page_idThe index of the page @access public

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

2681 {
2682 $ilDB = $this->db;
2683
2684 $affectedRows = $ilDB->manipulateF(
2685 "UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
2686 array('integer','integer'),
2687 array(($page_id) ? $page_id : 0, $finished_id)
2688 );
2689 }

References ilObject\$db, and $ilDB.

◆ setPoolUsage()

ilObjSurvey::setPoolUsage (   $a_value)

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

4767 {
4768 $this->pool_usage = (bool) $a_value;
4769 }

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderEnd()

ilObjSurvey::setReminderEnd ( ilDate  $a_value = null)

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

5576 {
5577 $this->reminder_end = $a_value;
5578 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderFrequency()

ilObjSurvey::setReminderFrequency (   $a_value)

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

5586 {
5587 $this->reminder_frequency = (int) $a_value;
5588 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderLastSent()

ilObjSurvey::setReminderLastSent (   $a_value)

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

5606 {
5607 $this->reminder_last_sent = $a_value;
5608 }

Referenced by checkReminder(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderStart()

ilObjSurvey::setReminderStart ( ilDate  $a_value = null)

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

5566 {
5567 $this->reminder_start = $a_value;
5568 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderStatus()

ilObjSurvey::setReminderStatus (   $a_value)

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

5556 {
5557 $this->reminder_status = (bool) $a_value;
5558 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderTarget()

ilObjSurvey::setReminderTarget (   $a_value)

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

5596 {
5597 $this->reminder_target = (int) $a_value;
5598 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReminderTemplate()

ilObjSurvey::setReminderTemplate (   $a_value)

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

5629 {
5630 $this->reminder_tmpl = $a_value;
5631 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSelfEvaluationResults()

ilObjSurvey::setSelfEvaluationResults (   $a_value)

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

6131 {
6132 $this->mode_self_eval_results = $a_value;
6133 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setShowQuestionTitles()

ilObjSurvey::setShowQuestionTitles (   $a_show)

Sets the status of the display_question_titles attribute.

Parameters
integer$a_showThe status of the display_question_titles attribute
See also
$display_question_titles

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

1352 {
1353 $this->display_question_titles = ($a_show) ? 1 : 0;
1354 }

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillService()

ilObjSurvey::setSkillService (   $a_val)

Set skill service.

Parameters
bool$a_valactivate skill service

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

5455 {
5456 $this->mode_skill_service = $a_val;
5457 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setStartDate()

ilObjSurvey::setStartDate (   $start_date = "")

Sets the start date of the survey.

Parameters
string$start_dataSurvey start date (YYYYMMDDHHMMSS) @access public
See also
$start_date

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

1488 {
1489 $this->start_date = $start_date;
1490 }

References $start_date.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setStartDateAndTime()

ilObjSurvey::setStartDateAndTime (   $start_date = "",
  $start_time 
)

Sets the start date of the survey.

Parameters
string$start_dateSurvey start date (YYYY-MM-DD)
string$start_timeSurvey start time (HH:MM:SS) @access public
See also
$start_date

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

1501 {
1502 $y = '';
1503 $m = '';
1504 $d = '';
1505 $h = '';
1506 $i = '';
1507 $s = '';
1508 if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches)) {
1509 $y = $matches[1];
1510 $m = $matches[2];
1511 $d = $matches[3];
1512 }
1513 if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches)) {
1514 $h = $matches[1];
1515 $i = $matches[2];
1516 $s = $matches[3];
1517 }
1518 $this->start_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
1519 }

References $d, $i, and $start_date.

◆ setStartTime()

ilObjSurvey::setStartTime (   $finished_id,
  $first_question 
)

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

4700 {
4701 $ilDB = $this->db;
4702 $time = time();
4703 //primary for table svy_times
4704 $id = $ilDB->nextId('svy_times');
4705 $_SESSION['svy_entered_page'] = $time;
4706 $affectedRows = $ilDB->manipulateF(
4707 "INSERT INTO svy_times (id, finished_fi, entered_page, left_page, first_question) VALUES (%s, %s, %s, %s,%s)",
4708 array('integer','integer', 'integer', 'integer', 'integer'),
4709 array($id, $finished_id, $time, null, $first_question)
4710 );
4711 }

References $_SESSION, ilObject\$db, ilObject\$id, and $ilDB.

◆ setSurveyId()

ilObjSurvey::setSurveyId (   $survey_id)

Sets the survey id.

Parameters
integer$survey_idThe survey id

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

4643 {
4644 $this->survey_id = $survey_id;
4645 }

References $survey_id.

Referenced by loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ setTemplate()

ilObjSurvey::setTemplate (   $template_id)

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

4744 {
4745 $this->template_id = (int) $template_id;
4746 }

References $template_id.

Referenced by applySettingsTemplate(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setTutorNotificationRecipients()

ilObjSurvey::setTutorNotificationRecipients ( array  $a_value)

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

5649 {
5650 $this->tutor_ntf_recipients = $a_value;
5651 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTutorNotificationStatus()

ilObjSurvey::setTutorNotificationStatus (   $a_value)

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

5639 {
5640 $this->tutor_ntf_status = (bool) $a_value;
5641 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTutorNotificationTarget()

ilObjSurvey::setTutorNotificationTarget (   $a_value)

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

5659 {
5660 $this->tutor_ntf_target = (int) $a_value;
5661 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTutorResultsRecipients()

ilObjSurvey::setTutorResultsRecipients ( array  $a_value)

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

5679 {
5680 $this->tutor_res_recipients = $a_value;
5681 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTutorResultsStatus()

ilObjSurvey::setTutorResultsStatus (   $a_value)

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

5669 {
5670 $this->tutor_res_status = (bool) $a_value;
5671 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setViewOwnResults()

ilObjSurvey::setViewOwnResults (   $a_value)

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

6026 {
6027 $this->view_own_results = (bool) $a_value;
6028 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ showQuestionTitles()

ilObjSurvey::showQuestionTitles ( )

Sets the question titles visible during the query.

@access public

See also
$display_question_titles

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

1363 {
1364 $this->display_question_titles = 1;
1365 }

◆ startSurvey()

ilObjSurvey::startSurvey (   $user_id,
  $anonymous_id,
  $appraisee_id 
)

Starts the survey creating an entry in the database.

Parameters
integer$user_idThe database id of the user who starts the survey @access public

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

2624 {
2625 $ilDB = $this->db;
2626
2627 if ($this->getAnonymize() && (strlen($anonymous_id) == 0)) {
2628 return;
2629 }
2630
2631 if (strcmp($user_id, "") == 0) {
2632 if ($user_id == ANONYMOUS_USER_ID) {
2633 $user_id = 0;
2634 }
2635 }
2636 $next_id = $ilDB->nextId('svy_finished');
2637 $affectedRows = $ilDB->manipulateF(
2638 "INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp, appr_id) " .
2639 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
2640 array('integer','integer','integer','text','text','integer','integer'),
2641 array($next_id, $this->getSurveyId(), $user_id, $anonymous_id, 0, time(), $appraisee_id)
2642 );
2643 return $next_id;
2644 }

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

+ Here is the call graph for this function:

◆ toXML()

ilObjSurvey::toXML ( )

Returns a QTI xml representation of the survey.

Returns
string The QTI xml representation of the survey @access public

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

3259 {
3260 $a_xml_writer = new ilXmlWriter;
3261 // set xml header
3262 $a_xml_writer->xmlHeader();
3263 $attrs = array(
3264 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
3265 "xsi:noNamespaceSchemaLocation" => "http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
3266 );
3267 $a_xml_writer->xmlStartTag("surveyobject", $attrs);
3268 $attrs = array(
3269 "id" => $this->getSurveyId(),
3270 "title" => $this->getTitle()
3271 );
3272 $a_xml_writer->xmlStartTag("survey", $attrs);
3273
3274 $a_xml_writer->xmlElement("description", null, $this->getDescription());
3275 $a_xml_writer->xmlElement("author", null, $this->getAuthor());
3276 $a_xml_writer->xmlStartTag("objectives");
3277 $attrs = array(
3278 "label" => "introduction"
3279 );
3280 $this->addMaterialTag($a_xml_writer, $this->getIntroduction(), true, true, $attrs);
3281 $attrs = array(
3282 "label" => "outro"
3283 );
3284 $this->addMaterialTag($a_xml_writer, $this->getOutro(), true, true, $attrs);
3285 $a_xml_writer->xmlEndTag("objectives");
3286
3287 if ($this->getAnonymize()) {
3288 $attribs = array("enabled" => "1");
3289 } else {
3290 $attribs = array("enabled" => "0");
3291 }
3292 $a_xml_writer->xmlElement("anonymisation", $attribs);
3293 $a_xml_writer->xmlStartTag("restrictions");
3294 if ($this->getAnonymize() == 2) {
3295 $attribs = array("type" => "free");
3296 } else {
3297 $attribs = array("type" => "restricted");
3298 }
3299 $a_xml_writer->xmlElement("access", $attribs);
3300 if ($this->getStartDate()) {
3301 $attrs = array("type" => "date");
3302 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches);
3303 $a_xml_writer->xmlElement("startingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
3304 }
3305 if ($this->getEndDate()) {
3306 $attrs = array("type" => "date");
3307 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches);
3308 $a_xml_writer->xmlElement("endingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
3309 }
3310 $a_xml_writer->xmlEndTag("restrictions");
3311
3312 // constraints
3313 $pages = &$this->getSurveyPages();
3314 $hasconstraints = false;
3315 foreach ($pages as $question_array) {
3316 foreach ($question_array as $question) {
3317 if (count($question["constraints"])) {
3318 $hasconstraints = true;
3319 }
3320 }
3321 }
3322
3323 if ($hasconstraints) {
3324 $a_xml_writer->xmlStartTag("constraints");
3325 foreach ($pages as $question_array) {
3326 foreach ($question_array as $question) {
3327 if (count($question["constraints"])) {
3328 // found constraints
3329 foreach ($question["constraints"] as $constraint) {
3330 $attribs = array(
3331 "sourceref" => $question["question_id"],
3332 "destref" => $constraint["question"],
3333 "relation" => $constraint["short"],
3334 "value" => $constraint["value"],
3335 "conjunction" => $constraint["conjunction"]
3336 );
3337 $a_xml_writer->xmlElement("constraint", $attribs);
3338 }
3339 }
3340 }
3341 }
3342 $a_xml_writer->xmlEndTag("constraints");
3343 }
3344
3345 // add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
3346 $a_xml_writer->xmlStartTag("metadata");
3347
3348 $custom_properties = array();
3349 $custom_properties["evaluation_access"] = $this->getEvaluationAccess();
3350 $custom_properties["status"] = !$this->getOfflineStatus();
3351 $custom_properties["display_question_titles"] = $this->getShowQuestionTitles();
3352 $custom_properties["pool_usage"] = (int) $this->getPoolUsage();
3353
3354 $custom_properties["own_results_view"] = (int) $this->hasViewOwnResults();
3355 $custom_properties["own_results_mail"] = (int) $this->hasMailOwnResults();
3356 $custom_properties["confirmation_mail"] = (int) $this->hasMailConfirmation();
3357
3358 $custom_properties["anon_user_list"] = (int) $this->hasAnonymousUserList();
3359 $custom_properties["mode"] = (int) $this->getMode();
3360 $custom_properties["mode_360_self_eval"] = (int) $this->get360SelfEvaluation();
3361 $custom_properties["mode_360_self_rate"] = (int) $this->get360SelfRaters();
3362 $custom_properties["mode_360_self_appr"] = (int) $this->get360SelfAppraisee();
3363 $custom_properties["mode_360_results"] = $this->get360Results();
3364 $custom_properties["mode_skill_service"] = (int) $this->getSkillService();
3365 $custom_properties["mode_self_eval_results"] = (int) $this->getSelfEvaluationResults();
3366
3367
3368 // :TODO: skills?
3369
3370 // reminder/tutor notification are (currently?) not exportable
3371
3372 foreach ($custom_properties as $label => $value) {
3373 $a_xml_writer->xmlStartTag("metadatafield");
3374 $a_xml_writer->xmlElement("fieldlabel", null, $label);
3375 $a_xml_writer->xmlElement("fieldentry", null, $value);
3376 $a_xml_writer->xmlEndTag("metadatafield");
3377 }
3378
3379 $a_xml_writer->xmlStartTag("metadatafield");
3380 $a_xml_writer->xmlElement("fieldlabel", null, "SCORM");
3381 $md = new ilMD($this->getId(), 0, $this->getType());
3382 $writer = new ilXmlWriter();
3383 $md->toXml($writer);
3384 $metadata = $writer->xmlDumpMem();
3385 $a_xml_writer->xmlElement("fieldentry", null, $metadata);
3386 $a_xml_writer->xmlEndTag("metadatafield");
3387
3388 $a_xml_writer->xmlEndTag("metadata");
3389 $a_xml_writer->xmlEndTag("survey");
3390
3391 $attribs = array("id" => $this->getId());
3392 $a_xml_writer->xmlStartTag("surveyquestions", $attribs);
3393 // add questionblock descriptions
3394 foreach ($pages as $question_array) {
3395 if (count($question_array) > 1) {
3396 $attribs = array("id" => $question_array[0]["question_id"]);
3397 $attribs = array(
3398 "showQuestiontext" => $question_array[0]["questionblock_show_questiontext"],
3399 "showBlocktitle" => $question_array[0]["questionblock_show_blocktitle"],
3400 "compressView" => $question_array[0]["questionblock_compress_view"]
3401 );
3402 $a_xml_writer->xmlStartTag("questionblock", $attribs);
3403 if (strlen($question_array[0]["questionblock_title"])) {
3404 $a_xml_writer->xmlElement("questionblocktitle", null, $question_array[0]["questionblock_title"]);
3405 }
3406 }
3407 foreach ($question_array as $question) {
3408 if (strlen($question["heading"])) {
3409 $a_xml_writer->xmlElement("textblock", null, $question["heading"]);
3410 }
3411 $questionObject = self::_instanciateQuestion($question["question_id"]);
3412 //questionObject contains all the fields from the database. (loadFromDb)
3413 //we don't need the value from svy_qst_oblig table, we already have the values from svy_question table.
3414 //if ($questionObject !== FALSE) $questionObject->insertXML($a_xml_writer, FALSE, $obligatory_states[$question["question_id"]]);
3415 if ($questionObject !== false) {
3416 $questionObject->insertXML($a_xml_writer, false);
3417 }
3418 }
3419 if (count($question_array) > 1) {
3420 $a_xml_writer->xmlEndTag("questionblock");
3421 }
3422 }
3423
3424 $a_xml_writer->xmlEndTag("surveyquestions");
3425 $a_xml_writer->xmlEndTag("surveyobject");
3426 $xml = $a_xml_writer->xmlDumpMem(false);
3427 return $xml;
3428 }
addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true, $attribs=null)
Creates an XML material tag from a plain text or xhtml text.
getDescription()
get object description
XML writer class.
xmlHeader()
Writes xml header @access public.

References $xml, _instanciateQuestion(), addMaterialTag(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), getAnonymize(), getAuthor(), ilObject\getDescription(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getIntroduction(), getMode(), ilObject\getOfflineStatus(), getOutro(), getPoolUsage(), getSelfEvaluationResults(), getShowQuestionTitles(), getSkillService(), getStartDate(), getSurveyId(), getSurveyPages(), ilObject\getTitle(), ilObject\getType(), hasAnonymousUserList(), hasMailConfirmation(), hasMailOwnResults(), hasViewOwnResults(), and ilXmlWriter\xmlHeader().

+ Here is the call graph for this function:

◆ unfoldQuestionblocks()

ilObjSurvey::unfoldQuestionblocks (   $questionblocks)

Unfolds question blocks of a question pool.

Parameters
array$questionblocksAn array of question block id's @access public

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

1831 {
1832 $ilDB = $this->db;
1833 foreach ($questionblocks as $index) {
1834 $affectedRows = $ilDB->manipulateF(
1835 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1836 array('integer'),
1837 array($index)
1838 );
1839 $affectedRows = $ilDB->manipulateF(
1840 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1841 array('integer','integer'),
1842 array($index, $this->getSurveyId())
1843 );
1844 }
1845 }

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

+ Here is the call graph for this function:

◆ update()

ilObjSurvey::update (   $a_upload = false)

update object data

@access public

Returns
boolean

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

277 {
278 if (!$a_upload) {
279 $this->updateMetaData();
280 }
281
282 if (!parent::update()) {
283 return false;
284 }
285
286 // put here object specific stuff
287
288 return true;
289 }
updateMetaData()
update meta data entry

References ilObject\updateMetaData().

+ Here is the call graph for this function:

◆ updateCode()

ilObjSurvey::updateCode (   $a_id,
  $a_email,
  $a_last_name,
  $a_first_name,
  $a_sent 
)

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

4866 {
4867 $ilDB = $this->db;
4868
4869 $a_email = trim($a_email);
4870
4871 // :TODO:
4872 if (($a_email && !ilUtil::is_email($a_email)) || $a_email == "") {
4873 return false;
4874 }
4875
4876 $data = array("email" => $a_email,
4877 "lastname" => trim($a_last_name),
4878 "firstname" => trim($a_first_name));
4879
4880 $fields = array(
4881 "externaldata" => array("text", serialize($data)),
4882 "sent" => array("integer", $a_sent)
4883 );
4884
4885 $ilDB->update(
4886 "svy_anonymous",
4887 $fields,
4888 array("anonymous_id" => array("integer", $a_id))
4889 );
4890
4891 return true;
4892 }
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.

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

+ Here is the call graph for this function:

◆ updateConjunctionForQuestions()

ilObjSurvey::updateConjunctionForQuestions (   $questions,
  $conjunction 
)

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

2526 {
2527 $ilDB = $this->db;
2528 foreach ($questions as $question_id) {
2529 $affectedRows = $ilDB->manipulateF(
2530 "UPDATE svy_constraint SET conjunction = %s " .
2531 "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2532 array('integer','integer'),
2533 array($conjunction, $question_id)
2534 );
2535 }
2536 }

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

◆ updateConstraint()

ilObjSurvey::updateConstraint (   $precondition_id,
  $if_question_id,
  $relation,
  $value,
  $conjunction 
)

Updates a precondition.

Parameters
integer$precondition_idThe id of the original precondition
integer$to_question_idThe question id of the question where to add the constraint
integer$if_question_idThe question id of the question which defines a precondition
integer$relationThe database id of the relation
mixed$valueThe value compared with the relation @access public

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

2515 {
2516 $ilDB = $this->db;
2517 $affectedRows = $ilDB->manipulateF(
2518 "UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s " .
2519 "WHERE constraint_id = %s",
2520 array('integer','integer','float','integer','integer'),
2521 array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2522 );
2523 }

References ilObject\$db, and $ilDB.

◆ updateOrder()

ilObjSurvey::updateOrder ( array  $a_order)

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

4754 {
4755 if (sizeof($this->questions) == sizeof($a_order)) {
4756 $this->questions = array_flip($a_order);
4757 $this->saveQuestionsToDB();
4758 }
4759 }

◆ validateExternalRaterCode()

static ilObjSurvey::validateExternalRaterCode (   $a_ref_id,
  $a_code 
)
static

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

5521 {
5522 if (!isset($_SESSION["360_extrtr"][$a_ref_id])) {
5523 $svy = new self($a_ref_id);
5524 $svy->loadFromDB();
5525
5526 if ($svy->canStartSurvey(null, true) &&
5527 $svy->get360Mode() &&
5528 $svy->isAnonymousKey($a_code)) {
5529 $anonymous_id = $svy->getAnonymousIdByCode($a_code);
5530 if ($anonymous_id) {
5531 if (sizeof($svy->getAppraiseesToRate(null, $anonymous_id))) {
5532 $_SESSION["360_extrtr"][$a_ref_id] = true;
5533 return true;
5534 }
5535 }
5536 }
5537
5538 $_SESSION["360_extrtr"][$a_ref_id] = false;
5539 return false;
5540 }
5541
5542 return $_SESSION["360_extrtr"][$a_ref_id];
5543 }

References $_SESSION.

Referenced by ilSurveyExecutionGUI\__construct(), ilObjSurveyAccess\_checkGoto(), and ilObjSurveyGUI\executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilObjSurvey::$access
protected

◆ $activation_ending_time

ilObjSurvey::$activation_ending_time
protected

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

◆ $activation_starting_time

ilObjSurvey::$activation_starting_time
protected

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

◆ $activation_visibility

ilObjSurvey::$activation_visibility
protected

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

Referenced by getActivationVisibility().

◆ $anon_user_list

ilObjSurvey::$anon_user_list
protected

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

Referenced by hasAnonymousUserList().

◆ $anonymize

ilObjSurvey::$anonymize

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

◆ $author

ilObjSurvey::$author

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

Referenced by getAuthor(), and setAuthor().

◆ $calculate_sum_score

ilObjSurvey::$calculate_sum_score = false
protected

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

Referenced by getCalculateSumScore().

◆ $display_question_titles

ilObjSurvey::$display_question_titles

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

◆ $end_date

ilObjSurvey::$end_date

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

Referenced by setEndDate(), and setEndDateAndTime().

◆ $evaluation_access

ilObjSurvey::$evaluation_access

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

Referenced by setEvaluationAccess().

◆ $introduction

ilObjSurvey::$introduction

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

Referenced by setIntroduction().

◆ $invitation_manager

ilObjSurvey::$invitation_manager
protected

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

◆ $log

ilObjSurvey::$log
protected

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

Referenced by getSurveysWithTutorResults(), and sendTutorResults().

◆ $mail_confirmation

ilObjSurvey::$mail_confirmation
protected

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

Referenced by hasMailConfirmation().

◆ $mail_own_results

ilObjSurvey::$mail_own_results
protected

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

Referenced by hasMailOwnResults().

◆ $mailaddresses

ilObjSurvey::$mailaddresses

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

Referenced by getMailAddresses().

◆ $mailnotification

ilObjSurvey::$mailnotification

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

Referenced by getMailNotification().

◆ $mailparticipantdata

ilObjSurvey::$mailparticipantdata

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

Referenced by getMailParticipantData(), and sendNotificationMail().

◆ $mode

ilObjSurvey::$mode
protected

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

Referenced by getMode().

◆ $mode_360_results

ilObjSurvey::$mode_360_results
protected

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

Referenced by get360Results().

◆ $mode_360_self_appr

ilObjSurvey::$mode_360_self_appr
protected

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

Referenced by get360SelfAppraisee().

◆ $mode_360_self_eval

ilObjSurvey::$mode_360_self_eval
protected

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

Referenced by get360SelfEvaluation().

◆ $mode_360_self_rate

ilObjSurvey::$mode_360_self_rate
protected

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

Referenced by get360SelfRaters().

◆ $mode_self_eval_results

ilObjSurvey::$mode_self_eval_results
protected

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

Referenced by getSelfEvaluationResults().

◆ $mode_skill_service

ilObjSurvey::$mode_skill_service
protected

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

Referenced by getSkillService().

◆ $outro

ilObjSurvey::$outro

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

Referenced by setOutro().

◆ $plugin_admin

ilObjSurvey::$plugin_admin
protected

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

Referenced by isPluginActive().

◆ $pool_usage

ilObjSurvey::$pool_usage

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

Referenced by getPoolUsage().

◆ $questions

◆ $reminder_end

ilObjSurvey::$reminder_end
protected

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

Referenced by getReminderEnd().

◆ $reminder_frequency

ilObjSurvey::$reminder_frequency
protected

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

Referenced by getReminderFrequency().

◆ $reminder_last_sent

ilObjSurvey::$reminder_last_sent
protected

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

Referenced by getReminderLastSent().

◆ $reminder_start

ilObjSurvey::$reminder_start
protected

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

Referenced by getReminderStart().

◆ $reminder_status

ilObjSurvey::$reminder_status
protected

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

Referenced by getReminderStatus().

◆ $reminder_target

ilObjSurvey::$reminder_target
protected

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

Referenced by getReminderTarget().

◆ $reminder_tmpl

ilObjSurvey::$reminder_tmpl
protected

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

Referenced by getReminderTemplate().

◆ $start_date

ilObjSurvey::$start_date

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

Referenced by setStartDate(), and setStartDateAndTime().

◆ $survey_id

◆ $surveyCodeSecurity

ilObjSurvey::$surveyCodeSecurity

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

◆ $svy_log

ilObjSurvey::$svy_log
protected

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

Referenced by deliverPDFfromFO(), getSurveyFinishedIds(), and importObject().

◆ $template_id

ilObjSurvey::$template_id

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

Referenced by applySettingsTemplate(), getTemplate(), and setTemplate().

◆ $tutor_ntf_recipients

ilObjSurvey::$tutor_ntf_recipients
protected

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

Referenced by getTutorNotificationRecipients().

◆ $tutor_ntf_status

ilObjSurvey::$tutor_ntf_status
protected

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

Referenced by getTutorNotificationStatus().

◆ $tutor_ntf_target

ilObjSurvey::$tutor_ntf_target
protected

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

Referenced by getTutorNotificationTarget().

◆ $tutor_res_recipients

ilObjSurvey::$tutor_res_recipients
protected

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

Referenced by getTutorResultsRecipients().

◆ $tutor_res_status

ilObjSurvey::$tutor_res_status
protected

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

Referenced by getTutorResultsStatus().

◆ $user

◆ $view_own_results

ilObjSurvey::$view_own_results
protected

Definition at line 175 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

◆ EVALUATION_ACCESS_PARTICIPANTS

◆ MODE_360

◆ MODE_SELF_EVAL

◆ MODE_STANDARD

const ilObjSurvey::MODE_STANDARD = 0

◆ NOTIFICATION_APPRAISEES

const ilObjSurvey::NOTIFICATION_APPRAISEES = 3

◆ NOTIFICATION_APPRAISEES_AND_RATERS

const ilObjSurvey::NOTIFICATION_APPRAISEES_AND_RATERS = 5

◆ NOTIFICATION_INVITED_USERS

const ilObjSurvey::NOTIFICATION_INVITED_USERS = 2

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

Referenced by ilObjSurveyGUI\initPropertiesForm().

◆ NOTIFICATION_PARENT_COURSE

const ilObjSurvey::NOTIFICATION_PARENT_COURSE = 1

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

Referenced by ilObjSurveyGUI\initPropertiesForm().

◆ NOTIFICATION_RATERS

const ilObjSurvey::NOTIFICATION_RATERS = 4

◆ 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 44 of file class.ilObjSurvey.php.

◆ QUESTIONTITLES_VISIBLE

const ilObjSurvey::QUESTIONTITLES_VISIBLE = 1

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

Referenced by __construct().

◆ RESULTS_360_ALL

◆ RESULTS_360_NONE

const ilObjSurvey::RESULTS_360_NONE = 0

◆ RESULTS_360_OWN

const ilObjSurvey::RESULTS_360_OWN = 1

◆ RESULTS_SELF_EVAL_ALL

const ilObjSurvey::RESULTS_SELF_EVAL_ALL = 2

◆ 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: