Public Member Functions | Data Fields

assFlashApp Class Reference

Class for Flash Application Questions. More...

Inheritance diagram for assFlashApp:
Collaboration diagram for assFlashApp:

Public Member Functions

 assFlashApp ($title="", $comment="", $author="", $owner=-1, $question="", $flash_filename="")
 assFlashApp constructor
 splitParams ($params="")
 Sets the applet parameters from a parameter string containing all parameters in a list.
 buildParams ()
 Returns a string containing the applet parameters.
 buildParamsOnly ()
 Returns a string containing the additional applet parameters.
 isComplete ()
 Returns true, if a FlashApp question is complete for use.
 saveToDb ($original_id="")
 Saves a assFlashApp object to a database.
 loadFromDb ($question_id)
 Loads a assFlashApp object from a database.
 duplicate ($for_test=true, $title="", $author="", $owner="")
 Duplicates an assFlashApp.
 copyObject ($target_questionpool, $title="")
 Copies an assFlashApp object.
 duplicateApplet ($question_id)
 copyApplet ($question_id, $source_questionpool)
 getQuestion ()
 Gets the multiple choice question.
 setQuestion ($question="")
 Sets the question text.
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question.
 getFlashWidth ()
 Returns the Flash Application width parameter.
 setFlashWidth ($flash_width="")
 Sets the Flash Application width parameter.
 getFlashHeight ()
 Returns the Flash Application height parameter.
 setFlashHeight ($flash_height="")
 Sets the Flash Application height parameter.
 calculateReachedPoints ($active_id, $pass=NULL)
 Returns the points, a learner has reached answering the question.
 getReachedInformation ($active_id, $pass=NULL)
 Returns the evaluation data, a learner has entered to answer the question.
 addParameter ($name="", $value="")
 Adds a new parameter value to the parameter list.
 addParameterAtIndex ($index=0, $name="", $value="")
 Adds a new parameter value to the parameter list at a given index.
 removeParameter ($name)
 Removes a parameter value from the parameter list.
 getParameter ($index)
 Returns the paramter at a given index.
 getParameterIndex ($name)
 Returns the index of an applet parameter.
 getParameterCount ()
 Returns the number of additional applet parameters.
 flushParams ()
 Removes all applet parameters.
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database.
 getFlashFilename ()
 Gets the Flash Application file name.
 setFlashFilename ($flash_filename, $javaapplet_tempfilename="")
 Sets the Flash Application file name.
 deleteFlashFilename ()
 syncWithOriginal ()
 getQuestionType ()
 Returns the question type of the question.
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database.
 writeTmpFile ($tmp_data)
 Writes the temporary file which includes all parameters for the flash question.
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor.

Data Fields

 $question
 $flash_filename
 $flash_width
 $flash_height
 $parameters

Detailed Description

Class for Flash Application Questions.

assFlashApp is a class for Flash Application Questions.

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Christian Müller <christian.mueller@uni-passau.de>
Version:
Id:
class.assFlashApp.php,v 1.81 2006/07/30 11:51:56 hschottm Exp

class.assFlashAppApplet.php Assessment

Definition at line 37 of file class.assFlashApp.php.


Member Function Documentation

assFlashApp::addParameter ( name = "",
value = "" 
)

Adds a new parameter value to the parameter list.

Adds a new parameter value to the parameter list

Parameters:
string $name The name of the parameter value
string $value The value of the parameter value public
See also:
$parameters

Definition at line 661 of file class.assFlashApp.php.

References getParameterIndex().

        {
                $index = $this->getParameterIndex($name);
                if ($index > -1)
                {
                        $this->parameters[$index] = array("name" => $name, "value" => $value);
                }
                else
                {
                        array_push($this->parameters, array("name" => $name, "value" => $value));
                }
        }

Here is the call graph for this function:

assFlashApp::addParameterAtIndex ( index = 0,
name = "",
value = "" 
)

Adds a new parameter value to the parameter list at a given index.

Adds a new parameter value to the parameter list at a given index

Parameters:
integer $index The index at which the parameter should be inserted
string $name The name of the parameter value
string $value The value of the parameter value public
See also:
$parameters

Definition at line 685 of file class.assFlashApp.php.

        {
                $this->parameters[$index] = array("name" => $name, "value" => $value);
        }

assFlashApp::assFlashApp ( title = "",
comment = "",
author = "",
owner = -1,
question = "",
flash_filename = "" 
)

assFlashApp constructor

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

Parameters:
string $title A title string to describe the question
string $comment A comment string to describe the question
string $author A string containing the name of the questions author
integer $owner A numerical ID to identify the owner/creator
string $question The question string of the multiple choice question
integer $response Indicates the response type of the multiple choice question
integer $output_type The output order of the multiple choice answers public
See also:
assQuestion:assQuestion()

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

References assQuestion::$author, assQuestion::$comment, $flash_filename, assQuestion::$owner, $question, assQuestion::$title, and assQuestion::assQuestion().

        {
                $this->assQuestion($title, $comment, $author, $owner);
                $this->question = $question;
                $this->flash_filename = $flash_filename;
                $this->parameters = array();
        }

Here is the call graph for this function:

assFlashApp::buildParams (  ) 

Returns a string containing the applet parameters.

Returns a string containing the applet parameters. This is used for saving the applet data to database

Returns:
string All applet parameters public

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

Referenced by saveToDb().

        {
                $params_array = array();
                if ($this->flash_width)
                {
                        array_push($params_array, "flash_width=$this->flash_width");
                }
                if ($this->flash_height)
                {
                        array_push($params_array, "flash_height=$this->flash_height");
                }
                foreach ($this->parameters as $key => $value)
                {
                        array_push($params_array, "param_name_$key=" . $value["name"]);
                        array_push($params_array, "param_value_$key=" . $value["value"]);
                }
                return join($params_array, "<separator>");
        }

Here is the caller graph for this function:

assFlashApp::buildParamsOnly (  ) 

Returns a string containing the additional applet parameters.

Returns a string containing the additional applet parameters

Returns:
string All additional applet parameters public

Definition at line 186 of file class.assFlashApp.php.

        {
                $params_array = array();
                
                foreach ($this->parameters as $key => $value)
                {
                        array_push($params_array, "param_name_$key=" . $value["name"]);
                        array_push($params_array, "param_value_$key=" . $value["value"]);
                }
                return join($params_array, "<separator>");
        }

assFlashApp::calculateReachedPoints ( active_id,
pass = NULL 
)

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

Returns the points, a learner has reached answering the question The points are calculated from the given answers including checks for all special scoring options in the test container.

Parameters:
integer $user_id The database ID of the learner
integer $test_id The database Id of the test containing the question public

Definition at line 580 of file class.assFlashApp.php.

References $data, assQuestion::$points, assQuestion::getId(), and assQuestion::getSolutionMaxPass().

        {
                global $ilDB;
                
                $found_values = array();
                if (is_null($pass))
                {
                        $pass = $this->getSolutionMaxPass($active_id);
                }
                $query = sprintf("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
                        $ilDB->quote($active_id . ""),
                        $ilDB->quote($this->getId() . ""),
                        $ilDB->quote($pass . "")
                );
                $result = $ilDB->query($query);
                $points = 0;
                while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $points += $data->points;
                }

                $points = parent::calculateReachedPoints($active_id, $pass = NULL, $points);
                return $points;
        }

Here is the call graph for this function:

assFlashApp::copyApplet ( question_id,
source_questionpool 
)

Definition at line 460 of file class.assFlashApp.php.

References $filename, getFlashFilename(), assQuestion::getFlashPath(), and ilUtil::makeDirParents().

        {
                $javapath = $this->getFlashPath();
                $javapath_original = preg_replace("/([^\d])$this->id([^\d])/", "\${1}$question_id\${2}", $javapath);
                $javapath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $javapath_original);
                if (!file_exists($javapath))
                {
                        ilUtil::makeDirParents($javapath);
                }
                $filename = $this->getFlashFilename();
                if (!copy($javapath_original . $filename, $javapath . $filename)) {
                        print "Flash Application could not be copied!!!! ";
                }
        }

Here is the call graph for this function:

assFlashApp::copyObject ( target_questionpool,
title = "" 
)

Copies an assFlashApp object.

Copies an assFlashApp object

public

Definition at line 416 of file class.assFlashApp.php.

References assQuestion::$title, assQuestion::_getOriginalId(), and assQuestion::getObjId().

        {
                if ($this->id <= 0)
                {
                        // The question has not been saved. It cannot be duplicated
                        return;
                }
                // duplicate the question in database
                $clone = $this;
                include_once ("./Modules/TestQuestionPoll/classes/class.assQuestion.php");
                $original_id = assQuestion::_getOriginalId($this->id);
                $clone->id = -1;
                $source_questionpool = $this->getObjId();
                $clone->setObjId($target_questionpool);
                if ($title)
                {
                        $clone->setTitle($title);
                }
                $clone->saveToDb();

                // copy question page content
                $clone->copyPageOfQuestion($original_id);
                // copy XHTML media objects
                $clone->copyXHTMLMediaObjectsOfQuestion($original_id);

                // duplicate the image
                $clone->copyApplet($original_id, $source_questionpool);
                return $clone->id;
        }

Here is the call graph for this function:

assFlashApp::deleteFlashFilename (  ) 

Definition at line 845 of file class.assFlashApp.php.

References getFlashFilename(), and assQuestion::getFlashPath().

        {
                unlink($this->getFlashPath() . $this->getFlashFilename());
                $this->flash_filename = "";
        }

Here is the call graph for this function:

assFlashApp::duplicate ( for_test = true,
title = "",
author = "",
owner = "" 
)

Duplicates an assFlashApp.

Duplicates an assFlashApp

public

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

References assQuestion::$author, assQuestion::$owner, assQuestion::$title, assQuestion::_getOriginalId(), and assQuestion::getId().

        {
                if ($this->id <= 0)
                {
                        // The question has not been saved. It cannot be duplicated
                        return;
                }
                // duplicate the question in database
                $this_id = $this->getId();
                $clone = $this;
                include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
                $original_id = assQuestion::_getOriginalId($this->id);
                $clone->id = -1;
                if ($title)
                {
                        $clone->setTitle($title);
                }
                if ($author)
                {
                        $clone->setAuthor($author);
                }
                if ($owner)
                {
                        $clone->setOwner($owner);
                }
                if ($for_test)
                {
                        $clone->saveToDb($original_id);
                }
                else
                {
                        $clone->saveToDb();
                }

                // copy question page content
                $clone->copyPageOfQuestion($this_id);
                // copy XHTML media objects
                $clone->copyXHTMLMediaObjectsOfQuestion($this_id);

                // duplicate the image
                $clone->duplicateApplet($this_id);
                return $clone->id;
        }

Here is the call graph for this function:

assFlashApp::duplicateApplet ( question_id  ) 

Definition at line 446 of file class.assFlashApp.php.

References $filename, getFlashFilename(), assQuestion::getFlashPath(), and ilUtil::makeDirParents().

        {
                $javapath = $this->getFlashPath();
                $javapath_original = preg_replace("/([^\d])$this->id([^\d])/", "\${1}$question_id\${2}", $javapath);
                if (!file_exists($javapath))
                {
                        ilUtil::makeDirParents($javapath);
                }
                $filename = $this->getFlashFilename();
                if (!copy($javapath_original . $filename, $javapath . $filename)) {
                        print "Flash Application could not be duplicated!!!! ";
                }
        }

Here is the call graph for this function:

assFlashApp::flushParams (  ) 

Removes all applet parameters.

Removes all applet parameters

public

See also:
$parameters

Definition at line 774 of file class.assFlashApp.php.

        {
                $this->parameters = array();
        }

assFlashApp::getAdditionalTableName (  ) 

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

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

Returns:
string The additional table name public

Reimplemented from assQuestion.

Definition at line 910 of file class.assFlashApp.php.

        {
                return "qpl_question_flashapp";
        }

assFlashApp::getFlashFilename (  ) 

Gets the Flash Application file name.

Gets the Flash Application file name

Returns:
string The Flash Application file of the assFlashApp object public
See also:
$flash_filename

Definition at line 804 of file class.assFlashApp.php.

Referenced by copyApplet(), deleteFlashFilename(), and duplicateApplet().

        {
                return $this->flash_filename;
        }

Here is the caller graph for this function:

assFlashApp::getFlashHeight (  ) 

Returns the Flash Application height parameter.

Returns the Flash Application height parameter

Returns:
integer Flash Application height parameter public

Definition at line 551 of file class.assFlashApp.php.

        {
                return $this->flash_height;
        }

assFlashApp::getFlashWidth (  ) 

Returns the Flash Application width parameter.

Returns the Flash Application width parameter

Returns:
integer Flash Application width parameter public

Definition at line 525 of file class.assFlashApp.php.

        {
                return $this->flash_width;
        }

assFlashApp::getMaximumPoints (  ) 

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

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

public

See also:
$points

Reimplemented from assQuestion.

Definition at line 511 of file class.assFlashApp.php.

Referenced by isComplete().

        {
                return $this->points;
        }

Here is the caller graph for this function:

assFlashApp::getParameter ( index  ) 

Returns the paramter at a given index.

Returns the paramter at a given index

Parameters:
intege $index The index value of the parameter
Returns:
array The parameter at the given index public
See also:
$parameters

Definition at line 721 of file class.assFlashApp.php.

        {
                if (($index < 0) or ($index >= count($this->parameters)))
                {
                        return undef;
                }
                return $this->parameters[$index];
        }

assFlashApp::getParameterCount (  ) 

Returns the number of additional applet parameters.

Returns the number of additional applet parameters

Returns:
integer The number of additional applet parameters public
See also:
$parameters

Definition at line 761 of file class.assFlashApp.php.

        {
                return count($this->parameters);
        }

assFlashApp::getParameterIndex ( name  ) 

Returns the index of an applet parameter.

Returns the index of an applet parameter

Parameters:
string $name The name of the parameter value
Returns:
integer The index of the applet parameter or -1 if the parameter wasn't found private
See also:
$parameters

Definition at line 740 of file class.assFlashApp.php.

Referenced by addParameter().

        {
                foreach ($this->parameters as $key => $value)
                {
                        if (array_key_exists($name, $value))
                        {
                                return $key;
                        }
                }
                return -1;
        }

Here is the caller graph for this function:

assFlashApp::getQuestion (  ) 

Gets the multiple choice question.

Gets the question string of the assFlashApp object

Returns:
string The question string of the assFlashApp object public
See also:
$question

Reimplemented from assQuestion.

Definition at line 484 of file class.assFlashApp.php.

        {
                return $this->question;
        }

assFlashApp::getQuestionType (  ) 

Returns the question type of the question.

Returns the question type of the question

Returns:
integer The question type of the question public

Reimplemented from assQuestion.

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

Referenced by saveToDb().

        {
                return "assFlashApp";
        }

Here is the caller graph for this function:

assFlashApp::getReachedInformation ( active_id,
pass = NULL 
)

Returns the evaluation data, a learner has entered to answer the question.

Returns the evaluation data, a learner has entered to answer the question

Parameters:
integer $user_id The database ID of the learner
integer $test_id The database Id of the test containing the question public

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

References $data, assQuestion::getId(), and assQuestion::getSolutionMaxPass().

        {
                global $ilDB;
                
                $found_values = array();
                if (is_null($pass))
                {
                        $pass = $this->getSolutionMaxPass($active_id);
                }
                $query = sprintf("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
                        $ilDB->quote($active_id . ""),
                        $ilDB->quote($this->getId() . ""),
                        $ilDB->quote($pass . "")
                );
                $result = $ilDB->query($query);
                $counter = 0;
                $user_result = array();
                while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $true = 0;
                        if ($data->points > 0)
                        {
                                $true = 1;
                        }
                        $solution = array(
                                "order" => "$counter",
                                "points" => "$data->points",
                                "true" => "$true",
                                "value1" => "$data->value1",
                                "value2" => "$data->value2",
                        );
                        $counter++;
                        array_push($user_result, $solution);
                }
                return $user_result;
        }

Here is the call graph for this function:

assFlashApp::getRTETextWithMediaObjects (  ) 

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

Reimplemented from assQuestion.

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

assFlashApp::isComplete (  ) 

Returns true, if a FlashApp question is complete for use.

Returns true, if a FlashApp question is complete for use

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

Reimplemented from assQuestion.

Definition at line 206 of file class.assFlashApp.php.

References getMaximumPoints().

