aboutsummaryrefslogtreecommitdiff
path: root/lib/evaluation/classes/HTMLempty.class.php
diff options
context:
space:
mode:
authorPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
committerPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
commit4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch)
tree5c07151ae61276d334e88f6309c30d439a85c12e /lib/evaluation/classes/HTMLempty.class.php
parentda0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff)
parent97a188592c679890a25c37ab78463add76a52ff7 (diff)
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/evaluation/classes/HTMLempty.class.php')
-rw-r--r--lib/evaluation/classes/HTMLempty.class.php184
1 files changed, 0 insertions, 184 deletions
diff --git a/lib/evaluation/classes/HTMLempty.class.php b/lib/evaluation/classes/HTMLempty.class.php
deleted file mode 100644
index 574816f..0000000
--- a/lib/evaluation/classes/HTMLempty.class.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
- * HTML-class for the Stud.IP-project.
- * Based on scripts from "http://tut.php-q.net/".
- *
- * @author Alexander Willner <mail@AlexanderWillner.de>
- *
- * @copyright 2004 Stud.IP-Project
- * @access public
- * @package evaluation
- * @modulegroup evaluation_modules
- *
- */
-
-// +--------------------------------------------------------------------------+
-// This file is part of Stud.IP
-// Copyright (C) 2001-2004 Stud.IP
-// +--------------------------------------------------------------------------+
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or any later version.
-// +--------------------------------------------------------------------------+
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// +--------------------------------------------------------------------------+
-
-class HTMLempty
-{
-
-# Define all required variables ============================================= #
- /**
- * Holds the name of the element.
- *
- * @access private
- * @var string $_name
- */
- var $_name = "";
-
- /**
- * Holds the attributes of the element.
- *
- * @access private
- * @var array $_attribute
- */
- var $_attribute = [];
-
- /**
- * Holds additional attributes (strings generated from studip functions)
- *
- * @access private
- * @var array $_string
- */
- var $_string = "";
-# ============================================================ end: variables #
-
-
-# Define constructor and destructor ========================================= #
- public function __construct($name)
- {
- if (preg_match('/^[a-zA-Z.:][\w\-_\.:]*$/i', $name)) {
- $this->_name = $name;
- } else {
- trigger_error("Unerlaubter Name für ein HTML-Element : '" . $name . "'", E_USER_ERROR);
- }
- }
-
- /**
- *
- */
- public function addAttr($name, $wert = null)
- {
- if (isset ($wert)) {
- $name = (string)$name;
- if (preg_match('/^[a-zA-Z.:][\w\-_\.:]*$/i', $name)) {
- $this->_attribute[$name] = $wert;
- } else {
- trigger_error("Unerlaubter Name für ein HTML-Attribut : '" . $name . "'", E_USER_ERROR);
- }
- } else {
- if (is_scalar($name)) {
- // Dies braucht man, falls man Attribute hinzufügen
- // will, die keinen Wert haben, wie man es bei
- // <option selected> kennt
- if (preg_match('/^[a-zA-Z\.:][\w\-_\.:]*$/i', $name)) {
- $this->_attribute[$name] = $name;
- // Da wir gültiges HTML bzw XML schreiben
- // muss jedes Attribut auch einen Wert haben
- // selected wird dann zu selected="selected"
- } else {
- trigger_error("Unerlaubter Name für ein HTML-Attribut : '" . $name . "'", E_USER_ERROR);
- }
- } elseif (is_array($name)) {
- // Jedes Arrayelement durchgehen
- foreach ($name as $key => $wert) {
- if (is_int($key)) {
- // Arrayelement wurde mit $foo[] hinzugefügt
- // also ohne Schlüssel. Ich nehme dann an
- // das es sich um ein Attribut wie
- // 'selected' oder 'readonly' handelt
- if (preg_match('/^[a-zA-Z\.:][\w\-_\.:]*$/i', $wert)) {
- $this->_attribute[$wert] = $wert;
- } else {
- trigger_error("Unerlaubter Name für ein HTML-Attribut : '" .
- $wert . "'", E_USER_ERROR);
- }
- } else {
- $key = (string)$key;
- if (preg_match('/^[a-zA-Z\.:][\w\-_\.:]*$/i', $key)) {
- $this->_attribute[$key] = $wert;
- } else {
- trigger_error("Unerlaubter Name für ein HTML-Attribut : '" .
- $key . "'", E_USER_ERROR);
- }
- }
- }
- } else {
- trigger_error("Erster Parameter muss ein Scalar oder ein Array sein",
- E_USER_ERROR);
- }
- }
- }
-
- /**
- * to support Stud.IP legacy functions like makeButton...
- */
- public function addString($string)
- {
- if (is_array($string)) {
- $string = implode(' ', $string);
- }
- $this->_string .= " " . $string;
- }
-
- /**
- *
- */
- public function getName()
- {
- return $this->_name;
- }
-
- /**
- *
- */
- public function getAttr()
- {
- return $this->_attribute;
- }
-
- /**
- *
- */
- public function printContent($indent = 0)
- {
- echo $this->createContent($indent);
- }
-
- /**
- *
- */
- public function createContent($indent = 0)
- {
- $str = str_repeat(' ', $indent);
- $str .= "<" . $this->getName();
- $attrib = $this->getAttr();
- foreach ($attrib as $name => $value) {
- $str .= ' ' . $name . '="' . htmlReady($value) . '"';
- }
- $str .= $this->_string;
- $str .= ">\n";
-
- return ($str);
- }
-}