diff --git a/lib/classes/AuthorObject.class.php b/lib/classes/AuthorObject.class.php index d5e35b601e4d67ac988b7d66955f7895b6fc3a27..b3e98e3a8ef6d22f1697610260d356502a52133f 100644 --- a/lib/classes/AuthorObject.class.php +++ b/lib/classes/AuthorObject.class.php @@ -51,20 +51,6 @@ class AuthorObject */ public $errorArray; - /** - * Holds the emailadress of the author - * @access private - * @var array $authorEmail - */ - public $authorEmail; - - /** - * Holds the name of the author - * @access private - * @var array $authorName - */ - public $authorName; - /** * Holds the type of object. See INSTANCEOF_* * @access private @@ -82,56 +68,6 @@ class AuthorObject $this->errorArray = []; } - - /** - * Destructor. Should be used every time after an object is not longer - * usefull! - * @access public - */ - public function finalize() - { - } - - /** - * Sets the emailaddress of the author - * @access public - * @param string $email The emailaddress - */ - public function setAuthorEmail($email) - { - $this->authorEmail = $email; - } - - /** - * Gets the emailaddress of the author - * @access public - * @return string The emailaddress - */ - public function getAuthorEmail() - { - return $this->authorEmail; - } - - /** - * Sets the name of the author - * @access public - * @param string $name The name - */ - public function setAuthorName($name) - { - $this->authorNmae = $name; - } - - /** - * Gets the name of the author - * @access public - * @return string The name - */ - public function getAuthorName() - { - return $this->authorName; - } - /** * Gets the type of object * @access public @@ -149,7 +85,7 @@ class AuthorObject */ public function isError() { - return (count($this->errorArray) != 0); + return count($this->errorArray) > 0; } /** @@ -176,33 +112,17 @@ class AuthorObject * @access public * @param integer $errcode The code of the error * @param string $errstring The description of the error - * @param integer $errline The line - * @param string $errfile The file - * @param integer $errtype Defines wheter the error is critical */ - public function throwError($errcode, $errstring, $errline = 0, $errfile = 0, $errtype = ERROR_NORMAL) + public function throwError($errcode, $errstring) { if (!is_array($this->errorArray)) { $this->errorArray = []; } - array_push($this->errorArray, - ["code" => $errcode, - "string" => $errstring, - "file" => $errfile, - "line" => $errline, - "type" => $errtype] - ); - if ($errtype == ERROR_CRITICAL) { - @mail($this->getAuthorEmail(), - "Critical error in Stud.IP", - "Hello " . $this->getAuthorName() . "\n\n" . - "there is an error in file " . $errfile . " " . - "in line " . $errline . ". \n" . - "The code is " . $errcode . "\n" . - "Description: " . $errstring . ".\n\n\n" . - "regards, *an AuthorObject*\n\n"); - } + $this->errorArray [] = [ + 'code' => $errcode, + 'string' => $errstring, + ]; } /** @@ -210,28 +130,10 @@ class AuthorObject * @access private * @param object $class The class with the error */ - public function throwErrorFromClass(&$class) + public function throwErrorFromClass(AuthorObject $class) { $this->errorArray = $class->getErrors(); $class->resetErrors(); } - - /** - * An errorHandler for PHP-errors - * @access private - * @param int $no Errornumber - * @param string $str Errordescription - * @param string $file Filename - * @param int $line Linenumber - * @param array $ctx All variables - */ - public function errorHandler($no, $str, $file, $line, $ctx) - { - if (!($no & error_reporting())) { - return; - } - $this->throwError($no, $str, $line, $file, ERROR_CRITICAL); - echo MessageBox::error("Schwerer PHP-Laufzeitfehler"); - } } diff --git a/lib/evaluation/classes/Evaluation.class.php b/lib/evaluation/classes/Evaluation.class.php index df8a2ce3bee73a1367d18a2cac9aa095561d6459..2fd240c739cbe0594d3ce562c5ffa189f12daa09 100644 --- a/lib/evaluation/classes/Evaluation.class.php +++ b/lib/evaluation/classes/Evaluation.class.php @@ -125,8 +125,6 @@ class Evaluation extends EvaluationObject implements PrivacyObject public function __construct($objectID = "", $parentObject = null, $loadChildren = EVAL_LOAD_NO_CHILDREN) { parent::__construct($objectID, $parentObject, $loadChildren); - $this->setAuthorEmail("mail@AlexanderWillner.de"); - $this->setAuthorName("Alexander Willner"); $this->instanceof = INSTANCEOF_EVAL; $this->rangeID = []; diff --git a/lib/evaluation/classes/EvaluationExportManager.class.php b/lib/evaluation/classes/EvaluationExportManager.class.php index 6155f3605a8eb6569d359835033beebf04b63fad..890a9a869fe02792aa5369760416ffa7a880dfed 100644 --- a/lib/evaluation/classes/EvaluationExportManager.class.php +++ b/lib/evaluation/classes/EvaluationExportManager.class.php @@ -121,8 +121,6 @@ class EvaluationExportManager extends AuthorObject register_shutdown_function([&$this, "_EvaluationExportManager"]); parent::__construct(); - $this->setAuthorEmail("mail@AlexanderWillner.de"); - $this->setAuthorName("Alexander Willner"); $this->instanceof = INSTANCEOF_EVALEXPORTMANAGER; $this->filename = ""; diff --git a/lib/evaluation/classes/EvaluationExportManagerCSV.class.php b/lib/evaluation/classes/EvaluationExportManagerCSV.class.php index ca3374f7e6fecc663231413827944944959bad56..7d8a47c69838015324492236ba447c028f56cd18 100644 --- a/lib/evaluation/classes/EvaluationExportManagerCSV.class.php +++ b/lib/evaluation/classes/EvaluationExportManagerCSV.class.php @@ -94,8 +94,6 @@ class EvaluationExportManagerCSV extends EvaluationExportManager { register_shutdown_function([&$this, "_EvaluationExportManagerCSV"]); ini_set('memory_limit', '256M'); parent::__construct($evalID); - $this->setAuthorEmail ("mail@AlexanderWillner.de"); - $this->setAuthorName ("Alexander Willner"); $this->instanceof = INSTANCEOF_EVALEXPORTMANAGERCSV; $this->extension = EVALEXPORT_EXTENSION; diff --git a/lib/evaluation/classes/EvaluationGroup.class.php b/lib/evaluation/classes/EvaluationGroup.class.php index daa04804b8f53b84b985f299bdedff257e525c76..fbe84af3bc6736d77d59e11c206eb74cc6fa0815 100644 --- a/lib/evaluation/classes/EvaluationGroup.class.php +++ b/lib/evaluation/classes/EvaluationGroup.class.php @@ -87,8 +87,6 @@ class EvaluationGroup extends EvaluationObject { $loadChildren = EVAL_LOAD_NO_CHILDREN) { /* Set default values ------------------------------------------------- */ parent::__construct($objectID, $parentObject, $loadChildren); - $this->setAuthorEmail ("mail@AlexanderWillner.de"); - $this->setAuthorName ("Alexander Willner"); $this->instanceof = INSTANCEOF_EVALGROUP; $this->childType = NULL; diff --git a/lib/evaluation/classes/EvaluationObject.class.php b/lib/evaluation/classes/EvaluationObject.class.php index 26b2d5ec3a655009ca67d74595dcfaf79501a276..4bb9423b5a09d30a085843aba312a01ea2c361ed 100644 --- a/lib/evaluation/classes/EvaluationObject.class.php +++ b/lib/evaluation/classes/EvaluationObject.class.php @@ -156,8 +156,6 @@ class EvaluationObject extends StudipObject { /* Set default values -------------------------------------------------- */ parent::__construct($objectID); - $this->setAuthorEmail ("mail@AlexanderWillner.de"); - $this->setAuthorName ("Alexander Willner"); $this->instanceof = INSTANCEOF_EVALOBJECT; $this->parentObject = $parentObject; diff --git a/lib/evaluation/classes/EvaluationTreeEditView.class.php b/lib/evaluation/classes/EvaluationTreeEditView.class.php index aa423949fbaa9bfe456b007be24d57cfa015b9f0..ef053c78a6da4e6d241be9da793c9afaabdaa1bc 100644 --- a/lib/evaluation/classes/EvaluationTreeEditView.class.php +++ b/lib/evaluation/classes/EvaluationTreeEditView.class.php @@ -3267,7 +3267,6 @@ class EvaluationTreeEditView else $group = &$this->tree->getGroupObject($parentID); $numberchildren = $group->getNumberChildren(); - $instance = $group->x_instanceof(); if ($direction == "up") { if ($oldposition == 0) diff --git a/lib/evaluation/evaluation.lib.php b/lib/evaluation/evaluation.lib.php index 6314454fa316b7039bf392276ce700418dfacc59..811e27db67ee5e9921c112cc0cbd47e8bbb5b3d3 100644 --- a/lib/evaluation/evaluation.lib.php +++ b/lib/evaluation/evaluation.lib.php @@ -163,48 +163,31 @@ class EvalCommon /** - * Creates an errormessage from an object - * @param object StudipObejct $object A Stud.IP-object + * @param $object + * @param string $errortitle + * @return MessageBox + * @deprecated */ - public static function showErsrorReport(&$object, $errortitle = "") + public static function createErrorReport(AuthorObject $object, string $errortitle = ''): MessageBox { $errors = $object->getErrors(); - if (empty ($errortitle)) { - if ($errors && count($errors) > 1) { - $errortitle = _("Es sind Fehler aufgetreten."); + + if (!$errortitle) { + if (count($errors) > 1) { + $errortitle = _('Es sind Fehler aufgetreten.'); } else { - $errortitle = _("Es ist ein Fehler aufgetreten."); + $errortitle = _('Es ist ein Fehler aufgetreten.'); } } - if (!$object->isError()) { - return MessageBox::success(_("Es ist kein Fehler aufgetreten")); - } else { - $details = []; - if (!empty($errors)) { - foreach ($errors as $error) { - $string = $error['string']; - if ($error["type"] == ERROR_CRITICAL) { - $string .= _("Datei: ") . $error["file"] . '<br>'; - $string .= _("Zeile: ") . $error["line"] . '<br>'; - - } - $details[] = $string; - } - } - return MessageBox::error($errortitle, $details); - } - } + $details = array_map( + function ($error) { + return "#{$error['code']}: {$error['string']}"; + }, + $errors + ); - /** - * @param $object - * @param string $errortitle - * @return MessageBox|object - * @deprecated - */ - public static function createErrorReport(&$object, $errortitle = "") - { - return MessageBox::error($errortitle); + return MessageBox::error($errortitle, $details); } /**