ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjSurvey Class Reference
+ Inheritance diagram for ilObjSurvey:
+ Collaboration diagram for ilObjSurvey:

Public Member Functions

 ilObjSurvey ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 create ($a_upload=false)
 create survey object
 createMetaData ()
 Create meta data entry.
 update ()
 update object data
 createReference ()
 creates reference for object
 read ($a_force_db=false)
 read object data from db into object
 addQuestion ($question_id)
 Adds a question to the survey.
 delete ()
 delete object and all related data
 deleteSurveyRecord ()
 Deletes the survey from the database.
 deleteAllUserData ()
 Deletes all user data of a survey.
 removeSelectedSurveyResults ($finished_ids)
 Deletes the user data of a given array of survey participants.
getSurveyParticipants ($finished_ids=null)
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
 isComplete ()
 Returns 1, if a survey is complete for use.
 _isComplete ($obj_id)
 Returns 1, if a survey is complete for use.
_getGlobalSurveyData ($obj_id)
 Returns an array with data needed in the repository, personal desktop or courses.
 saveCompletionStatus ()
 Saves the completion status of the survey.
 duplicateQuestionForSurvey ($question_id, $a_force=false)
 Takes a question and creates a copy of the question for use in the survey.
 insertQuestion ($question_id)
 Inserts a question in the survey and saves the relation to the database.
 insertQuestionblock ($questionblock_id)
 Inserts a questionblock in the survey and saves the relation to the database.
 getAllRTEContent ()
 Returns the content of all RTE enabled text areas in the test.
 cleanupMediaobjectUsage ()
 Cleans up the media objects for all text fields in a test which are using an RTE field.
 saveUserSettings ($usr_id, $key, $title, $value)
 deleteUserSettings ($id)
 getUserSettings ($usr_id, $key)
 saveToDb ()
 Saves a survey object to a database.
 saveQuestionsToDb ()
 Saves the survey questions to the database.
 getAnonymousId ($id)
 Checks for an anomyous survey id in the database an returns the id.
 getQuestionGUI ($questiontype, $question_id)
 Returns a question gui object to a given questiontype and question id.
 getQuestionType ($question_id)
 Returns the question type of a question with a given id.
 getSurveyId ()
 Returns the survey database id.
 setAnonymize ($a_anonymize)
 set anonymize status
 getAnonymize ()
 get anonymize status
 isAccessibleWithCodeForAll ()
 isAccessibleWithoutCode ()
 Checks if the survey is accessable without a survey code.
 loadFromDb ()
 Loads a survey object from a database.
 loadQuestionsFromDb ()
 Loads the survey questions from the database.
 setAuthor ($author="")
 Sets the authors name of the ilObjSurvey object.
 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.
 getAuthor ()
 Gets the authors name of the ilObjSurvey object.
 getShowQuestionTitles ()
 Gets the status of the display_question_titles attribute.
 setShowQuestionTitles ($a_show)
 Sets the status of the display_question_titles attribute.
 showQuestionTitles ()
 Sets the question titles visible during the query.
 hideQuestionTitles ()
 Sets the question titles hidden during the query.
 setInvitation ($invitation=0)
 Sets the invitation status.
 setInvitationMode ($invitation_mode=0)
 Sets the invitation mode.
 setInvitationAndMode ($invitation=0, $invitation_mode=0)
 Sets the invitation status and mode (a more performant solution if you change both)
 setIntroduction ($introduction="")
 Sets the introduction text.
 setOutro ($outro="")
 Sets the outro text.
 getInvitation ()
 Gets the invitation status.
 getInvitationMode ()
 Gets the invitation mode.
 getStatus ()
 Gets the survey status.
 isOnline ()
 Gets the survey status.
 isOffline ()
 Gets the survey status.
 setStatus ($status=self::STATUS_OFFLINE)
 Sets the survey status.
 getStartDate ()
 Gets the start date of the survey.
 canStartSurvey ($anonymous_id=NULL, $a_no_rbac=false)
 Checks if the survey can be started.
 setStartDate ($start_date="")
 Sets the start date of the survey.
 setStartDateAndTime ($start_date="", $start_time)
 Sets the start date of the survey.
 getEndDate ()
 Gets the end date of the survey.
 setEndDate ($end_date="")
 Sets the end date of the survey.
 setEndDateAndTime ($end_date="", $end_time)
 Sets the end date of the survey.
 getEvaluationAccess ()
 Gets the learners evaluation access.
 setEvaluationAccess ($evaluation_access=self::EVALUATION_ACCESS_OFF)
 Sets the learners evaluation access.
 setActivationVisibility ($a_value)
 getActivationVisibility ()
 isActivationLimited ()
 setActivationLimited ($a_value)
 getIntroduction ()
 Gets the introduction text.
 getOutro ()
 Gets the outro text.
getExistingQuestions ()
 Gets the question id's of the questions which are already in the survey.
getQuestionpoolTitles ($could_be_offline=FALSE, $showPath=FALSE)
 Get the titles of all available survey question pools.
 moveUpQuestion ($question_id)
 Moves a question up in the list of survey questions.
 moveDownQuestion ($question_id)
 Moves a question down in the list of survey questions.
 moveUpQuestionblock ($questionblock_id)
 Moves a questionblock up in the list of survey questions.
 moveDownQuestionblock ($questionblock_id)
 Moves a questionblock down in the list of survey questions.
 moveQuestions ($move_questions, $target_index, $insert_mode)
 Move questions and/or questionblocks to another position.
 removeQuestion ($question_id)
 Remove a question from the survey.
 removeConstraintsConcerningQuestion ($question_id)
 Remove constraints concerning a question with a given question_id.
 removeQuestions ($remove_questions, $remove_questionblocks)
 Remove questions from the survey.
 unfoldQuestionblocks ($questionblocks)
 Unfolds question blocks of a question pool.
 removeQuestionFromBlock ($question_id, $questionblock_id)
 addQuestionToBlock ($question_id, $questionblock_id)
getQuestionblockQuestions ($questionblock_id)
 Returns the question titles of all questions of a question block.
getQuestionblockQuestionIds ($questionblock_id)
 Returns the question id's of all questions of a question block.
 getQuestionblock ($questionblock_id)
 Returns the database row for a given question block.
 _getQuestionblock ($questionblock_id)
 Returns the database row for a given question block.
 _addQuestionblock ($title="", $owner=0, $show_questiontext=true, $show_blocktitle=false)
 Adds a questionblock to the database.
 createQuestionblock ($title, $show_questiontext, $show_blocktitle, $questions)
 Creates a question block for the survey.
 modifyQuestionblock ($questionblock_id, $title, $show_questiontext, $show_blocktitle)
 Modifies a question block.
 deleteConstraints ($question_id)
 Deletes the constraints for a question.
 deleteConstraint ($constraint_id)
 Deletes a constraint of a question.
getSurveyQuestions ($with_answers=false)
 Returns the survey questions and questionblocks in an array.
 setObligatoryStates ($obligatory_questions)
 Sets the obligatory states for questions in a survey from the questions form.
getObligatoryStates ()
 Gets specific obligatory states of the survey.
getSurveyPages ()
 Returns the survey pages in an array (a page contains one or more questions)
 getNextPage ($active_page_question_id, $direction)
 Returns the next "page" of a running test.
getAvailableQuestionpools ($use_obj_id=false, $could_be_offline=false, $showPath=FALSE, $permission="read")
 Returns the available question pools for the active user.
 getPrecondition ($id)
 Returns a precondition with a given id.
 getConstraints ($question_id)
 Returns the constraints to a given question or questionblock.
 _getConstraints ($survey_id)
 Returns the constraints to a given question or questionblock.
getVariables ($question_id)
 Returns all variables of a question.
 addConstraint ($if_question_id, $relation, $value, $conjunction)
 Adds a constraint.
 addConstraintToQuestion ($to_question_id, $constraint_id)
 Adds a constraint to a question.
 updateConstraint ($precondition_id, $if_question_id, $relation, $value, $conjunction)
 Updates a precondition.
 updateConjunctionForQuestions ($questions, $conjunction)
 getAllRelations ($short_as_key=false)
 Returns all available relations.
 disinviteAllUsers ()
 Disinvite all users.
 disinviteUser ($user_id)
 Disinvites a user from a survey.
 inviteUser ($user_id)
 Invites a user to a survey.
 inviteGroup ($group_id)
 Invites a group to a survey.
 inviteRole ($role_id)
 Invites a role to a survey.
getInvitedUsers ()
 Returns a list of all invited users in a survey.
 deleteWorkingData ($question_id, $active_id)
 Deletes the working data of a question in the database.
 loadWorkingData ($question_id, $active_id)
 Gets the working data of question from the database.
 fillSurveyForUser ($user_id=ANONYMOUS_USER_ID)
 Fills a survey randomly with data for a given user.
 startSurvey ($user_id, $anonymous_id, $appraisee_id)
 Starts the survey creating an entry in the database.
 finishSurvey ($finished_id)
 Finishes the survey creating an entry in the database.
 setPage ($finished_id, $page_id)
 Sets the number of the active survey page.
 sendNotificationMail ($user_id, $anonymize_id, $appr_id)
 getDetailedParticipantResultsAsText ()
 isAllowedToTakeMultipleSurveys ($userid="")
 Checks if a user is allowed to take multiple survey.
 isSurveyStarted ($user_id, $anonymize_id, $appr_id=0)
 Checks if a user already started a survey.
 getActiveID ($user_id, $anonymize_id, $appr_id)
 Checks if a user already started a survey.
 getLastActivePage ($active_id)
 Returns the question id of the last active page a user visited in a survey.
 checkConstraint ($constraint_data, $working_data)
 Checks if a constraint is valid.
 _hasDatasets ($survey_id)
getSurveyFinishedIds ()
 Get the finished id's of all survey participants.
getUserSpecificResults ($finished_ids)
 Calculates the evaluation data for the user specific results.
 getUserDataFromActiveId ($active_id)
 Returns the user information from an active_id (survey_finished.finished_id)
getEvaluationByUser ($questions, $active_id)
 Calculates the evaluation data for a given user or anonymous id.
 getCumulatedResults (&$question, $finished_ids)
 Calculates the evaluation data for a question.
 _getNrOfParticipants ($survey_id)
 Returns the number of participants for a survey.
getQuestions ($question_ids)
 getQuestionsTable ($arrFilter)
 Calculates the data for the output of the question browser.
 getQuestionblocksTable ($arrFilter)
 Calculates the data for the output of the questionblock browser.
 toXML ()
 Returns a QTI xml representation of the survey.
_instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id.
 locateImportFiles ($a_dir)
 Locates the import directory and the xml file in a directory with an unzipped import file.
 importObject ($file_info, $svy_qpl_id)
 Imports a survey from XML into the ILIAS database.
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone object.
 getTextblock ($question_id)
 cloneTextblocks ($mapping)
 Clones the textblocks of survey questions.
 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)
 getExportDirectory ()
 get export directory of survey
 getExportFiles ($dir)
 get export files
 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)
 getImportDirectory ()
 get import directory of survey
 saveHeading ($heading="", $insertbefore)
 isAnonymousKey ($key)
 getUserSurveyCode ($user_id)
 bindSurveyCodeToUser ($user_id, $code)
 isAnonymizedParticipant ($key)
 checkSurveyCode ($code)
 getSurveyCodesCount ()
 Returns the number of generated survey codes for the survey.
 getSurveyCodesForExport (array $a_codes=null, array $a_ids=null)
 Returns a list of survey codes for file export.
 getSurveyCodesTableData (array $ids=null, $lang=null)
 Fetches the data for the survey codes table.
 isSurveyCodeUsed ($code)
 isSurveyCodeUnique ($code)
 createSurveyCodes ($nrOfCodes)
 createSurveyCodesForExternalData ($data)
 sendCodes ($not_sent, $subject, $message, $lang)
 getExternalCodeRecipients ($a_check_finished=false)
 deleteSurveyCode ($survey_code)
 Deletes a given survey access code.
 getUserAccessCode ($user_id)
 Returns a survey access code that was saved for a registered user.
 saveUserAccessCode ($user_id, $access_code)
 Saves a survey access code for a registered user to the database.
 createNewAccessCode ()
 Returns a new, unused survey access code.
processCSVRow ($row, $quoteAll=FALSE, $separator=";")
 Processes an array as a CSV row and converts the array values to correct CSV values.
 _getLastAccess ($finished_id)
 prepareTextareaOutput ($txt_output)
 Prepares a string for a text area output in surveys.
 isHTML ($a_text)
 Checks if a given string contains HTML or not.
 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.
 canExportSurveyCode ()
 Checks if the survey code can be exported with the survey evaluation.
 processPrintoutput2FO ($print_output)
 Convert a print output to XSL-FO.
 deliverPDFfromFO ($fo)
 Delivers a PDF file from a XSL-FO string.
 _checkCondition ($a_svy_id, $a_operator, $a_value, $a_usr_id=0)
 isPluginActive ($a_pname)
 Checks whether or not a question plugin with a given name is active.
 setSurveyId ($survey_id)
 Sets the survey id.
getUserData ($ids)
 Returns a data of all users specified by id list.
getGroupData ($ids)
getRoleData ($ids)
 getMailNotification ()
 setMailNotification ($a_notification)
 getMailAddresses ()
 setMailAddresses ($a_addresses)
 getMailParticipantData ()
 setMailParticipantData ($a_data)
 getSurveyTimes ()
 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.
 applySettingsTemplate ($template_id)
 Apply settings template.
 updateCode ($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
 set360Mode ($a_value)
 get360Mode ()
 set360SelfEvaluation ($a_value)
 get360SelfEvaluation ()
 set360SelfAppraisee ($a_value)
 get360SelfAppraisee ()
 set360SelfRaters ($a_value)
 get360SelfRaters ()
 set360Results ($a_value)
 get360Results ()
 addAppraisee ($a_user_id)
 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.
 set360SkillService ($a_val)
 Set skill service.
 get360SkillService ()
 Get skill service.
 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)
 getTutorNotificationStatus ()
 setTutorNotificationStatus ($a_value)
 getTutorNotificationRecipients ()
 setTutorNotificationRecipients (array $a_value)
 getTutorNotificationTarget ()
 setTutorNotificationTarget ($a_value)
 checkReminder ()
 setActivationStartDate ($starting_time=NULL)
 setActivationEndDate ($ending_time=NULL)
 getActivationStartDate ()
 getActivationEndDate ()
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 MDUpdateListener ($a_element)
 Meta data update listener.
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 countReferences ()
 count references of object
 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) public
 createRoleFolder ()
 creates a local role folder
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static validateExternalRaterCode ($a_ref_id, $a_code)
static getSurveySkippedValue ()
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

const STATUS_OFFLINE = 0
const STATUS_ONLINE = 1
const EVALUATION_ACCESS_OFF = 0
const EVALUATION_ACCESS_ALL = 1
const EVALUATION_ACCESS_PARTICIPANTS = 2
const INVITATION_OFF = 0
const INVITATION_ON = 1
const MODE_UNLIMITED = 0
const MODE_PREDEFINED_USERS = 1
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
 $survey_id
 $author
 $introduction
 $outro
 $status
 $evaluation_access
 $start_date
 $end_date
 $questions
 $invitation
 $invitation_mode
 $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
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title
const DESC_LENGTH = 128
 $ilias
 $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
 $obj_data_record
 object_data record

Protected Member Functions

 getParticipantTextResults ($active_id)
 checkTutorNotification ()
 getNotificationTargetUserIds ($a_use_invited)
 sendTutorNotification ()
 sentReminder (array $a_recipient_ids)

Protected Attributes

 $activation_visibility
 $activation_starting_time
 $activation_ending_time
 $mode_360
 $mode_360_self_eval
 $mode_360_self_appr
 $mode_360_self_rate
 $mode_360_results
 $mode_360_skill_service
 $reminder_status
 $reminder_start
 $reminder_end
 $reminder_frequency
 $reminder_target
 $reminder_last_sent
 $tutor_ntf_status
 $tutor_ntf_recipients
 $tutor_ntf_target

Detailed Description

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

Member Function Documentation

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

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 public

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

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

Referenced by cloneObject().

{
global $ilDB;
$next_id = $ilDB->nextId('svy_qblk');
$ilDB->manipulateF("INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
" show_blocktitle, owner_fi, tstamp) " .
"VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','text','integer','integer','integer','integer'),
array($next_id, $title, $show_questiontext, $show_blocktitle, $owner, time())
);
return $next_id;
}

+ Here is the caller graph for this function:

ilObjSurvey::_checkCondition (   $a_svy_id,
  $a_operator,
  $a_value,
  $a_usr_id = 0 
)

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

References $ilUser, and ilObjSurveyAccess\_lookupFinished().

{
global $ilUser;
$a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
switch($a_operator)
{
case 'finished':
//if (ilExerciseMembers::_lookupStatus($a_exc_id, $ilias->account->getId()) == "passed")
include_once("./Modules/Survey/classes/class.ilObjSurveyAccess.php");
if (ilObjSurveyAccess::_lookupFinished($a_svy_id, $a_usr_id))
{
return true;
}
else
{
return false;
}
break;
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

ilObjSurvey::_getConstraints (   $survey_id)

Returns the constraints to a given question or questionblock.

public

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

References $result, $row, and $survey_id.

Referenced by cloneObject().

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* ".
"FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id ".
"AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
array('integer'),
array($survey_id)
);
while ($row = $ilDB->fetchAssoc($result))
{
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']));
}
return $result_array;
}

+ Here is the caller graph for this function:

& ilObjSurvey::_getGlobalSurveyData (   $obj_id)

Returns an array with data needed in the repository, personal desktop or courses.

Returns
array resulting array public

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

References $result, and ilObjSurvey().

{
$survey = new ilObjSurvey($obj_id, false);
$survey->loadFromDb();
$result = array();
if (($survey->getTitle()) and ($survey->author) and (count($survey->questions)))
{
$result["complete"] = true;
}
else
{
$result["complete"] = false;
}
$result["evaluation_access"] = $survey->getEvaluationAccess();
return $result;
}

+ Here is the call graph for this function:

ilObjSurvey::_getLastAccess (   $finished_id)

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

References $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
array('integer'),
array($finished_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return $row["tstamp"];
}
else
{
$result = $ilDB->queryF("SELECT tstamp FROM svy_finished WHERE finished_id = %s",
array('integer'),
array($finished_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return $row["tstamp"];
}
}
return "";
}
ilObjSurvey::_getNrOfParticipants (   $survey_id)

Returns the number of participants for a survey.

Parameters
integer$survey_idThe database ID of the survey
Returns
integer The number of participants public

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

References $result, and $survey_id.

Referenced by SurveyQuestion\calculateCumulatedResults(), SurveyTextQuestionGUI\getCumulatedResultsDetails(), SurveyMetricQuestionGUI\getCumulatedResultsDetails(), SurveySingleChoiceQuestionGUI\getCumulatedResultsDetails(), SurveyMultipleChoiceQuestionGUI\getCumulatedResultsDetails(), and SurveyMatrixQuestionGUI\getCumulatedResultsDetails().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($survey_id)
);
return $result->numRows();
}

+ Here is the caller graph for this function:

ilObjSurvey::_getQuestionblock (   $questionblock_id)

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 public

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

References $result, and $row.

Referenced by cloneObject().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_qblk WHERE questionblock_id = %s",
array('integer'),
array($questionblock_id)
);
$row = $ilDB->fetchAssoc($result);
return $row;
}

+ Here is the caller graph for this function:

ilObjSurvey::_hasDatasets (   $survey_id)

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

References $result, and $survey_id.

Referenced by ilSurveySyncTableGUI\importData().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($survey_id)
);
return ($result->numRows()) ? true : false;
}

+ Here is the caller graph for this function:

& ilObjSurvey::_instanciateQuestion (   $question_id)

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

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

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

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

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

{
if ($question_id < 1) return FALSE;
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question_type = SurveyQuestion::_getQuestionType($question_id);
if (strlen($question_type) == 0) return FALSE;
$question = new $question_type();
$question->loadFromDb($question_id);
return $question;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::_isComplete (   $obj_id)

Returns 1, if a survey is complete for use.

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

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

References ilObjSurvey().

{
$survey = new ilObjSurvey($obj_id, false);
$survey->loadFromDb();
if (($survey->getTitle()) and (count($survey->questions)))
{
return 1;
}
else
{
return 0;
}
}

+ Here is the call graph for this function:

ilObjSurvey::addAppraisee (   $a_user_id)

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

References getSurveyId(), and isAppraisee().

{
global $ilDB;
if(!$this->isAppraisee($a_user_id) &&
$a_user_id != ANONYMOUS_USER_ID)
{
$fields = array(
"obj_id" => array("integer", $this->getSurveyId()),
"user_id" => array("integer", $a_user_id)
);
$ilDB->insert("svy_360_appr", $fields);
}
}

+ Here is the call graph for this function:

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 public

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

{
global $ilDB;
$next_id = $ilDB->nextId('svy_constraint');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES ".
"(%s, %s, %s, %s, %s)",
array('integer','integer','integer','float', 'integer'),
array($next_id, $if_question_id, $relation, $value, $conjunction)
);
if ($affectedRows)
{
return $next_id;
}
else
{
return null;
}
}
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 2754 of file class.ilObjSurvey.php.

References getSurveyId().

{
global $ilDB;
$next_id = $ilDB->nextId('svy_qst_constraint');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, ".
"constraint_fi) VALUES (%s, %s, %s, %s)",
array('integer','integer','integer','integer'),
array($next_id, $this->getSurveyId(), $to_question_id, $constraint_id)
);
}

+ Here is the call graph for this function:

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 public

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

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

Referenced by toXML().

{
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$a_xml_writer->xmlStartTag("material", $attribs);
$attrs = array(
"type" => "text/plain"
);
if ($this->isHTML($a_material))
{
$attrs["type"] = "text/xhtml";
}
$mattext = ilRTE::_replaceMediaObjectImageSrc($a_material, 0);
$a_xml_writer->xmlElement("mattext", $attrs, $mattext);
if ($add_mobs)
{
foreach ($mobs as $mob)
{
$mob_id = "il_" . IL_INST_ID . "_mob_" . $mob;
if (strpos($mattext, $mob_id) !== FALSE)
{
$mob_obj =& new ilObjMediaObject($mob);
$imgattrs = array(
"label" => $mob_id,
"uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle(),
"type" => "svy:html",
"id" => $this->getId()
);
$a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
}
}
}
if ($close_material_tag) $a_xml_writer->xmlEndTag("material");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::addQuestion (   $question_id)

Adds a question to the survey.

Parameters
integer$question_idThe question id of the question public

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

{
array_push($this->questions, $question_id);
}
ilObjSurvey::addQuestionToBlock (   $question_id,
  $questionblock_id 
)

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

References deleteConstraints(), and getSurveyId().

{
global $ilDB;
$next_id = $ilDB->nextId('svy_qblk_qst');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
"question_fi) VALUES (%s, %s, %s, %s)",
array('integer','integer','integer','integer'),
array($next_id, $this->getSurveyId(), $questionblock_id, $question_id)
);
$this->deleteConstraints($question_id); // #13713
}

