Skip to content
Snippets Groups Projects
Commit a569ce88 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

add action to clone an irregular date, fixes #3275

Closes #3275

Merge request studip/studip!3324
parent 8c8c1b9d
No related branches found
No related tags found
No related merge requests found
...@@ -363,6 +363,33 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -363,6 +363,33 @@ class Course_TimesroomsController extends AuthenticatedController
} }
/**
* Clone an existing date
*
* @param $termin_id
*/
public function cloneDate_action($termin_id)
{
$date = CourseDate::find($termin_id);
if ($date) {
$termin = CourseDate::build($date);
$termin->setId($termin->getNewId());
$termin->dozenten = $date->dozenten;
$termin->statusgruppen = $date->statusgruppen;
$termin->store();
PageLayout::postSuccess(sprintf(
_('Der Termin "%s" wurde dupliziert.'),
htmlReady($termin->getFullName())
));
}
$this->redirect('course/timesrooms/index');
}
/** /**
* Save date-information * Save date-information
* *
......
...@@ -126,6 +126,13 @@ $is_exTermin = $termin instanceof CourseExDate; ...@@ -126,6 +126,13 @@ $is_exTermin = $termin instanceof CourseExDate;
Icon::create('edit'), Icon::create('edit'),
['data-dialog' => ''] ['data-dialog' => '']
) ?> ) ?>
<? if (!$termin->metadate_id): ?>
<? $actionMenu->addLink(
$controller->url_for('course/timesrooms/cloneDate/' . $termin->id, $linkAttributes),
_('Termin duplizieren'),
Icon::create('copy')
) ?>
<? endif ?>
<? $actionMenu <? $actionMenu
->conditionAll(Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) ->conditionAll(Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS)
->condition((bool) $room_request) ->condition((bool) $room_request)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment