Public Member Functions | Data Fields

ilObjAssessmentFolder Class Reference

Class ilObjAssessmentFolder. More...

Inheritance diagram for ilObjAssessmentFolder:
Collaboration diagram for ilObjAssessmentFolder:

Public Member Functions

 ilObjAssessmentFolder ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 update ()
 update object data
 delete ()
 delete object and all related data
 initDefaultRoles ()
 init default roles settings
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
 _enableAssessmentLogging ($a_enable)
 enable assessment logging
 _setLogLanguage ($a_language)
 set the log language
 _enabledAssessmentLogging ()
 check wether assessment logging is enabled or not
 _getForbiddenQuestionTypes ()
 Returns the forbidden questiontypes for ILIAS.
 _setForbiddenQuestionTypes ($a_types)
 Sets the forbidden questiontypes for ILIAS.
 _getLogLanguage ()
 retrieve the log language for assessment logging
 _getManualScoring ()
 Retrieve the manual scoring settings.
 _getManualScoringTypes ()
 Retrieve the manual scoring settings as type strings.
 _setManualScoring ($type_ids)
 Set the manual scoring settings.
 _addLog ($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $ref_id=NULL)
 Add an assessment log entry.
getLog ($ts_from, $ts_to, $test_id, $test_only=FALSE)
 Retrieve assessment log datasets from the database.
_getLog ($ts_from, $ts_to, $test_id, $test_only=FALSE)
 Retrieve assessment log datasets from the database.
 getNrOfLogEntries ($test_obj_id)
 Returns the number of log entries for a given test id.
 getFullPath ($ref_id)
 Returns the full path output of an object.
 deleteLogEntries ($a_array)
 Deletes the log entries for a given array of test object IDs.

Data Fields

 $setting

Detailed Description

Class ilObjAssessmentFolder.

Author:
Helmut Schottmüller <hschottm@gmx.de>
Version:
Id:
class.ilObjAssessmentFolder.php 14007 2007-05-30 11:13:46Z hschottm

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


Member Function Documentation

ilObjAssessmentFolder::_addLog ( user_id,
object_id,
logtext,
question_id = "",
original_id = "",
test_only = FALSE,
ref_id = NULL 
)

Add an assessment log entry.

Add an assessment log entry

Parameters:
integer $user_id The user id of the acting user
integer $object_id The database id of the modified test object
string $logtext The textual description for the log entry
integer $question_id The database id of a modified question (optional)
integer $original_id The database id of the original of a modified question (optional)
Returns:
array Array containing the datasets between $ts_from and $ts_to for the test with the id $test_id

Definition at line 335 of file class.ilObjAssessmentFolder.php.

References ilObject::$ref_id.

Referenced by assQuestion::_logAction(), deleteLogEntries(), assQuestion::logAction(), ilObjTest::logAction(), and ASS_MarkSchema::logAction().

        {
                global $ilUser, $ilDB;
                if (strlen($question_id) == 0)
                {
                        $question_id = "NULL";
                }
                else
                {
                        $question_id = $ilDB->quote($question_id . "");
                }
                if (strlen($original_id) == 0)
                {
                        $original_id = "NULL";
                }
                else
                {
                        $original_id = $ilDB->quote($original_id . "");
                }
                $only = "0";
                if ($test_only == TRUE)
                {
                        $only = "1";
                }
                $test_ref_id = "NULL";
                if ($ref_id > 0)
                {
                        $test_ref_id = $ilDB->quote($ref_id . "");
                }
                $query = sprintf("INSERT INTO ass_log (ass_log_id, user_fi, obj_fi, logtext, question_fi, original_fi, test_only, ref_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, NULL)",
                        $ilDB->quote($user_id . ""),
                        $ilDB->quote($object_id . ""),
                        $ilDB->quote($logtext . ""),
                        $question_id,
                        $original_id,
                        $ilDB->quote($only . ""),
                        $test_ref_id
                );
                $result = $ilDB->query($query);
        }

Here is the caller graph for this function:

ilObjAssessmentFolder::_enableAssessmentLogging ( a_enable  ) 

enable assessment logging

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

References $setting.

        {
                $setting = new ilSetting("assessment");

                if ($a_enable)
                {
                        $setting->set("assessment_logging", 1);
                }
                else
                {
                        $setting->set("assessment_logging", 0);
                }
        }