Referenced by saveToDb(), and syncWithOriginal().

        {
                if (($this->title) and ($this->author) and ($this->question) and ($this->flash_filename) and ($this->flash_width) and ($this->flash_height) and ($this->getMaximumPoints() > 0))
                {
                        return true;
                }
                /*
                else if (($this->title) and ($this->author) and ($this->question) and ($this->getJavaArchive()) and ($this->getJavaCodebase()) and ($this->flash_width) and ($this->flash_height) and ($this->getMaximumPoints() > 0))
                {
                        return true;
                }*/
                else
                {
                        return false;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

assFlashApp::loadFromDb ( question_id  ) 

Loads a assFlashApp object from a database.

Loads a assFlashApp object from a database (experimental)

Parameters:
object $db A pear DB object
integer $question_id A unique key which defines the multiple choice test in the database public

Reimplemented from assQuestion.

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

References $data, ilRTE::_replaceMediaObjectImageSrc(), assQuestion::setEstimatedWorkingTime(), and splitParams().

        {
                global $ilDB;

    $query = sprintf("SELECT qpl_questions.*, qpl_question_flashapp.* FROM qpl_questions, qpl_question_flashapp WHERE question_id = %s AND qpl_questions.question_id = qpl_question_flashapp.question_fi",
                        $ilDB->quote($question_id)
                );
                $result = $ilDB->query($query);

                if (strcmp(strtolower(get_class($result)), db_result) == 0)
                {
                        if ($result->numRows() == 1)
                        {
                                $data = $result->fetchRow(DB_FETCHMODE_OBJECT);
                                $this->id = $question_id;
                                $this->title = $data->title;
                                $this->comment = $data->comment;
                                $this->obj_id = $data->obj_fi;
                                $this->author = $data->author;
                                $this->points = $data->points;
                                $this->owner = $data->owner;
                                $this->original_id = $data->original_id;
                                $this->flash_filename = $data->flash_file;
                                include_once("./Services/RTE/classes/class.ilRTE.php");
                                $this->question = ilRTE::_replaceMediaObjectImageSrc($data->question_text, 1);
                                $this->solution_hint = $data->solution_hint;
                                $this->splitParams($data->params);
                                $this->setEstimatedWorkingTime(substr($data->working_time, 0, 2), substr($data->working_time, 3, 2), substr($data->working_time, 6, 2));
                        }
                }
                parent::loadFromDb($question_id);
        }

Here is the call graph for this function:

assFlashApp::removeParameter ( name  ) 

Removes a parameter value from the parameter list.

Removes a parameter value from the parameter list

Parameters:
string $name The name of the parameter value public
See also:
$parameters

Definition at line 699 of file class.assFlashApp.php.

        {
                foreach ($this->parameters as $key => $value)
                {
                        if (strcmp($name, $value["name"]) == 0)
                        {
                                array_splice($this->parameters, $key, 1);
                                return;
                        }
                }
        }

assFlashApp::saveToDb ( original_id = ""  ) 

Saves a assFlashApp object to a database.

Saves a assFlashApp object to a database (experimental)

Parameters:
object $db A pear DB object public

Reimplemented from assQuestion.

Definition at line 232 of file class.assFlashApp.php.

References ilRTE::_replaceMediaObjectImageSrc(), buildParams(), assQuestion::createPageObject(), assQuestion::getEstimatedWorkingTime(), getQuestionType(), assQuestion::getTestId(), assQuestion::insertIntoTest(), and isComplete().

        {
                global $ilDB;

                $complete = 0;
                if ($this->isComplete())
                {
                        $complete = 1;
                }

                $params = $this->buildParams();
                $estw_time = $this->getEstimatedWorkingTime();
                $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
                $original_id = $original_id ? $ilDB->quote($original_id) : "NULL";

                // cleanup RTE images which are not inserted into the question text
                include_once("./Services/RTE/classes/class.ilRTE.php");

                if ($this->id == -1)
                {
                        // Neuen Datensatz schreiben
                        $now = getdate();
                        $question_type = $this->getQuestionType();
                        $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
                        $query = sprintf("INSERT INTO qpl_questions (question_id, question_type_fi, obj_fi, title, comment, author, owner, question_text, points, working_time, complete, created, original_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
                                $ilDB->quote($this->getQuestionTypeID() . ""),
                                $ilDB->quote($this->obj_id . ""),
                                $ilDB->quote($this->title . ""),
                                $ilDB->quote($this->comment . ""),
                                $ilDB->quote($this->author . ""),
                                $ilDB->quote($this->owner . ""),
                                $ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->question, 0)),
                                $ilDB->quote($this->points . ""),
                                $ilDB->quote($estw_time . ""),
                                $ilDB->quote($complete . ""),
                                $ilDB->quote($created . ""),
                                $original_id
                        );

                        $result = $ilDB->query($query);
                        if ($result == DB_OK)
                        {
                                $this->id = $ilDB->getLastInsertId();
                                $query = sprintf("INSERT INTO qpl_question_flashapp (question_fi, flash_file, params) VALUES (%s, %s, %s)",
                                        $ilDB->quote($this->id . ""),
                                        $ilDB->quote($this->flash_filename . ""),
                                        $ilDB->quote($params . "")
                                );
                                $ilDB->query($query);

                                // create page object of question
                                $this->createPageObject();

                                if ($this->getTestId() > 0)
                                {
                                        $this->insertIntoTest($this->getTestId());
                                }
                        }
                }
                else
                {
                        // Vorhandenen Datensatz aktualisieren
                        $query = sprintf("UPDATE qpl_questions SET obj_fi = %s, title = %s, comment = %s, author = %s, question_text = %s, points = %s, working_time=%s, complete = %s WHERE question_id = %s",
                                $ilDB->quote($this->obj_id. ""),
                                $ilDB->quote($this->title . ""),
                                $ilDB->quote($this->comment . ""),
                                $ilDB->quote($this->author . ""),
                                $ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->question, 0)),
                                $ilDB->quote($this->points . ""),
                                $ilDB->quote($estw_time . ""),
                                $ilDB->quote($complete . ""),
                                $ilDB->quote($this->id . "")
                        );
                        $result = $ilDB->query($query);
                        $query = sprintf("UPDATE qpl_question_flashapp SET flash_file = %s, params = %s WHERE question_fi = %s",
                                $ilDB->quote($this->flash_filename . ""),
                                $ilDB->quote($params . ""),
                                $ilDB->quote($this->id . "")
                        );
                        $result = $ilDB->query($query);
                }
                parent::saveToDb($original_id);
        }

Here is the call graph for this function:

assFlashApp::saveWorkingData ( active_id,
pass = NULL 
)

Saves the learners input of the question to the database.

Saves the learners input of the question to the database

Parameters:
integer $test_id The database id of the test containing this question
Returns:
boolean Indicates the save status (true if saved successful, false otherwise) public
See also:
$answers

Reimplemented from assQuestion.

Definition at line 789 of file class.assFlashApp.php.

        {
    parent::saveWorkingData($active_id, $pass);
                return true;
  }

assFlashApp::setFlashFilename ( flash_filename,
javaapplet_tempfilename = "" 
)

Sets the Flash Application file name.

Sets the Flash Application file name

Parameters:
string $javaapplet_file. public
See also:
$flash_filename

Definition at line 818 of file class.assFlashApp.php.

References $flash_filename, assQuestion::getFlashPath(), ilUtil::makeDirParents(), and ilUtil::moveUploadedFile().

        {
                if (!empty($flash_filename))
                {
                        $this->flash_filename = $flash_filename;
                }
                if (!empty($javaapplet_tempfilename))
                {
                        $javapath = $this->getFlashPath();
                        if (!file_exists($javapath))
                        {
                                ilUtil::makeDirParents($javapath);
                        }
                        
                        //if (!move_uploaded_file($javaapplet_tempfilename, $javapath . $flash_filename))
                        if (!ilUtil::moveUploadedFile($javaapplet_tempfilename, $flash_filename, $javapath.$flash_filename))
                        {
                                print "Flash Application not uploaded!!!! ";
                        }
                        else
                        {
                                //$this->setJavaCodebase();
                                //$this->setJavaArchive();
                        }
                }
        }

Here is the call graph for this function:

assFlashApp::setFlashHeight ( flash_height = ""  ) 

Sets the Flash Application height parameter.

Sets the Flash Application height parameter

Parameters:
integer Flash Application height parameter public

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

References $flash_height.

        {
                $this->flash_height = $flash_height;
        }

assFlashApp::setFlashWidth ( flash_width = ""  ) 

Sets the Flash Application width parameter.

Sets the Flash Application width parameter

Parameters:
integer Flash Application width parameter public

Definition at line 538 of file class.assFlashApp.php.

References $flash_width.

        {
                $this->flash_width = $flash_width;
        }

assFlashApp::setQuestion ( question = ""  ) 

Sets the question text.

Sets the question string of the assFlashApp object

Parameters:
string $question A string containing the question text public
See also:
$question

Reimplemented from assQuestion.

Definition at line 498 of file class.assFlashApp.php.

References $question.

        {
                $this->question = $question;
        }

assFlashApp::splitParams ( params = ""  ) 

Sets the applet parameters from a parameter string containing all parameters in a list.