+ Here is the call graph for this function:

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

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

References getSurveyId(), isAppraisee(), and isRater().

{
global $ilDB;
if($this->isAppraisee($a_appraisee_id) &&
!$this->isRater($a_appraisee_id, $a_user_id, $a_anonymous_id))
{
$fields = array(
"obj_id" => array("integer", $this->getSurveyId()),
"appr_id" => array("integer", $a_appraisee_id),
"user_id" => array("integer", $a_user_id),
"anonymous_id" => array("integer", $a_anonymous_id)
);
$ilDB->insert("svy_360_rater", $fields);
}
}

+ Here is the call graph for this function:

ilObjSurvey::applySettingsTemplate (   $template_id)

Apply settings template.

Parameters
int$template_id

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

References $template_id, saveToDb(), setAnonymize(), setPoolUsage(), setShowQuestionTitles(), and setTemplate().

{
{
return;
}
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template = new ilSettingsTemplate($template_id);
$template_settings = $template->getSettings();
if($template_settings)
{
if($template_settings["show_question_titles"] !== NULL)
{
if($template_settings["show_question_titles"]["value"])
{
$this->setShowQuestionTitles(true);
}
else
{
$this->setShowQuestionTitles(false);
}
}
if($template_settings["use_pool"] !== NULL)
{
if($template_settings["use_pool"]["value"])
{
$this->setPoolUsage(true);
}
else
{
$this->setPoolUsage(false);
}
}
if($template_settings["anonymization_options"]["value"])
{
$anon_map = array('personalized' => self::ANONYMIZE_OFF,
'anonymize_with_code' => self::ANONYMIZE_ON,
'anonymize_without_code' => self::ANONYMIZE_FREEACCESS);
$this->setAnonymize($anon_map[$template_settings["anonymization_options"]["value"]]);
}
/* other settings: not needed here
* - enabled_end_date
* - enabled_start_date
* - rte_switch
*/
}
$this->saveToDb();
}

+ Here is the call graph for this function:

ilObjSurvey::bindSurveyCodeToUser (   $user_id,
  $code 
)

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

References checkSurveyCode().

{
global $ilDB;
if($user_id == ANONYMOUS_USER_ID)
{
return;
}
if($this->checkSurveyCode($code))
{
$ilDB->manipulate("UPDATE svy_anonymous".
" SET user_key = ".$ilDB->quote(md5($user_id), "text").
" WHERE survey_key = ".$ilDB->quote($code, "text"));
}
}

+ Here is the call graph for this function:

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 5302 of file class.ilObjSurvey.php.

References getAnonymize().

{
if ($this->getAnonymize() != self::ANONYMIZE_OFF)
{
if ($this->surveyCodeSecurity == FALSE)
{
return TRUE;
}
}
return FALSE;
}

+ Here is the call graph for this function:

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) public

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

References $messages, $result, ilDatePresentation\formatDate(), getEndDate(), getStartDate(), getStatus(), IL_CAL_TIMESTAMP, and STATUS_OFFLINE.

{
global $ilAccess;
$result = TRUE;
$messages = array();
$edit_settings = false;
// check start date
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
array_push($messages,$this->lng->txt('start_date_not_reached').' ('.
$result = FALSE;
$edit_settings = true;
}
}
// check end date
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now > $epoch_time)
{
array_push($messages,$this->lng->txt('end_date_reached').' ('.
$result = FALSE;
$edit_settings = true;
}
}
// check online status
{
array_push($messages, $this->lng->txt("survey_is_offline"));
$result = FALSE;
$edit_settings = true;
}
// check rbac permissions
if (!$a_no_rbac && !$ilAccess->checkAccess("read", "", $this->ref_id))
{
array_push($messages, $this->lng->txt("cannot_participate_survey"));
$result = FALSE;
}
/*
// 2. check previous access
if (!$result["error"])
{
global $ilUser;
$survey_started = $this->isSurveyStarted($ilUser->getId(), $anonymous_id);
if ($survey_started === 1)
{
array_push($messages, $this->lng->txt("already_completed_survey"));
$result = FALSE;
}
}
*/
return array(
"result" => $result,
"messages" => $messages,
"edit_settings" => $edit_settings
);
}

+ Here is the call graph for this function:

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 public

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

{
if (count($working_data) == 0)
{
return 0;
}
if ((count($working_data) == 1) and (strcmp($working_data[0]["value"], "") == 0))
{
return 0;
}
$found = false;
foreach ($working_data as $data)
{
switch ($constraint_data["short"])
{
case "<":
if ($data["value"] < $constraint_data["value"])
{
$found = true;
}
break;
case "<=":
if ($data["value"] <= $constraint_data["value"])
{
$found = true;
}
break;
case "=":
if ($data["value"] == $constraint_data["value"])
{
$found = true;
}
break;
case "<>":
if ($data["value"] <> $constraint_data["value"])
{
$found = true;
}
break;
case ">=":
if ($data["value"] >= $constraint_data["value"])
{
$found = true;
}
break;
case ">":
if ($data["value"] > $constraint_data["value"])
{
$found = true;
}
break;
}
if ($found)
{
break;
}
}
return (int)$found;
}
ilObjSurvey::checkReminder ( )

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

References $row, getEndDate(), ilObject\getId(), ilObjectActivation\getItem(), getNotificationTargetUserIds(), ilObject\getRefId(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderStart(), getReminderStatus(), getReminderTarget(), getStartDate(), IL_CAL_DATE, IL_CAL_DAY, isOffline(), saveToDb(), sentReminder(), setReminderLastSent(), and ilObjectActivation\TIMINGS_ACTIVATION.

{
global $ilDB, $ilAccess;
$now = time();
$today = date("Y-m-d");
// object settings / participation period
if($this->isOffline() ||
!$this->getReminderStatus() ||
($this->getStartDate() && $now < $this->getStartDate()) ||
($this->getEndDate() && $now > $this->getEndDate()))
{
return false;
}
// reminder period
$start = $this->getReminderStart();
if($start)
{
$start = $start->get(IL_CAL_DATE);
}
$end = $this->getReminderEnd();
if($end)
{
$end = $end->get(IL_CAL_DATE);
}
if($today < $start ||
($end && $today > $end))
{
return false;
}
// object access period
include_once "Services/Object/classes/class.ilObjectActivation.php";
$item_data = ilObjectActivation::getItem($this->getRefId());
if($item_data["timing_type"] == ilObjectActivation::TIMINGS_ACTIVATION &&
($now < $item_data["timing_start"] ||
$now > $item_data["timing_end"]))
{
return false;
}
// check frequency
$cut = new ilDate($today, IL_CAL_DATE);
$cut->increment(IL_CAL_DAY, $this->getReminderFrequency()*-1);
if(!$this->getReminderLastSent() ||
$cut->get(IL_CAL_DATE) >= substr($this->getReminderLastSent(), 0, 10))
{
// #16871
$user_ids = $this->getNotificationTargetUserIds(($this->getReminderTarget() == self::NOTIFICATION_INVITED_USERS));
if($user_ids)
{
// gather participants who already finished
$finished_ids = array();
$set = $ilDB->query("SELECT user_fi FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND state = ".$ilDB->quote(1, "text").
" AND ".$ilDB->in("user_fi", $user_ids, "", "integer"));
while($row = $ilDB->fetchAssoc($set))
{
$finished_ids[] = $row["user_fi"];
}
// some users missing out?
$missing_ids = array_diff($user_ids, $finished_ids);
if($missing_ids)
{
foreach($missing_ids as $idx => $user_id)
{
// should be able to participate
if(!$ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId()))
{
unset($missing_ids[$idx]);
}
}
}
if($missing_ids)
{
$this->sentReminder($missing_ids);
}
}
$this->setReminderLastSent($today);
$this->saveToDb();
return true;
}
return false;
}

+ Here is the call graph for this function:

ilObjSurvey::checkSurveyCode (   $code)

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

References isAnonymousKey(), and isSurveyStarted().

Referenced by bindSurveyCodeToUser().

{
if ($this->isAnonymousKey($code))
{
if ($this->isSurveyStarted("", $code) == 1)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::checkTutorNotification ( )
protected

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

References $row, getNotificationTargetUserIds(), getTutorNotificationStatus(), getTutorNotificationTarget(), and sendTutorNotification().

Referenced by finishSurvey().

{
global $ilDB;
{
$user_ids = $this->getNotificationTargetUserIds(($this->getTutorNotificationTarget() == self::NOTIFICATION_INVITED_USERS));
if($user_ids)
{
$set = $ilDB->query("SELECT COUNT(*) numall FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND state = ".$ilDB->quote(1, "integer").
" AND ".$ilDB->in("user_fi", $user_ids, "", "integer"));
$row = $ilDB->fetchAssoc($set);
if($row["numall"] == sizeof($user_ids))
{
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::cleanupMediaobjectUsage ( )

Cleans up the media objects for all text fields in a test which are using an RTE field.

private

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

References ilRTE\_cleanupMediaObjectUsage(), getAllRTEContent(), ilObject\getId(), and ilObject\getType().

{
include_once("./Services/RTE/classes/class.ilRTE.php");
$completecontent = "";
foreach ($this->getAllRTEContent() as $content)
{
$completecontent .= $content;
}
ilRTE::_cleanupMediaObjectUsage($completecontent, $this->getType() . ":html",
$this->getId());
}

+ Here is the call graph for this function:

ilObjSurvey::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone object.

public

Parameters
intref_id of target container
intcopy id
Returns
object new svy object

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

References $result, $row, _addQuestionblock(), _getConstraints(), SurveyQuestion\_getOriginalId(), _getQuestionblock(), _instanciateQuestion(), ilObject\cloneMetaData(), get360Mode(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), get360SkillService(), getAnonymize(), getAuthor(), getEndDate(), getEvaluationAccess(), getIntroduction(), getInvitation(), getInvitationMode(), getOutro(), getReminderEnd(), getReminderFrequency(), getReminderStart(), getReminderStatus(), getReminderTarget(), getShowQuestionTitles(), getStartDate(), getStatus(), getSurveyId(), getTemplate(), getTutorNotificationRecipients(), getTutorNotificationStatus(), getTutorNotificationTarget(), and loadFromDb().

{
global $ilDB;
$this->loadFromDb();
// Copy settings
$newObj = parent::cloneObject($a_target_id,$a_copy_id);
$this->cloneMetaData($newObj);
$newObj->updateMetaData();
$newObj->setAuthor($this->getAuthor());
$newObj->setIntroduction($this->getIntroduction());
$newObj->setOutro($this->getOutro());
$newObj->setStatus($this->getStatus());
$newObj->setEvaluationAccess($this->getEvaluationAccess());
$newObj->setStartDate($this->getStartDate());
$newObj->setEndDate($this->getEndDate());
$newObj->setInvitation($this->getInvitation());
$newObj->setInvitationMode($this->getInvitationMode());
$newObj->setAnonymize($this->getAnonymize());
$newObj->setShowQuestionTitles($this->getShowQuestionTitles());
$newObj->setTemplate($this->getTemplate());
// #12661
if($this->get360Mode())
{
$newObj->set360Mode(true);
$newObj->set360SelfEvaluation($this->get360SelfEvaluation());
$newObj->set360SelfAppraisee($this->get360SelfAppraisee());
$newObj->set360SelfRaters($this->get360SelfRaters());
$newObj->set360Results($this->get360Results());
$newObj->set360SkillService($this->get360SkillService());
}
// reminder/notification
$newObj->setReminderStatus($this->getReminderStatus());
$newObj->setReminderStart($this->getReminderStart());
$newObj->setReminderEnd($this->getReminderEnd());
$newObj->setReminderFrequency($this->getReminderFrequency());
$newObj->setReminderTarget($this->getReminderTarget());
// reminder_last_sent must not be copied!
$newObj->setTutorNotificationStatus($this->getTutorNotificationStatus());
$newObj->setTutorNotificationRecipients($this->getTutorNotificationRecipients());
$newObj->setTutorNotificationTarget($this->getTutorNotificationTarget());
$question_pointer = array();
// clone the questions
$mapping = array();
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
foreach ($this->questions as $key => $question_id)
{
$question = ilObjSurvey::_instanciateQuestion($question_id);
if($question) // #10824
{
$question->id = -1;
$original_id = SurveyQuestion::_getOriginalId($question_id, false);
$question->saveToDb($original_id);
$newObj->questions[$key] = $question->getId();
$question_pointer[$question_id] = $question->getId();
$mapping[$question_id] = $question->getId();
}
}
$newObj->saveToDb();
$newObj->cloneTextblocks($mapping);
// clone the questionblocks
$questionblocks = array();
$questionblock_questions = array();
$result = $ilDB->queryF("SELECT * FROM svy_qblk_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows() > 0)
{
while ($row = $ilDB->fetchAssoc($result))
{
array_push($questionblock_questions, $row);
$questionblocks[$row["questionblock_fi"]] = $row["questionblock_fi"];
}
}
// create new questionblocks
foreach ($questionblocks as $key => $value)
{
$questionblock = ilObjSurvey::_getQuestionblock($key);
$questionblock_id = ilObjSurvey::_addQuestionblock($questionblock["title"], $questionblock["owner_fi"], $questionblock["show_questiontext"], $questionblock["show_blocktitle"]);
$questionblocks[$key] = $questionblock_id;
}
// create new questionblock questions
foreach ($questionblock_questions as $key => $value)
{
if($questionblocks[$value["questionblock_fi"]] &&
$question_pointer[$value["question_fi"]])
{
$next_id = $ilDB->nextId('svy_qblk_qst');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) ".
"VALUES (%s, %s, %s, %s)",
array('integer','integer','integer','integer'),
array($next_id, $newObj->getSurveyId(), $questionblocks[$value["questionblock_fi"]], $question_pointer[$value["question_fi"]])
);
}
}
// clone the constraints
$constraints = ilObjSurvey::_getConstraints($this->getSurveyId());
$newConstraints = array();
foreach ($constraints as $key => $constraint)
{
if ($question_pointer[$constraint["for_question"]] &&
$question_pointer[$constraint["question"]])
{
if (!array_key_exists($constraint['id'], $newConstraints))
{
$constraint_id = $newObj->addConstraint($question_pointer[$constraint["question"]], $constraint["relation_id"], $constraint["value"], $constraint['conjunction']);
$newConstraints[$constraint['id']] = $constraint_id;
}
$newObj->addConstraintToQuestion($question_pointer[$constraint["for_question"]], $newConstraints[$constraint['id']]);
}
}
// clone the obligatory states
$result = $ilDB->queryF("SELECT * FROM svy_qst_oblig WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows() > 0)
{
while ($row = $ilDB->fetchAssoc($result))
{
if($question_pointer[$row["question_fi"]])
{
$next_id = $ilDB->nextId('svy_qst_oblig');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, ".
"obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','integer','integer','text','integer'),
array($next_id, $newObj->getSurveyId(), $question_pointer[$row["question_fi"]], $row["obligatory"], time())
);
}
}
}
return $newObj;
}

+ Here is the call graph for this function:

ilObjSurvey::cloneTextblocks (   $mapping)

Clones the textblocks of survey questions.

public

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

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

{
foreach ($mapping as $original_id => $new_id)
{
$textblock = $this->getTextblock($original_id);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
}
}

+ Here is the call graph for this function:

ilObjSurvey::closeAppraisee (   $a_user_id)

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

References get360SkillService(), and getSurveyId().

{
global $ilDB;
// close the appraisee
$ilDB->manipulate("UPDATE svy_360_appr".
" SET has_closed = ".$ilDB->quote(time(), "integer").
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
// write competences
include_once("./Services/Skill/classes/class.ilSkillManagementSettings.php");
$skmg_set = new ilSkillManagementSettings();
if ($this->get360SkillService() && $skmg_set->isActivated())
{
include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
$sskill = new ilSurveySkill($this);
$sskill->writeAppraiseeSkills($a_user_id);
}
}

+ Here is the call graph for this function:

ilObjSurvey::create (   $a_upload = false)

create survey object

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

References ilObject\create(), and createMetaData().

{
if(!$a_upload)
{
$this->createMetaData();
}
}

+ Here is the call graph for this function:

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)

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

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

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$svy_data_dir = ilUtil::getDataDir()."/svy_data";
ilUtil::makeDir($svy_data_dir);
if(!is_writable($svy_data_dir))
{
$this->ilias->raiseError("Survey Data Directory (".$svy_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$svy_dir = $svy_data_dir."/svy_".$this->getId();
ilUtil::makeDir($svy_dir);
if(!@is_dir($svy_dir))
{
$this->ilias->raiseError("Creation of Survey Directory failed.",$this->ilias->error_obj->FATAL);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
$export_dir = $svy_dir."/export";
ilUtil::makeDir($export_dir);
if(!@is_dir($export_dir))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
}
}

+ Here is the call graph for this function:

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)

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

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

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$svy_data_dir = ilUtil::getDataDir()."/svy_data";
ilUtil::makeDir($svy_data_dir);
if(!is_writable($svy_data_dir))
{
$this->ilias->raiseError("Survey Data Directory (".$svy_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create test directory (data_dir/svy_data/svy_<id>)
$svy_dir = $svy_data_dir."/svy_".$this->getId();
ilUtil::makeDir($svy_dir);
if(!@is_dir($svy_dir))
{
$this->ilias->raiseError("Creation of Survey Directory failed.",$this->ilias->error_obj->FATAL);
}
// create import subdirectory (data_dir/svy_data/svy_<id>/import)
$import_dir = $svy_dir."/import";
ilUtil::makeDir($import_dir);
if(!@is_dir($import_dir))
{
$this->ilias->raiseError("Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
}
}

+ Here is the call graph for this function:

ilObjSurvey::createMetaData ( )

Create meta data entry.

public

Reimplemented from ilObject.

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

References saveAuthorToMetadata().

Referenced by create().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::createNewAccessCode ( )

Returns a new, unused survey access code.

Returns
string A new survey access code

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

References isSurveyCodeUnique().

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

{
// create a 5 character code
$codestring = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
mt_srand();
$code = "";
for ($i = 1; $i <=5; $i++)
{
$index = mt_rand(0, strlen($codestring)-1);
$code .= substr($codestring, $index, 1);
}
// verify it against the database
while (!$this->isSurveyCodeUnique($code))
{
$code = $this->createNewAccessCode();
}
return $code;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::createQuestionblock (   $title,
  $show_questiontext,
  $show_blocktitle,
  $questions 
)

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 public

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

References $ilUser, $questions, ilObject\$title, deleteConstraints(), getSurveyId(), and moveQuestions().

Referenced by insertQuestionblock().

{
global $ilDB;
// if the selected questions are not in a continous selection, move all questions of the
// questionblock at the position of the first selected question
// now save the question block
global $ilUser;
$next_id = $ilDB->nextId('svy_qblk');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
" show_blocktitle, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','text','text','text','integer','integer'),
array($next_id, $title, $show_questiontext, $show_blocktitle, $ilUser->getId(), time())
);
if ($affectedRows)
{
$questionblock_id = $next_id;
foreach ($questions as $index)
{
$next_id = $ilDB->nextId('svy_qblk_qst');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
"question_fi) VALUES (%s, %s, %s, %s)",
array('integer','integer','integer','integer'),
array($next_id, $this->getSurveyId(), $questionblock_id, $index)
);
$this->deleteConstraints($index);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::createReference ( )

creates reference for object

public

Returns
integer reference_id of object

Reimplemented from ilObject.

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

References $result, and saveToDb().

{
$this->saveToDb();
return $result;
}

+ Here is the call graph for this function:

ilObjSurvey::createSurveyCodes (   $nrOfCodes)

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

References $res, createNewAccessCode(), and getSurveyId().

{
global $ilDB;
$res = array();
for ($i = 0; $i < $nrOfCodes; $i++)
{
$next_id = $ilDB->nextId('svy_anonymous');
$ilDB->manipulateF("INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, tstamp) ".
"VALUES (%s, %s, %s, %s)",
array('integer','text','integer','integer'),
array($next_id, $this->createNewAccessCode(), $this->getSurveyId(), time())
);
$res[] = $next_id;
}
return $res;
}

+ Here is the call graph for this function:

ilObjSurvey::createSurveyCodesForExternalData (   $data)

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

References createNewAccessCode(), and getSurveyId().

{
global $ilDB;
$ids = array();
foreach ($data as $dataset)
{
$anonymize_key = $this->createNewAccessCode();
$next_id = $ilDB->nextId('svy_anonymous');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) ".
"VALUES (%s, %s, %s, %s, %s)",
array('integer','text','integer','text','integer'),
array($next_id, $anonymize_key, $this->getSurveyId(), serialize($dataset), time())
);
$ids[] = $next_id;
}
return $ids;
}

+ Here is the call graph for this function:

ilObjSurvey::delete ( )

delete object and all related data

public

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

Reimplemented from ilObject.

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

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

{
$remove = parent::delete();
// always call parent delete function first!!
if (!$remove)
{
return false;
}
$this->deleteMetaData();
// Delete all survey questions, constraints and materials
foreach ($this->questions as $question_id)
{
$this->removeQuestion($question_id);
}
return true;
}

+ Here is the call graph for this function:

ilObjSurvey::deleteAllUserData ( )

Deletes all user data of a survey.

public

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

References $result, $row, and getSurveyId().

Referenced by deleteSurveyRecord().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$active_array = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($active_array, $row["finished_id"]);
}
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
foreach ($active_array as $active_fi)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_answer WHERE active_fi = %s",
array('integer'),
array($active_fi)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_times WHERE finished_fi = %s",
array('integer'),
array($active_fi)
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::deleteAppraisee (   $a_user_id)

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

References $row, deleteRater(), and get360SelfEvaluation().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM svy_360_appr".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
$set = $ilDB->query("SELECT user_id".
" FROM svy_360_rater".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_user_id, "integer"));
while($row = $ilDB->fetchAssoc($set))
{
$this->deleteRater($a_user_id, $row["user_id"]);
}
// appraisee will not be part of raters table
if($this->get360SelfEvaluation())
{
$this->deleteRater($a_user_id, $a_user_id);
}
}

+ Here is the call graph for this function:

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 public

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

Referenced by deleteConstraints(), and moveQuestions().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_constraint WHERE constraint_id = %s",
array('integer'),
array($constraint_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
array('integer'),
array($constraint_id)
);
}

+ Here is the caller graph for this function:

ilObjSurvey::deleteConstraints (   $question_id)

Deletes the constraints for a question.

Parameters
integer$question_idThe database id of the question public

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

References $result, $row, deleteConstraint(), and getSurveyId().

Referenced by addQuestionToBlock(), and createQuestionblock().

{
global $ilDB;
$result = $ilDB->queryF("SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($question_id, $this->getSurveyId())
);
$constraints = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($constraints, $row["constraint_fi"]);
}
foreach ($constraints as $constraint_id)
{
$this->deleteConstraint($constraint_id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References getFinishedIdForAppraiseeIdAndRaterId(), and removeSelectedSurveyResults().

Referenced by deleteAppraisee().

{
global $ilDB;
$finished_id = $this->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_user_id);
if($finished_id)
{
$this->removeSelectedSurveyResults(array($finished_id));
}
$ilDB->manipulate("DELETE FROM svy_360_rater".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_appraisee_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer").
" AND anonymous_id = ".$ilDB->quote($a_anonymous_id, "integer"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::deleteSurveyCode (   $survey_code)

Deletes a given survey access code.

Parameters
string$survey_codeThe survey code that should be deleted

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

References getSurveyId().

{
global $ilDB;
if (strlen($survey_code) > 0)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
array('integer', 'text'),
array($this->getSurveyId(), $survey_code)
);
}
}

+ Here is the call graph for this function:

ilObjSurvey::deleteSurveyRecord ( )

Deletes the survey from the database.

public

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

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

Referenced by delete().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_svy WHERE survey_id = %s",
array('integer'),
array($this->getSurveyId())
);
$result = $ilDB->queryF("SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$questionblocks = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($questionblocks, $row["questionblock_fi"]);
}
if (count($questionblocks))
{
$affectedRows = $ilDB->manipulate("DELETE FROM svy_qblk WHERE " . $ilDB->in('questionblock_id', $questionblocks, false, 'integer'));
}
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_anonymous WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
// delete export files
include_once "./Services/Utilities/classes/class.ilUtil.php";
$svy_data_dir = ilUtil::getDataDir()."/svy_data";
$directory = $svy_data_dir."/svy_".$this->getId();
if (is_dir($directory))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
// remaining usages are not in text anymore -> delete them
// and media objects (note: delete method of ilObjMediaObject
// checks whether object is used in another context; if yes,
// the object is not deleted!)
foreach($mobs as $mob)
{
ilObjMediaObject::_removeUsage($mob, "svy:html", $this->getId());
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->delete();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::deleteUserSettings (   $id)

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

References ilObject\$id.

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_settings WHERE settings_id = %s",
array('integer'),
array($id)
);
return $affectedRows;
}
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 public

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

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
array('integer','integer'),
array($question_id, $active_id)
);
}
ilObjSurvey::deliverPDFfromFO (   $fo)

Delivers a PDF file from a XSL-FO string.

Parameters
string$foThe XSL-FO string public

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

References $ilLog, ilUtil\deliverData(), ilRpcClientFactory\factory(), ilUtil\getASCIIFilename(), and ilUtil\ilTempnam().

{
global $ilLog;
include_once "./Services/Utilities/classes/class.ilUtil.php";
$fo_file = ilUtil::ilTempnam() . ".fo";
$fp = fopen($fo_file, "w"); fwrite($fp, $fo); fclose($fp);
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
try
{
$pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($fo);
ilUtil::deliverData($pdf_base64->scalar, ilUtil::getASCIIFilename($this->getTitle()) . ".pdf", "application/pdf");
return true;
}
{
$ilLog->write(__METHOD__.': '.$e->getMessage());
return false;
}
catch(Exception $e)
{
$ilLog->write(__METHOD__.': '.$e->getMessage());
return false;
}
/*
include_once "./Services/Transformation/classes/class.ilFO2PDF.php";
$fo2pdf = new ilFO2PDF();
$fo2pdf->setFOString($fo);
$result = $fo2pdf->send();
ilUtil::deliverData($result, ilUtil::getASCIIFilename($this->getTitle()) . ".pdf", "application/pdf");
*/
}

+ Here is the call graph for this function:

ilObjSurvey::disinviteAllUsers ( )

Disinvite all users.

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

References $result, $row, disinviteUser(), and getSurveyId().

Referenced by setInvitation().

{
global $ilDB;
$result = $ilDB->queryF("SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
$this->disinviteUser($row['user_fi']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::disinviteUser (   $user_id)

Disinvites a user from a survey.

Parameters
integer$user_idThe database id of the disinvited user

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

References ilObjUser\_dropDesktopItem(), ilObject\getRefId(), and getSurveyId().

Referenced by disinviteAllUsers().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s",
array('integer','integer'),
array($this->getSurveyId(), $user_id)
);
include_once './Services/User/classes/class.ilObjUser.php';
ilObjUser::_dropDesktopItem($user_id, $this->getRefId(), "svy");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 public

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

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

Referenced by insertQuestion(), and insertQuestionblock().

{
global $ilUser;
$questiontype = $this->getQuestionType($question_id);
$question_gui = $this->getQuestionGUI($questiontype, $question_id);
// check if question is a pool question at all, if not do nothing
if($this->getId() == $question_gui->object->getObjId() && !$a_force)
{
return $question_id;
}
$duplicate_id = $question_gui->object->duplicate(true);
return $duplicate_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::fillSurveyForUser (   $user_id = ANONYMOUS_USER_ID)

Fills a survey randomly with data for a given user.

Parameters
integer$user_idThe database id of the user. If empty an anonymous user will be taken public

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

References _instanciateQuestion(), createNewAccessCode(), getSurveyId(), getSurveyPages(), and saveUserAccessCode().

{
global $ilDB;
// create an anonymous key
$anonymous_id = $this->createNewAccessCode();
$this->saveUserAccessCode($user_id, $anonymous_id);
// create the survey_finished dataset and set the survey finished already
$active_id = $ilDB->nextId('svy_finished');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp) ".
"VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','text','text','integer'),
array($active_id, $this->getSurveyId(), $user_id, $anonymous_id, 1, time())
);
// fill the questions randomly
$pages =& $this->getSurveyPages();
foreach ($pages as $key => $question_array)
{
foreach ($question_array as $question)
{
// instanciate question
require_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question =& SurveyQuestion::_instanciateQuestion($question["question_id"]);
$question->saveRandomData($active_id);
}
}
}

+ Here is the call graph for this function:

ilObjSurvey::findCodeForUser (   $a_user_id)

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

{
global $ilDB;
if($a_user_id != ANONYMOUS_USER_ID)
{
$set = $ilDB->query("SELECT sf.anonymous_id FROM svy_finished sf".
" WHERE sf.survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND sf.user_fi = ".$ilDB->quote($a_user_id, "integer"));
$a_code = $ilDB->fetchAssoc($set);
return $a_code["anonymous_id"];
}
}
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 public

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

References checkTutorNotification(), and getSurveyId().

{
global $ilDB;
$ilDB->manipulateF("UPDATE svy_finished SET state = %s, tstamp = %s".
" WHERE survey_fi = %s AND finished_id = %s",
array('text','integer','integer','integer'),
array(1, time(), $this->getSurveyId(), $finished_id)
);
}

+ Here is the call graph for this function:

ilObjSurvey::get360Mode ( )

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

References $mode_360.

Referenced by cloneObject(), getUserSurveyExecutionStatus(), saveToDb(), and toXML().

{
return (bool)$this->mode_360;
}

+ Here is the caller graph for this function:

ilObjSurvey::get360Results ( )

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

References $mode_360_results.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::get360SelfAppraisee ( )

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

References $mode_360_self_appr.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::get360SelfEvaluation ( )

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

References $mode_360_self_eval.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::get360SelfRaters ( )

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

References $mode_360_self_rate.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::get360SkillService ( )

Get skill service.

Returns
bool activate skill service

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

References $mode_360_skill_service.

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

+ Here is the caller graph for this function:

ilObjSurvey::getActivationEndDate ( )

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

Referenced by saveToDb().

{
return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getActivationStartDate ( )

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

Referenced by saveToDb().

{
return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getActivationVisibility ( )

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

References $activation_visibility.

Referenced by saveToDb().

+ Here is the caller graph for this function:

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 public

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

References $result, $row, and getSurveyId().

Referenced by sendNotificationMail().

{
global $ilDB;
// see self::isSurveyStarted()
// #15031 - should not matter if code was used by registered or anonymous (each code must be unique)
if($anonymize_id)
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished".
" WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
array('integer','text','integer'),
array($this->getSurveyId(), $anonymize_id, $appr_id)
);
}
else
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
if ($result->numRows() == 0)
{
return false;
}
else
{
$row = $ilDB->fetchAssoc($result);
return $row["finished_id"];
}
/*
if ($this->getAnonymize())
{
if ((($user_id != ANONYMOUS_USER_ID) && (strlen($anonymize_id) == 0)) && (!($this->isAccessibleWithoutCode() && $this->isAllowedToTakeMultipleSurveys())))
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
else
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished".
" WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
array('integer','text','integer'),
array($this->getSurveyId(), $anonymize_id, $appr_id)
);
}
}
else
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
if ($result->numRows() == 0)
{
return false;
}
else
{
$row = $ilDB->fetchAssoc($result);
return $row["finished_id"];
}
*/
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getAllRelations (   $short_as_key = false)

Returns all available relations.

public

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

References $result, $row, and ilUtil\sortArray().

{
global $ilDB;
// #7987
$custom_order = array("equal", "not_equal", "less", "less_or_equal", "more", "more_or_equal");
$custom_order = array_flip($custom_order);
$result_array = array();
$result = $ilDB->query("SELECT * FROM svy_relation");
while ($row = $ilDB->fetchAssoc($result))
{
if ($short_as_key)
{
$result_array[$row["shortname"]] = array("short" => $row["shortname"], "long" => $row["longname"], "id" => $row["relation_id"], "order" => $custom_order[$row["longname"]]);
}
else
{
$result_array[$row["relation_id"]] = array("short" => $row["shortname"], "long" => $row["longname"], "order" => $custom_order[$row["longname"]]);
}
}
$result_array = ilUtil::sortArray($result_array, "order", "ASC", true, true);
foreach($result_array as $idx => $item)
{
unset($result_array[$idx]["order"]);
}
return $result_array;
}

+ Here is the call graph for this function:

ilObjSurvey::getAllRTEContent ( )

Returns the content of all RTE enabled text areas in the test.

private

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

References $result, getIntroduction(), and getOutro().

Referenced by cleanupMediaobjectUsage().

{
$result = array();
array_push($result, $this->getIntroduction());
array_push($result, $this->getOutro());
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getAnonymize ( )

get anonymize status

Returns
integer status

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

Referenced by canExportSurveyCode(), cloneObject(), getUserDataFromActiveId(), getUserSurveyExecutionStatus(), isAccessibleWithCodeForAll(), isAccessibleWithoutCode(), saveToDb(), sendNotificationMail(), startSurvey(), and toXML().

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

+ Here is the caller graph for this function:

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 public

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

References ilObject\$id, $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT anonymous_id FROM svy_finished WHERE anonymous_id = %s",
array('text'),
array($id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return $row["anonymous_id"];
}
else
{
return "";
}
}
ilObjSurvey::getAnonymousIdByCode (   $a_code)

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

References $res.

{
global $ilDB;
$set = $ilDB->query("SELECT anonymous_id FROM svy_anonymous".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND survey_key = ".$ilDB->quote($a_code, "text"));
$res = $ilDB->fetchAssoc($set);
return $res["anonymous_id"];
}
ilObjSurvey::getAppraiseesData ( )

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

References $res, $row, ilObjUser\_lookupEmail(), ilObjUser\_lookupName(), and getRatersData().

{
global $ilDB;
$res = array();
$set = $ilDB->query("SELECT * FROM svy_360_appr".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer"));
while($row = $ilDB->fetchAssoc($set))
{
$name = ilObjUser::_lookupName($row["user_id"]);
$name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
$res[$row["user_id"]] = $name;
$finished = 0;
$raters = $this->getRatersData($row["user_id"]);
foreach($raters as $rater)
{
if($rater["finished"])
{
$finished++;
}
}
$res[$row["user_id"]]["finished"] = $finished."/".sizeof($raters);
$res[$row["user_id"]]["closed"] = $row["has_closed"];
}
return $res;
}

+ Here is the call graph for this function:

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

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

References $res, $row, get360SelfEvaluation(), getSurveyId(), and isAppraisee().

{
global $ilDB;
$res = array();
$sql = "SELECT appr_id FROM svy_360_rater".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer");
if($a_user_id)
{
$sql .= " AND user_id = ".$ilDB->quote($a_user_id, "integer");
}
else
{
$sql .= " AND anonymous_id = ".$ilDB->quote($a_anonymous_id, "integer");
}
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row["appr_id"];
}
// user may evaluate himself if already appraisee
if($this->get360SelfEvaluation() &&
$this->isAppraisee($a_user_id) &&
!in_array($a_user_id, $res))
{
$res[] = $a_user_id;
}
return $res;
}

+ Here is the call graph for this function:

ilObjSurvey::getAuthor ( )

Gets the authors name of the ilObjSurvey object.

Returns
string The string containing the name of the test author public
See Also
$author

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

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

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

{
$author = array();
include_once "./Services/MetaData/classes/class.ilMD.php";
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_life =& $md->getLifecycle();
if ($md_life)
{
$ids =& $md_life->getContributeIds();
foreach ($ids as $id)
{
$md_cont =& $md_life->getContribute($id);
if (strcmp($md_cont->getRole(), "Author") == 0)
{
$entids =& $md_cont->getEntityIds();
foreach ($entids as $entid)
{
$md_ent =& $md_cont->getEntity($entid);
array_push($author, $md_ent->getEntity());
}
}
}
}
return join($author, ",");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& 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 public

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

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

Referenced by getQuestionsTable().

{
include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
return ilObjSurveyQuestionPool::_getAvailableQuestionpools($use_obj_id, $could_be_offline, $showPath, $permission);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getConstraints (   $question_id)

Returns the constraints to a given question or questionblock.

public

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

References $result, $row, SurveyQuestion\_getQuestionType(), SurveyQuestion\_includeClass(), and getSurveyId().

Referenced by getSurveyPages(), getSurveyQuestions(), and moveQuestions().

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation ".
"WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
"svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s ".
"AND svy_qst_constraint.survey_fi = %s",
array('integer','integer'),
array($question_id, $this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question_type = SurveyQuestion::_getQuestionType($row["question_fi"]);
$question = new $question_type();
$question->loadFromDb($row["question_fi"]);
$valueoutput = $question->getPreconditionValueOutput($row["value"]);
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));
}
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getCumulatedResults ( $question,
  $finished_ids 
)

Calculates the evaluation data for a question.

Parameters
integer$question_idThe database id of the question
integer$user_idThe database id of the user
Returns
array An array containing the evaluation parameters for the question public

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

References $result, and getSurveyId().

Referenced by getDetailedParticipantResultsAsText().

{
global $ilDB;
if(!$finished_ids)
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$nr_of_users = $result->numRows();
}
else
{
$nr_of_users = sizeof($finished_ids);
}
$result_array =& $question->getCumulatedResults($this->getSurveyId(), $nr_of_users, $finished_ids);
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getDetailedParticipantResultsAsText ( )

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

References $questions, _instanciateQuestion(), getCumulatedResults(), and getSurveyQuestions().

{
$counter = 0;
$counter++;
foreach ($questions as $data)
{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question = SurveyQuestion::_instanciateQuestion($data["question_id"]);
$eval = $this->getCumulatedResults($question);
}
}

+ Here is the call graph for this function:

ilObjSurvey::getEndDate ( )

Gets the end date of the survey.

Returns
string Survey end date (YYYY-MM-DD) public
See Also
$end_date

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

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

{
return (strlen($this->end_date)) ? $this->end_date : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getEvaluationAccess ( )

Gets the learners evaluation access.

Returns
integer The evaluation access public
See Also
$evaluation_access

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

References EVALUATION_ACCESS_OFF.

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

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

+ Here is the caller graph for this function:

& 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 public

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

References $questions, $result, $row, and getUserDataFromActiveId().

{
global $ilDB;
// collect all answers
$answers = array();
$result = $ilDB->queryF("SELECT * FROM svy_answer WHERE active_fi = %s",
array('integer'),
array($active_id)
);
while ($row = $ilDB->fetchAssoc($result))
{
if (!is_array($answers[$row["question_fi"]]))
{
$answers[$row["question_fi"]] = array();
}
array_push($answers[$row["question_fi"]], $row);
}
$userdata = $this->getUserDataFromActiveId($active_id);
$resultset = array(
"name" => $userdata["fullname"],
"firstname" => $userdata["firstname"],
"lastname" => $userdata["lastname"],
"login" => $userdata["login"],
"gender" => $userdata["gender"],
"answers" => array()
);
foreach ($questions as $key => $question)
{
if (array_key_exists($key, $answers))
{
$resultset["answers"][$key] = $answers[$key];
}
else
{
$resultset["answers"][$key] = array();
}
sort($resultset["answers"][$key]);
}
return $resultset;
}

+ Here is the call graph for this function:

& ilObjSurvey::getExistingQuestions ( )

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

Returns
array The questions of the survey public

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

References $result, and getSurveyId().

Referenced by getQuestionsTable().

{
global $ilDB;
$existing_questions = array();
$result = $ilDB->queryF("SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
"svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
array('integer'),
array($this->getSurveyId())
);
while ($data = $ilDB->fetchAssoc($result))
{
if($data["original_id"])
{
array_push($existing_questions, $data["original_id"]);
}
}
return $existing_questions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getExportDirectory ( )

get export directory of survey

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

References ilUtil\getDataDir().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$export_dir = ilUtil::getDataDir()."/svy_data"."/svy_".$this->getId()."/export";
return $export_dir;
}

+ Here is the call graph for this function:

ilObjSurvey::getExportFiles (   $dir)

get export files

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

References $file.

{
// quit if import dir not available
if (!@is_dir($dir) or
!is_writeable($dir))
{
return array();
}
// open directory
$dir = dir($dir);
// initialize array
$file = array();
// get files and save the in the array
while ($entry = $dir->read())
{
if ($entry != "." && $entry != ".." && ereg("^[0-9]{10}_{2}[0-9]+_{2}(svy_)*[0-9]+\.[a-z]{1,3}\$", $entry))
{
$file[] = $entry;
}
}
// close import directory
$dir->close();
// sort files
sort ($file);
reset ($file);
return $file;
}
ilObjSurvey::getExternalCodeRecipients (   $a_check_finished = false)

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

References $res, $result, $row, getSurveyId(), and isSurveyCodeUsed().

Referenced by sendCodes().

{
global $ilDB;
$result = $ilDB->queryF("SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$res = array();
while ($row = $ilDB->fetchAssoc($result))
{
if(!$row['externaldata'])
{
continue;
}
$externaldata = unserialize($row['externaldata']);
if(!$externaldata['email'])
{
continue;
}
$externaldata['code'] = $row['code'];
$externaldata['sent'] = $row['sent'];
if($a_check_finished)
{
$externaldata['finished'] = $this->isSurveyCodeUsed($row['code']);
}
array_push($res, $externaldata);
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 6195 of file class.ilObjSurvey.php.

References $row.

Referenced by deleteRater().

{
global $ilDB;
$set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_appr_id, "integer").
" AND user_fi = ".$ilDB->quote($a_rat_id, "integer"));
$row = $ilDB->fetchAssoc($set);
return $row["finished_id"];
}

+ Here is the caller graph for this function:

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

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

References $res, and $row.

{
global $ilDB;
$res = array();
$set = $ilDB->query("SELECT finished_id, user_fi FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_appr_id, "integer"));
while($row = $ilDB->fetchAssoc($set))
{
if ($a_exclude_appraisee && $row["user_fi"] == $a_appr_id)
{
continue;
}
$res[] = $row["finished_id"];
}
return $res;
}
& ilObjSurvey::getGroupData (   $ids)

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

References ilObject\$ref_id, $result, ilObject\_lookupDescription(), ilObject\_lookupObjId(), and ilObject\_lookupTitle().

{
if (!is_array($ids) || count($ids) ==0) return array();
$result = array();
foreach ($ids as $ref_id)
{
$obj_id = ilObject::_lookupObjId($ref_id);
$result[$ref_id] = array("ref_id" => $ref_id, "title" => ilObject::_lookupTitle($obj_id), "description" => ilObject::_lookupDescription($obj_id));
}
return $result;
}

+ Here is the call graph for this function:

ilObjSurvey::getImportDirectory ( )

get import directory of survey

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

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

Referenced by delete(), and importObject().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$import_dir = ilUtil::getDataDir()."/svy_data".
"/svy_".$this->getId()."/import";
if (!is_dir($import_dir))
{
ilUtil::makeDirParents($import_dir);
}
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getIntroduction ( )

Gets the introduction text.

Returns
string The introduction of the survey object public
See Also
$introduction

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

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

{
return (strlen($this->introduction)) ? $this->introduction : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getInvitation ( )

Gets the invitation status.

Returns
integer The invitation status public
See Also
$invitation

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

References INVITATION_OFF.

Referenced by cloneObject(), inviteGroup(), inviteRole(), inviteUser(), and saveToDb().

{
return ($this->invitation) ? $this->invitation : self::INVITATION_OFF;
}

+ Here is the caller graph for this function:

ilObjSurvey::getInvitationMode ( )

Gets the invitation mode.

Returns
integer The invitation mode public
See Also
$invitation

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

References MODE_PREDEFINED_USERS, and MODE_UNLIMITED.

Referenced by cloneObject(), saveToDb(), and setInvitation().

{
include_once "./Services/Administration/classes/class.ilSetting.php";
$surveySetting = new ilSetting("survey");
$unlimited_invitation = $surveySetting->get("unlimited_invitation");
if (!$unlimited_invitation && $this->invitation_mode == self::MODE_UNLIMITED)
{
}
else
{
return ($this->invitation_mode) ? $this->invitation_mode : self::MODE_UNLIMITED;
}
}

+ Here is the caller graph for this function:

& ilObjSurvey::getInvitedUsers ( )

Returns a list of all invited users in a survey.

Returns
array The user id's of the invited users public

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

References $result, $row, and getSurveyId().

Referenced by getNotificationTargetUserIds().

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
array_push($result_array, $row["user_fi"]);
}
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 public

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

References $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT lastpage FROM svy_finished WHERE finished_id = %s",
array('integer'),
array($active_id)
);
if ($result->numRows() == 0)
{
return "";
}
else
{
$row = $ilDB->fetchAssoc($result);
return ($row["lastpage"]) ? $row["lastpage"] : '';
}
}
ilObjSurvey::getMailAddresses ( )

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

References $mailaddresses.

Referenced by saveToDb().

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getMailNotification ( )

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

References $mailnotification.

Referenced by saveToDb().

+ Here is the caller graph for this function:

ilObjSurvey::getMailParticipantData ( )

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

References $mailparticipantdata.

Referenced by saveToDb().

+ Here is the caller graph for this function:

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 public

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

References getSurveyPages().

{
$foundpage = -1;
$pages =& $this->getSurveyPages();
if (strcmp($active_page_question_id, "") == 0)
{
return $pages[0];
}
foreach ($pages as $key => $question_array)
{
foreach ($question_array as $question)
{
if ($active_page_question_id == $question["question_id"])
{
$foundpage = $key;
}
}
}
if ($foundpage == -1)
{
// error: page not found
}
else
{
$foundpage += $direction;
if ($foundpage < 0)
{
return 0;
}
if ($foundpage >= count($pages))
{
return 1;
}
return $pages[$foundpage];
}
}

+ Here is the call graph for this function:

ilObjSurvey::getNotificationTargetUserIds (   $a_use_invited)
protected

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

References ilObject\_lookupObjId(), getInvitedUsers(), and ilObject\getRefId().

Referenced by checkReminder(), and checkTutorNotification().

{
global $tree;
if((bool)$a_use_invited)
{
$user_ids = $this->getInvitedUsers();
}
else
{
$parent_grp_ref_id = $tree->checkForParentType($this->getRefId(), "grp");
if($parent_grp_ref_id)
{
include_once "Modules/Group/classes/class.ilGroupParticipants.php";
$part = new ilGroupParticipants(ilObject::_lookupObjId($parent_grp_ref_id));
$user_ids = $part->getMembers();
}
else
{
$parent_crs_ref_id = $tree->checkForParentType($this->getRefId(), "crs");
if($parent_crs_ref_id)
{
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
$part = new ilCourseParticipants(ilObject::_lookupObjId($parent_crs_ref_id));
$user_ids = $part->getMembers();
}
}
}
return $user_ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjSurvey::getObligatoryStates ( )

Gets specific obligatory states of the survey.

Returns
array An array containing the obligatory states for every question found in the database public

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

References $result, $row, and getSurveyId().

Referenced by getSurveyPages(), getSurveyQuestions(), and toXML().

{
global $ilDB;
$obligatory_states = array();
$result = $ilDB->queryF("SELECT * FROM svy_qst_oblig WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$obligatory_states[$row["question_fi"]] = $row["obligatory"];
}
}
return $obligatory_states;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getOutro ( )

Gets the outro text.

Returns
string The outro of the survey object public
See Also
$outro

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

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

{
return (strlen($this->outro)) ? $this->outro : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getParticipantTextResults (   $active_id)
protected

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

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

Referenced by sendNotificationMail().

{
$textresult = "";
$userResults =& $this->getUserSpecificResults(array($active_id));
$questions =& $this->getSurveyQuestions(true);
$questioncounter = 1;
foreach ($questions as $question_id => $question_data)
{
$textresult .= $questioncounter++ . ". " . $question_data["title"] . "\n";
$found = $userResults[$question_id][$active_id];
$text = "";
if (is_array($found))
{
$text = implode("\n", $found);
}
else
{
$text = $found;
}
if (strlen($text) == 0) $text = self::getSurveySkippedValue();
$text = str_replace("<br />", "\n", $text);
$textresult .= $text . "\n\n";
}
return $textresult;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getPoolUsage ( )

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

References $pool_usage.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getPrecondition (   $id)

Returns a precondition with a given id.

public

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

References ilObject\$id, and $result.

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, ".
"svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
"svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
array('integer'),
array($id)
);
$pc = array();
if ($result->numRows())
{
$pc = $ilDB->fetchAssoc($result);
}
return $pc;
}
ilObjSurvey::getQuestionblock (   $questionblock_id)

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 public

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

References $result.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_qblk WHERE questionblock_id = %s",
array('integer'),
array($questionblock_id)
);
return $ilDB->fetchAssoc($result);
}
& 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 public

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

References $result.

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_fi FROM svy_qblk_qst WHERE questionblock_fi = %s",
array("integer"),
array($questionblock_id)
);
$ids = array();
if ($result->numRows())
{
while ($data = $ilDB->fetchAssoc($result))
{
array_push($ids, $data['question_fi']);
}
}
return $ids;
}
& 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 public

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

References $result, $row, and $survey_id.

Referenced by getQuestionblocksTable().

{
global $ilDB;
$titles = array();
$result = $ilDB->queryF("SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM ".
"svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
"svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
array('integer'),
array($questionblock_id)
);
$survey_id = "";
while ($row = $ilDB->fetchAssoc($result))
{
$titles[$row["question_fi"]] = $row["title"];
$survey_id = $row["survey_fi"];
}
$result = $ilDB->queryF("SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
array('integer'),
array($survey_id)
);
$resultarray = array();
$counter = 1;
while ($row = $ilDB->fetchAssoc($result))
{
if (array_key_exists($row["question_fi"], $titles))
{
$resultarray[$counter++] = $titles[$row["question_fi"]];
}
}
return $resultarray;
}

+ Here is the caller graph for this function:

ilObjSurvey::getQuestionblocksTable (   $arrFilter)

Calculates the data for the output of the questionblock browser.

public

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

References $ilUser, $row, $survey_id, ilUtil\_getObjectsByOperations(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and getQuestionblockQuestions().

{
global $ilUser, $ilDB;
$where = "";
if (is_array($arrFilter))
{
if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title']))
{
$where .= " AND " . $ilDB->like('svy_qblk.title', 'text', "%%" . $arrFilter['title'] . "%%");
}
}
$query_result = $ilDB->query("SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE ".
"svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi ".
"$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, ".
"svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
$rows = array();
if ($query_result->numRows())
{
$survey_ref_ids = ilUtil::_getObjectsByOperations("svy", "write");
$surveytitles = array();
foreach ($survey_ref_ids as $survey_ref_id)
{
}
while ($row = $ilDB->fetchAssoc($query_result))
{
$questions_array =& $this->getQuestionblockQuestions($row["questionblock_id"]);
$counter = 1;
foreach ($questions_array as $key => $value)
{
$questions_array[$key] = "$counter. $value";
$counter++;
}
if (strlen($surveytitles[$row["obj_fi"]])) // only questionpools which are not in trash
{
$rows[$row["questionblock_id"]] = array(
"questionblock_id" => $row["questionblock_id"],
"title" => $row["title"],
"svy" => $surveytitles[$row["obj_fi"]],
"contains" => join($questions_array, ", "),
"owner" => $row["owner_fi"]
);
}
}
}
return $rows;
}

+ Here is the call graph for this function:

ilObjSurvey::getQuestionGUI (   $questiontype,
  $question_id 
)

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

Returns
object Resulting question gui object public

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

References SurveyQuestionGUI\_getQuestionGUI().

Referenced by duplicateQuestionForSurvey().

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
return SurveyQuestionGUI::_getQuestionGUI($questiontype, $question_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& 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 public

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

References ilObjSurveyQuestionPool\_getAvailableQuestionpools().

{
include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
return ilObjSurveyQuestionPool::_getAvailableQuestionpools($use_object_id = TRUE, $could_be_offline, $showPath);
}

+ Here is the call graph for this function:

& ilObjSurvey::getQuestions (   $question_ids)

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

References $result, and $row.

{
global $ilDB;
$result_array = array();
$result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag FROM svy_question, svy_qtype WHERE ".
"svy_question.questiontype_fi = svy_qtype.questiontype_id AND svy_question.tstamp > 0 AND ".
$ilDB->in('svy_question.question_id', $question_ids, false, 'integer'));
while ($row = $ilDB->fetchAssoc($result))
{
array_push($result_array, $row);
}
return $result_array;
}
ilObjSurvey::getQuestionsTable (   $arrFilter)

Calculates the data for the output of the question browser.

public

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

References $ilUser, $row, ilObjSurveyQuestionPool\_getQuestionTypeTranslations(), getAvailableQuestionpools(), getExistingQuestions(), and isPluginActive().

{
global $ilUser;
global $ilDB;
$where = "";
if (is_array($arrFilter))
{
if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title']))
{
$where .= " AND " . $ilDB->like('svy_question.title', 'text', "%%" . $arrFilter['title'] . "%%");
}
if (array_key_exists('description', $arrFilter) && strlen($arrFilter['description']))
{
$where .= " AND " . $ilDB->like('svy_question.description', 'text', "%%" . $arrFilter['description'] . "%%");
}
if (array_key_exists('author', $arrFilter) && strlen($arrFilter['author']))
{
$where .= " AND " . $ilDB->like('svy_question.author', 'text', "%%" . $arrFilter['author'] . "%%");
}
if (array_key_exists('type', $arrFilter) && strlen($arrFilter['type']))
{
$where .= " AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter['type'], 'text');
}
if (array_key_exists('spl', $arrFilter) && strlen($arrFilter['spl']))
{
$where .= " AND svy_question.obj_fi = " . $ilDB->quote($arrFilter['spl'], 'integer');
}
}
$spls =& $this->getAvailableQuestionpools($use_obj_id = TRUE, $could_be_offline = FALSE, $showPath = FALSE);
$forbidden = "";
$forbidden = " AND " . $ilDB->in('svy_question.obj_fi', array_keys($spls), false, 'integer');
$forbidden .= " AND svy_question.complete = " . $ilDB->quote("1", 'text');
$existing = "";
$existing_questions =& $this->getExistingQuestions();
if (count($existing_questions))
{
$existing = " AND " . $ilDB->in('svy_question.question_id', $existing_questions, true, 'integer');
}
include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
$query_result = $ilDB->query("SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id".
" FROM svy_question, svy_qtype, object_reference".
" WHERE svy_question.original_id IS NULL".$forbidden.$existing.
" AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0".
" AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
$rows = array();
if ($query_result->numRows())
{
while ($row = $ilDB->fetchAssoc($query_result))
{
if (array_key_exists('spl_txt', $arrFilter) && strlen($arrFilter['spl_txt']))
{
if(!stristr($spls[$row["obj_fi"]], $arrFilter['spl_txt']))
{
continue;
}
}
$row['ttype'] = $trans[$row['type_tag']];
if ($row["plugin"])
{
if ($this->isPluginActive($row["type_tag"]))
{
array_push($rows, $row);
}
}
else
{
array_push($rows, $row);
}
}
}
return $rows;
}

+ Here is the call graph for this function:

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 private

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

References $result.

Referenced by duplicateQuestionForSurvey().

{
global $ilDB;
if ($question_id < 1) return -1;
$result = $ilDB->queryF("SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
"svy_question.questiontype_fi = svy_qtype.questiontype_id",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["type_tag"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

ilObjSurvey::getRatersData (   $a_appraisee_id)

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

References $res, $row, ilObjUser\_lookupEmail(), ilObjUser\_lookupName(), getSurveyCodesTableData(), and is360SurveyStarted().

Referenced by getAppraiseesData().

{
global $ilDB;
$res = $anonymous_ids = array();
$set = $ilDB->query("SELECT * FROM svy_360_rater".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_appraisee_id, "integer"));
while($row = $ilDB->fetchAssoc($set))
{
if($row["anonymous_id"])
{
$res["a".$row["anonymous_id"]] = array(
"lastname" => "unknown code ".$row["anonymous_id"],
"sent" => $row["mail_sent"],
"finished" => null
);
$anonymous_ids[] = $row["anonymous_id"];
}
else
{
$name = ilObjUser::_lookupName($row["user_id"]);
$name["user_id"] = "u".$name["user_id"];
$name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
$name["sent"] = $row["mail_sent"];
$name["finished"] = (bool)$this->is360SurveyStarted($a_appraisee_id, $row["user_id"]);
$res["u".$row["user_id"]] = $name;
}
}
if(sizeof($anonymous_ids))
{
$data = $this->getSurveyCodesTableData($anonymous_ids);
foreach($data as $item)
{
if(isset($res["a".$item["id"]]))
{
$res["a".$item["id"]] = array(
"user_id" => "a".$item["id"],
"lastname" => $item["last_name"],
"firstname" => $item["first_name"],
"login" => "",
"email" => $item["email"],
"code" => $item["code"],
"href" => $item["href"],
"sent" => $res["a".$item["id"]]["sent"],
"finished" => (bool)$this->is360SurveyStarted($a_appraisee_id, null, $item["code"])
);
}
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getReminderEnd ( )

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

References $reminder_end.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getReminderFrequency ( )

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

References $reminder_frequency.

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

+ Here is the caller graph for this function:

ilObjSurvey::getReminderLastSent ( )

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

References $reminder_last_sent.

Referenced by checkReminder(), and saveToDb().

+ Here is the caller graph for this function:

ilObjSurvey::getReminderStart ( )

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

References $reminder_start.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getReminderStatus ( )

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

References $reminder_status.

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

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

+ Here is the caller graph for this function:

ilObjSurvey::getReminderTarget ( )

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

References $reminder_target.

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

+ Here is the caller graph for this function:

& ilObjSurvey::getRoleData (   $ids)

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

References $result, ilObject\_lookupDescription(), and ilObject\_lookupTitle().

{
if (!is_array($ids) || count($ids) ==0) return array();
$result = array();
foreach ($ids as $obj_id)
{
$result[$obj_id] = array("obj_id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "description" => ilObject::_lookupDescription($obj_id));
}
return $result;
}

+ Here is the call graph for this function:

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 1267 of file class.ilObjSurvey.php.

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

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

+ Here is the caller graph for this function:

ilObjSurvey::getStartDate ( )

Gets the start date of the survey.

Returns
string Survey start date (YYYY-MM-DD) public
See Also
$start_date

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

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

{
return (strlen($this->start_date)) ? $this->start_date : NULL;
}

+ Here is the caller graph for this function:

ilObjSurvey::getStatus ( )

Gets the survey status.

Returns
integer Survey status public
See Also
$status

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

References STATUS_OFFLINE.

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

{
return ($this->status) ? $this->status : self::STATUS_OFFLINE;
}

+ Here is the caller graph for this function:

ilObjSurvey::getSurveyCodesCount ( )

Returns the number of generated survey codes for the survey.

Returns
integer The number of generated survey codes public

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

References $result, and getSurveyId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND user_key IS NULL",
array('integer'),
array($this->getSurveyId())
);
return $result->numRows();
}

+ Here is the call graph for this function:

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 public

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

References $ilUser, $result, $row, ilLink\_getLink(), ilObject\getRefId(), getSurveyId(), IL_CAL_DATE, IL_CAL_UNIX, and isSurveyCodeUsed().

{
global $ilDB, $ilUser;
include_once "./Services/Link/classes/class.ilLink.php";
$sql = "SELECT svy_anonymous.*, svy_finished.state".
" FROM svy_anonymous".
" LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
" WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND svy_anonymous.user_key IS NULL";
if($a_codes)
{
$sql .= " AND ".$ilDB->in("svy_anonymous.survey_key", $a_codes, "", "text");
}
else if($a_ids)
{
$sql .= " AND ".$ilDB->in("svy_anonymous.anonymous_id", $a_ids, "", "text");
}
$result = $ilDB->query($sql);
$export = array();
$default_lang = $ilUser->getPref("survey_code_language");
while ($row = $ilDB->fetchAssoc($result))
{
$item = array();
$item[] = $row["survey_key"];
if($row["externaldata"])
{
$ext = unserialize($row["externaldata"]);
$item[] = $ext["email"];
$item[] = $ext["lastname"];
$item[] = $ext["firstname"];
}
else
{
$item[] = "";
$item[] = "";
$item[] = "";
}
// No relative (today, tomorrow...) dates in export.
$date = new ilDate($row['tstamp'],IL_CAL_UNIX);
$item[] = $date->get(IL_CAL_DATE);
$item[] = ($this->isSurveyCodeUsed($row["survey_key"])) ? 1 : 0;
$item[] = ($row["sent"]) ? 1 : 0;
$params = array("accesscode" => $row["survey_key"]);
if ($default_lang)
{
$params["lang"] = $default_lang;
}
$item[] = ilLink::_getLink($this->getRefId(), "svy", $params);
$export[] = '"'.implode('";"', $item).'"';
}
return implode("\n", $export);
}

+ Here is the call graph for this function:

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 public

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

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

Referenced by getRatersData().

{
global $ilDB;
include_once "./Services/Link/classes/class.ilLink.php";
$codes = array();
$sql = "SELECT svy_anonymous.*, svy_finished.state".
" FROM svy_anonymous".
" LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
" WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer") /*.
" AND svy_anonymous.user_key IS NULL" */; // #15860
if($ids)
{
$sql .= " AND ".$ilDB->in("svy_anonymous.anonymous_id", $ids, "", "integer");
}
$sql .= " ORDER BY tstamp, survey_key ASC";
$result = $ilDB->query($sql);
if ($result->numRows() > 0)
{
while ($row = $ilDB->fetchAssoc($result))
{
$href = "";
$used = false;
if ($this->isSurveyCodeUsed($row["survey_key"]))
{
$used = true;
}
else
{
$params = array("accesscode" => $row["survey_key"]);
if ($lang)
{
$params["lang"] = $lang;
}
$href = ilLink::_getLink($this->getRefId(), "svy", $params);
}
$item = array(
'id' => $row["anonymous_id"],
'code' => $row["survey_key"],
'date' => $row["tstamp"],
'used' => $used,
'sent' => $row['sent'],
'href' => $href,
'email' => '',
'last_name' => '',
'first_name' => ''
);
if($row["externaldata"])
{
$ext = unserialize($row["externaldata"]);
$item['email'] = $ext['email'];
$item['last_name'] = $ext['lastname'];
$item['first_name'] = $ext['firstname'];
}
array_push($codes, $item);
}
}
return $codes;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjSurvey::getSurveyFinishedIds ( )

Get the finished id's of all survey participants.

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

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

References $ilLog, $result, $row, and getSurveyId().

{
global $ilDB, $ilLog;
$users = array();
$result = $ilDB->queryF("SELECT * FROM svy_finished WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
array_push($users, $row["finished_id"]);
}
}
return $users;
}

+ Here is the call graph for this function:

ilObjSurvey::getSurveyId ( )

Returns the survey database id.

Returns
integer survey database id public

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

References $survey_id.

Referenced by addAppraisee(), addConstraintToQuestion(), addQuestionToBlock(), addRater(), cloneObject(), closeAppraisee(), createQuestionblock(), createSurveyCodes(), createSurveyCodesForExternalData(), deleteAllUserData(), deleteConstraints(), deleteSurveyCode(), deleteSurveyRecord(), disinviteAllUsers(), disinviteUser(), fillSurveyForUser(), finishSurvey(), getActiveID(), getAppraiseesToRate(), getConstraints(), getCumulatedResults(), getExistingQuestions(), getExternalCodeRecipients(), getInvitedUsers(), getObligatoryStates(), getSurveyCodesCount(), getSurveyCodesForExport(), getSurveyCodesTableData(), getSurveyFinishedIds(), getSurveyPages(), getSurveyParticipants(), getSurveyQuestions(), getUserAccessCode(), getUserSpecificResults(), getUserSurveyCode(), getUserSurveyExecutionStatus(), insertQuestion(), inviteUser(), is360SurveyStarted(), isAnonymizedParticipant(), isAnonymousKey(), isRater(), isSurveyCodeUnique(), isSurveyCodeUsed(), isSurveyStarted(), loadQuestionsFromDb(), openAllAppraisees(), removeConstraintsConcerningQuestion(), removeQuestionFromBlock(), removeQuestions(), saveCompletionStatus(), saveHeading(), saveQuestionsToDb(), saveToDb(), saveUserAccessCode(), sendCodes(), set360RaterSent(), setObligatoryStates(), startSurvey(), toXML(), and unfoldQuestionblocks().

{
}

+ Here is the caller graph for this function:

& ilObjSurvey::getSurveyPages ( )

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

public

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

References $result, $row, getConstraints(), getObligatoryStates(), and getSurveyId().

Referenced by fillSurveyForUser(), getNextPage(), moveDownQuestion(), moveDownQuestionblock(), moveUpQuestion(), moveUpQuestionblock(), and toXML().

{
global $ilDB;
$obligatory_states =& $this->getObligatoryStates();
// get questionblocks
$all_questions = array();
$result = $ilDB->queryF("SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
"svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
"svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id ".
"ORDER BY svy_svy_qst.sequence",
array('integer'),
array($this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
$all_questions[$row["question_id"]] = $row;
}
// get all questionblocks
$questionblocks = array();
if (count($all_questions))
{
$result = $ilDB->queryF("SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst ".
"WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s ".
"AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
array('integer'),
array($this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
$questionblocks[$row['question_fi']] = $row;
}
}
$all_pages = array();
$pageindex = -1;
$currentblock = "";
foreach ($all_questions as $question_id => $row)
{
if (array_key_exists($question_id, $obligatory_states))
{
$all_questions[$question_id]["obligatory"] = $obligatory_states[$question_id];
}
$constraints = array();
if (isset($questionblocks[$question_id]))
{
if (!$currentblock or ($currentblock != $questionblocks[$question_id]['questionblock_id']))
{
$pageindex++;
}
$all_questions[$question_id]['page'] = $pageindex;
$all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
$all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
$all_questions[$question_id]["questionblock_show_questiontext"] = $questionblocks[$question_id]['show_questiontext'];
$all_questions[$question_id]["questionblock_show_blocktitle"] = $questionblocks[$question_id]['show_blocktitle'];
$currentblock = $questionblocks[$question_id]['questionblock_id'];
$constraints = $this->getConstraints($question_id);
$all_questions[$question_id]["constraints"] = $constraints;
}
else
{
$pageindex++;
$all_questions[$question_id]['page'] = $pageindex;
$all_questions[$question_id]["questionblock_title"] = "";
$all_questions[$question_id]["questionblock_id"] = "";
$all_questions[$question_id]["questionblock_show_questiontext"] = 1;
$all_questions[$question_id]["questionblock_show_blocktitle"] = 1;
$currentblock = "";
$constraints = $this->getConstraints($question_id);
$all_questions[$question_id]["constraints"] = $constraints;
}
if (!isset($all_pages[$pageindex]))
{
$all_pages[$pageindex] = array();
}
array_push($all_pages[$pageindex], $all_questions[$question_id]);
}
// calculate position percentage for every page
$max = count($all_pages);
$counter = 1;
foreach ($all_pages as $index => $block)
{
foreach ($block as $blockindex => $question)
{
$all_pages[$index][$blockindex]["position"] = $counter / $max;
}
$counter++;
}
return $all_pages;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjSurvey::getSurveyParticipants (   $finished_ids = null)

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

References $result, $row, getSurveyId(), and getUserDataFromActiveId().

{
global $ilDB;
$sql = "SELECT * FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer");
if($finished_ids)
{
$sql .= " AND ".$ilDB->in("finished_id", $finished_ids, "", "integer");
}
$result = $ilDB->query($sql);
$participants = array();
if ($result->numRows() > 0)
{
while ($row = $ilDB->fetchAssoc($result))
{
$userdata = $this->getUserDataFromActiveId($row["finished_id"]);
$participants[$userdata["sortname"] . $userdata["active_id"]] = $userdata;
}
}
return $participants;
}

+ Here is the call graph for this function:

& ilObjSurvey::getSurveyQuestions (   $with_answers = false)

Returns the survey questions and questionblocks in an array.

public

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

References $result, $row, _instanciateQuestion(), getConstraints(), getObligatoryStates(), getSurveyId(), and isPluginActive().

Referenced by getDetailedParticipantResultsAsText(), getParticipantTextResults(), getUserSpecificResults(), moveDownQuestion(), moveUpQuestion(), and removeQuestions().

{
global $ilDB;
$obligatory_states =& $this->getObligatoryStates();
// get questionblocks
$all_questions = array();
$result = $ilDB->queryF("SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, ".
"svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
"svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
"ORDER BY svy_svy_qst.sequence",
array('integer'),
array($this->getSurveyId())
);
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
while ($row = $ilDB->fetchAssoc($result))
{
$add = true;
if ($row["plugin"])
{
if (!$this->isPluginActive($row["type_tag"]))
{
$add = false;
}
}
if ($add)
{
$question =& $this->_instanciateQuestion($row["question_id"]);
$questionrow = $question->_getQuestionDataArray($row["question_id"]);
foreach ($row as $key => $value)
{
$questionrow[$key] = $value;
}
$all_questions[$row["question_id"]] = $questionrow;
$all_questions[$row["question_id"]]["usableForPrecondition"] = $question->usableForPrecondition();
$all_questions[$row["question_id"]]["availableRelations"] = $question->getAvailableRelations();
if (array_key_exists($row["question_id"], $obligatory_states))
{
$all_questions[$row["question_id"]]["obligatory"] = $obligatory_states[$row["question_id"]];
}
}
}
// get all questionblocks
$questionblocks = array();
if (count($all_questions))
{
$result = $ilDB->queryF("SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
"svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
"AND " . $ilDB->in('svy_qblk_qst.question_fi', array_keys($all_questions), false, 'integer'),
array('integer'),
array($this->getSurveyId())
);
while ($row = $ilDB->fetchAssoc($result))
{
$questionblocks[$row['question_fi']] = $row;
}
}
foreach ($all_questions as $question_id => $row)
{
$constraints = $this->getConstraints($question_id);
if (isset($questionblocks[$question_id]))
{
$all_questions[$question_id]["questionblock_title"] = $questionblocks[$question_id]['title'];
$all_questions[$question_id]["questionblock_id"] = $questionblocks[$question_id]['questionblock_id'];
$all_questions[$question_id]["constraints"] = $constraints;
}
else
{
$all_questions[$question_id]["questionblock_title"] = "";
$all_questions[$question_id]["questionblock_id"] = "";
$all_questions[$question_id]["constraints"] = $constraints;
}
if ($with_answers)
{
$answers = array();
$result = $ilDB->queryF("SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
"WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id ".
"ORDER BY sequence ASC",
array('integer'),
array($question_id)
);
if ($result->numRows() > 0)
{
while ($data = $ilDB->fetchAssoc($result))
{
array_push($answers, $data["title"]);
}
}
$all_questions[$question_id]["answers"] = $answers;
}
}
return $all_questions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjSurvey::getSurveySkippedValue ( )
static

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

References ilObject\$lng.

Referenced by ilSurveyEvaluationGUI\evaluationuser(), getParticipantTextResults(), and SurveyQuestion\getSkippedValue().

{
global $lng;
// #13541
include_once "./Services/Administration/classes/class.ilSetting.php";
$surveySetting = new ilSetting("survey");
if(!$surveySetting->get("skipped_is_custom", false))
{
return $lng->txt("skipped");
}
else
{
return $surveySetting->get("skipped_custom_value", "");
}
}

+ Here is the caller graph for this function:

ilObjSurvey::getSurveyTimes ( )

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

References $result, $row, and ilObject\getId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_times, svy_finished WHERE svy_finished.survey_fi = %s",
array('integer'),
array($this->getId())
);
$times = array();;
while ($row = $ilDB->fetchAssoc($result))
{
if (strlen($row['left_page']) && strlen($row['entered_page']))
$times[$row['finished_fi']] += ($row['left_page']-$row['entered_page']);
}
return $times;
}

+ Here is the call graph for this function:

ilObjSurvey::getTemplate ( )

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

References $template_id.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getTextblock (   $question_id)

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

References $result, and $row.

Referenced by cloneTextblocks(), and ilSurveyPageGUI\editJS().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy_qst WHERE question_fi = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return $row["heading"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

ilObjSurvey::getTutorNotificationRecipients ( )

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

References $tutor_ntf_recipients.

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

+ Here is the caller graph for this function:

ilObjSurvey::getTutorNotificationStatus ( )

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

References $tutor_ntf_status.

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

{
}

+ Here is the caller graph for this function:

ilObjSurvey::getTutorNotificationTarget ( )

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

References $tutor_ntf_target.

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

+ Here is the caller graph for this function:

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 5084 of file class.ilObjSurvey.php.

References $result, $row, and getSurveyId().

{
global $ilDB;
$access_code = "";
$result = $ilDB->queryF("SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
array('integer','text'),
array($this->getSurveyId(), md5($user_id))
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
$access_code = $row["survey_key"];
}
return $access_code;
}

+ Here is the call graph for this function:

& 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 5472 of file class.ilObjSurvey.php.

References $result, and $row.

{
global $ilDB;
if (!is_array($ids) || count($ids) ==0) return array();
$result = $ilDB->query("SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " . $ilDB->in('usr_id', $ids, false, 'integer') . " ORDER BY login");
$result_array = array();
while ($row = $ilDB->fetchAssoc($result))
{
$result_array[$row["usr_id"]]= $row;
}
return $result_array;
}
ilObjSurvey::getUserDataFromActiveId (   $active_id)

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 public

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

References $_GET, $result, $row, ilObjUser\_lookupLogin(), and getAnonymize().

Referenced by getEvaluationByUser(), and getSurveyParticipants().

{
global $ilDB;
$surveySetting = new ilSetting("survey");
$use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
$result = $ilDB->queryF("SELECT * FROM svy_finished WHERE finished_id = %s",
array('integer'),
array($active_id)
);
$row = array();
$foundrows = $result->numRows();
if ($foundrows)
{
$row = $ilDB->fetchAssoc($result);
}
$name = ($use_anonymous_id) ? $row["anonymous_id"] : $this->lng->txt("anonymous");
$userdata = array(
"fullname" => $name,
"sortname" => $name,
"firstname" => "",
"lastname" => "",
"login" => "",
"gender" => "",
"active_id" => "$active_id"
);
if ($foundrows)
{
if (($row["user_fi"] > 0) && ($row["user_fi"] != ANONYMOUS_USER_ID) && ($this->getAnonymize() == 0))
{
include_once './Services/User/classes/class.ilObjUser.php';
if (strlen(ilObjUser::_lookupLogin($row["user_fi"])) == 0)
{
$userdata["fullname"] = $userdata["sortname"] = $this->lng->txt("deleted_user");
}
else
{
$user = new ilObjUser($row["user_fi"]);
$userdata["fullname"] = $user->getFullname();
$gender = $user->getGender();
if (strlen($gender) == 1) $gender = $this->lng->txt("gender_$gender");
$userdata["gender"] = $gender;
$userdata["firstname"] = $user->getFirstname();
$userdata["lastname"] = $user->getLastname();
$userdata["sortname"] = $user->getLastname() . ", " . $user->getFirstname();
$userdata["login"] = $user->getLogin();
}
}
}
return $userdata;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getUserSettings (   $usr_id,
  $key 
)

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

References $result, $row, and $usr_id.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
array('integer', 'text'),
array($usr_id, $key)
);
$found = array();
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$found[$row['settings_id']] = $row;
}
}
return $found;
}
& ilObjSurvey::getUserSpecificResults (   $finished_ids)

Calculates the evaluation data for the user specific results.

Returns
array An array containing the user specific results public

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

References $questions, SurveyQuestion\_getQuestionType(), SurveyQuestion\_includeClass(), getSurveyId(), and getSurveyQuestions().

Referenced by getParticipantTextResults().

{
global $ilDB;
$evaluation = array();
foreach ($questions as $question_id => $question_data)
{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question_type = SurveyQuestion::_getQuestionType($question_id);
$question = new $question_type();
$question->loadFromDb($question_id);
$data =& $question->getUserAnswers($this->getSurveyId(), $finished_ids);
$evaluation[$question_id] = $data;
}
return $evaluation;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::getUserSurveyCode (   $user_id)

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

References $result, $row, getSurveyId(), isAccessibleWithoutCode(), and isAllowedToTakeMultipleSurveys().

{
global $ilDB;
if (($user_id == ANONYMOUS_USER_ID) || (($this->isAccessibleWithoutCode() && $this->isAllowedToTakeMultipleSurveys()))) return "";
$result = $ilDB->queryF("SELECT anonymous_id FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
array('integer','integer'),
array($this->getSurveyId(), $user_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["anonymous_id"];
}
else
{
return "";
}
}

+ Here is the call graph for this function:

ilObjSurvey::getUserSurveyExecutionStatus (   $a_code = null)

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

References $ilUser, $res, $row, createNewAccessCode(), get360Mode(), getAnonymize(), getSurveyId(), isAccessibleWithoutCode(), isRater(), and saveUserAccessCode().

{
global $ilUser, $ilDB;
$user_id = $ilUser->getId();
// code is obligatory?
{
if(!$a_code)
{
// registered raters do not need code
if($this->get360Mode() &&
$user_id != ANONYMOUS_USER_ID &&
$this->isRater(0, $user_id))
{
// auto-generate code
$a_code = $this->createNewAccessCode();
$this->saveUserAccessCode($user_id, $a_code);
}
else
{
return null;
}
}
}
else if($user_id == ANONYMOUS_USER_ID || $this->getAnonymize())
{
if(!$a_code)
{
// auto-generate code
$a_code = $this->createNewAccessCode();
$this->saveUserAccessCode($user_id, $a_code);
}
}
else
{
$a_code = null;
}
$res = array();
$sql = "SELECT * FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer");
// if proper user id is given, use it or current code
if($user_id != ANONYMOUS_USER_ID)
{
$sql .= " AND (user_fi = ".$ilDB->quote($user_id, "integer").
" OR anonymous_id = ".$ilDB->quote($a_code, "text").")";
}
// use anonymous code to find finished id(s)
else
{
$sql .= " AND anonymous_id = ".$ilDB->quote($a_code, "text");
}
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[$row["finished_id"]] = array("appr_id" => $row["appr_id"],
"user_id" => $row["user_fi"],
"code" => $row["anonymous_id"],
"finished" => (bool)$row["state"]);
}
return array("code"=>$a_code, "runs"=>$res);
}

+ Here is the call graph for this function:

& ilObjSurvey::getVariables (   $question_id)

Returns all variables of a question.

public

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

References $result, and $row.

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN ".
"svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s ".
"ORDER BY svy_variable.sequence",
array('integer'),
array($question_id)
);
while ($row = $ilDB->fetchObject($result))
{
$result_array[$row->sequence] = $row;
}
return $result_array;
}
ilObjSurvey::getWorkingtimeForParticipant (   $finished_id)

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

References $result, $row, and $total.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_times WHERE finished_fi = %s",
array('integer'),
array($finished_id)
);
$total = 0;
while ($row = $ilDB->fetchAssoc($result))
{
if ($row['left_page'] > 0 && $row['entered_page'] > 0)
$total += $row['left_page'] - $row['entered_page'];
}
return $total;
}
ilObjSurvey::hideQuestionTitles ( )

Sets the question titles hidden during the query.

public

See Also
$display_question_titles

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

{
$this->display_question_titles = 0;
}
ilObjSurvey::ilObjSurvey (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

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

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

References $ilUser, ilObject\$lng, ANONYMIZE_OFF, EVALUATION_ACCESS_OFF, INVITATION_OFF, MODE_PREDEFINED_USERS, QUESTIONTITLES_VISIBLE, and STATUS_OFFLINE.

Referenced by _getGlobalSurveyData(), and _isComplete().

{
global $ilUser, $lng;
$this->type = "svy";
$this->survey_id = -1;
$this->introduction = "";
$this->outro = $lng->txt("survey_finished");
$this->author = $ilUser->getFullname();
$this->status = self::STATUS_OFFLINE;
$this->evaluation_access = self::EVALUATION_ACCESS_OFF;
$this->questions = array();
$this->invitation = self::INVITATION_OFF;
$this->invitation_mode = self::MODE_PREDEFINED_USERS;
$this->anonymize = self::ANONYMIZE_OFF;
$this->display_question_titles = self::QUESTIONTITLES_VISIBLE;
$this->surveyCodeSecurity = TRUE;
$this->template_id = NULL;
$this->pool_usage = true;
parent::__construct($a_id,$a_call_by_reference);
}

+ Here is the caller graph for this function:

ilObjSurvey::importObject (   $file_info,
  $svy_qpl_id 
)

Imports a survey from XML into the ILIAS database.

Returns
boolean True, if the import succeeds, false otherwise public

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

References $_SESSION, $ilLog, $result, _instanciateQuestion(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilObjMediaObject\_saveUsage(), ilUtil\delDir(), ilObject\getId(), getImportDirectory(), getIntroduction(), getOutro(), locateImportFiles(), ilUtil\moveUploadedFile(), saveToDb(), setIntroduction(), setOutro(), and ilUtil\unzip().

{
if ($svy_qpl_id < 1) $svy_qpl_id = -1;
// check if file was uploaded
$source = $file_info["tmp_name"];
$error = "";
if (($source == 'none') || (!$source) || $file_info["error"] > UPLOAD_ERR_OK)
{
$error = $this->lng->txt("import_no_file_selected");
}
// check correct file type
$isXml = FALSE;
$isZip = FALSE;
if ((strcmp($file_info["type"], "text/xml") == 0) || (strcmp($file_info["type"], "application/xml") == 0))
{
$isXml = TRUE;
}
// too many different mime-types, so we use the suffix
$suffix = pathinfo($file_info["name"]);
if (strcmp(strtolower($suffix["extension"]), "zip") == 0)
{
$isZip = TRUE;
}
if (!$isXml && !$isZip)
{
$error = $this->lng->txt("import_wrong_file_type");
global $ilLog;
$ilLog->write("Survey: Import error. Filetype was \"" . $file_info["type"] ."\"");
}
if (strlen($error) == 0)
{
// import file as a survey
$import_dir = $this->getImportDirectory();
$import_subdir = "";
$importfile = "";
include_once "./Services/Utilities/classes/class.ilUtil.php";
if ($isZip)
{
$importfile = $import_dir."/".$file_info["name"];
ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
ilUtil::unzip($importfile);
$found = $this->locateImportFiles($import_dir);
if (!((strlen($found["dir"]) > 0) && (strlen($found["xml"]) > 0)))
{
$error = $this->lng->txt("wrong_import_file_structure");
return $error;
}
$importfile = $found["xml"];
$import_subdir = $found["dir"];
}
else
{
$importfile = tempnam($import_dir, "survey_import");
ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
}
$fh = fopen($importfile, "r");
if (!$fh)
{
$error = $this->lng->txt("import_error_opening_file");
return $error;
}
$xml = fread($fh, filesize($importfile));
$result = fclose($fh);
if (!$result)
{
$error = $this->lng->txt("import_error_closing_file");
return $error;
}
unset($_SESSION["import_mob_xhtml"]);
if (strpos($xml, "questestinterop"))
{
include_once "./Services/Survey/classes/class.SurveyImportParserPre38.php";
$import = new SurveyImportParserPre38($svy_qpl_id, "", TRUE);
$import->setSurveyObject($this);
$import->setXMLContent($xml);
$import->startParsing();
}
else
{
include_once "./Services/Survey/classes/class.SurveyImportParser.php";
$import = new SurveyImportParser($svy_qpl_id, "", TRUE);
$import->setSurveyObject($this);
$import->setXMLContent($xml);
$import->startParsing();
}
if (is_array($_SESSION["import_mob_xhtml"]))
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
foreach ($_SESSION["import_mob_xhtml"] as $mob)
{
$importfile = $import_subdir . "/" . $mob["uri"];
if (file_exists($importfile))
{
if (!$mob["type"])
{
$mob["type"] = "svy:html";
}
$media_object = ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
// survey mob
if ($mob["type"] == "svy:html")
{
ilObjMediaObject::_saveUsage($media_object->getId(), "svy:html", $this->getId());
$this->setIntroduction(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()));
$this->setOutro(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getOutro()));
}
// question mob
else if($import->questions[$mob["id"]])
{
$new_qid = $import->questions[$mob["id"]];
ilObjMediaObject::_saveUsage($media_object->getId(), $mob["type"], $new_qid);
$new_question = SurveyQuestion::_instanciateQuestion($new_qid);
$qtext = $new_question->getQuestiontext();
$qtext = ilRTE::_replaceMediaObjectImageSrc($qtext, 0);
$qtext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $qtext);
$qtext = ilRTE::_replaceMediaObjectImageSrc($qtext, 1);
$new_question->setQuestiontext($qtext);
$new_question->saveToDb();
// also fix existing original in pool
if($new_question->getOriginalId())
{
$pool_question = SurveyQuestion::_instanciateQuestion($new_question->getOriginalId());
$pool_question->setQuestiontext($qtext);
$pool_question->saveToDb();
}
}
}
else
{
global $ilLog;
$ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
}
}
$this->saveToDb();
}
// delete import directory
}
return $error;
}

+ Here is the call graph for this function:

ilObjSurvey::insertQuestion (   $question_id)

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

public

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

References $result, SurveyQuestion\_isComplete(), duplicateQuestionForSurvey(), getSurveyId(), and loadQuestionsFromDb().

{
global $ilDB;
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
if (!SurveyQuestion::_isComplete($question_id))
{
return FALSE;
}
else
{
// get maximum sequence index in test
$result = $ilDB->queryF("SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
$sequence = $result->numRows();
$duplicate_id = $this->duplicateQuestionForSurvey($question_id);
$next_id = $ilDB->nextId('svy_svy_qst');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer', 'integer', 'integer', 'integer', 'integer'),
array($next_id, $this->getSurveyId(), $duplicate_id, $sequence, time())
);
return TRUE;
}
}

+ Here is the call graph for this function:

ilObjSurvey::insertQuestionblock (   $questionblock_id)

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

public

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

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

{
global $ilDB;
$result = $ilDB->queryF("SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle,".
" svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst".
" WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi".
" AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi".
" AND svy_qblk.questionblock_id = %s".
" ORDER BY svy_svy_qst.sequence",
array('integer'),
array($questionblock_id)
);
$questions = array();
$show_questiontext = 0;
$show_blocktitle = 0;
while ($row = $ilDB->fetchAssoc($result))
{
$duplicate_id = $this->duplicateQuestionForSurvey($row["question_fi"]);
array_push($questions, $duplicate_id);
$title = $row["title"];
$show_questiontext = $row["show_questiontext"];
$show_blocktitle = $row["show_blocktitle"];
}
$this->createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions);
}

+ Here is the call graph for this function:

ilObjSurvey::inviteGroup (   $group_id)

Invites a group to a survey.

Parameters
integer$group_idThe database id of the invited group public

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

References ilObjUser\_addDesktopItem(), ilObject\getId(), getInvitation(), ilObject\getRefId(), INVITATION_ON, and inviteUser().

{
global $ilAccess;
$invited = 0;
include_once "./Modules/Group/classes/class.ilObjGroup.php";
$group = new ilObjGroup($group_id);
$members = $group->getGroupMemberIds();
foreach ($members as $user_id)
{
if ($ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId()))
{
$this->inviteUser($user_id);
{
include_once './Services/User/classes/class.ilObjUser.php';
ilObjUser::_addDesktopItem($user_id, $this->getRefId(), "svy");
}
}
}
return $invited;
}

+ Here is the call graph for this function:

ilObjSurvey::inviteRole (   $role_id)

Invites a role to a survey.

Parameters
integer$role_idThe database id of the invited role public

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

References ilObjUser\_addDesktopItem(), ilObject\getId(), getInvitation(), ilObject\getRefId(), INVITATION_ON, and inviteUser().

{
global $rbacreview;
global $ilAccess;
$invited = 0;
$members = $rbacreview->assignedUsers($role_id);
foreach ($members as $user_id)
{
if ($ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId()))
{
$this->inviteUser($user_id);
{
include_once './Services/User/classes/class.ilObjUser.php';
ilObjUser::_addDesktopItem($user_id, $this->getRefId(), "svy");
}
}
}
return $invited;
}

+ Here is the call graph for this function:

ilObjSurvey::inviteUser (   $user_id)

Invites a user to a survey.

Parameters
integer$user_idThe database id of the invited user public

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

References $result, ilObjUser\_addDesktopItem(), getInvitation(), ilObject\getRefId(), getSurveyId(), and INVITATION_ON.

Referenced by inviteGroup(), inviteRole(), and setInvitation().

{
global $ilDB;
$result = $ilDB->queryF("SELECT user_fi FROM svy_inv_usr WHERE user_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($user_id, $this->getSurveyId())
);
if ($result->numRows() < 1)
{
$next_id = $ilDB->nextId('svy_inv_usr');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_inv_usr (invited_user_id, survey_fi, user_fi, tstamp) " .
"VALUES (%s, %s, %s, %s)",
array('integer','integer','integer','integer'),
array($next_id, $this->getSurveyId(), $user_id, time())
);
}
{
include_once './Services/User/classes/class.ilObjUser.php';
ilObjUser::_addDesktopItem($user_id, $this->getRefId(), "svy");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $result, $row, and getSurveyId().

Referenced by getRatersData().

{
global $ilDB;
$sql = "SELECT * FROM svy_finished".
" WHERE survey_fi =".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($appr_id, "integer");
if ($user_id)
{
$sql .= " AND user_fi = ".$ilDB->quote($user_id, "integer");
}
else
{
$sql .= " AND anonymous_id = ".$ilDB->quote($anonymous_code, "text");
}
$result = $ilDB->query($sql);
if ($result->numRows() == 0)
{
return false;
}
else
{
$row = $ilDB->fetchAssoc($result);
return (int)$row["state"];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isAccessibleWithCodeForAll ( )

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

References getAnonymize().

{
if ($this->getAnonymize() == self::ANONYMIZE_CODE_ALL)
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilObjSurvey::isAccessibleWithoutCode ( )

Checks if the survey is accessable without a survey code.

Returns
boolean status

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

References getAnonymize().

Referenced by getUserSurveyCode(), and getUserSurveyExecutionStatus().

{
if ($this->getAnonymize() == self::ANONYMIZE_FREEACCESS || !$this->getAnonymize())
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isActivationLimited ( )

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

Referenced by saveToDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::isAllowedToTakeMultipleSurveys (   $userid = "")

Checks if a user is allowed to take multiple survey.

Parameters
int$useriduser id of the user
Returns
boolean TRUE if the user is allowed to take the survey more than once, FALSE otherwise public

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

Referenced by getUserSurveyCode().

{
// #7927: special users are deprecated
return false;
/*
$result = FALSE;
if ($this->getAnonymize())
{
if ($this->isAccessibleWithoutCode())
{
if (strlen($username) == 0)
{
global $ilUser;
$userid = $ilUser->getId();
}
global $ilSetting;
$surveysetting = new ilSetting("survey");
$allowedUsers = strlen($surveysetting->get("multiple_survey_users")) ? explode(",",$surveysetting->get("multiple_survey_users")) : array();
if (in_array($userid, $allowedUsers))
{
$result = TRUE;
}
}
}
return $result;
*/
}

+ Here is the caller graph for this function:

ilObjSurvey::isAnonymizedParticipant (   $key)

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

References $result, and getSurveyId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
array('text','integer'),
array($key, $this->getSurveyId())
);
return ($result->numRows() == 1) ? true : false;
}

+ Here is the call graph for this function:

ilObjSurvey::isAnonymousKey (   $key)

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

References $result, and getSurveyId().

Referenced by checkSurveyCode().

{
global $ilDB;
$result = $ilDB->queryF("SELECT anonymous_id FROM svy_anonymous WHERE survey_key = %s AND survey_fi = %s",
array('text','integer'),
array($key, $this->getSurveyId())
);
return ($result->numRows() == 1) ? true : false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isAppraisee (   $a_user_id)

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

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

{
global $ilDB;
$set = $ilDB->query("SELECT user_id".
" FROM svy_360_appr".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
return (bool)$ilDB->numRows($set);
}

+ Here is the caller graph for this function:

ilObjSurvey::isAppraiseeClosed (   $a_user_id)

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

References $row.

{
global $ilDB;
$set = $ilDB->query("SELECT has_closed".
" FROM svy_360_appr".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
$row = $ilDB->fetchAssoc($set);
return $row["has_closed"];
}
ilObjSurvey::isComplete ( )

Returns 1, if a survey is complete for use.

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

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

References ilObject\getTitle().

Referenced by saveCompletionStatus(), and saveToDb().

{
if (($this->getTitle()) and (count($this->questions)))
{
return 1;
}
else
{
return 0;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean public

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

Referenced by addMaterialTag().

{
if (preg_match("/<[^>]*?>/", $a_text))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the caller graph for this function:

ilObjSurvey::isOffline ( )

Gets the survey status.

Returns
integer true if status is online, false otherwise public
See Also
$status

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

Referenced by checkReminder().

{
return ($this->status == self::STATUS_OFFLINE) ? true : false;
}

+ Here is the caller graph for this function:

ilObjSurvey::isOnline ( )

Gets the survey status.

Returns
integer true if status is online, false otherwise public
See Also
$status

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

{
return ($this->status == self::STATUS_ONLINE) ? true : false;
}
ilObjSurvey::isPluginActive (   $a_pname)

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

Parameters
string$a_pnameThe plugin name public

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

References IL_COMP_MODULE.

Referenced by getQuestionsTable(), and getSurveyQuestions().

{
global $ilPluginAdmin;
if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "SurveyQuestionPool", "svyq", $a_pname))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the caller graph for this function:

ilObjSurvey::isPoolActive ( )

Get current pool status.

Returns
bool

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

References getPoolUsage(), and getTemplate().

{
$use_pool = (bool)$this->getPoolUsage();
$template_settings = $this->getTemplate();
if($template_settings)
{
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template_settings = new ilSettingsTemplate($template_settings);
$template_settings = $template_settings->getSettings();
$template_settings = $template_settings["use_pool"];
if($template_settings && $template_settings["hide"])
{
$use_pool = (bool)$template_settings["value"];
}
}
return $use_pool;
}

+ Here is the call graph for this function:

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

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

References get360SelfEvaluation(), getSurveyId(), and isAppraisee().

Referenced by addRater(), and getUserSurveyExecutionStatus().

{
global $ilDB;
// user is rater if already appraisee and active self-evaluation
if($this->isAppraisee($a_user_id) &&
$this->get360SelfEvaluation() &&
(!$a_appraisee_id || $a_appraisee_id == $a_user_id))
{
return true;
}
// :TODO: should we get rid of code as well?
$sql = "SELECT user_id".
" FROM svy_360_rater".
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer").
" AND anonymous_id = ".$ilDB->quote($a_anonymous_id, "integer");
if($a_appraisee_id)
{
$sql .= " AND appr_id = ".$ilDB->quote($a_appraisee_id, "integer");
}
$set = $ilDB->query($sql);
return (bool)$ilDB->numRows($set);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isSurveyCodeUnique (   $code)

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

References $result, and getSurveyId().

Referenced by createNewAccessCode().

{
global $ilDB;
$result = $ilDB->queryF("SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
array('integer','text'),
array($this->getSurveyId(), $code)
);
return ($result->numRows() > 0) ? false : true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isSurveyCodeUsed (   $code)

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

References $result, and getSurveyId().

Referenced by getExternalCodeRecipients(), getSurveyCodesForExport(), and getSurveyCodesTableData().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
array('integer','text'),
array($this->getSurveyId(), $code)
);
return ($result->numRows() > 0) ? true : false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 public

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

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

Referenced by checkSurveyCode().

{
global $ilDB;
// #15031 - should not matter if code was used by registered or anonymous (each code must be unique)
if($anonymize_id)
{
$result = $ilDB->queryF("SELECT * FROM svy_finished".
" WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
array('integer','text','integer'),
array($this->getSurveyId(), $anonymize_id, $appr_id)
);
}
else
{
$result = $ilDB->queryF("SELECT * FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
if ($result->numRows() == 0)
{
return false;
}
else
{
$row = $ilDB->fetchAssoc($result);
// yes, we are doing it this way
$_SESSION["finished_id"][$this->getId()] = $row["finished_id"];
return (int)$row["state"];
}
/*
if ($this->getAnonymize())
{
if ((($user_id != ANONYMOUS_USER_ID) && sizeof($anonymize_id)) && (!($this->isAccessibleWithoutCode() && $this->isAllowedToTakeMultipleSurveys())))
{
$result = $ilDB->queryF("SELECT * FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
else
{
$result = $ilDB->queryF("SELECT * FROM svy_finished".
" WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
array('integer','text','integer'),
array($this->getSurveyId(), $anonymize_id, $appr_id)
);
}
}
else
{
$result = $ilDB->queryF("SELECT * FROM svy_finished".
" WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
array('integer','integer','integer'),
array($this->getSurveyId(), $user_id, $appr_id)
);
}
if ($result->numRows() == 0)
{
return false;
}
else
{
$row = $ilDB->fetchAssoc($result);
$_SESSION["finished_id"][$this->getId()] = $row["finished_id"];
return (int)$row["state"];
}
*/
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::isUnusedCode (   $a_code,
  $a_user_id 
)

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

{
global $ilDB;
$set = $ilDB->query("SELECT user_fi FROM svy_finished".
" WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND anonymous_id = ".$ilDB->quote($a_code, "text"));
$user_id = $ilDB->fetchAssoc($set);
$user_id = $user_id["user_fi"];
if($user_id && ($user_id != $a_user_id || $user_id == ANONYMOUS_USER_ID))
{
return false;
}
return true;
}
ilObjSurvey::loadFromDb ( )

Loads a survey object from a database.

public

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

References $result, ilRTE\_replaceMediaObjectImageSrc(), ilObject\getId(), ilObjectActivation\getItem(), IL_CAL_DATE, loadQuestionsFromDb(), set360Mode(), set360Results(), set360SelfAppraisee(), set360SelfEvaluation(), set360SelfRaters(), set360SkillService(), setActivationEndDate(), setActivationLimited(), setActivationStartDate(), setActivationVisibility(), setAnonymize(), setAuthor(), setEndDate(), setEvaluationAccess(), setIntroduction(), setInvitation(), setInvitationMode(), setMailAddresses(), setMailNotification(), setMailParticipantData(), setOutro(), setPoolUsage(), setReminderEnd(), setReminderFrequency(), setReminderLastSent(), setReminderStart(), setReminderStatus(), setReminderTarget(), setShowQuestionTitles(), setStartDate(), setStatus(), setSurveyId(), setTemplate(), setTutorNotificationRecipients(), setTutorNotificationStatus(), setTutorNotificationTarget(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by cloneObject(), and read().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy WHERE obj_fi = %s",
array('integer'),
array($this->getId())
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
$this->setSurveyId($data["survey_id"]);
$this->setAuthor($data["author"]);
include_once("./Services/RTE/classes/class.ilRTE.php");
$this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($data["introduction"], 1));
if (strcmp($data["outro"], "survey_finished") == 0)
{
$this->setOutro($this->lng->txt("survey_finished"));
}
else
{
$this->setOutro(ilRTE::_replaceMediaObjectImageSrc($data["outro"], 1));
}
$this->setInvitation($data["invitation"]);
$this->setInvitationMode($data["invitation_mode"]);
$this->setShowQuestionTitles($data["show_question_titles"]);
$this->setStartDate($data["startdate"]);
$this->setEndDate($data["enddate"]);
$this->setAnonymize($data["anonymize"]);
$this->setEvaluationAccess($data["evaluation_access"]);
$this->setStatus($data["status"]);
$this->setMailNotification($data['mailnotification']);
$this->setMailAddresses($data['mailaddresses']);
$this->setMailParticipantData($data['mailparticipantdata']);
$this->setTemplate($data['template_id']);
$this->setPoolUsage($data['pool_usage']);
// 360°
$this->set360Mode($data['mode_360']);
$this->set360SelfEvaluation($data['mode_360_self_eval']);
$this->set360SelfRaters($data['mode_360_self_rate']);
$this->set360SelfAppraisee($data['mode_360_self_appr']);
$this->set360Results($data['mode_360_results']);
$this->set360SkillService($data['mode_360_skill_service']);
// reminder/notification
$this->setReminderStatus($data["reminder_status"]);
$this->setReminderStart($data["reminder_start"] ? new ilDate($data["reminder_start"], IL_CAL_DATE) : null);
$this->setReminderEnd($data["reminder_end"] ? new ilDate($data["reminder_end"], IL_CAL_DATE) : null);
$this->setReminderFrequency($data["reminder_frequency"]);
$this->setReminderTarget($data["reminder_target"]);
$this->setReminderLastSent($data["reminder_last_sent"]);
$this->setTutorNotificationStatus($data["tutor_ntf_status"]);
$this->setTutorNotificationRecipients(explode(";", $data["tutor_ntf_reci"]));
$this->setTutorNotificationTarget($data["tutor_ntf_target"]);
}
// moved activation to ilObjectActivation
if($this->ref_id)
{
include_once "./Services/Object/classes/class.ilObjectActivation.php";
$activation = ilObjectActivation::getItem($this->ref_id);
switch($activation["timing_type"])
{
$this->setActivationLimited(true);
$this->setActivationStartDate($activation["timing_start"]);
$this->setActivationEndDate($activation["timing_end"]);
$this->setActivationVisibility($activation["visible"]);
break;
default:
$this->setActivationLimited(false);
break;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::loadQuestionsFromDb ( )

Loads the survey questions from the database.

public

See Also
$questions

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

References $result, and getSurveyId().

Referenced by insertQuestion(), and loadFromDb().

{
global $ilDB;
$this->questions = array();
$result = $ilDB->queryF("SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
array('integer'),
array($this->getSurveyId())
);
while ($data = $ilDB->fetchAssoc($result))
{
$this->questions[$data["sequence"]] = $data["question_fi"];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 public

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

References $result, and $row.

{
global $ilDB;
$result_array = array();
$result = $ilDB->queryF("SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
array('integer','integer'),
array($question_id, $active_id)
);
if ($result->numRows() >= 1)
{
while ($row = $ilDB->fetchAssoc($result))
{
array_push($result_array, $row);
}
return $result_array;
}
else
{
return $result_array;
}
}
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) private

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

References $file.

Referenced by importObject().

{
if (!is_dir($a_dir) || is_int(strpos($a_dir, "..")))
{
return;
}
$importDirectory = "";
$xmlFile = "";
$current_dir = opendir($a_dir);
$files = array();
while($entryname = readdir($current_dir))
{
$files[] = $entryname;
}
foreach($files as $file)
{
if(is_dir($a_dir."/".$file) and ($file != "." and $file!=".."))
{
// found directory created by zip
$importDirectory = $a_dir."/".$file;
}
}
closedir($current_dir);
if (strlen($importDirectory))
{
// find the xml file
$current_dir = opendir($importDirectory);
$files = array();
while($entryname = readdir($current_dir))
{
$files[] = $entryname;
}
foreach($files as $file)
{
if(@is_file($importDirectory."/".$file) && ($file != "." && $file!="..") && (ereg("^[0-9]{10}_{2}[0-9]+_{2}(svy_)*[0-9]+\.[a-z]{1,3}\$", $file) || ereg("^[0-9]{10}_{2}[0-9]+_{2}(survey__)*[0-9]+\.[a-z]{1,3}\$", $file)))
{
// found xml file
$xmlFile = $importDirectory."/".$file;
}
}
}
return array("dir" => $importDirectory, "xml" => $xmlFile);
}

+ Here is the caller graph for this function:

ilObjSurvey::modifyQuestionblock (   $questionblock_id,
  $title,
  $show_questiontext,
  $show_blocktitle 
)

Modifies a question block.

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

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

References ilObject\$title.

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("UPDATE svy_qblk SET title = %s, show_questiontext = %s,".
" show_blocktitle = %s WHERE questionblock_id = %s",
array('text','text','text','integer'),
array($title, $show_questiontext, $show_blocktitle, $questionblock_id)
);
}
ilObjSurvey::moveDownQuestion (   $question_id)

Moves a question down in the list of survey questions.

Parameters
integer$question_idThe question id of the question which has to be moved down

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

References $questions, getSurveyPages(), getSurveyQuestions(), and moveQuestions().

{
$move_questions = array($question_id);
$pages =& $this->getSurveyPages();
$pageindex = -1;
foreach ($pages as $idx => $page)
{
if (($page[0]["question_id"] == $question_id) && (strcmp($page[0]["questionblock_id"], "") == 0))
{
$pageindex = $idx;
}
}
if (($pageindex < count($pages)-1) && ($pageindex >= 0))
{
$this->moveQuestions($move_questions, $pages[$pageindex+1][count($pages[$pageindex+1])-1]["question_id"], 1);
}
else
{
// move down a question in a questionblock
$questions = array_keys($questions);
$index = array_search($question_id, $questions);
if (($index !== FALSE) && ($index < count($questions)-1))
{
$this->moveQuestions($move_questions, $questions[$index+1], 1);
}
}
}

+ Here is the call graph for this function:

ilObjSurvey::moveDownQuestionblock (   $questionblock_id)

Moves a questionblock down in the list of survey questions.

Parameters
integer$questionblock_idThe questionblock id of the questionblock which has to be moved down public

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

References getSurveyPages(), and moveQuestions().

{
$pages =& $this->getSurveyPages();
$move_questions = array();
$pageindex = -1;
foreach ($pages as $idx => $page)
{
if ($page[0]["questionblock_id"] == $questionblock_id)
{
foreach ($page as $pageidx => $question)
{
array_push($move_questions, $question["question_id"]);
}
$pageindex = $idx;
}
}
if ($pageindex < count($pages)-1)
{
$this->moveQuestions($move_questions, $pages[$pageindex+1][count($pages[$pageindex+1])-1]["question_id"], 1);
}
}

+ Here is the call graph for this function:

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 public

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

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

Referenced by createQuestionblock(), moveDownQuestion(), moveDownQuestionblock(), moveUpQuestion(), and moveUpQuestionblock().

{
$array_pos = array_search($target_index, $this->questions);
if ($insert_mode == 0)
{
$part1 = array_slice($this->questions, 0, $array_pos);
$part2 = array_slice($this->questions, $array_pos);
}
else if ($insert_mode == 1)
{
$part1 = array_slice($this->questions, 0, $array_pos + 1);
$part2 = array_slice($this->questions, $array_pos + 1);
}
foreach ($move_questions as $question_id)
{
if (!(array_search($question_id, $part1) === FALSE))
{
unset($part1[array_search($question_id, $part1)]);
}
if (!(array_search($question_id, $part2) === FALSE))
{
unset($part2[array_search($question_id, $part2)]);
}
}
$part1 = array_values($part1);
$part2 = array_values($part2);
$this->questions = array_values(array_merge($part1, $move_questions, $part2));
foreach ($move_questions as $question_id)
{
$constraints = $this->getConstraints($question_id);
foreach ($constraints as $idx => $constraint)
{
foreach ($part2 as $next_question_id)
{
if ($constraint["question"] == $next_question_id)
{
// constraint concerning a question that follows -> delete constraint
$this->deleteConstraint($constraint["id"]);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::moveUpQuestion (   $question_id)

Moves a question up in the list of survey questions.

Parameters
integer$question_idThe question id of the question which has to be moved up public

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

References $questions, getSurveyPages(), getSurveyQuestions(), and moveQuestions().

{
$move_questions = array($question_id);
$pages =& $this->getSurveyPages();
$pageindex = -1;
foreach ($pages as $idx => $page)
{
if ($page[0]["question_id"] == $question_id)
{
$pageindex = $idx;
}
}
if ($pageindex > 0)
{
$this->moveQuestions($move_questions, $pages[$pageindex-1][0]["question_id"], 0);
}
else
{
// move up a question in a questionblock
$questions = array_keys($questions);
$index = array_search($question_id, $questions);
if (($index !== FALSE) && ($index > 0))
{
$this->moveQuestions($move_questions, $questions[$index-1], 0);
}
}
}

+ Here is the call graph for this function:

ilObjSurvey::moveUpQuestionblock (   $questionblock_id)

Moves a questionblock up in the list of survey questions.

Parameters
integer$questionblock_idThe questionblock id of the questionblock which has to be moved up public

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

References getSurveyPages(), and moveQuestions().

{
$pages =& $this->getSurveyPages();
$move_questions = array();
$pageindex = -1;
foreach ($pages as $idx => $page)
{
if ($page[0]["questionblock_id"] == $questionblock_id)
{
foreach ($page as $pageidx => $question)
{
array_push($move_questions, $question["question_id"]);
}
$pageindex = $idx;
}
}
if ($pageindex > 0)
{
$this->moveQuestions($move_questions, $pages[$pageindex-1][0]["question_id"], 0);
}
}

+ Here is the call graph for this function:

ilObjSurvey::notify (   $a_event,
  $a_ref_id,
  $a_parent_non_rbac_id,
  $a_node_id,
  $a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)

public

Parameters
stringevent
integerreference id of object where the event occured
arraypasses optional parameters if required
Returns
boolean

Reimplemented from ilObject.

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

References $_GET, and ilObject\getType().

{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
//exit;
break;
case "cut":
//echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
//exit;
break;
case "copy":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
//exit;
break;
case "paste":
//echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
//exit;
break;
case "new":
//echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
//exit;
break;
}
// At the beginning of the recursive process it avoids second call of the notify function with the same parameter
if ($a_node_id==$_GET["ref_id"])
{
$parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
$parent_type = $parent_obj->getType();
if($parent_type == $this->getType())
{
$a_node_id = (int) $tree->getParentId($a_node_id);
}
}
parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
}

+ Here is the call graph for this function:

ilObjSurvey::openAllAppraisees ( )

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

References getSurveyId().

{
global $ilDB;
$ilDB->manipulate("UPDATE svy_360_appr".
" SET has_closed = ".$ilDB->quote(null, "integer").
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer"));
}

+ Here is the call graph for this function:

ilObjSurvey::prepareTextareaOutput (   $txt_output)

Prepares a string for a text area output in surveys.

Parameters
string$txt_outputString which should be prepared for output public

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

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
}
& ilObjSurvey::processCSVRow (   $row,
  $quoteAll = FALSE,
  $separator = ";" 
)

Processes an array as a CSV row and converts the array values to correct CSV values.

The "converted" array is returned

Parameters
array$rowThe array containing the values for a CSV row
string$quoteAllIndicates to quote every value (=TRUE) or only values containing quotes and separators (=FALSE, default)
string$separatorThe value separator in the CSV row (used for quoting) (; = default)
Returns
array The converted array ready for CSV use public

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

References $row, and $separator.

{
$resultarray = array();
foreach ($row as $rowindex => $entry)
{
if(is_array($entry))
{
$entry = implode("/", $entry);
}
$surround = FALSE;
if ($quoteAll)
{
$surround = TRUE;
}
if (strpos($entry, "\"") !== FALSE)
{
$entry = str_replace("\"", "\"\"", $entry);
$surround = TRUE;
}
if (strpos($entry, $separator) !== FALSE)
{
$surround = TRUE;
}
// replace all CR LF with LF (for Excel for Windows compatibility
$entry = str_replace(chr(13).chr(10), chr(10), $entry);
if ($surround)
{
$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
}
else
{
$resultarray[$rowindex] = utf8_decode($entry);
}
}
return $resultarray;
}
ilObjSurvey::processPrintoutput2FO (   $print_output)

Convert a print output to XSL-FO.

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

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

References $GLOBALS, $ilLog, xslt_create(), xslt_error(), xslt_free(), and xslt_process().

{
global $ilLog;
if (extension_loaded("tidy"))
{
$config = array(
"indent" => false,
"output-xml" => true,
"numeric-entities" => true
);
$tidy = new tidy();
$tidy->parseString($print_output, $config, 'utf8');
$tidy->cleanRepair();
$print_output = tidy_get_output($tidy);
$print_output = preg_replace("/^.*?(<html)/", "\\1", $print_output);
}
else
{
$print_output = str_replace("&nbsp;", "&#160;", $print_output);
$print_output = str_replace("&otimes;", "X", $print_output);
// #17680 - metric questions use &#160; in print view
$print_output = str_replace("&gt;", ">", $print_output);
$print_output = str_replace("&lt;", "<", $print_output);
$print_output = str_replace("&#160;", "~|nbsp|~", $print_output);
$print_output = preg_replace('/&(?!amp)/', '&amp;', $print_output);
$print_output = str_replace("~|nbsp|~", "&#160;", $print_output);
}
$xsl = file_get_contents("./Modules/Survey/xml/question2fo.xsl");
// additional font support
$xsl = str_replace(
'font-family="Helvetica, unifont"',
'font-family="'.$GLOBALS['ilSetting']->get('rpc_pdf_font','Helvetica, unifont').'"',
$xsl
);
$args = array( '/_xml' => $print_output, '/_xsl' => $xsl );
$xh = xslt_create();
$params = array();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
xslt_error($xh);
xslt_free($xh);
$ilLog->write($output);
return $output;
}

+ Here is the call graph for this function:

ilObjSurvey::read (   $a_force_db = false)

read object data from db into object

Parameters
booleanpublic

Reimplemented from ilObject.

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

References loadFromDb().

{
parent::read($a_force_db);
$this->loadFromDb();
}

+ Here is the call graph for this function:

ilObjSurvey::removeConstraintsConcerningQuestion (   $question_id)

Remove constraints concerning a question with a given question_id.

Parameters
integer$question_idThe database id of the question public

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

References $result, $row, and getSurveyId().

Referenced by removeQuestion().

{
global $ilDB;
$result = $ilDB->queryF("SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($question_id, $this->getSurveyId())
);
if ($result->numRows() > 0)
{
$remove_constraints = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($remove_constraints, $row["constraint_fi"]);
}
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($question_id, $this->getSurveyId())
);
foreach ($remove_constraints as $key => $constraint_id)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_constraint WHERE constraint_id = %s",
array('integer'),
array($constraint_id)
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::removeQuestion (   $question_id)

Remove a question from the survey.

Parameters
integer$question_idThe database id of the question public

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

References _instanciateQuestion(), and removeConstraintsConcerningQuestion().

Referenced by delete(), and removeQuestions().

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question =& $this->_instanciateQuestion($question_id);
$question->delete($question_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::removeQuestionFromBlock (   $question_id,
  $questionblock_id 
)

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

References getSurveyId().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
array('integer','integer','integer'),
array($questionblock_id, $this->getSurveyId(), $question_id)
);
}

+ Here is the call graph for this function:

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 public

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

References $size, getSurveyId(), getSurveyQuestions(), removeQuestion(), and saveQuestionsToDb().

{
global $ilDB;
$block_sizes = array();
foreach ($this->getSurveyQuestions() as $question_id => $data)
{
if (in_array($question_id, $remove_questions) or in_array($data["questionblock_id"], $remove_questionblocks))
{
unset($this->questions[array_search($question_id, $this->questions)]);
$this->removeQuestion($question_id);
}
else if($data["questionblock_id"])
{
$block_sizes[$data["questionblock_id"]]++;
}
}
// blocks with just 1 question need to be deleted
foreach($block_sizes as $block_id => $size)
{
if($size < 2)
{
$remove_questionblocks[] = $block_id;
}
}
foreach (array_unique($remove_questionblocks) as $questionblock_id)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk WHERE questionblock_id = %s",
array('integer'),
array($questionblock_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($questionblock_id, $this->getSurveyId())
);
}
$this->questions = array_values($this->questions);
}

+ Here is the call graph for this function:

ilObjSurvey::removeSelectedSurveyResults (   $finished_ids)

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

public

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

References $result, and $row.

Referenced by deleteRater().

{
global $ilDB;
foreach ($finished_ids as $finished_id)
{
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE finished_id = %s",
array('integer'),
array($finished_id)
);
$row = $ilDB->fetchAssoc($result);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_answer WHERE active_fi = %s",
array('integer'),
array($row["finished_id"])
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_finished WHERE finished_id = %s",
array('integer'),
array($finished_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_times WHERE finished_fi = %s",
array('integer'),
array($row["finished_id"])
);
}
}

+ Here is the caller graph for this function:

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 private
See Also
$author

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

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

Referenced by createMetaData().

{
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_life =& $md->getLifecycle();
if (!$md_life)
{
if (strlen($a_author) == 0)
{
global $ilUser;
$a_author = $ilUser->getFullname();
}
$md_life =& $md->addLifecycle();
$md_life->save();
$con =& $md_life->addContribute();
$con->setRole("Author");
$con->save();
$ent =& $con->addEntity();
$ent->setEntity($a_author);
$ent->save();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::saveCompletionStatus ( )

Saves the completion status of the survey.

public

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

References getSurveyId(), and isComplete().

{
global $ilDB;
$complete = 0;
if ($this->isComplete())
{
$complete = 1;
}
if ($this->getSurveyId() > 0)
{
$affectedRows = $ilDB->manipulateF("UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
array('text','integer','integer'),
array($this->isComplete(), time(), $this->getSurveyId())
);
}
}

+ Here is the call graph for this function:

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

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

References getSurveyId().

Referenced by cloneTextblocks().

{
global $ilDB;
if ($heading)
{
$affectedRows = $ilDB->manipulateF("UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
array('text','integer','integer'),
array($heading, $this->getSurveyId(), $insertbefore)
);
}
else
{
$affectedRows = $ilDB->manipulateF("UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
array('text','integer','integer'),
array(NULL, $this->getSurveyId(), $insertbefore)
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::saveQuestionsToDb ( )

Saves the survey questions to the database.

public

See Also
$questions

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

References $result, $row, and getSurveyId().

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

{
global $ilDB;
// save old questions state
$old_questions = array();
$result = $ilDB->queryF("SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$old_questions[$row["question_fi"]] = $row;
}
}
// delete existing question relations
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_svy_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
// create new question relations
foreach ($this->questions as $key => $value)
{
$next_id = $ilDB->nextId('svy_svy_qst');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','text','integer','integer'),
array($next_id, $this->getSurveyId(), $value, (strlen($old_questions[$value]["heading"])) ? $old_questions[$value]["heading"] : NULL, $key, time())
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::saveToDb ( )

Saves a survey object to a database.

public

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

References ilRTE\_replaceMediaObjectImageSrc(), get360Mode(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), get360SkillService(), getActivationEndDate(), getActivationStartDate(), getActivationVisibility(), getAnonymize(), getAuthor(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getIntroduction(), getInvitation(), getInvitationMode(), ilObjectActivation\getItem(), getMailAddresses(), getMailNotification(), getMailParticipantData(), getOutro(), getPoolUsage(), getReminderEnd(), getReminderFrequency(), getReminderLastSent(), getReminderStart(), getReminderStatus(), getReminderTarget(), getShowQuestionTitles(), getStartDate(), getStatus(), getSurveyId(), getTemplate(), getTutorNotificationRecipients(), getTutorNotificationStatus(), getTutorNotificationTarget(), IL_CAL_DATE, isActivationLimited(), isComplete(), saveQuestionsToDb(), setSurveyId(), ilObjectActivation\setTimingType(), ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

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

{
global $ilDB;
// date handling
$rmd_start = $this->getReminderStart();
if(is_object($rmd_start))
{
$rmd_start = $rmd_start->get(IL_CAL_DATE);
}
$rmd_end = $this->getReminderEnd();
if(is_object($rmd_end))
{
$rmd_end = $rmd_end->get(IL_CAL_DATE);
}
include_once("./Services/RTE/classes/class.ilRTE.php");
if ($this->getSurveyId() < 1)
{
$next_id = $ilDB->nextId('svy_svy');
$affectedRows = $ilDB->insert("svy_svy", array(
"survey_id" => array("integer", $next_id),
"obj_fi" => array("integer", $this->getId()),
"author" => array("text", $this->getAuthor()),
"introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
"outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
"status" => array("text", $this->getStatus()),
"startdate" => array("text", $this->getStartDate()),
"enddate" => array("text", $this->getEndDate()),
"evaluation_access" => array("text", $this->getEvaluationAccess()),
"invitation" => array("text", $this->getInvitation()),
"invitation_mode" => array("text", $this->getInvitationMode()),
"complete" => array("text", $this->isComplete()),
"created" => array("integer", time()),
"anonymize" => array("text", $this->getAnonymize()),
"show_question_titles" => array("text", $this->getShowQuestionTitles()),
"mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
"mailaddresses" => array('text', strlen($this->getMailAddresses()) ? $this->getMailAddresses() : NULL),
"mailparticipantdata" => array('text', strlen($this->getMailParticipantData()) ? $this->getMailParticipantData() : NULL),
"tstamp" => array("integer", time()),
"template_id" => array("integer", $this->getTemplate()),
"pool_usage" => array("integer", $this->getPoolUsage()),
// 360°
"mode_360" => array("integer", $this->get360Mode()),
"mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
"mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
"mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
"mode_360_results" => array("integer", $this->get360Results()),
"mode_360_skill_service" => array("integer", (int) $this->get360SkillService()),
// reminder/notification
"reminder_status" => array("integer", (int)$this->getReminderStatus()),
"reminder_start" => array("datetime", $rmd_start),
"reminder_end" => array("datetime", $rmd_end),
"reminder_frequency" => array("integer", (int)$this->getReminderFrequency()),
"reminder_target" => array("integer", (int)$this->getReminderTarget()),
"reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
"tutor_ntf_status" => array("integer", (int)$this->getTutorNotificationStatus()),
"tutor_ntf_reci" => array("text", implode(";", (array)$this->getTutorNotificationRecipients())),
"tutor_ntf_target" => array("integer", (int)$this->getTutorNotificationTarget())
));
$this->setSurveyId($next_id);
}
else
{
$affectedRows = $ilDB->update("svy_svy", array(
"author" => array("text", $this->getAuthor()),
"introduction" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0)),
"outro" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 0)),
"status" => array("text", $this->getStatus()),
"startdate" => array("text", $this->getStartDate()),
"enddate" => array("text", $this->getEndDate()),
"evaluation_access" => array("text", $this->getEvaluationAccess()),
"invitation" => array("text", $this->getInvitation()),
"invitation_mode" => array("text", $this->getInvitationMode()),
"complete" => array("text", $this->isComplete()),
"anonymize" => array("text", $this->getAnonymize()),
"show_question_titles" => array("text", $this->getShowQuestionTitles()),
"mailnotification" => array('integer', ($this->getMailNotification()) ? 1 : 0),
"mailaddresses" => array('text', strlen($this->getMailAddresses()) ? $this->getMailAddresses() : NULL),
"mailparticipantdata" => array('text', strlen($this->getMailParticipantData()) ? $this->getMailParticipantData() : NULL),
"tstamp" => array("integer", time()),
"template_id" => array("integer", $this->getTemplate()),
"pool_usage" => array("integer", $this->getPoolUsage()),
// 360°
"mode_360" => array("integer", $this->get360Mode()),
"mode_360_self_eval" => array("integer", $this->get360SelfEvaluation()),
"mode_360_self_rate" => array("integer", $this->get360SelfRaters()),
"mode_360_self_appr" => array("integer", $this->get360SelfAppraisee()),
"mode_360_results" => array("integer", $this->get360Results()),
"mode_360_skill_service" => array("integer", (int) $this->get360SkillService()),
// reminder/notification
"reminder_status" => array("integer", $this->getReminderStatus()),
"reminder_start" => array("datetime", $rmd_start),
"reminder_end" => array("datetime", $rmd_end),
"reminder_frequency" => array("integer", $this->getReminderFrequency()),
"reminder_target" => array("integer", $this->getReminderTarget()),
"reminder_last_sent" => array("datetime", $this->getReminderLastSent()),
"tutor_ntf_status" => array("integer", $this->getTutorNotificationStatus()),
"tutor_ntf_reci" => array("text", implode(";", (array)$this->getTutorNotificationRecipients())),
"tutor_ntf_target" => array("integer", $this->getTutorNotificationTarget())
), array(
"survey_id" => array("integer", $this->getSurveyId())
));
}
if ($affectedRows)
{
// save questions to db
}
// moved activation to ilObjectActivation
if($this->ref_id)
{
include_once "./Services/Object/classes/class.ilObjectActivation.php";
$item = new ilObjectActivation;
if(!$this->isActivationLimited())
{
}
else
{
$item->setTimingStart($this->getActivationStartDate());
$item->setTimingEnd($this->getActivationEndDate());
$item->toggleVisible($this->getActivationVisibility());
}
$item->update($this->ref_id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 5106 of file class.ilObjSurvey.php.

References getSurveyId().

Referenced by fillSurveyForUser(), and getUserSurveyExecutionStatus().

{
global $ilDB;
$next_id = $ilDB->nextId('svy_anonymous');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) ".
"VALUES (%s, %s, %s, %s, %s)",
array('integer','text', 'integer', 'text', 'integer'),
array($next_id, $access_code, $this->getSurveyId(), md5($user_id), time())
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References ilObject\$title, and $usr_id.

{
global $ilDB;
$next_id = $ilDB->nextId('svy_settings');
$affectedRows = $ilDB->insert("svy_settings", array(
"settings_id" => array("integer", $next_id),
"usr_id" => array("integer", $usr_id),
"keyword" => array("text", $key),
"title" => array("text", $title),
"value" => array("clob", $value)
));
}
ilObjSurvey::sendCodes (   $not_sent,
  $subject,
  $message,
  $lang 
)

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

References $lang, ilLink\_getLink(), getExternalCodeRecipients(), ilObject\getOwner(), ilObject\getRefId(), and getSurveyId().

{
/*
* 0 = all
* 1 = not sent
* 2 = finished
* 3 = not finished
*/
$check_finished = ($not_sent > 1);
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/Link/classes/class.ilLink.php";
$user_id = $this->getOwner();
$mail = new ilMail($user_id);
$recipients = $this->getExternalCodeRecipients($check_finished);
foreach ($recipients as $data)
{
if($data['email'] && $data['code'])
{
$do_send = false;
switch ((int)$not_sent)
{
case 1:
$do_send = !(bool)$data['sent'];
break;
case 2:
$do_send = $data['finished'];
break;
case 3:
$do_send = !$data['finished'];
break;
default:
$do_send = true;
break;
}
if ($do_send)
{
// build text
$messagetext = $message;
$url = ilLink::_getLink($this->getRefId(), "svy",
array(
"accesscode" => $data["code"],
"lang" => $lang
));
$messagetext = str_replace('[url]', "<" . $url . ">", $messagetext);
foreach ($data as $key => $value)
{
$messagetext = str_replace('[' . $key . ']', $value, $messagetext);
}
// send mail
$mail->sendMail(
$data['email'], // to
"", // cc
"", // bcc
$subject, // subject
$messagetext, // message
array(), // attachments
array('normal') // type
);
}
}
}
global $ilDB;
$ilDB->manipulateF("UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
array('integer','integer'),
array(1, $this->getSurveyId())
);
}

+ Here is the call graph for this function:

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

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

References $mailparticipantdata, ilObjUser\_getUserData(), getActiveID(), getAnonymize(), ilUserUtil\getNamePresentation(), getParticipantTextResults(), and ilObject\getRefId().

{
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
// #12755
$placeholders = array(
"FIRST_NAME" => "firstname",
"LAST_NAME" => "lastname",
"LOGIN" => "login",
// old style
"firstname" => "firstname"
);
$recipients = preg_split('/,/', $this->mailaddresses);
foreach ($recipients as $recipient)
{
// #11298
include_once "./Services/Notification/classes/class.ilSystemNotification.php";
$ntf = new ilSystemNotification();
$ntf->setLangModules(array("survey"));
$ntf->setRefId($this->getRefId());
$ntf->setSubjectLangId('finished_mail_subject');
if(trim($messagetext))
{
$data = ilObjUser::_getUserData(array($user_id));
$data = $data[0];
foreach ($placeholders as $key => $mapping)
{
if ($this->getAnonymize())
{
$messagetext = str_replace('[' . $key . ']', '', $messagetext);
}
else
{
$messagetext = str_replace('[' . $key . ']', trim($data[$mapping]), $messagetext);
}
}
$ntf->setIntroductionDirect($messagetext);
}
else
{
$ntf->setIntroductionLangId('survey_notification_finished_introduction');
}
// 360°? add appraisee data
if($appr_id)
{
$ntf->addAdditionalInfo('survey_360_appraisee',
}
$active_id = $this->getActiveID($user_id, $anonymize_id, $appr_id);
$ntf->addAdditionalInfo('results',
$this->getParticipantTextResults($active_id), true);
$ntf->setGotoLangId('survey_notification_tutor_link');
$ntf->setReasonLangId('survey_notification_finished_reason');
$ntf->sendMail(array($recipient), null, null);
}
}

+ Here is the call graph for this function:

ilObjSurvey::sendTutorNotification ( )
protected

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

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

Referenced by checkTutorNotification().

{
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getStaticLink($this->getRefId(), "svy");
foreach($this->getTutorNotificationRecipients() as $user_id)
{
// use language of recipient to compose message
$ulng->loadLanguageModule('survey');
$subject = sprintf($ulng->txt('survey_notification_tutor_subject'), $this->getTitle());
$message = sprintf($ulng->txt('survey_notification_tutor_salutation'), ilObjUser::_lookupFullname($user_id))."\n\n";
$message .= $ulng->txt('survey_notification_tutor_body').":\n\n";
$message .= $ulng->txt('obj_svy').": ". $this->getTitle()."\n";
$message .= "\n".$ulng->txt('survey_notification_tutor_link').": ".$link;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail(ilObjUser::_lookupLogin($user_id),
"", "", $subject, $message, array(), array("system"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::sentReminder ( array  $a_recipient_ids)
protected

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

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

Referenced by checkReminder().

{
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getStaticLink($this->getRefId(), "svy");
foreach($a_recipient_ids as $user_id)
{
// use language of recipient to compose message
$ulng->loadLanguageModule('survey');
$subject = sprintf($ulng->txt('survey_reminder_subject'), $this->getTitle());
$message = sprintf($ulng->txt('survey_reminder_salutation'), ilObjUser::_lookupFullname($user_id))."\n\n";
$message .= $ulng->txt('survey_reminder_body').":\n\n";
$message .= $ulng->txt('obj_svy').": ". $this->getTitle()."\n";
$message .= "\n".$ulng->txt('survey_reminder_link').": ".$link;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail(ilObjUser::_lookupLogin($user_id),
"", "", $subject, $message, array(), array("system"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::set360Mode (   $a_value)

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

Referenced by loadFromDb().

{
$this->mode_360 = (bool)$a_value;
}

+ Here is the caller graph for this function:

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

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

References getSurveyId().

{
global $ilDB;
if(!$a_tstamp)
{
$a_tstamp = time();
}
$ilDB->manipulate("UPDATE svy_360_rater".
" SET mail_sent = ".$ilDB->quote($a_tstamp, "integer").
" WHERE obj_id = ".$ilDB->quote($this->getSurveyId(), "integer").
" AND appr_id = ".$ilDB->quote($a_appraisee_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer").
" AND anonymous_id = ".$ilDB->quote($a_anonymous_id, "integer"));
}

+ Here is the call graph for this function:

ilObjSurvey::set360Results (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::set360SelfAppraisee (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::set360SelfEvaluation (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::set360SelfRaters (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::set360SkillService (   $a_val)

Set skill service.

Parameters
bool$a_valactivate skill service

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

Referenced by loadFromDb().

{
$this->mode_360_skill_service = $a_val;
}

+ Here is the caller graph for this function:

ilObjSurvey::setActivationEndDate (   $ending_time = NULL)

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

Referenced by loadFromDb().

{
$this->activation_ending_time = $ending_time;
}

+ Here is the caller graph for this function:

ilObjSurvey::setActivationLimited (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setActivationStartDate (   $starting_time = NULL)

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

Referenced by loadFromDb().

{
$this->activation_starting_time = $starting_time;
}

+ Here is the caller graph for this function:

ilObjSurvey::setActivationVisibility (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setAnonymize (   $a_anonymize)

set anonymize status

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

References ANONYMIZE_OFF.

Referenced by applySettingsTemplate(), and loadFromDb().

{
switch ($a_anonymize)
{
case self::ANONYMIZE_OFF:
case self::ANONYMIZE_ON:
case self::ANONYMIZE_FREEACCESS:
case self::ANONYMIZE_CODE_ALL:
$this->anonymize = $a_anonymize;
break;
default:
$this->anonymize = self::ANONYMIZE_OFF;
break;
}
}

+ Here is the caller graph for this function:

ilObjSurvey::setAuthor (   $author = "")

Sets the authors name of the ilObjSurvey object.

Parameters
string$authorA string containing the name of the test author public
See Also
$author

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

References $author.

Referenced by loadFromDb().

{
$this->author = $author;
}

+ Here is the caller graph for this function:

ilObjSurvey::setEndDate (   $end_date = "")

Sets the end date of the survey.

Parameters
string$end_dateSurvey end date (YYYYMMDDHHMMSS) public
See Also
$end_date

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

References $end_date.

Referenced by loadFromDb().

{
$this->end_date = $end_date;
}

+ Here is the caller graph for this function:

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) public
See Also
$start_date

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

References $d, and $end_date.

{
$y = ''; $m = ''; $d = ''; $h = ''; $i = ''; $s = '';
if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches))
{
$y = $matches[1];
$m = $matches[2];
$d = $matches[3];
}
if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches))
{
$h = $matches[1];
$i = $matches[2];
$s = $matches[3];
}
$this->end_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
}
ilObjSurvey::setEndTime (   $finished_id)

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

References $_SESSION.

{
global $ilDB;
$time = time();
$affectedRows = $ilDB->manipulateF("UPDATE svy_times SET left_page = %s WHERE finished_fi = %s AND entered_page = %s",
array('integer', 'integer', 'integer'),
array($time, $finished_id, $_SESSION['svy_entered_page'])
);
unset($_SESSION['svy_entered_page']);
}
ilObjSurvey::setEvaluationAccess (   $evaluation_access = self::EVALUATION_ACCESS_OFF)

Sets the learners evaluation access.

Parameters
integer$evaluation_accessThe evaluation access public
See Also
$evaluation_access

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

References $evaluation_access.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setIntroduction (   $introduction = "")

Sets the introduction text.

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

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

References $introduction.

Referenced by importObject(), and loadFromDb().

{
$this->introduction = $introduction;
}

+ Here is the caller graph for this function:

ilObjSurvey::setInvitation (   $invitation = 0)

Sets the invitation status.

Parameters
integer$invitationThe invitation status public
See Also
$invitation

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

References $invitation, $result, $row, disinviteAllUsers(), ilObject\getId(), getInvitationMode(), INVITATION_OFF, INVITATION_ON, and inviteUser().

Referenced by loadFromDb(), and setInvitationAndMode().

{
global $ilDB;
global $ilAccess;
$this->invitation = $invitation;
{
}
{
if ($this->getInvitationMode() == self::MODE_UNLIMITED)
{
$result = $ilDB->query("SELECT usr_id FROM usr_data");
while ($row = $ilDB->fetchAssoc($result))
{
if ($ilAccess->checkAccessOfUser($row["usr_id"], "read", "", $this->getRefId(), "svy", $this->getId()))
{
$this->inviteUser($row['usr_id']);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurvey::setInvitationAndMode (   $invitation = 0,
  $invitation_mode = 0 
)

Sets the invitation status and mode (a more performant solution if you change both)

Parameters
integer$invitationThe invitation status
integer$invitation_modeThe invitation mode public
See Also
$invitation_mode

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

References $invitation, $invitation_mode, and setInvitation().

{
$this->invitation_mode = $invitation_mode;
}

+ Here is the call graph for this function:

ilObjSurvey::setInvitationMode (   $invitation_mode = 0)

Sets the invitation mode.

Parameters
integer$invitation_modeThe invitation mode public
See Also
$invitation_mode

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

References $invitation_mode.

Referenced by loadFromDb().

{
$this->invitation_mode = $invitation_mode;
}

+ Here is the caller graph for this function:

ilObjSurvey::setMailAddresses (   $a_addresses)

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

Referenced by loadFromDb().

{
$this->mailaddresses = $a_addresses;
}

+ Here is the caller graph for this function:

ilObjSurvey::setMailNotification (   $a_notification)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setMailParticipantData (   $a_data)

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

Referenced by loadFromDb().

{
$this->mailparticipantdata = $a_data;
}

+ Here is the caller graph for this function:

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 public

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

References $result, $row, and getSurveyId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
if (!array_key_exists($row["question_fi"], $obligatory_questions))
{
$obligatory_questions[$row["question_fi"]] = 0;
}
}
}
// set the obligatory states in the database
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_oblig WHERE survey_fi = %s",
array('integer'),
array($this->getSurveyId())
);
// set the obligatory states in the database
foreach ($obligatory_questions as $question_fi => $obligatory)
{
$next_id = $ilDB->nextId('svy_qst_oblig');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " .
"obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','integer','integer','text','integer'),
array($next_id, $this->getSurveyId(), $question_fi, (strlen($obligatory)) ? $obligatory : 0, time())
);
// #12420
$ilDB->manipulate("UPDATE svy_question".
" SET obligatory = ".$ilDB->quote($obligatory, "integer").
" WHERE question_id = ".$ilDB->quote($question_fi, "integer"));
}
}

+ Here is the call graph for this function:

ilObjSurvey::setOutro (   $outro = "")

Sets the outro text.

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

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

References $outro.

Referenced by importObject(), and loadFromDb().

{
$this->outro = $outro;
}

+ Here is the caller graph for this function:

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 public

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

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
array('integer','integer'),
array(($page_id) ? $page_id : 0, $finished_id)
);
}
ilObjSurvey::setPoolUsage (   $a_value)

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

Referenced by applySettingsTemplate(), and loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setReminderEnd ( ilDate  $a_value = null)

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

Referenced by loadFromDb().

{
$this->reminder_end = $a_value;
}

+ Here is the caller graph for this function:

ilObjSurvey::setReminderFrequency (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setReminderLastSent (   $a_value)

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

Referenced by checkReminder(), and loadFromDb().

{
$this->reminder_last_sent = $a_value;
}

+ Here is the caller graph for this function:

ilObjSurvey::setReminderStart ( ilDate  $a_value = null)

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

Referenced by loadFromDb().

{
$this->reminder_start = $a_value;
}

+ Here is the caller graph for this function:

ilObjSurvey::setReminderStatus (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setReminderTarget (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

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 1278 of file class.ilObjSurvey.php.

Referenced by applySettingsTemplate(), and loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setStartDate (   $start_date = "")

Sets the start date of the survey.

Parameters
string$start_dataSurvey start date (YYYYMMDDHHMMSS) public
See Also
$start_date

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

References $start_date.

Referenced by loadFromDb().

{
$this->start_date = $start_date;
}

+ Here is the caller graph for this function:

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) public
See Also
$start_date

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

References $d, and $start_date.

{
$y = ''; $m = ''; $d = ''; $h = ''; $i = ''; $s = '';
if (preg_match("/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches))
{
$y = $matches[1];
$m = $matches[2];
$d = $matches[3];
}
if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches))
{
$h = $matches[1];
$i = $matches[2];
$s = $matches[3];
}
$this->start_date = sprintf('%04d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
}
ilObjSurvey::setStartTime (   $finished_id,
  $first_question 
)

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

References $_SESSION.

{
global $ilDB;
$time = time();
$_SESSION['svy_entered_page'] = $time;
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_times (finished_fi, entered_page, left_page, first_question) VALUES (%s, %s, %s, %s)",
array('integer', 'integer', 'integer', 'integer'),
array($finished_id, $time, NULL, $first_question)
);
}
ilObjSurvey::setStatus (   $status = self::STATUS_OFFLINE)

Sets the survey status.

Parameters
integer$statusSurvey status
Returns
string An error message, if the status cannot be set, otherwise an empty string public
See Also
$status

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

References $result, $status, and STATUS_OFFLINE.

Referenced by loadFromDb().

{
$result = "";
if (($status == self::STATUS_ONLINE) && (count($this->questions) == 0))
{
$this->status = self::STATUS_OFFLINE;
$result = $this->lng->txt("cannot_switch_to_online_no_questions");
}
else
{
$this->status = $status;
}
return $result;
}

+ Here is the caller graph for this function:

ilObjSurvey::setSurveyId (   $survey_id)

Sets the survey id.

Parameters
integer$survey_idThe survey id

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

References $survey_id.

Referenced by loadFromDb(), and saveToDb().

{
$this->survey_id = $survey_id;
}

+ Here is the caller graph for this function:

ilObjSurvey::setTemplate (   $template_id)

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

References $template_id.

Referenced by applySettingsTemplate(), and loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setTutorNotificationRecipients ( array  $a_value)

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

Referenced by loadFromDb().

{
$this->tutor_ntf_recipients = $a_value;
}

+ Here is the caller graph for this function:

ilObjSurvey::setTutorNotificationStatus (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::setTutorNotificationTarget (   $a_value)

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

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

ilObjSurvey::showQuestionTitles ( )

Sets the question titles visible during the query.

public

See Also
$display_question_titles

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

{
$this->display_question_titles = 1;
}
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 public

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

References getAnonymize(), and getSurveyId().

{
global $ilDB;
if ($this->getAnonymize() && (strlen($anonymous_id) == 0)) return;
if (strcmp($user_id, "") == 0)
{
if ($user_id == ANONYMOUS_USER_ID)
{
$user_id = 0;
}
}
$next_id = $ilDB->nextId('svy_finished');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp, appr_id) ".
"VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','text','text','integer','integer'),
array($next_id, $this->getSurveyId(), $user_id, $anonymous_id, 0, time(), $appraisee_id)
);
return $next_id;
}

+ Here is the call graph for this function:

ilObjSurvey::toXML ( )

Returns a QTI xml representation of the survey.

Returns
string The QTI xml representation of the survey public

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

References _instanciateQuestion(), addMaterialTag(), get360Mode(), get360Results(), get360SelfAppraisee(), get360SelfEvaluation(), get360SelfRaters(), get360SkillService(), getAnonymize(), getAuthor(), ilObject\getDescription(), getEndDate(), getEvaluationAccess(), ilObject\getId(), getIntroduction(), getObligatoryStates(), getOutro(), getPoolUsage(), getShowQuestionTitles(), getStartDate(), getStatus(), getSurveyId(), getSurveyPages(), ilObject\getTitle(), ilObject\getType(), and ilXmlWriter\xmlHeader().

{
include_once("./Services/Xml/classes/class.ilXmlWriter.php");
$a_xml_writer = new ilXmlWriter;
// set xml header
$a_xml_writer->xmlHeader();
$attrs = array(
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xsi:noNamespaceSchemaLocation" => "http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
);
$a_xml_writer->xmlStartTag("surveyobject", $attrs);
$attrs = array(
"id" => $this->getSurveyId(),
"title" => $this->getTitle()
);
$a_xml_writer->xmlStartTag("survey", $attrs);
$a_xml_writer->xmlElement("description", NULL, $this->getDescription());
$a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
$a_xml_writer->xmlStartTag("objectives");
$attrs = array(
"label" => "introduction"
);
$this->addMaterialTag($a_xml_writer, $this->getIntroduction(), TRUE, TRUE, $attrs);
$attrs = array(
"label" => "outro"
);
$this->addMaterialTag($a_xml_writer, $this->getOutro(), TRUE, TRUE, $attrs);
$a_xml_writer->xmlEndTag("objectives");
if ($this->getAnonymize())
{
$attribs = array("enabled" => "1");
}
else
{
$attribs = array("enabled" => "0");
}
$a_xml_writer->xmlElement("anonymisation", $attribs);
$a_xml_writer->xmlStartTag("restrictions");
if ($this->getAnonymize() == 2)
{
$attribs = array("type" => "free");
}
else
{
$attribs = array("type" => "restricted");
}
$a_xml_writer->xmlElement("access", $attribs);
if ($this->getStartDate())
{
$attrs = array("type" => "date");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches);
$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]));
}
if ($this->getEndDate())
{
$attrs = array("type" => "date");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches);
$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]));
}
$a_xml_writer->xmlEndTag("restrictions");
// constraints
$pages =& $this->getSurveyPages();
$hasconstraints = FALSE;
foreach ($pages as $question_array)
{
foreach ($question_array as $question)
{
if (count($question["constraints"]))
{
$hasconstraints = TRUE;
}
}
}
if ($hasconstraints)
{
$a_xml_writer->xmlStartTag("constraints");
foreach ($pages as $question_array)
{
foreach ($question_array as $question)
{
if (count($question["constraints"]))
{
// found constraints
foreach ($question["constraints"] as $constraint)
{
$attribs = array(
"sourceref" => $question["question_id"],
"destref" => $constraint["question"],
"relation" => $constraint["short"],
"value" => $constraint["value"],
"conjunction" => $constraint["conjunction"]
);
$a_xml_writer->xmlElement("constraint", $attribs);
}
}
}
}
$a_xml_writer->xmlEndTag("constraints");
}
// add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
$a_xml_writer->xmlStartTag("metadata");
$custom_properties = array();
$custom_properties["evaluation_access"] = $this->getEvaluationAccess();
$custom_properties["status"] = $this->getStatus();
$custom_properties["display_question_titles"] = $this->getShowQuestionTitles();
$custom_properties["pool_usage"] = (int)$this->getPoolUsage();
// #14967
$custom_properties["mode_360"] = (int)$this->get360Mode();
$custom_properties["mode_360_self_eval"] = (int)$this->get360SelfEvaluation();
$custom_properties["mode_360_self_rate"] = (int)$this->get360SelfRaters();
$custom_properties["mode_360_self_appr"] = (int)$this->get360SelfAppraisee();
$custom_properties["mode_360_results"] = $this->get360Results();
$custom_properties["mode_360_skill_service"] = (int)$this->get360SkillService();
// :TODO: skills?
// reminder/tutor notification are (currently?) not exportable
foreach($custom_properties as $label => $value)
{
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, $label);
$a_xml_writer->xmlElement("fieldentry", NULL, $value);
$a_xml_writer->xmlEndTag("metadatafield");
}
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "SCORM");
include_once "./Services/MetaData/classes/class.ilMD.php";
$md = new ilMD($this->getId(),0, $this->getType());
$writer = new ilXmlWriter();
$md->toXml($writer);
$metadata = $writer->xmlDumpMem();
$a_xml_writer->xmlElement("fieldentry", NULL, $metadata);
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlEndTag("metadata");
$a_xml_writer->xmlEndTag("survey");
$attribs = array("id" => $this->getId());
$a_xml_writer->xmlStartTag("surveyquestions", $attribs);
// add questionblock descriptions
$obligatory_states =& $this->getObligatoryStates();
foreach ($pages as $question_array)
{
if (count($question_array) > 1)
{
$attribs = array("id" => $question_array[0]["question_id"]);
$attribs = array("showQuestiontext" => $question_array[0]["questionblock_show_questiontext"],
"showBlocktitle" => $question_array[0]["questionblock_show_blocktitle"]);
$a_xml_writer->xmlStartTag("questionblock", $attribs);
if (strlen($question_array[0]["questionblock_title"]))
{
$a_xml_writer->xmlElement("questionblocktitle", NULL, $question_array[0]["questionblock_title"]);
}
}
foreach ($question_array as $question)
{
if (strlen($question["heading"]))
{
$a_xml_writer->xmlElement("textblock", NULL, $question["heading"]);
}
$questionObject =& $this->_instanciateQuestion($question["question_id"]);
if ($questionObject !== FALSE) $questionObject->insertXML($a_xml_writer, FALSE, $obligatory_states[$question["question_id"]]);
}
if (count($question_array) > 1)
{
$a_xml_writer->xmlEndTag("questionblock");
}
}
$a_xml_writer->xmlEndTag("surveyquestions");
$a_xml_writer->xmlEndTag("surveyobject");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
return $xml;
}

+ Here is the call graph for this function:

ilObjSurvey::unfoldQuestionblocks (   $questionblocks)

Unfolds question blocks of a question pool.

Parameters
array$questionblocksAn array of question block id's public

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

References getSurveyId().

{
global $ilDB;
foreach ($questionblocks as $index)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk WHERE questionblock_id = %s",
array('integer'),
array($index)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($index, $this->getSurveyId())
);
}
}

+ Here is the call graph for this function:

ilObjSurvey::update ( )

update object data

public

Returns
boolean

Reimplemented from ilObject.

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

References ilObject\updateMetaData().

{
$this->updateMetaData();
if (!parent::update())
{
return false;
}
// put here object specific stuff
return true;
}

+ Here is the call graph for this function:

ilObjSurvey::updateCode (   $a_id,
  $a_email,
  $a_last_name,
  $a_first_name,
  $a_sent 
)

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

References ilUtil\is_email().

{
global $ilDB;
$a_email = trim($a_email);
// :TODO:
if($a_email && !ilUtil::is_email($a_email))
{
return;
}
$data = array("email" => $a_email,
"lastname" => trim($a_last_name),
"firstname" => trim($a_first_name));
$fields = array(
"externaldata" => array("text", serialize($data)),
"sent" => array("integer", $a_sent)
);
$ilDB->update("svy_anonymous", $fields,
array("anonymous_id" => array("integer", $a_id)));
}

+ Here is the call graph for this function:

ilObjSurvey::updateConjunctionForQuestions (   $questions,
  $conjunction 
)

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

References $questions.

{
global $ilDB;
foreach ($questions as $question_id)
{
$affectedRows = $ilDB->manipulateF("UPDATE svy_constraint SET conjunction = %s ".
"WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
array('integer','integer'),
array($conjunction, $question_id)
);
}
}
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 public

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

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s ".
"WHERE constraint_id = %s",
array('integer','integer','float','integer','integer'),
array($if_question_id, $relation, $value, $conjunction, $precondition_id)
);
}
ilObjSurvey::updateOrder ( array  $a_order)

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

{
if(sizeof($this->questions) == sizeof($a_order))
{
$this->questions = array_flip($a_order);
$this->saveQuestionsToDB();
}
}
static ilObjSurvey::validateExternalRaterCode (   $a_ref_id,
  $a_code 
)
static

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

References $_SESSION.

Referenced by ilObjSurveyAccess\_checkGoto(), ilObjSurveyGUI\executeCommand(), and ilSurveyExecutionGUI\ilSurveyExecutionGUI().

{
if(!isset($_SESSION["360_extrtr"][$a_ref_id]))
{
$svy = new self($a_ref_id);
$svy->loadFromDB();
if($svy->canStartSurvey(null, true) &&
$svy->get360Mode() &&
$svy->isAnonymousKey($a_code))
{
$anonymous_id = $svy->getAnonymousIdByCode($a_code);
if($anonymous_id)
{
if(sizeof($svy->getAppraiseesToRate(null, $anonymous_id)))
{
$_SESSION["360_extrtr"][$a_ref_id] = true;
return true;
}
}
}
$_SESSION["360_extrtr"][$a_ref_id] = false;
return false;
}
return $_SESSION["360_extrtr"][$a_ref_id];
}

+ Here is the caller graph for this function:

Field Documentation

ilObjSurvey::$activation_ending_time
protected

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

ilObjSurvey::$activation_starting_time
protected

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

ilObjSurvey::$activation_visibility
protected

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

Referenced by getActivationVisibility().

ilObjSurvey::$anonymize

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

ilObjSurvey::$author

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

Referenced by getAuthor(), and setAuthor().

ilObjSurvey::$display_question_titles

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

ilObjSurvey::$end_date

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

Referenced by setEndDate(), and setEndDateAndTime().

ilObjSurvey::$evaluation_access

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

Referenced by setEvaluationAccess().

ilObjSurvey::$introduction

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

Referenced by setIntroduction().

ilObjSurvey::$invitation

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

Referenced by setInvitation(), and setInvitationAndMode().

ilObjSurvey::$invitation_mode

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

Referenced by setInvitationAndMode(), and setInvitationMode().

ilObjSurvey::$mailaddresses

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

Referenced by getMailAddresses().

ilObjSurvey::$mailnotification

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

Referenced by getMailNotification().

ilObjSurvey::$mailparticipantdata

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

Referenced by getMailParticipantData(), and sendNotificationMail().

ilObjSurvey::$mode_360
protected

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

Referenced by get360Mode().

ilObjSurvey::$mode_360_results
protected

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

Referenced by get360Results().

ilObjSurvey::$mode_360_self_appr
protected

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

Referenced by get360SelfAppraisee().

ilObjSurvey::$mode_360_self_eval
protected

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

Referenced by get360SelfEvaluation().

ilObjSurvey::$mode_360_self_rate
protected

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

Referenced by get360SelfRaters().

ilObjSurvey::$mode_360_skill_service
protected

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

Referenced by get360SkillService().

ilObjSurvey::$outro

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

Referenced by setOutro().

ilObjSurvey::$pool_usage

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

Referenced by getPoolUsage().

ilObjSurvey::$reminder_end
protected

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

Referenced by getReminderEnd().

ilObjSurvey::$reminder_frequency
protected

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

Referenced by getReminderFrequency().

ilObjSurvey::$reminder_last_sent
protected

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

Referenced by getReminderLastSent().

ilObjSurvey::$reminder_start
protected

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

Referenced by getReminderStart().

ilObjSurvey::$reminder_status
protected

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

Referenced by getReminderStatus().

ilObjSurvey::$reminder_target
protected

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

Referenced by getReminderTarget().

ilObjSurvey::$start_date

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

Referenced by setStartDate(), and setStartDateAndTime().

ilObjSurvey::$status

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

Referenced by setStatus().

ilObjSurvey::$surveyCodeSecurity

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

ilObjSurvey::$template_id

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

Referenced by applySettingsTemplate(), getTemplate(), and setTemplate().

ilObjSurvey::$tutor_ntf_recipients
protected

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

Referenced by getTutorNotificationRecipients().

ilObjSurvey::$tutor_ntf_status
protected

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

Referenced by getTutorNotificationStatus().

ilObjSurvey::$tutor_ntf_target
protected

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

Referenced by getTutorNotificationTarget().

const ilObjSurvey::ANONYMIZE_CODE_ALL = 3
const ilObjSurvey::ANONYMIZE_FREEACCESS = 2
const ilObjSurvey::ANONYMIZE_OFF = 0
const ilObjSurvey::ANONYMIZE_ON = 1
const ilObjSurvey::EVALUATION_ACCESS_ALL = 1
const ilObjSurvey::EVALUATION_ACCESS_OFF = 0
const ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS = 2
const ilObjSurvey::INVITATION_OFF = 0

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

Referenced by getInvitation(), and ilObjSurvey().

const ilObjSurvey::INVITATION_ON = 1

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

const ilObjSurvey::MODE_PREDEFINED_USERS = 1

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

Referenced by getInvitationMode(), and ilObjSurvey().

const ilObjSurvey::MODE_UNLIMITED = 0

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

Referenced by getInvitationMode().

const ilObjSurvey::NOTIFICATION_INVITED_USERS = 2

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

Referenced by ilObjSurveyGUI\initPropertiesForm().

const ilObjSurvey::NOTIFICATION_PARENT_COURSE = 1

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

Referenced by ilObjSurveyGUI\initPropertiesForm().

const ilObjSurvey::QUESTIONTITLES_HIDDEN = 0

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

const ilObjSurvey::QUESTIONTITLES_VISIBLE = 1

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

Referenced by ilObjSurvey().

const ilObjSurvey::RESULTS_360_NONE = 0
const ilObjSurvey::RESULTS_360_OWN = 1
const ilObjSurvey::STATUS_OFFLINE = 0

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

Referenced by canStartSurvey(), getStatus(), ilObjSurvey(), and setStatus().

const ilObjSurvey::STATUS_ONLINE = 1

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


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