ilObjAssessmentFolder::_enabledAssessmentLogging (  ) 
ilObjAssessmentFolder::_getForbiddenQuestionTypes (  ) 

Returns the forbidden questiontypes for ILIAS.

Definition at line 223 of file class.ilObjAssessmentFolder.php.

References $setting.

Referenced by ilObjQuestionPool::_getQuestionTypes().

        {
                $setting = new ilSetting("assessment");
                $types = $setting->get("forbidden_questiontypes");
                $result = array();
                if (strlen(trim($types)) == 0)
                {
                        $result = array();
                }
                else
                {
                        $result = unserialize($types);
                }
                return $result;
        }

Here is the caller graph for this function:

& ilObjAssessmentFolder::_getLog ( ts_from,
ts_to,
test_id,
test_only = FALSE 
)

Retrieve assessment log datasets from the database.

Retrieve assessment log datasets from the database

Parameters:
string $ts_from Timestamp of the starting date/time period
string $ts_to Timestamp of the ending date/time period
integer $test_id Database id of the ILIAS test object
Returns:
array Array containing the datasets between $ts_from and $ts_to for the test with the id $test_id

Definition at line 438 of file class.ilObjAssessmentFolder.php.

References $log.

Referenced by ilObjTestGUI::historyObject().

        {
                global $ilDB;
                
                $log = array();
                if ($test_only == TRUE)
                {
                        $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM ass_log WHERE obj_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s AND test_only = %s ORDER BY TIMESTAMP14",
                                $ilDB->quote($test_id . ""),
                                $ilDB->quote($ts_from . ""),
                                $ilDB->quote($ts_to . ""),
                                $ilDB->quote("1")
                        );
                }
                else
                {
                        $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM ass_log WHERE obj_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s ORDER BY TIMESTAMP14",
                                $ilDB->quote($test_id . ""),
                                $ilDB->quote($ts_from . ""),
                                $ilDB->quote($ts_to . "")
                        );
                }
                $result = $ilDB->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if (!array_key_exists($row["TIMESTAMP14"], $log))
                        {
                                $log[$row["TIMESTAMP14"]] = array();
                        }
                        $type_href = "";
                        if (array_key_exists("ref_id", $row))
                        {
                                if ($row["ref_id"] > 0)
                                {
                                        $typequery = sprintf("SELECT object_data.type FROM object_data, object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = object_data.obj_id",
                                                $ilDB->quote($row["ref_id"])
                                        );
                                        $typequeryresult = $ilDB->query($typequery);
                                        if ($typequeryresult->numRows() == 1)
                                        {
                                                $typerow = $typequeryresult->fetchRow(DB_FETCHMODE_ASSOC);
                                                switch ($typerow["type"])
                                                {
                                                        case "tst":
                                                                $type_href = sprintf("goto.php?target=tst_%s&amp;client_id=" . CLIENT_ID, $row["ref_id"]);
                                                                break;
                                                        case "cat":
                                                                $type_href = sprintf("goto.php?target=cat_%s&amp;client_id=" . CLIENT_ID, $row["ref_id"]);
                                                                break;
                                                }
                                        }
                                }
                        }
                        $row["href"] = $type_href;
                        array_push($log[$row["TIMESTAMP14"]], $row);
                }
                krsort($log);
                // flatten array
                $log_array = array();
                foreach ($log as $key => $value)
                {
                        foreach ($value as $index => $row)
                        {
                                array_push($log_array, $row);
                        }
                }
                return $log_array;
        }

Here is the caller graph for this function:

ilObjAssessmentFolder::_getLogLanguage (  ) 
ilObjAssessmentFolder::_getManualScoring (  ) 

Retrieve the manual scoring settings.

Definition at line 273 of file class.ilObjAssessmentFolder.php.

References $setting.

Referenced by ilTestServiceGUI::getPassListOfAnswersWithScoring(), ilObjTestGUI::getTabs(), and ilTestScoringGUI::manscoring().

        {
                $setting = new ilSetting("assessment");

                $types = $setting->get("assessment_manual_scoring");
                return explode(",", $types);
        }

Here is the caller graph for this function:

ilObjAssessmentFolder::_getManualScoringTypes (  ) 

Retrieve the manual scoring settings as type strings.

Definition at line 284 of file class.ilObjAssessmentFolder.php.

References $setting.

