From fd49ac1d71c3e5712de8a4a857c0c32c83ebbf6d Mon Sep 17 00:00:00 2001 From: David Siegfried Date: Fri, 19 Aug 2022 19:13:16 +0000 Subject: remove obsolete code, refs #1121 Merge request studip/studip!879 --- app/controllers/room_management/planning.php | 5 +-- lib/classes/sidebar/ClipboardWidget.class.php | 60 ++------------------------- templates/sidebar/clipboard-area.php | 49 +++++++--------------- templates/sidebar/clipboard-widget.php | 52 +++++++++++------------ templates/sidebar/room-clipboard-item.php | 14 +++---- templates/sidebar/room-clipboard-widget.php | 48 ++++++++++----------- 6 files changed, 75 insertions(+), 153 deletions(-) diff --git a/app/controllers/room_management/planning.php b/app/controllers/room_management/planning.php index 7aafe68..74ea008 100644 --- a/app/controllers/room_management/planning.php +++ b/app/controllers/room_management/planning.php @@ -44,7 +44,7 @@ class RoomManagement_PlanningController extends AuthenticatedController $sidebar = Sidebar::get(); $views = new ViewsWidget(); - if ($GLOBALS['user']->id && ($GLOBALS['user']->id != 'nobody')) { + if ($GLOBALS['user']->id && ($GLOBALS['user']->id !== 'nobody')) { $views->addLink( _('Standard Zeitfenster'), URLHelper::getURL( @@ -82,7 +82,6 @@ class RoomManagement_PlanningController extends AuthenticatedController //Add clipboard widget: $clipboard_widget = new RoomClipboardWidget(); - $clipboard_widget->setReadonly(true); $clipboard_widget->setApplyButtonTitle( _('Anzeigen') ); @@ -382,7 +381,6 @@ class RoomManagement_PlanningController extends AuthenticatedController //Add clipboard widget: $clipboard_widget = new RoomClipboardWidget(); - $clipboard_widget->setReadonly(true); $clipboard_widget->setApplyButtonTitle( _('Anzeigen') ); @@ -1102,7 +1100,6 @@ class RoomManagement_PlanningController extends AuthenticatedController //Add clipboard widget: $clipboard_widget = new RoomClipboardWidget(); - $clipboard_widget->setReadonly(true); $clipboard_widget->setApplyButtonTitle( _('Anzeigen') ); diff --git a/lib/classes/sidebar/ClipboardWidget.class.php b/lib/classes/sidebar/ClipboardWidget.class.php index 376e47e..9de627d 100644 --- a/lib/classes/sidebar/ClipboardWidget.class.php +++ b/lib/classes/sidebar/ClipboardWidget.class.php @@ -10,9 +10,8 @@ */ class ClipboardWidget extends SidebarWidget { - protected $allowed_item_class; protected $draggable_items; - + protected $current_selected_items = []; /** * clipboard_widget_id is required in the case that multiple @@ -49,7 +48,7 @@ class ClipboardWidget extends SidebarWidget //Check if all allowed item classes are SimpleORMap objects //and if the classes implement the StudipItem interface: foreach ($allowed_item_classes as $class) { - if (!is_subclass_of($class, 'StudipItem', true)) { + if (!is_subclass_of($class, 'StudipItem')) { throw new InvalidArgumentException( sprintf( 'The class %s does not implement the StudipItem interface which is required for clipboard items!', @@ -66,17 +65,14 @@ class ClipboardWidget extends SidebarWidget $this->allowed_item_classes = $allowed_item_classes; $this->template = 'sidebar/clipboard-widget'; $this->title = _('Eigene Merkzettel'); - $this->readonly = false; $this->apply_button_title = _('Hauptbereich aktualisieren'); $this->clipboard_widget_id = md5(uniqid('clipboard_widget_id')); - $this->draggable_items = false; $this->updateSessionVariables(); $this->current_clipboard_id = $_SESSION['selected_clipboard_id']; - $this->current_selected_items = $_SESSION['selected_clipboard_items']; - if (!is_array($this->current_selected_items)) { - $this->current_selected_items = []; + if (is_array($_SESSION['selected_clipboard_items'])) { + $this->current_selected_items = $_SESSION['selected_clipboard_items']; } $this->setId("ClipboardWidget_{$this->clipboard_widget_id}"); @@ -84,14 +80,6 @@ class ClipboardWidget extends SidebarWidget $this->addLayoutCSSClass('clipboard-widget'); } - - public function clearSessionVariables() - { - $_SESSION['selected_clipboard_id'] = null; - $_SESSION['selected_clipboard_items'] = []; - } - - /** * Updates session variables if a special POST request is made. */ @@ -109,37 +97,6 @@ class ClipboardWidget extends SidebarWidget } } - - /** - * Enables clipboard items to be dragged to the main area of the page. - */ - public function enableDraggableItems() - { - $this->draggable_items = true; - } - - - /** - * Disables the dragging of clipboard items. - */ - public function disableDraggableItems() - { - $this->draggable_items = false; - } - - - public function setReadonly($readonly = false) - { - $this->readonly = (bool)$readonly; - } - - - public function isReadonly() - { - return $this->readonly; - } - - public function setApplyButtonTitle($title = '') { if ($title) { @@ -147,19 +104,11 @@ class ClipboardWidget extends SidebarWidget } } - - public function getApplyButtonTitle() - { - return $this->apply_button_title; - } - - public function getClipboardWidgetId() { return $this->clipboard_widget_id; } - public function render($variables = []) { $clipboards = Clipboard::getClipboardsForUser( @@ -177,7 +126,6 @@ class ClipboardWidget extends SidebarWidget 'allowed_item_classes' => $this->allowed_item_classes, 'clipboard_widget_id' => $this->clipboard_widget_id, 'draggable_items' => $this->draggable_items, - 'readonly' => $this->readonly, 'apply_button_title' => $this->apply_button_title, 'elements' => $this->elements, 'selected_clipboard_id' => $this->current_clipboard_id, diff --git a/templates/sidebar/clipboard-area.php b/templates/sidebar/clipboard-area.php index 64c3d03..dd8f676 100644 --- a/templates/sidebar/clipboard-area.php +++ b/templates/sidebar/clipboard-area.php @@ -14,8 +14,6 @@ - - asInput( [ @@ -44,7 +42,6 @@ 'data-confirm-message' => _('Sind Sie sicher?') ] ) ?> -
@@ -74,7 +71,6 @@ [ 'item' => $item, 'draggable_items' => $draggable_items, - 'readonly' => $readonly, 'checkbox_id' => $checkbox_id ] ) ?> @@ -98,17 +94,15 @@ - - - asInput( - [ - 'title' => sprintf(_('%s löschen.'), htmlReady($item['name'])), - 'data-confirm-message' => _('Sind Sie sicher?'), - 'class' => 'text-bottom clipboard-item-remove-button' - ] - ) ?> - - + + asInput( + [ + 'title' => sprintf(_('%s löschen.'), htmlReady($item['name'])), + 'data-confirm-message' => _('Sind Sie sicher?'), + 'class' => 'text-bottom clipboard-item-remove-button' + ] + ) ?> + @@ -138,15 +132,13 @@ value="" class="item-id"> - - - asInput( - [ - 'class' => 'text-bottom clipboard-item-remove-button' - ] - ) ?> - - + + asInput( + [ + 'class' => 'text-bottom clipboard-item-remove-button' + ] + ) ?> + @@ -195,13 +187,4 @@
- - 'apply-button' - ] - ) ?> - diff --git a/templates/sidebar/clipboard-widget.php b/templates/sidebar/clipboard-widget.php index 46015e7..ccb44b2 100644 --- a/templates/sidebar/clipboard-widget.php +++ b/templates/sidebar/clipboard-widget.php @@ -19,31 +19,29 @@ - -
- - - -