Sets the applet parameters from a parameter string containing all parameters in a list

Parameters:
string $params All applet parameters in a list public

Definition at line 123 of file class.assFlashApp.php.

Referenced by loadFromDb().

        {
                $params_array = split("<separator>", $params);
                foreach ($params_array as $pair)
                {
                        if (preg_match("/(.*?)\=(.*)/", $pair, $matches))
                        {
                                switch ($matches[1])
                                {
                                        case "flash_width" :
                                                $this->flash_width = $matches[2];
                                                break;
                                        case "flash_height" :
                                                $this->flash_height = $matches[2];
                                                break;
                                }
                                if (preg_match("/param_name_(\d+)/", $matches[1], $found_key))
                                {
                                        $this->parameters[$found_key[1]]["name"] = $matches[2];
                                }
                                if (preg_match("/param_value_(\d+)/", $matches[1], $found_key))
                                {
                                        $this->parameters[$found_key[1]]["value"] = $matches[2];
                                }
                        }
                }
        }

Here is the caller graph for this function:

assFlashApp::syncWithOriginal (  ) 

Reimplemented from assQuestion.

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

References assQuestion::getEstimatedWorkingTime(), and isComplete().

        {
                global $ilDB;
                
                if ($this->original_id)
                {
                        $complete = 0;
                        if ($this->isComplete())
                        {
                                $complete = 1;
                        }
        
                        $estw_time = $this->getEstimatedWorkingTime();
                        $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
        
                        $query = sprintf("UPDATE qpl_questions SET obj_fi = %s, title = %s, comment = %s, author = %s, question_text = %s, points = %s, working_time=%s, complete = %s WHERE question_id = %s",
                                $ilDB->quote($this->obj_id. ""),
                                $ilDB->quote($this->title . ""),
                                $ilDB->quote($this->comment . ""),
                                $ilDB->quote($this->author . ""),
                                $ilDB->quote($this->question . ""),
                                $ilDB->quote($this->points . ""),
                                $ilDB->quote($estw_time . ""),
                                $ilDB->quote($complete . ""),
                                $ilDB->quote($this->original_id . "")
                        );
                        $result = $ilDB->query($query);
                        $query = sprintf("UPDATE qpl_question_flashapp SET flash_file = %s, params = %s WHERE question_fi = %s",
                                $ilDB->quote($this->flash_filename . ""),
                                $ilDB->quote($params . ""),
                                $ilDB->quote($this->original_id . "")
                        );
                        $result = $ilDB->query($query);

                        parent::syncWithOriginal();
                }
        }

Here is the call graph for this function:

assFlashApp::writeTmpFile ( tmp_data  ) 

Writes the temporary file which includes all parameters for the flash question.

The name of the file is the actual session number. It will be saved in the data/[client_id]/assesment/flash/tmp directory

Returns:
boolean Success of creating the tmp File public

Definition at line 924 of file class.assFlashApp.php.

References ilUtil::makeDirParents(), and ilUtil::removeTrailingPathSeparators().

        {
        // tmp directory erzeugen 
        $tmp_flash_dir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/flash/tmp";
        //echo $tmp_flash_dir;
        if (    ilUtil::makeDirParents($tmp_flash_dir)) 
                

            $fp = @fopen ($tmp_flash_dir."/".$_COOKIE["PHPSESSID"], "w");

                        
                        if ($fp == false)
                        {
                                die("FlashApp tmp file: cannot create file.");
                        }

                        if (fwrite($fp,$tmp_data) == -1)
                        {
                                die("FlashApp tmp file: cannot write to file. Please check Writepermissions.");
                        }

                        fclose($fp);
        
                return true;
        }       

Here is the call graph for this function:


Field Documentation

assFlashApp::$flash_filename

Definition at line 55 of file class.assFlashApp.php.

Referenced by assFlashApp(), and setFlashFilename().

assFlashApp::$flash_height

Definition at line 74 of file class.assFlashApp.php.

Referenced by setFlashHeight().

assFlashApp::$flash_width

Definition at line 65 of file class.assFlashApp.php.

Referenced by setFlashWidth().

assFlashApp::$parameters

Definition at line 83 of file class.assFlashApp.php.

assFlashApp::$question

Reimplemented from assQuestion.

Definition at line 46 of file class.assFlashApp.php.

Referenced by assFlashApp(), and setQuestion().


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