ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assFileUpload Class Reference

Class for file upload questions. More...

+ Inheritance diagram for assFileUpload:
+ Collaboration diagram for assFileUpload:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assFileUpload constructor More...
 
 isComplete ()
 Returns true, if the question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a assFileUpload object to a database. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 loadFromDb ($question_id)
 Loads a assFileUpload object from a database. More...
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 Duplicates an assFileUpload. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assFileUpload object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 checkUpload ()
 Check file upload. More...
 
 getFileUploadPath ($test_id, $active_id, $question_id=null)
 Returns the filesystem path for file uploads. More...
 
 getFileUploadPathWeb ($test_id, $active_id, $question_id=null)
 Returns the file upload path for web accessible files of a question. More...
 
 getUploadedFiles ($active_id, $pass=null, $authorized=true)
 Returns the uploaded files for an active user in a given pass. More...
 
 getPreviewFileUploads (ilAssQuestionPreviewSession $previewSession)
 
 getUploadedFilesForWeb ($active_id, $pass)
 Returns the web accessible uploaded files for an active user in a given pass. More...
 
 getMaxFilesizeAsString ()
 
 getMaxFilesizeInBytes ()
 
 saveWorkingData ($active_id, $pass=NULL, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Creates a question from a QTI file. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
 getBestSolution ($active_id, $pass)
 Returns the best solution for a given pass of a participant. More...
 
 getMaxSize ()
 Get max file size. More...
 
 setMaxSize ($a_value)
 Set max file size. More...
 
 getAllowedExtensionsArray ()
 Get allowed file extensions. More...
 
 getAllowedExtensions ()
 Get allowed file extensions. More...
 
 setAllowedExtensions ($a_value)
 Set allowed file extensions. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 hasFileUploads ($test_id)
 Checks if file uploads exist for a given test and the original id of the question. More...
 
 deliverFileUploadZIPFile ($test_id, $test_title)
 Generates a ZIP file containing all file uploads for a given test and the original id of the question. More...
 
 isCompletionBySubmissionEnabled ()
 Checks whether completion by submission is enabled or not. More...
 
 setCompletionBySubmission ($bool)
 Enabled/Disable completion by submission. More...
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
_getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 _getReachedPoints ($active_id, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question. More...
 
 getReachedPoints ($active_id, $pass=NULL)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=NULL, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=NULL, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 saveWorkingData ($active_id, $pass=NULL, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 @TODO Move this to a proper place. More...
 
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=NULL)
 
 getSolutionValues ($active_id, $pass=NULL, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTitle ($a_q_id)
 Returns the title of a question. More...
 
 _getQuestionText ($a_q_id)
 Returns question text. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 _getInternalLinkHref ($target="")
 
 syncWithOriginal ()
 
 createRandomSolution ($test_id, $user_id)
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=NULL)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 createNewImageFileName ($image_filename, $unique=false)
 
 _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 _needsManualScoring ($question_id)
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 _questionExistsInTest ($question_id, $test_id)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 lookupForExistingSolutions ($activeId, $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 validateSolutionSubmit ()
 
 updateTimestamp ()
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 hasFileUploads ($test_id)
 Checks if file uploads exist for a given test and the original id of the question. More...
 
 deliverFileUploadZIPFile ($test_id, $test_title)
 Generates a ZIP file containing all file uploads for a given test and the original id of the question. More...
 
 getFileUploadPath ($test_id, $active_id, $question_id=null)
 Returns the path for uploaded files from given active in given test on current or given question. More...
 

Static Public Member Functions

static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled ($forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier ($contentTypeString)
 
static getAllowedFileExtensionsForMimeType ($mimeType)
 
static isAllowedImageFileExtension ($mimeType, $fileExtension)
 
static getAllowedImageFileExtensions ()
 
static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static isFileAvailable ($file)
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _isWorkedThrough ($active_id, $question_id, $pass=NULL)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static lookupParentObjId ($questionId)
 @global ilDB $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 

Protected Member Functions

 calculateReachedPointsForSolution ($userSolution)
 
 getPreviewFileUploadPath ($userId)
 Returns the filesystem path for file uploads. More...
 
 getPreviewFileUploadPathWeb ($userId)
 Returns the filesystem path for file uploads. More...
 
 deleteUploadedFiles ($files, $test_id, $active_id, $authorized)
 
 deletePreviewFileUploads ($userId, $userSolution, $files)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 Reworks the allready saved working data if neccessary. More...
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 Reworks the allready saved working data if neccessary. More...
 
 handleSubmission ($active_id, $pass, $obligationsAnswered, $authorized)
 This method is called after an user submitted one or more files. More...
 
- Protected Member Functions inherited from assQuestion
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 Reworks the allready saved working data if neccessary. More...
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 duplicateSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet ($active_id, $pass, $authorized=true)
 Get a restulset for the current user solution for a this question by active_id and pass. More...
 
 removeSolutionRecordById ($solutionId)
 
 getSelfAssessmentFormatter ()
 

Protected Attributes

 $maxsize
 
 $allowedextensions
 
 $completion_by_submission = false
 
- Protected Attributes inherited from assQuestion
 $id
 
 $title
 
 $comment
 
 $owner
 
 $author
 
 $question
 
 $points
 
 $est_working_time
 
 $shuffle
 
 $test_id
 
 $obj_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $db
 
 $outputType
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 

Additional Inherited Members

- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords ($activeId, $pass, $questionId)
 returns the number of existing solution records for the given test active / pass and given question id More...
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

Class for file upload questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 20 of file class.assFileUpload.php.

Constructor & Destructor Documentation

◆ __construct()

assFileUpload::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "" 
)

assFileUpload constructor

The constructor takes possible arguments an creates an instance of the assFileUpload object.

Parameters
string$titleA title string to describe the question
string$commentA comment string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator
string$questionThe question string of the single choice question
See also
assQuestion:__construct()

Reimplemented from assQuestion.

Definition at line 42 of file class.assFileUpload.php.

References assQuestion\$author, assQuestion\$comment, assQuestion\$owner, assQuestion\$question, and assQuestion\$title.

Member Function Documentation

◆ __get()

assFileUpload::__get (   $value)

Object getter.

Reimplemented from assQuestion.

Definition at line 996 of file class.assFileUpload.php.

997 {
998 switch ($value)
999 {
1000 case "maxsize":
1001 return $this->getMaxSize();
1002 break;
1003 case "allowedextensions":
1004 return $this->getAllowedExtensions();
1005 break;
1006 case 'completion_by_submission':
1007 return $this->isCompletionBySubmissionEnabled();
1008 break;
1009 default:
1010 return parent::__get($value);
1011 break;
1012 }
1013 }
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
getAllowedExtensions()
Get allowed file extensions.
getMaxSize()
Get max file size.

References getAllowedExtensions(), getMaxSize(), and isCompletionBySubmissionEnabled().

+ Here is the call graph for this function:

◆ __set()

assFileUpload::__set (   $key,
  $value 
)

Object setter.

Reimplemented from assQuestion.

Definition at line 1018 of file class.assFileUpload.php.

1019 {
1020 switch ($key)
1021 {
1022 case "maxsize":
1023 $this->setMaxSize($value);
1024 break;
1025 case "allowedextensions":
1026 $this->setAllowedExtensions($value);
1027 break;
1028 case 'completion_by_submission':
1029 $this->setCompletionBySubmission($value);
1030 break;
1031 default:
1032 parent::__set($key, $value);
1033 break;
1034 }
1035 }
setMaxSize($a_value)
Set max file size.
setAllowedExtensions($a_value)
Set allowed file extensions.
setCompletionBySubmission($bool)
Enabled/Disable completion by submission.

References setAllowedExtensions(), setCompletionBySubmission(), and setMaxSize().

+ Here is the call graph for this function:

◆ calculateReachedPoints()

assFileUpload::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $authorizedSolution = true,
  $returndetails = FALSE 
)

Returns the points, a learner has reached answering the question.

The points are calculated from the given answers.

@access public

Parameters
integer$active_id
integer$pass
boolean$returndetails(deprecated !!)
Returns
integer/array $points/$details (array $details is deprecated !!)

Reimplemented from assQuestion.

Definition at line 290 of file class.assFileUpload.php.

291 {
292 if( $returndetails )
293 {
294 throw new ilTestException('return details not implemented for '.__METHOD__);
295 }
296
297 global $ilDB;
298
299 if (is_null($pass))
300 {
301 $pass = $this->getSolutionMaxPass($active_id);
302 }
303 $points = 0;
304 return $points;
305 }
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
Base Exception for all Exceptions relating to Modules/Test.
global $ilDB

References $ilDB, $pass, assQuestion\$points, and assQuestion\getSolutionMaxPass().

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

assFileUpload::calculateReachedPointsForSolution (   $userSolution)
protected

Definition at line 307 of file class.assFileUpload.php.

308 {
309 $points = 0;
310 return $points;
311 }

References assQuestion\$points.

◆ checkUpload()

assFileUpload::checkUpload ( )

Check file upload.

Returns
boolean Input ok, true/false

Definition at line 318 of file class.assFileUpload.php.

319 {
320 $this->lng->loadLanguageModule("form");
321 // remove trailing '/'
322 while (substr($_FILES["upload"]["name"],-1) == '/')
323 {
324 $_FILES["upload"]["name"] = substr($_FILES["upload"]["name"],0,-1);
325 }
326
327 $filename = $_FILES["upload"]["name"];
328 $filename_arr = pathinfo($_FILES["upload"]["name"]);
329 $suffix = $filename_arr["extension"];
330 $mimetype = $_FILES["upload"]["type"];
331 $size_bytes = $_FILES["upload"]["size"];
332 $temp_name = $_FILES["upload"]["tmp_name"];
333 $error = $_FILES["upload"]["error"];
334
335 if ($size_bytes > $this->getMaxFilesizeInBytes())
336 {
337 ilUtil::sendFailure($this->lng->txt("form_msg_file_size_exceeds"), true);
338 return false;
339 }
340
341 // error handling
342 if ($error > 0)
343 {
344 switch ($error)
345 {
346 case UPLOAD_ERR_INI_SIZE:
347 ilUtil::sendFailure($this->lng->txt("form_msg_file_size_exceeds"), true);
348 return false;
349 break;
350
351 case UPLOAD_ERR_FORM_SIZE:
352 ilUtil::sendFailure($this->lng->txt("form_msg_file_size_exceeds"), true);
353 return false;
354 break;
355
356 case UPLOAD_ERR_PARTIAL:
357 ilUtil::sendFailure($this->lng->txt("form_msg_file_partially_uploaded"), true);
358 return false;
359 break;
360
361 case UPLOAD_ERR_NO_FILE:
362 ilUtil::sendFailure($this->lng->txt("form_msg_file_no_upload"), true);
363 return false;
364 break;
365
366 case UPLOAD_ERR_NO_TMP_DIR:
367 ilUtil::sendFailure($this->lng->txt("form_msg_file_missing_tmp_dir"), true);
368 return false;
369 break;
370
371 case UPLOAD_ERR_CANT_WRITE:
372 ilUtil::sendFailure($this->lng->txt("form_msg_file_cannot_write_to_disk"), true);
373 return false;
374 break;
375
376 case UPLOAD_ERR_EXTENSION:
377 ilUtil::sendFailure($this->lng->txt("form_msg_file_upload_stopped_ext"), true);
378 return false;
379 break;
380 }
381 }
382
383 // check suffixes
384 if (strlen($suffix) && count($this->getAllowedExtensionsArray()))
385 {
386 if (!in_array(strtolower($suffix), $this->getAllowedExtensionsArray()))
387 {
388 ilUtil::sendFailure($this->lng->txt("form_msg_file_wrong_file_type"), true);
389 return false;
390 }
391 }
392
393 // virus handling
394 if (strlen($temp_name))
395 {
396 $vir = ilUtil::virusHandling($temp_name, $filename);
397 if ($vir[0] == false)
398 {
399 ilUtil::sendFailure($this->lng->txt("form_msg_file_virus_found")."<br />".$vir[1], true);
400 return false;
401 }
402 }
403 return true;
404 }
$filename
Definition: buildRTE.php:89
getAllowedExtensionsArray()
Get allowed file extensions.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible

References $filename, getAllowedExtensionsArray(), getMaxFilesizeInBytes(), ilUtil\sendFailure(), and ilUtil\virusHandling().

Referenced by savePreviewData(), and saveWorkingData().

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

◆ copyObject()

assFileUpload::copyObject (   $target_questionpool_id,
  $title = "" 
)

Copies an assFileUpload object.

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

206 {
207 if ($this->id <= 0)
208 {
209 // The question has not been saved. It cannot be duplicated
210 return;
211 }
212 // duplicate the question in database
213 $clone = $this;
214 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
216 $clone->id = -1;
217 $source_questionpool_id = $this->getObjId();
218 $clone->setObjId($target_questionpool_id);
219 if ($title)
220 {
221 $clone->setTitle($title);
222 }
223 $clone->saveToDb();
224
225 // copy question page content
226 $clone->copyPageOfQuestion($original_id);
227 // copy XHTML media objects
228 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
229
230 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
231
232 return $clone->id;
233 }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.

References assQuestion\$original_id, assQuestion\$title, assQuestion\_getOriginalId(), and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

assFileUpload::createNewOriginalFromThisDuplicate (   $targetParentId,
  $targetQuestionTitle = "" 
)

Definition at line 235 of file class.assFileUpload.php.

236 {
237 if ($this->id <= 0)
238 {
239 // The question has not been saved. It cannot be duplicated
240 return;
241 }
242
243 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
244
245 $sourceQuestionId = $this->id;
246 $sourceParentId = $this->getObjId();
247
248 // duplicate the question in database
249 $clone = $this;
250 $clone->id = -1;
251
252 $clone->setObjId($targetParentId);
253
254 if ($targetQuestionTitle)
255 {
256 $clone->setTitle($targetQuestionTitle);
257 }
258
259 $clone->saveToDb();
260 // copy question page content
261 $clone->copyPageOfQuestion($sourceQuestionId);
262 // copy XHTML media objects
263 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
264
265 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
266
267 return $clone->id;
268 }

References assQuestion\$id, and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ deleteAnswers()

assFileUpload::deleteAnswers (   $question_id)

Deletes datasets from answers tables.

Parameters
integer$question_idThe question id which should be deleted in the answers table

Reimplemented from assQuestion.

Definition at line 851 of file class.assFileUpload.php.

852 {
853 }

◆ deletePreviewFileUploads()

assFileUpload::deletePreviewFileUploads (   $userId,
  $userSolution,
  $files 
)
protected

Definition at line 541 of file class.assFileUpload.php.

542 {
543 foreach($files as $name)
544 {
545 if( isset($userSolution[$name]) )
546 {
547 unset($userSolution[$name]);
548 @unlink($this->getPreviewFileUploadPath($userId) . $name);
549 }
550 }
551
552 return $userSolution;
553 }
getPreviewFileUploadPath($userId)
Returns the filesystem path for file uploads.

References getPreviewFileUploadPath().

Referenced by savePreviewData().

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

◆ deleteUploadedFiles()

assFileUpload::deleteUploadedFiles (   $files,
  $test_id,
  $active_id,
  $authorized 
)
protected
  Delete uploaded files
Parameters
arrayArray with ID's of the file datasets

Definition at line 512 of file class.assFileUpload.php.

513 {
514 global $ilDB;
515
516 $pass = null;
517 $active_id = null;
518 foreach ($files as $solution_id)
519 {
520 $result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE solution_id = %s AND authorized = %s",
521 array("integer", 'integer'),
522 array($solution_id, (int)$authorized)
523 );
524 if ($result->numRows() == 1)
525 {
526 $data = $ilDB->fetchAssoc($result);
527 $pass = $data['pass'];
528 $active_id = $data['active_fi'];
529 @unlink($this->getFileUploadPath($test_id, $active_id) . $data['value1']);
530 }
531 }
532 foreach ($files as $solution_id)
533 {
534 $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE solution_id = %s AND authorized = %s",
535 array("integer", 'integer'),
536 array($solution_id, $authorized)
537 );
538 }
539 }
$result
getFileUploadPath($test_id, $active_id, $question_id=null)
Returns the filesystem path for file uploads.
$data

References $data, $ilDB, $pass, $result, assQuestion\$test_id, and getFileUploadPath().

Referenced by saveWorkingData().

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

◆ deliverFileUploadZIPFile()

assFileUpload::deliverFileUploadZIPFile (   $test_id,
  $test_title 
)

Generates a ZIP file containing all file uploads for a given test and the original id of the question.

Parameters
int$test_id

Implements ilObjFileHandlingQuestionType.

Definition at line 1072 of file class.assFileUpload.php.

1073 {
1074 global $ilDB, $lng;
1075
1076 require_once 'Modules/TestQuestionPool/classes/class.ilAssFileUploadUploadsExporter.php';
1077 $exporter = new ilAssFileUploadUploadsExporter($ilDB, $lng);
1078
1079 $exporter->setTestId($test_id);
1080 $exporter->setTestTitle($test_title);
1081 $exporter->setQuestion($this);
1082
1083 $exporter->build();
1084
1086 $exporter->getFinalZipFilePath(), $exporter->getDispoZipFileName(),
1087 $exporter->getZipFileMimeType(), false, true
1088 );
1089 }
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References $ilDB, assQuestion\$lng, assQuestion\$test_id, and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ duplicate()

assFileUpload::duplicate (   $for_test = true,
  $title = "",
  $author = "",
  $owner = "",
  $testObjId = null 
)

Duplicates an assFileUpload.

Reimplemented from assQuestion.

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

149 {
150 if ($this->id <= 0)
151 {
152 // The question has not been saved. It cannot be duplicated
153 return;
154 }
155 // duplicate the question in database
156 $this_id = $this->getId();
157 $thisObjId = $this->getObjId();
158
159 $clone = $this;
160 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
162 $clone->id = -1;
163
164 if( (int)$testObjId > 0 )
165 {
166 $clone->setObjId($testObjId);
167 }
168
169 if ($title)
170 {
171 $clone->setTitle($title);
172 }
173
174 if ($author)
175 {
176 $clone->setAuthor($author);
177 }
178 if ($owner)
179 {
180 $clone->setOwner($owner);
181 }
182
183 if ($for_test)
184 {
185 $clone->saveToDb($original_id);
186 }
187 else
188 {
189 $clone->saveToDb();
190 }
191
192 // copy question page content
193 $clone->copyPageOfQuestion($this_id);
194 // copy XHTML media objects
195 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
196
197 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
198
199 return $clone->id;
200 }
getId()
Gets the id of the assQuestion object.

References assQuestion\$author, assQuestion\$original_id, assQuestion\$owner, assQuestion\$title, assQuestion\_getOriginalId(), assQuestion\getId(), and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ fromXML()

assFileUpload::fromXML ( $item,
$questionpool_id,
$tst_id,
$tst_object,
$question_counter,
$import_mapping 
)

Creates a question from a QTI file.

Receives parameters from a QTI parser and creates a valid ILIAS question object

Parameters
object$itemThe QTI item object
integer$questionpool_idThe id of the parent questionpool
integer$tst_idThe id of the parent test if the question is part of a test
object$tst_objectA reference to the parent test object
integer$question_counterA reference to a question counter to count the questions of an imported question pool
array$import_mappingAn array containing references to included ILIAS objects

Reimplemented from assQuestion.

Definition at line 908 of file class.assFileUpload.php.

909 {
910 include_once "./Modules/TestQuestionPool/classes/import/qti12/class.assFileUploadImport.php";
911 $import = new assFileUploadImport($this);
912 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
913 }
Class for file upload question imports.

◆ getAdditionalTableName()

assFileUpload::getAdditionalTableName ( )

Returns the name of the additional question data table in the database.

Returns
string The additional table name

Reimplemented from assQuestion.

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

832 {
833 return "qpl_qst_fileupload";
834 }

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAllowedExtensions()

assFileUpload::getAllowedExtensions ( )

Get allowed file extensions.

Returns
string Allowed file extensions

Definition at line 978 of file class.assFileUpload.php.

979 {
981 }

References $allowedextensions.

Referenced by __get(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAllowedExtensionsArray()

assFileUpload::getAllowedExtensionsArray ( )

Get allowed file extensions.

Returns
array Allowed file extensions

Definition at line 964 of file class.assFileUpload.php.

965 {
966 if (strlen($this->allowedextensions))
967 {
968 return array_filter(array_map('trim', explode(",", $this->allowedextensions)));
969 }
970 return array();
971 }

Referenced by checkUpload().

+ Here is the caller graph for this function:

◆ getAnswerTableName()

assFileUpload::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name

Reimplemented from assQuestion.

Definition at line 841 of file class.assFileUpload.php.

842 {
843 return "";
844 }

◆ getBestSolution()

assFileUpload::getBestSolution (   $active_id,
  $pass 
)

Returns the best solution for a given pass of a participant.

Returns
array An associated array containing the best solution

Definition at line 933 of file class.assFileUpload.php.

934 {
935 $user_solution = array();
936 return $user_solution;
937 }

◆ getFileUploadPath()

assFileUpload::getFileUploadPath (   $test_id,
  $active_id,
  $question_id = null 
)

Returns the filesystem path for file uploads.

Implements ilObjFileHandlingQuestionType.

Definition at line 409 of file class.assFileUpload.php.

410 {
411 if (is_null($question_id)) $question_id = $this->getId();
412 return CLIENT_WEB_DIR . "/assessment/tst_$test_id/$active_id/$question_id/files/";
413 }

References assQuestion\getId().

Referenced by deleteUploadedFiles(), and saveWorkingData().

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

◆ getFileUploadPathWeb()

assFileUpload::getFileUploadPathWeb (   $test_id,
  $active_id,
  $question_id = null 
)

Returns the file upload path for web accessible files of a question.

@access public

Definition at line 428 of file class.assFileUpload.php.

429 {
430 if (is_null($question_id)) $question_id = $this->getId();
431 include_once "./Services/Utilities/classes/class.ilUtil.php";
432 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/tst_$test_id/$active_id/$question_id/files/";
434 }
static removeTrailingPathSeparators($path)
const ILIAS_ABSOLUTE_PATH

References assQuestion\getId(), ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by getUploadedFilesForWeb().

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

◆ getMaxFilesizeAsString()

assFileUpload::getMaxFilesizeAsString ( )
  Return the maximum allowed file size as string
Returns
string The number of bytes of the maximum allowed file size

Definition at line 560 of file class.assFileUpload.php.

561 {
562 $size = $this->getMaxFilesizeInBytes();
563 if ($size < 1024)
564 {
565 $max_filesize = sprintf("%d Bytes",$size);
566 }
567 else if ($size < 1024*1024)
568 {
569 $max_filesize = sprintf("%.1f KB",$size/1024);
570 }
571 else
572 {
573 $max_filesize = sprintf("%.1f MB",$size/1024/1024);
574 }
575
576 return $max_filesize;
577 }
$size
Definition: RandomTest.php:79

References $size, and getMaxFilesizeInBytes().

+ Here is the call graph for this function:

◆ getMaxFilesizeInBytes()

assFileUpload::getMaxFilesizeInBytes ( )
  Return the maximum allowed file size in bytes
Returns
integer The number of bytes of the maximum allowed file size

Definition at line 584 of file class.assFileUpload.php.

585 {
586 if (strlen($this->getMaxSize()))
587 {
588 return $this->getMaxSize();
589 }
590 else
591 {
592 // get the value for the maximal uploadable filesize from the php.ini (if available)
593 $umf = get_cfg_var("upload_max_filesize");
594 // get the value for the maximal post data from the php.ini (if available)
595 $pms = get_cfg_var("post_max_size");
596
597 //convert from short-string representation to "real" bytes
598 $multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
599
600 $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
601 $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
602
603 if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
604 if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
605
606 // use the smaller one as limit
607 $max_filesize = min($umf, $pms);
608
609 if (!$max_filesize) $max_filesize=max($umf, $pms);
610 return $max_filesize;
611 }
612 }
echo;exit;}function LogoutNotification($SessionID) { global $ilDB; $q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE

References getMaxSize(), and PREG_SPLIT_DELIM_CAPTURE.

Referenced by checkUpload(), and getMaxFilesizeAsString().

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

◆ getMaximumPoints()

assFileUpload::getMaximumPoints ( )

Returns the maximum points, a learner can reach answering the question.

See also
$points

Reimplemented from assQuestion.

Definition at line 275 of file class.assFileUpload.php.

276 {
277 return $this->getPoints();
278 }
getPoints()
Returns the maximum available points for the question.

References assQuestion\getPoints().

Referenced by isComplete().

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

◆ getMaxSize()

assFileUpload::getMaxSize ( )

Get max file size.

Returns
double Max file size

Definition at line 944 of file class.assFileUpload.php.

945 {
946 return $this->maxsize;
947 }

References $maxsize.

Referenced by __get(), getMaxFilesizeInBytes(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getPreviewFileUploadPath()

assFileUpload::getPreviewFileUploadPath (   $userId)
protected

Returns the filesystem path for file uploads.

Definition at line 418 of file class.assFileUpload.php.

419 {
420 return CLIENT_WEB_DIR . "/assessment/qst_preview/$userId/{$this->getId()}/fileuploads/";
421 }

Referenced by deletePreviewFileUploads(), and savePreviewData().

+ Here is the caller graph for this function:

◆ getPreviewFileUploadPathWeb()

assFileUpload::getPreviewFileUploadPathWeb (   $userId)
protected

Returns the filesystem path for file uploads.

Definition at line 439 of file class.assFileUpload.php.

440 {
441 include_once "./Services/Utilities/classes/class.ilUtil.php";
442 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/qst_preview/$userId/{$this->getId()}/fileuploads/";
444 }

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by savePreviewData().

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

◆ getPreviewFileUploads()

assFileUpload::getPreviewFileUploads ( ilAssQuestionPreviewSession  $previewSession)

Definition at line 475 of file class.assFileUpload.php.

476 {
477 return (array)$previewSession->getParticipantsSolution();
478 }

References ilAssQuestionPreviewSession\getParticipantsSolution().

+ Here is the call graph for this function:

◆ getQuestionType()

assFileUpload::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

Reimplemented from assQuestion.

Definition at line 821 of file class.assFileUpload.php.

822 {
823 return "assFileUpload";
824 }

◆ getRTETextWithMediaObjects()

assFileUpload::getRTETextWithMediaObjects ( )

Collects all text in the question which could contain media objects which were created with the Rich Text Editor.

Reimplemented from assQuestion.

Definition at line 859 of file class.assFileUpload.php.

860 {
861 $text = parent::getRTETextWithMediaObjects();
862 return $text;
863 }
$text

References $text.

◆ getUploadedFiles()

assFileUpload::getUploadedFiles (   $active_id,
  $pass = null,
  $authorized = true 
)

Returns the uploaded files for an active user in a given pass.

Returns
array Results

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

452 {
453 global $ilDB;
454
455 if (is_null($pass))
456 {
457 $pass = $this->getSolutionMaxPass($active_id);
458 }
459
460 $result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND authorized = %s ORDER BY tstamp",
461 array("integer", "integer", "integer", 'integer'),
462 array($active_id, $this->getId(), $pass, (int)$authorized)
463 );
464
465 $found = array();
466
467 while ($data = $ilDB->fetchAssoc($result))
468 {
469 array_push($found, $data);
470 }
471
472 return $found;
473 }

References $data, $ilDB, $pass, $result, assQuestion\getId(), and assQuestion\getSolutionMaxPass().

Referenced by getUploadedFilesForWeb(), and handleSubmission().

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

◆ getUploadedFilesForWeb()

assFileUpload::getUploadedFilesForWeb (   $active_id,
  $pass 
)

Returns the web accessible uploaded files for an active user in a given pass.

Returns
array Results

Definition at line 485 of file class.assFileUpload.php.

486 {
487 global $ilDB;
488
489 $found = $this->getUploadedFiles($active_id, $pass);
490 $result = $ilDB->queryF("SELECT test_fi FROM tst_active WHERE active_id = %s",
491 array('integer'),
492 array($active_id)
493 );
494 if ($result->numRows() == 1)
495 {
496 $row = $ilDB->fetchAssoc($result);
497 $test_id = $row["test_fi"];
498 $path = $this->getFileUploadPathWeb($test_id, $active_id);
499 foreach ($found as $idx => $data)
500 {
501 $found[$idx]['webpath'] = $path;
502 }
503 }
504 return $found;
505 }
getFileUploadPathWeb($test_id, $active_id, $question_id=null)
Returns the file upload path for web accessible files of a question.
getUploadedFiles($active_id, $pass=null, $authorized=true)
Returns the uploaded files for an active user in a given pass.
$path
Definition: index.php:22

References $data, $ilDB, $pass, $path, $result, $row, assQuestion\$test_id, getFileUploadPathWeb(), and getUploadedFiles().

+ Here is the call graph for this function:

◆ handleSubmission()

assFileUpload::handleSubmission (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
protected

This method is called after an user submitted one or more files.

It should handle the setting "Completion by Submission" and, if enabled, set the status of the current user.

Parameters
integer
integer@access protected

Definition at line 784 of file class.assFileUpload.php.

785 {
786 if(!$authorized)
787 {
788 return;
789 }
790
792 {
793 $maxpoints = assQuestion::_getMaximumPoints($this->getId());
794
795 if($this->getUploadedFiles($active_id, $pass, $authorized))
796 {
797 $points = $maxpoints;
798 }
799 else
800 {
801 $points = 0;
802 }
803
804 assQuestion::_setReachedPoints($active_id, $this->getId(), $points, $maxpoints, $pass, 1, $obligationsAnswered);
805
806 // update learning progress
807 include_once 'Modules/Test/classes/class.ilObjTestAccess.php';
808 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
811 ilObjTestAccess::_getParticipantId((int) $active_id)
812 );
813 }
814 }
_getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
_setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
Sets the points, a learner has reached answering the question Additionally objective results are upda...
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
_getParticipantId($active_id)
Get user id for active id.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.

References $pass, assQuestion\$points, assQuestion\_getMaximumPoints(), ilObjTest\_getObjectIDFromActiveID(), ilObjTestAccess\_getParticipantId(), assQuestion\_setReachedPoints(), ilLPStatusWrapper\_updateStatus(), assQuestion\getId(), getUploadedFiles(), and isCompletionBySubmissionEnabled().

Referenced by reworkWorkingData().

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

◆ hasFileUploads()

assFileUpload::hasFileUploads (   $test_id)

Checks if file uploads exist for a given test and the original id of the question.

Parameters
int$test_id
Returns
boolean TRUE if file uploads exist, FALSE otherwise

Implements ilObjFileHandlingQuestionType.

Definition at line 1044 of file class.assFileUpload.php.

1045 {
1046 global $ilDB;
1047 $query = "
1048 SELECT tst_solutions.solution_id
1049 FROM tst_solutions, tst_active, qpl_questions
1050 WHERE tst_solutions.active_fi = tst_active.active_id
1051 AND tst_solutions.question_fi = qpl_questions.question_id
1052 AND tst_solutions.question_fi = %s AND tst_active.test_fi = %s";
1053 $result = $ilDB->queryF( $query,
1054 array("integer", "integer"),
1055 array($this->getId(), $test_id)
1056 );
1057 if ($result->numRows() > 0)
1058 {
1059 return true;
1060 }
1061 else
1062 {
1063 return false;
1064 }
1065 }

References $ilDB, $query, $result, assQuestion\$test_id, and assQuestion\getId().

+ Here is the call graph for this function:

◆ isAnswered()

assFileUpload::isAnswered (   $active_id,
  $pass = null 
)

returns boolean wether the question is answered during test pass or not

(overwrites method in class assQuestion)

@global ilDB $ilDB

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

Reimplemented from assQuestion.

Definition at line 1130 of file class.assFileUpload.php.

1131 {
1132 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1133
1134 return $numExistingSolutionRecords > 0;
1135 }
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...

References $pass, assQuestion\getId(), and assQuestion\getNumExistingSolutionRecords().

+ Here is the call graph for this function:

◆ isAutosaveable()

assFileUpload::isAutosaveable ( )

Reimplemented from assQuestion.

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

1153 {
1154 return FALSE;
1155 }

◆ isComplete()

assFileUpload::isComplete ( )

Returns true, if the question is complete for use.

Returns
boolean True, if the question is complete for use, otherwise false

Reimplemented from assQuestion.

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

59 {
60 if (
61 strlen($this->title)
62 && ($this->author)
63 && ($this->question)
64 && ($this->getMaximumPoints() >= 0)
65 && is_numeric($this->getMaximumPoints()))
66 {
67 return true;
68 }
69 return false;
70 }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.

References getMaximumPoints().

+ Here is the call graph for this function:

◆ isCompletionBySubmissionEnabled()

assFileUpload::isCompletionBySubmissionEnabled ( )

Checks whether completion by submission is enabled or not.

Returns
boolean @access public

Definition at line 1099 of file class.assFileUpload.php.

1100 {
1102 }

References $completion_by_submission.

Referenced by __get(), handleSubmission(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ isObligationPossible()

static assFileUpload::isObligationPossible (   $questionId)
static

returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration

(overwrites method in class assQuestion)

Parameters
integer$questionId
Returns
boolean $obligationPossible

Reimplemented from assQuestion.

Definition at line 1147 of file class.assFileUpload.php.

1148 {
1149 return true;
1150 }

◆ loadFromDb()

assFileUpload::loadFromDb (   $question_id)

Loads a assFileUpload object from a database.

Parameters
integer$question_idA unique key which defines the question in the database

Reimplemented from assQuestion.

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

107 {
108 global $ilDB;
109 $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s",
110 array("integer"),
111 array($question_id)
112 );
113 if ($result->numRows() == 1)
114 {
115 $data = $ilDB->fetchAssoc($result);
116 $this->setId($question_id);
117 $this->setTitle($data["title"]);
118 $this->setComment($data["description"]);
119 $this->setNrOfTries($data['nr_of_tries']);
120 $this->setSuggestedSolution($data["solution_hint"]);
121 $this->setOriginalId($data["original_id"]);
122 $this->setObjId($data["obj_fi"]);
123 $this->setAuthor($data["author"]);
124 $this->setOwner($data["owner"]);
125 $this->setPoints($data["points"]);
126
127 include_once("./Services/RTE/classes/class.ilRTE.php");
128 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
129 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
130 $this->setMaxSize($data["maxsize"]);
131 $this->setAllowedExtensions($data["allowedextensions"]);
132 $this->setCompletionBySubmission($data['compl_by_submission'] == 1 ? true : false);
133
134 try
135 {
136 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
137 }
139 {
140 }
141 }
142 parent::loadFromDb($question_id);
143 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setSuggestedSolution($solution_id="", $subquestion_index=0, $is_import=false)
Sets a suggested solution for the question.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References $data, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), assQuestion\setAdditionalContentEditingMode(), setAllowedExtensions(), assQuestion\setAuthor(), assQuestion\setComment(), setCompletionBySubmission(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), setMaxSize(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), assQuestion\setSuggestedSolution(), and assQuestion\setTitle().

+ Here is the call graph for this function:

◆ reworkWorkingData()

assFileUpload::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
protected

Reworks the allready saved working data if neccessary.

@access protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

Definition at line 770 of file class.assFileUpload.php.

771 {
772 $this->handleSubmission($active_id, $pass, $obligationsAnswered, $authorized);
773 }
handleSubmission($active_id, $pass, $obligationsAnswered, $authorized)
This method is called after an user submitted one or more files.

References $pass, and handleSubmission().

+ Here is the call graph for this function:

◆ saveAdditionalQuestionDataToDb()

assFileUpload::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

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

83 {
84 global $ilDB;
85 $ilDB->manipulateF( "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
86 array( "integer" ),
87 array( $this->getId() )
88 );
89 $ilDB->manipulateF( "INSERT INTO " . $this->getAdditionalTableName(
90 ) . " (question_fi, maxsize, allowedextensions, compl_by_submission) VALUES (%s, %s, %s, %s)",
91 array( "integer", "float", "text", "integer" ),
92 array(
93 $this->getId(),
94 (strlen( $this->getMaxSize() )) ? $this->getMaxSize() : NULL,
95 (strlen( $this->getAllowedExtensions() )) ? $this->getAllowedExtensions() : NULL,
97 )
98 );
99 }

References $ilDB, getAdditionalTableName(), getAllowedExtensions(), assQuestion\getId(), getMaxSize(), and isCompletionBySubmissionEnabled().

Referenced by saveToDb().

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

◆ savePreviewData()

assFileUpload::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Reworks the allready saved working data if neccessary.

@abstract @access protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

Reimplemented from assQuestion.

Definition at line 711 of file class.assFileUpload.php.

712 {
713 $userSolution = $previewSession->getParticipantsSolution();
714
715 if( !is_array($userSolution) )
716 {
717 $userSolution = array();
718 }
719
720 if (strcmp($_POST['cmd'][$this->questionActionCmd], $this->lng->txt('delete')) == 0)
721 {
722 if (is_array($_POST['deletefiles']) && count($_POST['deletefiles']) > 0)
723 {
724 $userSolution = $this->deletePreviewFileUploads($previewSession->getUserId(), $userSolution, $_POST['deletefiles']);
725 }
726 else
727 {
728 ilUtil::sendInfo($this->lng->txt('no_checkbox'), true);
729 }
730 }
731 else
732 {
733 if (strlen($_FILES["upload"]["tmp_name"]))
734 {
735 if ($this->checkUpload())
736 {
737 if( !@file_exists($this->getPreviewFileUploadPath($previewSession->getUserId())) )
738 {
740 }
741
742 $version = time();
743 $filename_arr = pathinfo($_FILES["upload"]["name"]);
744 $extension = $filename_arr["extension"];
745 $newfile = "file_".md5($_FILES["upload"]["name"])."_" . $version . "." . $extension;
746 ilUtil::moveUploadedFile($_FILES["upload"]["tmp_name"], $_FILES["upload"]["name"], $this->getPreviewFileUploadPath($previewSession->getUserId()) . $newfile);
747
748 $userSolution[$newfile] = array(
749 'solution_id' => $newfile,
750 'value1' => $newfile,
751 'value2' => $_FILES['upload']['name'],
752 'tstamp' => $version,
753 'webpath' => $this->getPreviewFileUploadPathWeb($previewSession->getUserId())
754 );
755 }
756 }
757 }
758
759 $previewSession->setParticipantsSolution($userSolution);
760 }
getPreviewFileUploadPathWeb($userId)
Returns the filesystem path for file uploads.
deletePreviewFileUploads($userId, $userSolution, $files)
checkUpload()
Check file upload.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, checkUpload(), deletePreviewFileUploads(), ilAssQuestionPreviewSession\getParticipantsSolution(), getPreviewFileUploadPath(), getPreviewFileUploadPathWeb(), ilAssQuestionPreviewSession\getUserId(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), ilUtil\sendInfo(), and ilAssQuestionPreviewSession\setParticipantsSolution().

+ Here is the call graph for this function:

◆ saveToDb()

assFileUpload::saveToDb (   $original_id = "")

Saves a assFileUpload object to a database.

Reimplemented from assQuestion.

Definition at line 75 of file class.assFileUpload.php.

76 {
79 parent::saveToDb();
80 }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveQuestionDataToDb($original_id="")

References assQuestion\$original_id, saveAdditionalQuestionDataToDb(), and assQuestion\saveQuestionDataToDb().

+ Here is the call graph for this function:

◆ saveWorkingData()

assFileUpload::saveWorkingData (   $active_id,
  $pass = NULL,
  $authorized = true 
)

Saves the learners input of the question to the database.

@access public

Parameters
integer$active_idActive id of the user
integer$passTest pass
Returns
boolean $status

Reimplemented from assQuestion.

Definition at line 622 of file class.assFileUpload.php.

623 {
624 global $ilDB;
625 global $ilUser;
626
627 if (is_null($pass))
628 {
629 include_once "./Modules/Test/classes/class.ilObjTest.php";
630 $pass = ilObjTest::_getPass($active_id);
631 }
632
633 if( $_POST['cmd'][$this->questionActionCmd] != $this->lng->txt('delete')
634 && strlen($_FILES["upload"]["tmp_name"]) )
635 {
636 $checkUploadResult = $this->checkUpload();
637 }
638 else
639 {
640 $checkUploadResult = false;
641 }
642
643 $result = $ilDB->queryF("SELECT test_fi FROM tst_active WHERE active_id = %s",
644 array('integer'),
645 array($active_id)
646 );
647 $test_id = 0;
648 if ($result->numRows() == 1)
649 {
650 $row = $ilDB->fetchAssoc($result);
651 $test_id = $row["test_fi"];
652 }
653
654 $this->getProcessLocker()->requestUserSolutionUpdateLock();
655
656 $this->updateCurrentSolutionsAuthorization($active_id, $pass, $authorized);
657
658 $entered_values = false;
659 if( $_POST['cmd'][$this->questionActionCmd] == $this->lng->txt('delete') )
660 {
661 if (is_array($_POST['deletefiles']) && count($_POST['deletefiles']) > 0)
662 {
663 $this->deleteUploadedFiles($_POST['deletefiles'], $test_id, $active_id, $authorized);
664 }
665 else
666 {
667 ilUtil::sendInfo($this->lng->txt('no_checkbox'), true);
668 }
669 }
670 elseif( $checkUploadResult )
671 {
672 if(!@file_exists($this->getFileUploadPath($test_id, $active_id)))
673 {
675 }
676
677 $version = time();
678 $filename_arr = pathinfo($_FILES["upload"]["name"]);
679 $extension = $filename_arr["extension"];
680 $newfile = "file_" . $active_id . "_" . $pass . "_" . $version . "." . $extension;
681
682 ilUtil::moveUploadedFile($_FILES["upload"]["tmp_name"], $_FILES["upload"]["name"], $this->getFileUploadPath($test_id, $active_id) . $newfile);
683
684 $this->saveCurrentSolution($active_id, $pass, $newfile, $_FILES['upload']['name'], $authorized);
685
686 $entered_values = true;
687 }
688
689 $this->getProcessLocker()->releaseUserSolutionUpdateLock();
690
691 if ($entered_values)
692 {
693 include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
695 {
696 $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
697 }
698 }
699 else
700 {
701 include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
703 {
704 $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
705 }
706 }
707
708 return true;
709 }
deleteUploadedFiles($files, $test_id, $active_id, $authorized)
updateCurrentSolutionsAuthorization($activeId, $pass, $authorized)
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
global $ilUser
Definition: imgupload.php:15

References $_POST, $ilDB, $ilUser, $pass, $result, $row, assQuestion\$test_id, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), checkUpload(), deleteUploadedFiles(), getFileUploadPath(), assQuestion\getProcessLocker(), assQuestion\logAction(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), assQuestion\saveCurrentSolution(), ilUtil\sendInfo(), and assQuestion\updateCurrentSolutionsAuthorization().

+ Here is the call graph for this function:

◆ setAllowedExtensions()

assFileUpload::setAllowedExtensions (   $a_value)

Set allowed file extensions.

Parameters
string$a_valueAllowed file extensions

Definition at line 988 of file class.assFileUpload.php.

989 {
990 $this->allowedextensions = strtolower(trim($a_value));
991 }

Referenced by __set(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setCompletionBySubmission()

assFileUpload::setCompletionBySubmission (   $bool)

Enabled/Disable completion by submission.

Parameters
boolean
Returns
assFileUpload @access public

Definition at line 1113 of file class.assFileUpload.php.

1114 {
1115 $this->completion_by_submission = (bool)$bool;
1116 return $this;
1117 }

Referenced by __set(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

assFileUpload::setExportDetailsXLS ( $worksheet,
  $startrow,
  $active_id,
  $pass,
$format_title,
$format_bold 
)

Creates an Excel worksheet for the detailed cumulated results of this question.

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data

Reimplemented from assQuestion.

Definition at line 876 of file class.assFileUpload.php.

877 {
878 include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
879 $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
880 $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
881 $i = 1;
882 $solutions = $this->getSolutionValues($active_id, $pass);
883 foreach ($solutions as $solution)
884 {
885 $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($this->lng->txt("result")), $format_bold);
886 if (strlen($solution["value1"]))
887 {
888 $worksheet->write($startrow + $i, 1, ilExcelUtils::_convert_text($solution["value1"]));
889 $worksheet->write($startrow + $i, 2, ilExcelUtils::_convert_text($solution["value2"]));
890 }
891 $i++;
892 }
893 return $startrow + $i + 1;
894 }
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
getTitle()
Gets the title string of the assQuestion object.
_convert_text($a_text, $a_target="has been removed")

References $pass, ilExcelUtils\_convert_text(), assQuestion\getSolutionValues(), and assQuestion\getTitle().

+ Here is the call graph for this function:

◆ setMaxSize()

assFileUpload::setMaxSize (   $a_value)

Set max file size.

Parameters
double$a_valueMax file size

Definition at line 954 of file class.assFileUpload.php.

955 {
956 $this->maxsize = $a_value;
957 }

Referenced by __set(), and loadFromDb().

+ Here is the caller graph for this function:

◆ toXML()

assFileUpload::toXML (   $a_include_header = true,
  $a_include_binary = true,
  $a_shuffle = false,
  $test_output = false,
  $force_image_references = false 
)

Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation.

Returns
string The QTI xml representation of the question

Reimplemented from assQuestion.

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

922 {
923 include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assFileUploadExport.php";
924 $export = new assFileUploadExport($this);
925 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
926 }
Class for file upload question exports.

Field Documentation

◆ $allowedextensions

assFileUpload::$allowedextensions
protected

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

Referenced by getAllowedExtensions().

◆ $completion_by_submission

assFileUpload::$completion_by_submission = false
protected

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

Referenced by isCompletionBySubmissionEnabled().

◆ $maxsize

assFileUpload::$maxsize
protected

Definition at line 22 of file class.assFileUpload.php.

Referenced by getMaxSize().


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