ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 checkUpload ()
 Check file upload. 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)
 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 ()
 Return the maximum allowed file size as string. More...
 
 getMaxFilesizeInBytes ()
 Return the maximum allowed file size in bytes. More...
 
 saveWorkingData ($active_id, $pass=NULL)
 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...
 
 isCompletionBySubmissionEnabled ()
 Checks whether completion by submission is enabled or not. More...
 
 setCompletionBySubmission ($bool)
 Enabled/Disable completion by submission. More...
 
 isAnswered ($active_id, $pass)
 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...
 
 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)
 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)
 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)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 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...
 
getSolutionValues ($active_id, $pass=NULL)
 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, $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)
 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...
 
 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...
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 setObligationsToBeConsidered ($obligationsToBeConsidered=true)
 sets the flag wether obligations are to be considered or not More...
 
 areObligationsToBeConsidered ()
 gets the flag wether obligations are to be considered 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 ()
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
- Public Member Functions inherited from ilObjFileHandlingQuestionType
 getFileUploadZIPFile ($test_id)
 Generates a ZIP file containing all file uploads for a given test and the original id of the 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 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)
 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)
 

Protected Member Functions

 calculateReachedPointsForSolution ($userSolution)
 
 getFileUploadPath ($test_id, $active_id, $question_id=null)
 Returns the filesystem path for file uploads. More...
 
 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)
 Delete uploaded files. More...
 
 deletePreviewFileUploads ($userId, $userSolution, $files)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 handleSubmission ($active_id, $pass, $obligationsAnswered)
 This method is called after an user submitted one or more files. More...
 
- Protected Member Functions inherited from assQuestion
 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 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...
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 buildQuestionDataQuery ()
 
 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
 

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 $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()

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.

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

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

989  {
990  switch ($value)
991  {
992  case "maxsize":
993  return $this->getMaxSize();
994  break;
995  case "allowedextensions":
996  return $this->getAllowedExtensions();
997  break;
998  case 'completion_by_submission':
999  return $this->isCompletionBySubmissionEnabled();
1000  break;
1001  default:
1002  return parent::__get($value);
1003  break;
1004  }
1005  }
getAllowedExtensions()
Get allowed file extensions.
getMaxSize()
Get max file size.
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
+ Here is the call graph for this function:

◆ __set()

assFileUpload::__set (   $key,
  $value 
)

Object setter.

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

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

1011  {
1012  switch ($key)
1013  {
1014  case "maxsize":
1015  $this->setMaxSize($value);
1016  break;
1017  case "allowedextensions":
1018  $this->setAllowedExtensions($value);
1019  break;
1020  case 'completion_by_submission':
1021  $this->setCompletionBySubmission($value);
1022  break;
1023  default:
1024  parent::__set($key, $value);
1025  break;
1026  }
1027  }
setAllowedExtensions($a_value)
Set allowed file extensions.
setMaxSize($a_value)
Set max file size.
setCompletionBySubmission($bool)
Enabled/Disable completion by submission.
+ Here is the call graph for this function:

◆ calculateReachedPoints()

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

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

The points are calculated from the given answers.

public

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

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

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

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
+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

assFileUpload::calculateReachedPointsForSolution (   $userSolution)
protected

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

References assQuestion\$points.

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

◆ checkUpload()

assFileUpload::checkUpload ( )

Check file upload.

Returns
boolean Input ok, true/false

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

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

Referenced by savePreviewData(), and saveWorkingData().

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  }
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
getAllowedExtensionsArray()
Get allowed file extensions.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$filename
Definition: buildRTE.php:89
getMaxFilesizeInBytes()
Return the maximum allowed file size in bytes.
+ 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.

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

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.
+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

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  }
getObjId()
Get the object id of the container object.
+ 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

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

844  {
845  }

◆ deletePreviewFileUploads()

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

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

References getPreviewFileUploadPath().

Referenced by savePreviewData().

537  {
538  foreach($files as $name)
539  {
540  if( isset($userSolution[$name]) )
541  {
542  unset($userSolution[$name]);
543  @unlink($this->getPreviewFileUploadPath($userId) . $name);
544  }
545  }
546 
547  return $userSolution;
548  }
getPreviewFileUploadPath($userId)
Returns the filesystem path for file uploads.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteUploadedFiles()

assFileUpload::deleteUploadedFiles (   $files,
  $test_id,
  $active_id 
)
protected

Delete uploaded files.

Parameters
arrayArray with ID's of the file datasets

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

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

Referenced by saveWorkingData().

508  {
509  global $ilDB;
510 
511  $pass = null;
512  $active_id = null;
513  foreach ($files as $solution_id)
514  {
515  $result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE solution_id = %s",
516  array("integer"),
517  array($solution_id)
518  );
519  if ($result->numRows() == 1)
520  {
521  $data = $ilDB->fetchAssoc($result);
522  $pass = $data['pass'];
523  $active_id = $data['active_fi'];
524  @unlink($this->getFileUploadPath($test_id, $active_id) . $data['value1']);
525  }
526  }
527  foreach ($files as $solution_id)
528  {
529  $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE solution_id = %s",
530  array("integer"),
531  array($solution_id)
532  );
533  }
534  }
$result
getFileUploadPath($test_id, $active_id, $question_id=null)
Returns the filesystem path for file uploads.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

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

Duplicates an assFileUpload.

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

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

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.
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ 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

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

901  {
902  include_once "./Modules/TestQuestionPool/classes/import/qti12/class.assFileUploadImport.php";
903  $import = new assFileUploadImport($this);
904  $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
905  }
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

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

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

824  {
825  return "qpl_qst_fileupload";
826  }
+ Here is the caller graph for this function:

◆ getAllowedExtensions()

assFileUpload::getAllowedExtensions ( )

Get allowed file extensions.

Returns
string Allowed file extensions

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

References $allowedextensions.

Referenced by __get(), and saveAdditionalQuestionDataToDb().

971  {
973  }
+ Here is the caller graph for this function:

◆ getAllowedExtensionsArray()

assFileUpload::getAllowedExtensionsArray ( )

Get allowed file extensions.

Returns
array Allowed file extensions

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

Referenced by checkUpload().

957  {
958  if (strlen($this->allowedextensions))
959  {
960  return array_filter(array_map('trim', explode(",", $this->allowedextensions)));
961  }
962  return array();
963  }
+ 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

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

834  {
835  return "";
836  }

◆ 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 925 of file class.assFileUpload.php.

926  {
927  $user_solution = array();
928  return $user_solution;
929  }

◆ getFileUploadPath()

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

Returns the filesystem path for file uploads.

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

References assQuestion\getId().

Referenced by deleteUploadedFiles(), hasFileUploads(), and saveWorkingData().

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  }
getId()
Gets the id of the assQuestion object.
+ 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.

public

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

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

Referenced by getUploadedFilesForWeb().

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  }
getId()
Gets the id of the assQuestion object.
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ 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 555 of file class.assFileUpload.php.

References $size, and getMaxFilesizeInBytes().

556  {
557  $size = $this->getMaxFilesizeInBytes();
558  if ($size < 1024)
559  {
560  $max_filesize = sprintf("%d Bytes",$size);
561  }
562  else if ($size < 1024*1024)
563  {
564  $max_filesize = sprintf("%.1f KB",$size/1024);
565  }
566  else
567  {
568  $max_filesize = sprintf("%.1f MB",$size/1024/1024);
569  }
570 
571  return $max_filesize;
572  }
$size
Definition: RandomTest.php:79
getMaxFilesizeInBytes()
Return the maximum allowed file size in bytes.
+ 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 579 of file class.assFileUpload.php.

References getMaxSize().

Referenced by checkUpload(), and getMaxFilesizeAsString().

580  {
581  if (strlen($this->getMaxSize()))
582  {
583  return $this->getMaxSize();
584  }
585  else
586  {
587  // get the value for the maximal uploadable filesize from the php.ini (if available)
588  $umf = get_cfg_var("upload_max_filesize");
589  // get the value for the maximal post data from the php.ini (if available)
590  $pms = get_cfg_var("post_max_size");
591 
592  //convert from short-string representation to "real" bytes
593  $multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
594 
595  $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
596  $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
597 
598  if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
599  if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
600 
601  // use the smaller one as limit
602  $max_filesize = min($umf, $pms);
603 
604  if (!$max_filesize) $max_filesize=max($umf, $pms);
605  return $max_filesize;
606  }
607  }
getMaxSize()
Get max file size.
+ 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

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

References assQuestion\getPoints().

Referenced by isComplete().

276  {
277  return $this->getPoints();
278  }
getPoints()
Returns the maximum available points for the question.
+ 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 936 of file class.assFileUpload.php.

References $maxsize.

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

937  {
938  return $this->maxsize;
939  }
+ 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.

Referenced by deletePreviewFileUploads(), and savePreviewData().

419  {
420  return CLIENT_WEB_DIR . "/assessment/qst_preview/$userId/{$this->getId()}/fileuploads/";
421  }
+ 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.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by savePreviewData().

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  }
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPreviewFileUploads()

assFileUpload::getPreviewFileUploads ( ilAssQuestionPreviewSession  $previewSession)

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

References ilAssQuestionPreviewSession\getParticipantsSolution().

471  {
472  return (array)$previewSession->getParticipantsSolution();
473  }
+ 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

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

814  {
815  return "assFileUpload";
816  }

◆ getRTETextWithMediaObjects()

assFileUpload::getRTETextWithMediaObjects ( )

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

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

852  {
853  $text = parent::getRTETextWithMediaObjects();
854  return $text;
855  }

◆ getUploadedFiles()

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

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

Returns
array Results

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

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

Referenced by getUploadedFilesForWeb(), and handleSubmission().

452  {
453  global $ilDB;
454  if (is_null($pass))
455  {
456  $pass = $this->getSolutionMaxPass($active_id);
457  }
458  $result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s ORDER BY tstamp",
459  array("integer", "integer", "integer"),
460  array($active_id, $this->getId(), $pass)
461  );
462  $found = array();
463  while ($data = $ilDB->fetchAssoc($result))
464  {
465  array_push($found, $data);
466  }
467  return $found;
468  }
getId()
Gets the id of the assQuestion object.
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
global $ilDB
+ 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 480 of file class.assFileUpload.php.

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

481  {
482  global $ilDB;
483 
484  $found = $this->getUploadedFiles($active_id, $pass);
485  $result = $ilDB->queryF("SELECT test_fi FROM tst_active WHERE active_id = %s",
486  array('integer'),
487  array($active_id)
488  );
489  if ($result->numRows() == 1)
490  {
491  $row = $ilDB->fetchAssoc($result);
492  $test_id = $row["test_fi"];
493  $path = $this->getFileUploadPathWeb($test_id, $active_id);
494  foreach ($found as $idx => $data)
495  {
496  $found[$idx]['webpath'] = $path;
497  }
498  }
499  return $found;
500  }
$result
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)
Returns the uploaded files for an active user in a given pass.
$path
Definition: index.php:22
global $ilDB
+ Here is the call graph for this function:

◆ handleSubmission()

assFileUpload::handleSubmission (   $active_id,
  $pass,
  $obligationsAnswered 
)
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
integerprotected

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

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

Referenced by reworkWorkingData().

780  {
781  global $ilObjDataCache;
782 
784  {
785  $maxpoints = assQuestion::_getMaximumPoints($this->getId());
786 
787  if($this->getUploadedFiles($active_id, $pass))
788  {
789  $points = $maxpoints;
790  }
791  else
792  {
793  $points = 0;
794  }
795 
796  assQuestion::_setReachedPoints($active_id, $this->getId(), $points, $maxpoints, $pass, 1, $obligationsAnswered);
797 
798  // update learning progress
799  include_once 'Modules/Test/classes/class.ilObjTestAccess.php';
800  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
802  ilObjTest::_getObjectIDFromActiveID((int)$active_id),
803  ilObjTestAccess::_getParticipantId((int) $active_id)
804  );
805  }
806  }
getId()
Gets the id of the assQuestion object.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
getUploadedFiles($active_id, $pass=null)
Returns the uploaded files for an active user in a given pass.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
_getParticipantId($active_id)
Get user id for active id.
_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...
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
+ 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 1036 of file class.assFileUpload.php.

References $data, $ilDB, $query, $result, $row, assQuestion\$test_id, ilObjTestAccess\_getParticipantData(), ilUtil\delDir(), ilUtil\deliverFile(), ilFormat\fmtDateTime(), ilUtil\getASCIIFilename(), getFileUploadPath(), ilObjFileHandlingQuestionType\getFileUploadZIPFile(), assQuestion\getId(), assQuestion\getTitle(), ilUtil\ilTempnam(), ilUtil\makeDirParents(), ilFormat\unixtimestamp2datetime(), and ilUtil\zip().

1037  {
1038  global $ilDB;
1039  $query = "
1040  SELECT tst_solutions.solution_id
1041  FROM tst_solutions, tst_active, qpl_questions
1042  WHERE tst_solutions.active_fi = tst_active.active_id
1043  AND tst_solutions.question_fi = qpl_questions.question_id
1044  AND tst_solutions.question_fi = %s AND tst_active.test_fi = %s";
1045  $result = $ilDB->queryF( $query,
1046  array("integer", "integer"),
1047  array($this->getId(), $test_id)
1048  );
1049  if ($result->numRows() > 0)
1050  {
1051  return true;
1052  }
1053  else
1054  {
1055  return false;
1056  }
1057  }
getId()
Gets the id of the assQuestion object.
$result
global $ilDB
+ Here is the call graph for this function:

◆ isAnswered()

assFileUpload::isAnswered (   $active_id,
  $pass 
)

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

(overwrites method in class assQuestion)

ilDB $ilDB

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

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

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

1166  {
1167  $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1168 
1169  return $numExistingSolutionRecords > 0;
1170  }
getId()
Gets the id of the assQuestion object.
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...
+ Here is the call graph for this function:

◆ isAutosaveable()

assFileUpload::isAutosaveable ( )

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

1188  {
1189  return FALSE;
1190  }

◆ isComplete()

assFileUpload::isComplete ( )

Returns true, if the question is complete for use.

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

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

References getMaximumPoints().

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.
+ Here is the call graph for this function:

◆ isCompletionBySubmissionEnabled()

assFileUpload::isCompletionBySubmissionEnabled ( )

Checks whether completion by submission is enabled or not.

Returns
boolean public

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

References $completion_by_submission.

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

1135  {
1137  }
+ 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

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

1183  {
1184  return true;
1185  }

◆ 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

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

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().

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  }
setSuggestedSolution($solution_id="", $subquestion_index=0, $is_import=false)
Sets a suggested solution for the question.
setAllowedExtensions($a_value)
Set allowed file extensions.
$result
setId($id=-1)
Sets the 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. ...
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
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...
setAuthor($author="")
Sets the authors name of the assQuestion object.
setMaxSize($a_value)
Set max file size.
setPoints($a_points)
Sets the maximum available points for the question.
setQuestion($question="")
Sets the question string of the question object.
global $ilDB
setOriginalId($original_id)
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setCompletionBySubmission($bool)
Enabled/Disable completion by submission.
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ reworkWorkingData()

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

Reworks the allready saved working data if neccessary.

protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

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

References $pass, and handleSubmission().

766  {
767  $this->handleSubmission($active_id, $pass, $obligationsAnswered);
768  }
handleSubmission($active_id, $pass, $obligationsAnswered)
This method is called after an user submitted one or more files.
+ 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.

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

Referenced by saveToDb().

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  }
getId()
Gets the id of the assQuestion object.
getAllowedExtensions()
Get allowed file extensions.
getMaxSize()
Get max file size.
global $ilDB
getAdditionalTableName()
Returns the name of the additional question data table in the database.
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assFileUpload::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

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

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

◆ saveToDb()

assFileUpload::saveToDb (   $original_id = "")

Saves a assFileUpload object to a database.

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

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

76  {
79  parent::saveToDb();
80  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveQuestionDataToDb($original_id="")
+ Here is the call graph for this function:

◆ saveWorkingData()

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

Saves the learners input of the question to the database.

public

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

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

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

618  {
619  global $ilDB;
620  global $ilUser;
621 
622  if (is_null($pass))
623  {
624  include_once "./Modules/Test/classes/class.ilObjTest.php";
625  $pass = ilObjTest::_getPass($active_id);
626  }
627 
628  if( $_POST['cmd'][$this->questionActionCmd] != $this->lng->txt('delete')
629  && strlen($_FILES["upload"]["tmp_name"]) )
630  {
631  $checkUploadResult = $this->checkUpload();
632  }
633  else
634  {
635  $checkUploadResult = false;
636  }
637 
638  $result = $ilDB->queryF("SELECT test_fi FROM tst_active WHERE active_id = %s",
639  array('integer'),
640  array($active_id)
641  );
642  $test_id = 0;
643  if ($result->numRows() == 1)
644  {
645  $row = $ilDB->fetchAssoc($result);
646  $test_id = $row["test_fi"];
647  }
648 
649  $this->getProcessLocker()->requestUserSolutionUpdateLock();
650 
651  $entered_values = false;
652  if( $_POST['cmd'][$this->questionActionCmd] == $this->lng->txt('delete') )
653  {
654  if (is_array($_POST['deletefiles']) && count($_POST['deletefiles']) > 0)
655  {
656  $this->deleteUploadedFiles($_POST['deletefiles'], $test_id, $active_id);
657  }
658  else
659  {
660  ilUtil::sendInfo($this->lng->txt('no_checkbox'), true);
661  }
662  }
663  elseif( $checkUploadResult )
664  {
665  if (!@file_exists($this->getFileUploadPath($test_id, $active_id))) ilUtil::makeDirParents($this->getFileUploadPath($test_id, $active_id));
666  $version = time();
667  $filename_arr = pathinfo($_FILES["upload"]["name"]);
668  $extension = $filename_arr["extension"];
669  $newfile = "file_" . $active_id . "_" . $pass . "_" . $version . "." . $extension;
670  ilUtil::moveUploadedFile($_FILES["upload"]["tmp_name"], $_FILES["upload"]["name"], $this->getFileUploadPath($test_id, $active_id) . $newfile);
671  $next_id = $ilDB->nextId('tst_solutions');
672  $affectedRows = $ilDB->insert("tst_solutions", array(
673  "solution_id" => array("integer", $next_id),
674  "active_fi" => array("integer", $active_id),
675  "question_fi" => array("integer", $this->getId()),
676  "value1" => array("clob", $newfile),
677  "value2" => array("clob", $_FILES['upload']['name']),
678  "pass" => array("integer", $pass),
679  "tstamp" => array("integer", time())
680  ));
681  $entered_values = true;
682  }
683 
684  $this->getProcessLocker()->releaseUserSolutionUpdateLock();
685 
686  if ($entered_values)
687  {
688  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
690  {
691  $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
692  }
693  }
694  else
695  {
696  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
698  {
699  $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
700  }
701  }
702 
703  return true;
704  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getId()
Gets the id of the assQuestion object.
$_POST['username']
Definition: cron.php:12
$result
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
checkUpload()
Check file upload.
_getLogLanguage()
retrieve the log language for assessment logging
getFileUploadPath($test_id, $active_id, $question_id=null)
Returns the filesystem path for file uploads.
global $ilUser
Definition: imgupload.php:15
global $ilDB
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
deleteUploadedFiles($files, $test_id, $active_id)
Delete uploaded files.
+ 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 980 of file class.assFileUpload.php.

Referenced by __set(), and loadFromDb().

981  {
982  $this->allowedextensions = strtolower(trim($a_value));
983  }
+ Here is the caller graph for this function:

◆ setCompletionBySubmission()

assFileUpload::setCompletionBySubmission (   $bool)

Enabled/Disable completion by submission.

Parameters
boolean
Returns
assFileUpload public

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

Referenced by __set(), and loadFromDb().

1149  {
1150  $this->completion_by_submission = (bool)$bool;
1151  return $this;
1152  }
+ 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

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

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

869  {
870  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
871  $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
872  $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
873  $i = 1;
874  $solutions = $this->getSolutionValues($active_id, $pass);
875  foreach ($solutions as $solution)
876  {
877  $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($this->lng->txt("result")), $format_bold);
878  if (strlen($solution["value1"]))
879  {
880  $worksheet->write($startrow + $i, 1, ilExcelUtils::_convert_text($solution["value1"]));
881  $worksheet->write($startrow + $i, 2, ilExcelUtils::_convert_text($solution["value2"]));
882  }
883  $i++;
884  }
885  return $startrow + $i + 1;
886  }
& getSolutionValues($active_id, $pass=NULL)
Loads solutions of a given user from the database an returns it.
_convert_text($a_text, $a_target="has been removed")
getTitle()
Gets the title string of the assQuestion object.
+ 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 946 of file class.assFileUpload.php.

Referenced by __set(), and loadFromDb().

947  {
948  $this->maxsize = $a_value;
949  }
+ 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

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

914  {
915  include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assFileUploadExport.php";
916  $export = new assFileUploadExport($this);
917  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
918  }
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: