Skip to content
Snippets Groups Projects
Commit fd49ac1d authored by David Siegfried's avatar David Siegfried
Browse files

remove obsolete code, refs #1121

Merge request studip/studip!879
parent 2e319c4d
No related branches found
No related tags found
No related merge requests found
......@@ -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')
);
......
......@@ -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'];
if (is_array($_SESSION['selected_clipboard_items'])) {
$this->current_selected_items = $_SESSION['selected_clipboard_items'];
if (!is_array($this->current_selected_items)) {
$this->current_selected_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,
......
......@@ -14,8 +14,6 @@
<? endforeach ?>
<? endif ?>
</select>
<? if (!$readonly): ?>
<input class="clipboard-name invisible" type="text" name="clipboard_name" value="">
<?= Icon::create('edit')->asInput(
[
......@@ -44,7 +42,6 @@
'data-confirm-message' => _('Sind Sie sicher?')
]
) ?>
<? endif ?>
</div>
<div class="clipboard-area-container">
<? if ($clipboards): ?>
......@@ -74,7 +71,6 @@
[
'item' => $item,
'draggable_items' => $draggable_items,
'readonly' => $readonly,
'checkbox_id' => $checkbox_id
]
) ?>
......@@ -98,7 +94,6 @@
<?= htmlReady($item['name']) ?>
</label>
</td>
<? if (!$readonly): ?>
<td class="actions">
<?= Icon::create('trash')->asInput(
[
......@@ -108,7 +103,6 @@
]
) ?>
</td>
<? endif ?>
</tr>
<? endif ?>
<? endforeach ?>
......@@ -138,7 +132,6 @@
value=""
class="item-id">
</td>
<? if (!$readonly): ?>
<td class="item-actions">
<?= Icon::create('trash')->asInput(
[
......@@ -146,7 +139,6 @@
]
) ?>
</td>
<? endif ?>
</tr>
<? endif ?>
</table>
......@@ -195,13 +187,4 @@
<? endif ?>
</table>
</div>
<? if ($readonly): ?>
<?= \Studip\Button::create(
$apply_button_title,
'clipboard_update_session_special_action',
[
'class' => 'apply-button'
]
) ?>
<? endif ?>
</form>
......@@ -19,7 +19,6 @@
<? endforeach; ?>
</ul>
<? if (!$readonly): ?>
<form class="default new-clipboard-form"
action="<?= URLHelper::getLink(
'dispatch.php/clipboard/add'
......@@ -33,7 +32,7 @@
<label>
<?= _('Merkzettel hinzufügen') ?>
<?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um einen neuen Merkzettel zu erstellen.')) ?>
<input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>"
<input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>">
</label>
<?= Icon::create(
......@@ -46,4 +45,3 @@
'disabled' => 'disabled'
]) ?>
</form>
<? endif ?>
......@@ -66,13 +66,11 @@ if (!$item) {
]
)?>
</a>
<? if (!$readonly): ?>
<?= Icon::create('trash')->asInput(
[
'data-confirm-message' => _('Sind Sie sicher?'),
'class' => 'text-bottom clipboard-item-remove-button'
]
) ?>
<? endif ?>
</td>
</tr>
......@@ -20,7 +20,6 @@
<? endforeach; ?>
</ul>
</div>
<? if (!$readonly): ?>
<form class="default new-clipboard-form"
action="<?= URLHelper::getLink(
'dispatch.php/clipboard/add'
......@@ -46,4 +45,3 @@
</label>
</form>
<? endif ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment