Public Member Functions | Data Fields

ilErrorHandling Class Reference

Inheritance diagram for ilErrorHandling:
Collaboration diagram for ilErrorHandling:

Public Member Functions

 ilErrorHandling ()
 Constructor public.
 errorHandler ($a_error_obj)
 defines what has to happen in case of error private

Data Fields

 $DEBUG_ENV
 $FATAL
 $WARNING
 $MESSAGE

Detailed Description

Definition at line 36 of file class.ilErrorHandling.php.


Member Function Documentation

ilErrorHandling::errorHandler ( a_error_obj  ) 

defines what has to happen in case of error private

Parameters:
object Error

Definition at line 86 of file class.ilErrorHandling.php.

References $_POST, $_SESSION, $dirname, $log, and ilUtil::redirect().

        {
                global $log;

                if ($_SESSION["message"])
                {
                        $m = "Fatal Error: Called raise error two times.<br>".
                                "First error: ".$_SESSION["message"];
                        //return;
                        $log->logError($a_error_obj->getCode(), $m);
                        unset($_SESSION["message"]);
                        die ($m);
                }

                if (is_object($log) and $log->enabled == true)
                {
                        $log->logError($a_error_obj->getCode(),$a_error_obj->getMessage());
                }
//echo $a_error_obj->getCode().":"; exit;
                if ($a_error_obj->getCode() == $this->FATAL)
                {
                        die (stripslashes($a_error_obj->getMessage()));
                }

                if ($a_error_obj->getCode() == $this->WARNING)
                {
                        if ($this->DEBUG_ENV)
                        {
                                $message = $a_error_obj->getMessage();
                        }
                        else
                        {
                                $message = "Under Construction";
                        }

                        $_SESSION["message"] = $message;

                        if (!defined("ILIAS_MODULE"))
                        {
                                ilUtil::redirect("error.php");
                        }
                        else
                        {
                                ilUtil::redirect("../error.php");
                        }
                }

                if ($a_error_obj->getCode() == $this->MESSAGE)
                {
                        $_SESSION["message"] = $a_error_obj->getMessage();
                        // save post vars to session in case of error
                        $_SESSION["error_post_vars"] = $_POST;

                        if (empty($_SESSION["referer"]))
                        {
                                $dirname = dirname($_SERVER["PHP_SELF"]);
                                $ilurl = parse_url(ILIAS_HTTP_PATH);
                                $subdir = substr(strstr($dirname,$ilurl["path"]),strlen($ilurl["path"]));
                                $updir = "";

                                if ($subdir)
                                {
                                        $num_subdirs = substr_count($subdir,"/");

                                        for ($i=1;$i<=$num_subdirs;$i++)
                                        {
                                                $updir .= "../";
                                        }
                                }

                                ilUtil::redirect($updir."index.php");
                        }

                        // check if already GET-Parameters exists in Referer-URI
                        if (substr($_SESSION["referer"],-4) == ".php")
                        {
                                $glue = "?";
                        }
                        else
                        {
                                $glue = "&";
                        }

                        ilUtil::redirect($_SESSION["referer"].$glue);
                }
        }

Here is the call graph for this function:

ilErrorHandling::ilErrorHandling (  ) 

Constructor public.

Definition at line 70 of file class.ilErrorHandling.php.

        {
                $this->PEAR();
                
                // init vars
                $this->DEBUG_ENV = true;
                $this->FATAL     = 1;
                $this->WARNING   = 2;
                $this->MESSAGE   = 3;
        }


Field Documentation

ilErrorHandling::$DEBUG_ENV

Definition at line 43 of file class.ilErrorHandling.php.

ilErrorHandling::$FATAL

Definition at line 50 of file class.ilErrorHandling.php.

ilErrorHandling::$MESSAGE

Definition at line 64 of file class.ilErrorHandling.php.

ilErrorHandling::$WARNING

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


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