ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assLongMenu Class Reference
+ Inheritance diagram for assLongMenu:
+ Collaboration diagram for assLongMenu:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 
 getAnswerType ()
 
 setAnswerType ($answerType)
 
 getCorrectAnswers ()
 
 setCorrectAnswers ($correct_answers)
 
 getAnswerTableName ()
 
 setLongMenuTextValue ($long_menu_text="")
 
 getLongMenuTextValue ()
 
 setAnswers ($answers)
 
 getAnswers ()
 
 getJsonStructure ()
 
 setJsonStructure ($json_structure)
 
 setSpecificFeedbackSetting ($specificFeedbackSetting)
 
 getSpecificFeedbackSetting ()
 
 setMinAutoComplete ($minAutoComplete)
 
 getMinAutoComplete ()
 
 isComplete ()
 
 saveToDb ($original_id="")
 
 checkQuestionCustomPart ()
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 saveAnswerSpecificDataToDb ()
 
 loadFromDb ($question_id)
 
 getCorrectAnswersForQuestionSolution ($question_id)
 
 getAnswersObject ()
 
 getCorrectAnswersAsJson ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 copyObject ($target_questionpool_id, $title="")
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 saveWorkingData ($active_id, $pass=NULL, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getSolutionSubmit ()
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. 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...
 
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 
 isShuffleAnswersEnabled ()
 
 clearAnswerSpecificDataFromDb ($question_id)
 
 delete ($original_id)
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
- 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)
 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 ()
 

Data Fields

 $long_menu_text
 
 $answers
 
 $correct_answers
 
 $json_structure
 
 $ilDB
 
 $minAutoComplete
 
const ANSWER_TYPE_SELECT_VAL = 0
 
const ANSWER_TYPE_TEXT_VAL = 1
 
const GAP_PLACEHOLDER = 'Longmenu'
 
const MIN_LENGTH_AUTOCOMPLETE = 3
 
const MAX_INPUT_FIELDS = 500
 
- 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'
 

Protected Member Functions

 calculateReachedPointsForSolution ($found_values, $active_id=0)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
- 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 ()
 

Private Member Functions

 buildFolderName ()
 
 buildFileName ($gap_id)
 
 correctAnswerDoesNotExistInAnswerOptions ($answers, $answer_options)
 
 createFileFromArray ()
 
 createArrayFromFile ()
 
 clearFolder ($let_folder_exists=true)
 
 assertDirExists ()
 
 loadCorrectAnswerData ($question_id)
 
 getCorrectAnswersForGap ($question_id, $gap_id)
 
 getPointsForGap ($question_id, $gap_id)
 

Private Attributes

 $answerType
 
 $specificFeedbackSetting
 

Additional Inherited Members

- 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)
 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)
 
- 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...
 
- 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
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

Definition at line 11 of file class.assLongMenu.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

29  {
30  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
32  $this->minAutoComplete = self::MIN_LENGTH_AUTOCOMPLETE;
33  parent::__construct($title, $comment, $author, $owner, $question);
34  global $ilDB;
35  $this->ilDB = $ilDB;
36  }
Database Wrapper.
Definition: class.ilDB.php:28

Member Function Documentation

◆ assertDirExists()

assLongMenu::assertDirExists ( )
private

Definition at line 347 of file class.assLongMenu.php.

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

Referenced by buildFileName().

348  {
349  $folder_name = $this->buildFolderName();
350  if(!ilUtil::makeDirParents($folder_name))
351  {
352  throw new ilException('Cannot create export directory');
353  }
354 
355  if(
356  !is_dir($folder_name) ||
357  !is_readable($folder_name) ||
358  !is_writable($folder_name)
359  )
360  {
361  throw new ilException('Cannot create export directory');
362  }
363  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Base class for ILIAS Exception handling.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFileName()

assLongMenu::buildFileName (   $gap_id)
private

Definition at line 78 of file class.assLongMenu.php.

References assertDirExists(), and buildFolderName().

Referenced by createFileFromArray().

79  {
80  try
81  {
82  $this->assertDirExists();
83  return $this->buildFolderName() . $gap_id . '.txt';
84  }
85  catch (ilException $e) {
86 
87  }
88  }
Base class for ILIAS Exception handling.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFolderName()

assLongMenu::buildFolderName ( )
private

Definition at line 68 of file class.assLongMenu.php.

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

Referenced by assertDirExists(), buildFileName(), clearFolder(), and createArrayFromFile().

69  {
70  return ilUtil::getDataDir() . '/assessment/longMenuQuestion/' . $this->getId() . '/' ;
71  }
getId()
Gets the id of the assQuestion object.
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPoints()

assLongMenu::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.

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

Definition at line 614 of file class.assLongMenu.php.

References $data, $pass, assQuestion\$points, $result, calculateReachedPointsForSolution(), ilDB\fetchAssoc(), assQuestion\getCurrentSolutionResultSet(), and assQuestion\getSolutionMaxPass().

Referenced by getUserQuestionResult().

615  {
616  if( $returndetails )
617  {
618  throw new ilTestException('return details not implemented for '.__METHOD__);
619  }
620 
621  $found_values = array();
622  if (is_null($pass))
623  {
624  $pass = $this->getSolutionMaxPass($active_id);
625  }
626  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
627  while ($data = $this->ilDB->fetchAssoc($result))
628  {
629  $found_values[(int)$data['value1']] = $data['value2'];
630  }
631 
632  $points = $this->calculateReachedPointsForSolution($found_values, $active_id);
633 
634  return $points;
635  }
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsForSolution($found_values, $active_id=0)
Base Exception for all Exceptions relating to Modules/Test.
fetchAssoc($a_set)
Fetch row as associative array from result set.
$data
Database Wrapper.
Definition: class.ilDB.php:28
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

assLongMenu::calculateReachedPointsForSolution (   $found_values,
  $active_id = 0 
)
protected

Definition at line 637 of file class.assLongMenu.php.

References assQuestion\$points, getCorrectAnswersForGap(), and getPointsForGap().

Referenced by calculateReachedPoints().

638  {
639  $points = 0;
640  foreach($found_values as $key => $answer)
641  {
642  if($answer != '')
643  {
644  $correct_answers = $this->getCorrectAnswersForGap($this->id, $key);
645  if(in_array($answer, $correct_answers))
646  {
647  $points += $this->getPointsForGap($this->id, $key);
648  }
649  }
650  }
651  return $points;
652  }
getCorrectAnswersForGap($question_id, $gap_id)
getPointsForGap($question_id, $gap_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkQuestionCustomPart()

assLongMenu::checkQuestionCustomPart ( )

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

References assQuestion\$points, $row, correctAnswerDoesNotExistInAnswerOptions(), getAnswers(), and getCorrectAnswers().

170  {
171  $hidden_text_files = $this->getAnswers();
173  $points = array();
174  if( sizeof($correct_answers) == 0 || sizeof($hidden_text_files) == 0 )
175  {
176  return false;
177  }
178  if(sizeof($correct_answers) != sizeof($hidden_text_files))
179  {
180  return false;
181  }
182  foreach($correct_answers as $key => $correct_answers_row)
183  {
184  if($this->correctAnswerDoesNotExistInAnswerOptions($correct_answers_row, $hidden_text_files[$key]))
185  {
186  return false;
187  }
188  if( !is_array($correct_answers_row[0]) || sizeof($correct_answers_row[0]) == 0)
189  {
190  return false;
191  }
192  if($correct_answers_row[1] > 0)
193  {
194  array_push($points, $correct_answers_row[1]);
195  }
196  }
197  if(sizeof($correct_answers) != sizeof($points))
198  {
199  return false;
200  }
201 
202  foreach($points as $row)
203  {
204  if($row <= 0)
205  {
206  return false;
207  }
208  }
209  return true;
210  }
correctAnswerDoesNotExistInAnswerOptions($answers, $answer_options)
+ Here is the call graph for this function:

◆ clearAnswerSpecificDataFromDb()

assLongMenu::clearAnswerSpecificDataFromDb (   $question_id)

Definition at line 854 of file class.assLongMenu.php.

References getAnswerTableName(), and ilDB\manipulateF().

Referenced by saveAnswerSpecificDataToDb().

855  {
856  $this->ilDB->manipulateF( 'DELETE FROM ' . $this->getAnswerTableName() .' WHERE question_fi = %s',
857  array( 'integer' ),
858  array( $question_id )
859  );
860  }
manipulateF($a_query, $a_types, $a_values)
Formatted manupulate (for DELETE, UPDATE, INSERT).
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearFolder()

assLongMenu::clearFolder (   $let_folder_exists = true)
private

Definition at line 342 of file class.assLongMenu.php.

References buildFolderName(), and ilUtil\delDir().

Referenced by createFileFromArray(), and delete().

343  {
344  ilUtil::delDir($this->buildFolderName(), $let_folder_exists);
345  }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyObject()

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

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

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

542  {
543  if ($this->id <= 0)
544  {
545  // The question has not been saved. It cannot be duplicated
546  return;
547  }
548  // duplicate the question in database
549  $clone = $this;
550  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
552  $clone->id = -1;
553  $source_questionpool_id = $this->getObjId();
554  $clone->setObjId($target_questionpool_id);
555  if ($title)
556  {
557  $clone->setTitle($title);
558  }
559  $clone->saveToDb();
560 
561  $clone->copyPageOfQuestion($original_id);
562  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
563 
564  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
565 
566  return $clone->id;
567  }
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:

◆ correctAnswerDoesNotExistInAnswerOptions()

assLongMenu::correctAnswerDoesNotExistInAnswerOptions (   $answers,
  $answer_options 
)
private

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

Referenced by checkQuestionCustomPart().

213  {
214  foreach($answers[0] as $key => $answer)
215  {
216  if(!in_array($answer, $answer_options))
217  {
218  return true;
219  }
220  }
221  return false;
222  }
+ Here is the caller graph for this function:

◆ createArrayFromFile()

assLongMenu::createArrayFromFile ( )
private

Definition at line 322 of file class.assLongMenu.php.

References $answers, $file, buildFolderName(), and setAnswers().

Referenced by getAnswersObject(), getAvailableAnswerOptions(), and loadFromDb().

323  {
324  $files = glob( $this->buildFolderName() . '*.txt' );
325 
326  if($files === false)
327  {
328  $files = array();
329  }
330 
331  $answers = array();
332 
333  foreach( $files as $file)
334  {
335  $gap = str_replace('.txt', '', basename($file));
336  $answers[(int) $gap] = explode("\n", file_get_contents($file));
337  }
338  $this->setAnswers($answers);
339  return $answers;
340  }
setAnswers($answers)
print $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFileFromArray()

assLongMenu::createFileFromArray ( )
private

Definition at line 301 of file class.assLongMenu.php.

References $file, buildFileName(), clearFolder(), and getAnswers().

Referenced by saveAdditionalQuestionDataToDb().

302  {
303  $array = $this->getAnswers();
304  $this->clearFolder();
305  foreach($array as $gap => $values)
306  {
307  $file_content = '';
308  if(is_array($values))
309  {
310  foreach($values as $key => $value)
311  {
312  $file_content .= $value . "\n";
313  }
314  $file_content = rtrim($file_content, "\n");
315  $file = fopen($this->buildFileName($gap), "w");
316  fwrite($file, $file_content);
317  fclose($file);
318  }
319  }
320  }
print $file
clearFolder($let_folder_exists=true)
buildFileName($gap_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 569 of file class.assLongMenu.php.

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

570  {
571  if ($this->id <= 0)
572  {
573  // The question has not been saved. It cannot be duplicated
574  return;
575  }
576 
577  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
578 
579  $sourceQuestionId = $this->id;
580  $sourceParentId = $this->getObjId();
581 
582  // duplicate the question in database
583  $clone = $this;
584  $clone->id = -1;
585 
586  $clone->setObjId($targetParentId);
587 
588  if ($targetQuestionTitle)
589  {
590  $clone->setTitle($targetQuestionTitle);
591  }
592 
593  $clone->saveToDb();
594  $clone->copyPageOfQuestion($sourceQuestionId);
595  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
596 
597  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
598 
599  return $clone->id;
600  }
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ delete()

assLongMenu::delete (   $original_id)

Definition at line 862 of file class.assLongMenu.php.

References assQuestion\$original_id, and clearFolder().

863  {
864  parent::delete($original_id);
865  $this->clearFolder(false);
866  }
clearFolder($let_folder_exists=true)
+ Here is the call graph for this function:

◆ duplicate()

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

Definition at line 488 of file class.assLongMenu.php.

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

489  {
490 
491  if ($this->id <= 0)
492  {
493  // The question has not been saved. It cannot be duplicated
494  return;
495  }
496 
497  // duplicate the question in database
498  $this_id = $this->getId();
499  $thisObjId = $this->getObjId();
500 
501  $clone = $this;
502  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
504  $clone->id = -1;
505 
506  if( (int)$testObjId > 0 )
507  {
508  $clone->setObjId($testObjId);
509  }
510 
511  if ($title)
512  {
513  $clone->setTitle($title);
514  }
515 
516  if ($author)
517  {
518  $clone->setAuthor($author);
519  }
520  if ($owner)
521  {
522  $clone->setOwner($owner);
523  }
524 
525  if ($for_test)
526  {
527  $clone->saveToDb($original_id);
528  }
529  else
530  {
531  $clone->saveToDb();
532  }
533 
534  $clone->copyPageOfQuestion($this_id);
535  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
536  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
537 
538  return $clone->id;
539  }
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:

◆ getAdditionalTableName()

assLongMenu::getAdditionalTableName ( )

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

Returns
string The additional table name

Definition at line 756 of file class.assLongMenu.php.

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

757  {
758  return 'qpl_qst_lome';
759  }
+ Here is the caller graph for this function:

◆ getAnswers()

assLongMenu::getAnswers ( )

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

References $answers.

Referenced by checkQuestionCustomPart(), createFileFromArray(), and toJSON().

106  {
107  return $this->answers;
108  }
+ Here is the caller graph for this function:

◆ getAnswersObject()

assLongMenu::getAnswersObject ( )

Definition at line 477 of file class.assLongMenu.php.

References createArrayFromFile().

478  {
479  return json_encode($this->createArrayFromFile());
480  }
+ Here is the call graph for this function:

◆ getAnswerTableName()

assLongMenu::getAnswerTableName ( )

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

Referenced by clearAnswerSpecificDataFromDb(), getCorrectAnswersForGap(), getCorrectAnswersForQuestionSolution(), getPointsForGap(), and saveAnswerSpecificDataToDb().

74  {
75  return "qpl_a_lome";
76  }
+ Here is the caller graph for this function:

◆ getAnswerType()

assLongMenu::getAnswerType ( )
Returns
mixed

Definition at line 41 of file class.assLongMenu.php.

References $answerType.

Referenced by saveAnswerSpecificDataToDb().

42  {
43  return $this->answerType;
44  }
+ Here is the caller graph for this function:

◆ getAvailableAnswerOptions()

assLongMenu::getAvailableAnswerOptions (   $index = null)

If index is null, the function returns an array with all anwser options Else it returns the specific answer option.

Parameters
null | int$index
Returns
array|ASS_AnswerSimple

Definition at line 844 of file class.assLongMenu.php.

References createArrayFromFile().

845  {
846  return $this->createArrayFromFile();
847  }
+ Here is the call graph for this function:

◆ getCorrectAnswers()

assLongMenu::getCorrectAnswers ( )
Returns
mixed

Definition at line 57 of file class.assLongMenu.php.

References $correct_answers.

Referenced by checkQuestionCustomPart(), getMaximumPoints(), saveAnswerSpecificDataToDb(), setExportDetailsXLS(), and toJSON().

58  {
60  }
+ Here is the caller graph for this function:

◆ getCorrectAnswersAsJson()

assLongMenu::getCorrectAnswersAsJson ( )

Definition at line 482 of file class.assLongMenu.php.

References assQuestion\getId(), getJsonStructure(), and loadCorrectAnswerData().

483  {
484  $this->loadCorrectAnswerData($this->getId());
485  return $this->getJsonStructure();
486  }
getId()
Gets the id of the assQuestion object.
loadCorrectAnswerData($question_id)
+ Here is the call graph for this function:

◆ getCorrectAnswersForGap()

assLongMenu::getCorrectAnswersForGap (   $question_id,
  $gap_id 
)
private

Definition at line 448 of file class.assLongMenu.php.

References $correct_answers, $data, $res, ilDB\fetchAssoc(), and getAnswerTableName().

Referenced by calculateReachedPointsForSolution().

449  {
450  $correct_answers = array();
451  $res = $this->db->queryF(
452  'SELECT answer_text FROM ' . $this->getAnswerTableName() .' WHERE question_fi = %s AND gap_number = %s',
453  array('integer', 'integer'), array($question_id, $gap_id)
454  );
455  while($data = $this->ilDB->fetchAssoc($res))
456  {
457  $correct_answers[] = rtrim($data['answer_text']);
458  }
459  return $correct_answers;
460  }
fetchAssoc($a_set)
Fetch row as associative array from result set.
$data
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCorrectAnswersForQuestionSolution()

assLongMenu::getCorrectAnswersForQuestionSolution (   $question_id)

Definition at line 426 of file class.assLongMenu.php.

References $correct_answers, $data, $res, ilDB\fetchAssoc(), and getAnswerTableName().

427  {
428  $correct_answers = array();
429  $res = $this->db->queryF(
430  'SELECT gap_number, answer_text FROM ' . $this->getAnswerTableName() .' WHERE question_fi = %s',
431  array('integer'), array($question_id)
432  );
433  while($data = $this->ilDB->fetchAssoc($res))
434  {
435  if(array_key_exists($data['gap_number'], $correct_answers))
436  {
437  $correct_answers[$data['gap_number']] .= ' ' . $this->lng->txt("or") . ' ';
438  $correct_answers[$data['gap_number']] .= rtrim($data['answer_text']);
439  }
440  else
441  {
442  $correct_answers[$data['gap_number']] .= rtrim($data['answer_text']);
443  }
444  }
445  return $correct_answers;
446  }
fetchAssoc($a_set)
Fetch row as associative array from result set.
$data
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:

◆ getJsonStructure()

assLongMenu::getJsonStructure ( )
Returns
mixed

Definition at line 113 of file class.assLongMenu.php.

References $json_structure.

Referenced by getCorrectAnswersAsJson().

114  {
115  return $this->json_structure;
116  }
+ Here is the caller graph for this function:

◆ getLongMenuTextValue()

assLongMenu::getLongMenuTextValue ( )

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

References $long_menu_text.

Referenced by getRTETextWithMediaObjects(), saveAdditionalQuestionDataToDb(), and toJSON().

96  {
97  return $this->long_menu_text;
98  }
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assLongMenu::getMaximumPoints ( )

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

public

See also
$points

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

References assQuestion\$points, and getCorrectAnswers().

Referenced by getUserQuestionResult().

232  {
233  $sum = 0;
234  $points = $this->getCorrectAnswers();
235  if($points)
236  {
237  foreach($points as $add)
238  {
239  $sum += $add[1];
240  }
241  }
242  return $sum;
243  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMinAutoComplete()

assLongMenu::getMinAutoComplete ( )

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

Referenced by saveAdditionalQuestionDataToDb().

142  {
143  return $this->minAutoComplete ? $this->minAutoComplete : self::MIN_LENGTH_AUTOCOMPLETE;
144  }
+ Here is the caller graph for this function:

◆ getPointsForGap()

assLongMenu::getPointsForGap (   $question_id,
  $gap_id 
)
private

Definition at line 462 of file class.assLongMenu.php.

References $data, assQuestion\$points, $res, ilDB\fetchAssoc(), and getAnswerTableName().

Referenced by calculateReachedPointsForSolution().

463  {
464  $points = 0;
465  $res = $this->db->queryF(
466  'SELECT points FROM ' . $this->getAnswerTableName() .' WHERE question_fi = %s AND gap_number = %s GROUP BY gap_number, points',
467  array('integer', 'integer'), array($question_id, $gap_id)
468  );
469  while($data = $this->ilDB->fetchAssoc($res))
470  {
471  $points = $data['points'];
472  }
473  return $points;
474  }
fetchAssoc($a_set)
Fetch row as associative array from result set.
$data
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionType()

assLongMenu::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

Definition at line 746 of file class.assLongMenu.php.

Referenced by toJSON().

747  {
748  return "assLongMenu";
749  }
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assLongMenu::getRTETextWithMediaObjects ( )

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

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

References getLongMenuTextValue().

766  {
767  return parent::getRTETextWithMediaObjects() . $this->getLongMenuTextValue();
768  }
+ Here is the call graph for this function:

◆ getSolutionSubmit()

assLongMenu::getSolutionSubmit ( )

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

References $_POST, and ilUtil\stripSlashesRecursive().

Referenced by saveWorkingData().

705  {
706  $solutionSubmit = array();
707  $answer = ilUtil::stripSlashesRecursive($_POST['answer']);
708 
709  foreach($answer as $key => $value)
710  {
711  $solutionSubmit[$key] = $value;
712  }
713 
714  return $solutionSubmit;
715  }
$_POST['username']
Definition: cron.php:12
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificFeedbackSetting()

assLongMenu::getSpecificFeedbackSetting ( )

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

References $specificFeedbackSetting.

Referenced by saveAdditionalQuestionDataToDb().

132  {
134  }
+ Here is the caller graph for this function:

◆ getUserQuestionResult()

assLongMenu::getUserQuestionResult (   $active_id,
  $pass 
)

Get the user solution for a question by active_id and the test pass.

Parameters
int$active_id
int$pass
Returns
ilUserQuestionResult

Definition at line 824 of file class.assLongMenu.php.

References $pass, assQuestion\$points, $result, calculateReachedPoints(), and getMaximumPoints().

825  {
826  $result = new ilUserQuestionResult($this, $active_id, $pass);
827 
828  $points = $this->calculateReachedPoints($active_id, $pass);
829  $max_points = $this->getMaximumPoints();
830 
831  $result->setReachedPercentage(($points/$max_points) * 100);
832 
833  return $result;
834  }
$result
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
Class ilUserQuestionResult.
+ Here is the call graph for this function:

◆ isComplete()

assLongMenu::isComplete ( )

Definition at line 146 of file class.assLongMenu.php.

References assQuestion\getPoints().

147  {
148  if (strlen($this->title)
149  && $this->author
150  && $this->question
151  && sizeof($this->answers) > 0
152  && sizeof($this->correct_answers) > 0
153  && $this->getPoints() > 0
154  )
155  {
156  return true;
157  }
158  return false;
159  }
getPoints()
Returns the maximum available points for the question.
+ Here is the call graph for this function:

◆ isShuffleAnswersEnabled()

assLongMenu::isShuffleAnswersEnabled ( )

Definition at line 849 of file class.assLongMenu.php.

850  {
851  return false;
852  }

◆ lmMigrateQuestionTypeSpecificContent()

assLongMenu::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected
Parameters
ilAssSelfAssessmentMigrator$migrator

Definition at line 871 of file class.assLongMenu.php.

References ilAssSelfAssessmentMigrator\migrateToLmContent(), and setLongMenuTextValue().

872  {
873  $this->setLongMenuTextValue( $migrator->migrateToLmContent($this->getLongMenuTextValue()) );
874  }
setLongMenuTextValue($long_menu_text="")
+ Here is the call graph for this function:

◆ loadCorrectAnswerData()

assLongMenu::loadCorrectAnswerData (   $question_id)
private

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

References $data, $res, ilDB\fetchAssoc(), setCorrectAnswers(), and setJsonStructure().

Referenced by getCorrectAnswersAsJson(), and loadFromDb().

408  {
409  $res = $this->db->queryF(
410  "SELECT * FROM {$this->getAnswerTableName()} WHERE question_fi = %s ORDER BY gap_number, position ASC",
411  array('integer'), array($question_id)
412  );
413 
414  $correct_answers = array();
415  while($data = $this->ilDB->fetchAssoc($res))
416  {
417  $correct_answers[$data['gap_number']][0][$data['position']] = rtrim($data['answer_text']);
418  $correct_answers[$data['gap_number']][1] = $data['points'];
419  $correct_answers[$data['gap_number']][2] = $data['type'];
420  }
421  $this->setJsonStructure(json_encode($correct_answers));
423 
424  }
setJsonStructure($json_structure)
fetchAssoc($a_set)
Fetch row as associative array from result set.
$data
Database Wrapper.
Definition: class.ilDB.php:28
setCorrectAnswers($correct_answers)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

assLongMenu::loadFromDb (   $question_id)

Definition at line 365 of file class.assLongMenu.php.

References $data, $result, ilRTE\_replaceMediaObjectImageSrc(), createArrayFromFile(), ilDB\fetchAssoc(), getAdditionalTableName(), loadCorrectAnswerData(), ilDB\queryF(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), setLongMenuTextValue(), setMinAutoComplete(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), setSpecificFeedbackSetting(), and assQuestion\setTitle().

366  {
367  $result = $this->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",
368  array("integer"),
369  array($question_id)
370  );
371  if ($result->numRows() == 1)
372  {
373  $data = $this->ilDB->fetchAssoc($result);
374  $this->setId($question_id);
375  $this->setObjId($data["obj_fi"]);
376  $this->setNrOfTries($data['nr_of_tries']);
377  $this->setTitle($data["title"]);
378  $this->setComment($data["description"]);
379  $this->setOriginalId($data["original_id"]);
380  $this->setAuthor($data["author"]);
381  $this->setPoints($data["points"]);
382  $this->setOwner($data["owner"]);
383  include_once("./Services/RTE/classes/class.ilRTE.php");
384  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data['question_text'], 1));
385  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
386  $this->setLongMenuTextValue(ilRTE::_replaceMediaObjectImageSrc($data['long_menu_text'], 1));
387  $this->loadCorrectAnswerData($question_id);
388  $this->setMinAutoComplete($data["min_auto_complete"]);
389  if( isset($data['feedback_setting']) )
390  {
391  $this->setSpecificFeedbackSetting((int)$data['feedback_setting']);
392  }
393  try
394  {
395  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
396  }
398  {
399  }
400  }
401 
402  $this->loadCorrectAnswerData($question_id);
403  $this->createArrayFromFile();
404  parent::loadFromDb($question_id);
405  }
$result
setMinAutoComplete($minAutoComplete)
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setId($id=-1)
Sets the id of the assQuestion object.
setSpecificFeedbackSetting($specificFeedbackSetting)
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
loadCorrectAnswerData($question_id)
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...
fetchAssoc($a_set)
Fetch row as associative array from result set.
setAuthor($author="")
Sets the authors name of the assQuestion object.
$data
setLongMenuTextValue($long_menu_text="")
queryF($a_query, $a_types, $a_values)
Formatted query (for SELECTS).
setPoints($a_points)
Sets the maximum available points for the question.
Database Wrapper.
Definition: class.ilDB.php:28
setQuestion($question="")
Sets the question string of the question object.
setOriginalId($original_id)
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()

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

Reworks the allready saved working data if neccessary.

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

Definition at line 736 of file class.assLongMenu.php.

737  {
738  // nothing to rework!
739  }

◆ saveAdditionalQuestionDataToDb()

assLongMenu::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

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

References createFileFromArray(), getAdditionalTableName(), assQuestion\getId(), getLongMenuTextValue(), getMinAutoComplete(), getSpecificFeedbackSetting(), and ilDB\manipulateF().

Referenced by saveToDb().

246  {
247  // save additional data
248  $this->ilDB->manipulateF( "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
249  array( "integer" ),
250  array( $this->getId() )
251  );
252  $this->ilDB->manipulateF( "INSERT INTO " . $this->getAdditionalTableName(
253  ) . " (question_fi, long_menu_text, feedback_setting, min_auto_complete) VALUES (%s, %s, %s, %s)",
254  array( "integer", "text", "integer", "integer"),
255  array(
256  $this->getId(),
257  $this->getLongMenuTextValue(),
258  (int)$this->getSpecificFeedbackSetting(),
259  (int)$this->getMinAutoComplete()
260  )
261  );
262  $this->createFileFromArray();
263  }
getId()
Gets the id of the assQuestion object.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
manipulateF($a_query, $a_types, $a_values)
Formatted manupulate (for DELETE, UPDATE, INSERT).
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswerSpecificDataToDb()

assLongMenu::saveAnswerSpecificDataToDb ( )

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

References assQuestion\$points, clearAnswerSpecificDataFromDb(), getAnswerTableName(), getAnswerType(), getCorrectAnswers(), assQuestion\getId(), and assQuestion\setPoints().

Referenced by saveToDb().

266  {
267  $this->clearAnswerSpecificDataFromDb($this->getId());
268  $type_array = $this->getAnswerType();
269  $points = 0;
270  foreach($this->getCorrectAnswers() as $gap_number => $gap)
271  {
272  foreach($gap[0] as $position => $answer)
273  {
274  if($type_array == null)
275  {
276  $type = $gap[2];
277  }
278  else
279  {
280  $type = $type_array[$gap_number];
281  }
282  $this->db->replace(
283  $this->getAnswerTableName(),
284  array(
285  'question_fi' => array('integer', (int)$this->getId()),
286  'gap_number' => array('integer', (int)$gap_number),
287  'position' => array('integer', (int)$position)
288  ),
289  array(
290  'answer_text' => array('text', $answer),
291  'points' => array('float', $gap[1]),
292  'type' => array('integer', (int) $type)
293  )
294  );
295  }
296  $points += $gap[1];
297  }
298  $this->setPoints($points);
299  }
getId()
Gets the id of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
clearAnswerSpecificDataFromDb($question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assLongMenu::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

References $_POST, and ilAssQuestionPreviewSession\setParticipantsSolution().

718  {
719  if( array_key_exists('answer',$_POST) )
720  {
721  $previewSession->setParticipantsSolution($_POST['answer']);
722  }
723  else
724  {
725  $previewSession->setParticipantsSolution(null);
726  }
727  }
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ saveToDb()

assLongMenu::saveToDb (   $original_id = "")

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

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

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

◆ saveWorkingData()

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

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 662 of file class.assLongMenu.php.

References $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\getId(), assQuestion\getProcessLocker(), getSolutionSubmit(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), assQuestion\saveCurrentSolution(), and ilUtil\stripSlashes().

663  {
664  if (is_null($pass))
665  {
666  include_once "./Modules/Test/classes/class.ilObjTest.php";
667  $pass = ilObjTest::_getPass($active_id);
668  }
669  $this->getProcessLocker()->requestUserSolutionUpdateLock();
670 
671  $entered_values = 0;
672  $this->removeCurrentSolution($active_id, $pass, $authorized);
673 
674  foreach($this->getSolutionSubmit() as $val1 => $val2)
675  {
676  $value = ilUtil::stripSlashes($val2, FALSE);
677  if (strlen($value))
678  {
679  $this->saveCurrentSolution($active_id,$pass, $val1, $value, $authorized);
680  $entered_values++;
681  }
682  }
683  $this->getProcessLocker()->releaseUserSolutionUpdateLock();
684 
685  if ($entered_values)
686  {
687  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
689  {
690  $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
691  }
692  }
693  else
694  {
695  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
697  {
698  $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
699  }
700  }
701  return true;
702  }
getId()
Gets the id of the assQuestion object.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
_getLogLanguage()
retrieve the log language for assessment logging
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
+ Here is the call graph for this function:

◆ setAnswers()

assLongMenu::setAnswers (   $answers)

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

References $answers.

Referenced by createArrayFromFile().

101  {
102  $this->answers = $answers;
103  }
+ Here is the caller graph for this function:

◆ setAnswerType()

assLongMenu::setAnswerType (   $answerType)
Parameters
mixed$answerType

Definition at line 49 of file class.assLongMenu.php.

References $answerType.

50  {
51  $this->answerType = $answerType;
52  }

◆ setCorrectAnswers()

assLongMenu::setCorrectAnswers (   $correct_answers)

Definition at line 63 of file class.assLongMenu.php.

References $correct_answers.

Referenced by loadCorrectAnswerData().

64  {
65  $this->correct_answers = $correct_answers;
66  }
+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

assLongMenu::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
Returns
object

Definition at line 781 of file class.assLongMenu.php.

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

782  {
783  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
784  $solution = $this->getSolutionValues($active_id, $pass);
785  $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
786  $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
787  $i = 1;
788  foreach ($this->getCorrectAnswers() as $gap_index => $gap)
789  {
790  $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($this->lng->txt('assLongMenu') . " $i"), $format_bold);
791  foreach ($solution as $solutionvalue)
792  {
793  if ($gap_index == $solutionvalue["value1"])
794  {
795  switch ($gap[2])
796  {
797  case self::ANSWER_TYPE_SELECT_VAL:
798  $value = $solutionvalue["value2"];
799  if($value == -1)
800  {
801  $value = '';
802  }
803  $worksheet->writeString($startrow + $i, 1, $value);
804  break;
805  case self::ANSWER_TYPE_TEXT_VAL:
806  $worksheet->writeString($startrow + $i, 1, $solutionvalue["value2"]);
807  break;
808  }
809  }
810  }
811  $i++;
812  }
813  return $startrow + $i + 1;
814  }
_convert_text($a_text, $a_target="has been removed")
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.
+ Here is the call graph for this function:

◆ setJsonStructure()

assLongMenu::setJsonStructure (   $json_structure)
Parameters
mixed$json_structure

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

References $json_structure.

Referenced by loadCorrectAnswerData().

122  {
123  $this->json_structure = $json_structure;
124  }
+ Here is the caller graph for this function:

◆ setLongMenuTextValue()

assLongMenu::setLongMenuTextValue (   $long_menu_text = "")

Definition at line 90 of file class.assLongMenu.php.

References $long_menu_text.

Referenced by lmMigrateQuestionTypeSpecificContent(), and loadFromDb().

91  {
92  $this->long_menu_text = $long_menu_text;
93  }
+ Here is the caller graph for this function:

◆ setMinAutoComplete()

assLongMenu::setMinAutoComplete (   $minAutoComplete)

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

References $minAutoComplete.

Referenced by loadFromDb().

137  {
138  $this->minAutoComplete = $minAutoComplete;
139  }
+ Here is the caller graph for this function:

◆ setSpecificFeedbackSetting()

assLongMenu::setSpecificFeedbackSetting (   $specificFeedbackSetting)

Definition at line 126 of file class.assLongMenu.php.

References $specificFeedbackSetting.

Referenced by loadFromDb().

127  {
128  $this->specificFeedbackSetting = $specificFeedbackSetting;
129  }
+ Here is the caller graph for this function:

◆ toJSON()

assLongMenu::toJSON ( )

Returns a JSON representation of the question.

Definition at line 879 of file class.assLongMenu.php.

References $mobs, $result, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), getAnswers(), getCorrectAnswers(), assQuestion\getId(), getLongMenuTextValue(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitle().

880  {
881  include_once("./Services/RTE/classes/class.ilRTE.php");
882  $result = array();
883  $result['id'] = (int) $this->getId();
884  $result['type'] = (string) $this->getQuestionType();
885  $result['title'] = (string) $this->getTitle();
886  $replaced_quesiton_text = $this->getLongMenuTextValue();
887  $result['question'] = $this->formatSAQuestion($this->getQuestion());
888  $result['lmtext'] = $this->formatSAQuestion($replaced_quesiton_text);
889  $result['nr_of_tries'] = (int) $this->getNrOfTries();
890  $result['shuffle'] = (bool) $this->getShuffle();
891  $result['feedback'] = array(
892  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
893  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
894  );
895 
896  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
897  $result['answers'] = $this->getAnswers();
898  $result['correct_answers'] = $this->getCorrectAnswers();
899  $result['mobs'] = $mobs;
900  return json_encode($result);
901  }
getId()
Gets the id of the assQuestion object.
formatSAQuestion($a_q)
Format self assessment question.
$result
getShuffle()
Gets the shuffle flag.
$mobs
getQuestion()
Gets the question string of the question object.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
getQuestionType()
Returns the question type of the question.
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:

Field Documentation

◆ $answers

assLongMenu::$answers

Definition at line 13 of file class.assLongMenu.php.

Referenced by createArrayFromFile(), getAnswers(), and setAnswers().

◆ $answerType

assLongMenu::$answerType
private

Definition at line 13 of file class.assLongMenu.php.

Referenced by getAnswerType(), and setAnswerType().

◆ $correct_answers

assLongMenu::$correct_answers

◆ $ilDB

assLongMenu::$ilDB

Definition at line 13 of file class.assLongMenu.php.

Referenced by __construct().

◆ $json_structure

assLongMenu::$json_structure

Definition at line 13 of file class.assLongMenu.php.

Referenced by getJsonStructure(), and setJsonStructure().

◆ $long_menu_text

assLongMenu::$long_menu_text

Definition at line 13 of file class.assLongMenu.php.

Referenced by getLongMenuTextValue(), and setLongMenuTextValue().

◆ $minAutoComplete

assLongMenu::$minAutoComplete

Definition at line 14 of file class.assLongMenu.php.

Referenced by setMinAutoComplete().

◆ $specificFeedbackSetting

assLongMenu::$specificFeedbackSetting
private

Definition at line 14 of file class.assLongMenu.php.

Referenced by getSpecificFeedbackSetting(), and setSpecificFeedbackSetting().

◆ ANSWER_TYPE_SELECT_VAL

const assLongMenu::ANSWER_TYPE_SELECT_VAL = 0

◆ ANSWER_TYPE_TEXT_VAL

const assLongMenu::ANSWER_TYPE_TEXT_VAL = 1

◆ GAP_PLACEHOLDER

◆ MAX_INPUT_FIELDS

const assLongMenu::MAX_INPUT_FIELDS = 500

◆ MIN_LENGTH_AUTOCOMPLETE

const assLongMenu::MIN_LENGTH_AUTOCOMPLETE = 3

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