Referenced by assQuestion::_needsManualScoring().

        {
                global $ilDB;
                
                $query = "SELECT * FROM qpl_question_type";
                $result = $ilDB->query($query);
                $dbtypes = array();
                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $dbtypes[$row["question_type_id"]] = $row["type_tag"];
                }
                $setting = new ilSetting("assessment");
                $types = $setting->get("assessment_manual_scoring");
                $ids = explode(",", $types);
                foreach ($ids as $key => $value)
                {
                        $ids[$key] = $dbtypes[$value];
                }
                return $ids;
        }

Here is the caller graph for this function:

ilObjAssessmentFolder::_setForbiddenQuestionTypes ( a_types  ) 

Sets the forbidden questiontypes for ILIAS.

Parameters:
array $a_types An array containing the database ID's of the forbidden question types

Definition at line 244 of file class.ilObjAssessmentFolder.php.

References $setting.

        {
                $setting = new ilSetting("assessment");
                $types = "";
                if (is_array($a_types) && (count($a_types) > 0))
                {
                        $types = serialize($a_types);
                }
                $setting->set("forbidden_questiontypes", $types);
        }

ilObjAssessmentFolder::_setLogLanguage ( a_language  ) 

set the log language

Definition at line 203 of file class.ilObjAssessmentFolder.php.

References $setting.

        {
                $setting = new ilSetting("assessment");

                $setting->set("assessment_log_language", $a_language);
        }

ilObjAssessmentFolder::_setManualScoring ( type_ids  ) 

Set the manual scoring settings.

Parameters:
array $type_ids An array containing the database ids of the question types which could be scored manually

Definition at line 310 of file class.ilObjAssessmentFolder.php.

References $setting.

        {
                $setting = new ilSetting("assessment");
                if ((!is_array($type_ids)) || (count($type_ids) == 0))
                {
                        $setting->delete("assessment_manual_scoring");
                }
                else
                {
                        $setting->set("assessment_manual_scoring", implode($type_ids, ","));
                }
        }

ilObjAssessmentFolder::delete (  ) 

delete object and all related data

public

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

Reimplemented from ilObject.

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

        {
                // always call parent delete function first!!
                if (!parent::delete())
                {
                        return false;
                }

                //put here your module specific stuff

                return true;
        }

ilObjAssessmentFolder::deleteLogEntries ( a_array  ) 

Deletes the log entries for a given array of test object IDs.

Deletes the log entries for a given array of test object IDs

Parameters:
array $a_array An array containing the object IDs of the tests

Definition at line 567 of file class.ilObjAssessmentFolder.php.

References _addLog().

        {
                global $ilDB;
                global $ilUser;
                
                foreach ($a_array as $object_id)
                {
                        $query = sprintf("DELETE FROM ass_log WHERE obj_fi = %s",
                                $ilDB->quote($object_id . "")
                        );
                        $ilDB->query($query);
                        $this->_addLog($ilUser->getId(), $object_id, $this->lng->txt("assessment_log_deleted"));
                }
        }

Here is the call graph for this function:

ilObjAssessmentFolder::getFullPath ( ref_id  ) 

Returns the full path output of an object.

Returns the full path output of an object

Parameters:
integer $ref_id The reference id of the object
Returns:
string The full path with hyperlinks to the path elements

Definition at line 540 of file class.ilObjAssessmentFolder.php.

References $data, ilObject::$id, ilObject::$ref_id, and ilUtil::prepareFormOutput().

        {
                global $tree;
                $path = $tree->getPathFull($ref_id);
                $pathelements = array();
                foreach ($path as $id => $data)
                {
                        if ($id == 0)
                        {
                                array_push($pathelements, ilUtil::prepareFormOutput($this->lng->txt("repository")));
                        }
                        else
                        {
                                array_push($pathelements, "<a href=\"./goto.php?target=" . $data["type"] . "_" . $data["ref_id"] . "&amp;client=" . CLIENT_ID . "\">" .
                                        ilUtil::prepareFormOutput($data["title"]) . "</a>");
                        }
                }
                return implode("&nbsp;&gt;&nbsp;", $pathelements);
        }

Here is the call graph for this function:

& ilObjAssessmentFolder::getLog ( ts_from,
ts_to,
test_id,
test_only = FALSE 
)

Retrieve assessment log datasets from the database.

Retrieve assessment log datasets from the database

Parameters:
string $ts_from Timestamp of the starting date/time period
string $ts_to Timestamp of the ending date/time period
integer $test_id Database id of the ILIAS test object
Returns:
array Array containing the datasets between $ts_from and $ts_to for the test with the id $test_id

Definition at line 386 of file class.ilObjAssessmentFolder.php.

References $log.

        {
                $log = array();
                if ($test_only == TRUE)
                {
                        $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM ass_log WHERE obj_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s AND test_only = %s ORDER BY TIMESTAMP14",
                                $this->ilias->db->quote($test_id . ""),
                                $this->ilias->db->quote($ts_from . ""),
                                $this->ilias->db->quote($ts_to . ""),
                                $this->ilias->db->quote("1")
                        );
                }
                else
                {
                        $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM ass_log WHERE obj_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s ORDER BY TIMESTAMP14",
                                $this->ilias->db->quote($test_id . ""),
                                $this->ilias->db->quote($ts_from . ""),
                                $this->ilias->db->quote($ts_to . "")
                        );
                }
                $result = $this->ilias->db->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if (!array_key_exists($row["TIMESTAMP14"], $log))
                        {
                                $log[$row["TIMESTAMP14"]] = array();
                        }
                        array_push($log[$row["TIMESTAMP14"]], $row);
                }
                krsort($log);
                // flatten array
                $log_array = array();
                foreach ($log as $key => $value)
                {
                        foreach ($value as $index => $row)
                        {
                                array_push($log_array, $row);
                        }
                }
                return $log_array;
        }

ilObjAssessmentFolder::getNrOfLogEntries ( test_obj_id  ) 

Returns the number of log entries for a given test id.

Returns the number of log entries for a given test id

Parameters:
integer $test_obj_id Database id of the ILIAS test object
Returns:
integer The number of log entries for the test object

Definition at line 515 of file class.ilObjAssessmentFolder.php.

        {
                $query = sprintf("SELECT COUNT(obj_fi) AS logcount FROM ass_log WHERE obj_fi = %s",
                        $this->ilias->db->quote($test_obj_id . "")
                );
                $result = $this->ilias->db->query($query);
                if ($result->numRows())
                {
                        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
                        return $row["logcount"];
                }
                else
                {
                        return 0;
                }
        }

ilObjAssessmentFolder::ilObjAssessmentFolder ( a_id = 0,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 45 of file class.ilObjAssessmentFolder.php.

References ilObject::ilObject().

        {
                include_once "./Services/Administration/classes/class.ilSetting.php";
                $this->setting = new ilSetting("assessment");
                $this->type = "assf";
                $this->ilObject($a_id,$a_call_by_reference);
        }

Here is the call graph for this function:

ilObjAssessmentFolder::initDefaultRoles (  ) 

init default roles settings

If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)

public

Returns:
array object IDs of created local roles.

Reimplemented from ilObject.

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

        {
                global $rbacadmin;

                // create a local role folder
                //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());

                // create moderator role and assign role to rolefolder...
                //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
                //$roles[] = $roleObj->getId();

                //unset($rfoldObj);
                //unset($roleObj);

                return $roles ? $roles : array();
        }

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

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

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

public

Parameters:
string event
integer reference id of object where the event occured
array passes optional parameters if required
Returns:
boolean

Reimplemented from ilObject.

Definition at line 130 of file class.ilObjAssessmentFolder.php.

References $_GET, and ilObject::getType().

        {
                global $tree;

                switch ($a_event)
                {
                        case "link":

                                //var_dump("<pre>",$a_params,"</pre>");
                                //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;

                        case "cut":

                                //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
                                //exit;
                                break;

                        case "copy":

                                //var_dump("<pre>",$a_params,"</pre>");
                                //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;

                        case "paste":

                                //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
                                //exit;
                                break;

                        case "new":

                                //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
                                //exit;
                                break;
                }

                // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
                if ($a_node_id==$_GET["ref_id"])
                {
                        $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
                        $parent_type = $parent_obj->getType();
                        if($parent_type == $this->getType())
                        {
                                $a_node_id = (int) $tree->getParentId($a_node_id);
                        }
                }

                parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
        }

Here is the call graph for this function:

ilObjAssessmentFolder::update (  ) 

update object data

public

Returns:
boolean

Reimplemented from ilObject.

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

        {
                if (!parent::update())
                {
                        return false;
                }

                // put here object specific stuff

                return true;
        }


Field Documentation

ilObjAssessmentFolder::$setting

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