diff --git a/app/controllers/course/timesrooms.php b/app/controllers/course/timesrooms.php index 4788eee05e098b7254a3635366212b7f1c39b0a2..129a0610ca77d68d692147fedbc56ef3b4133bc0 100644 --- a/app/controllers/course/timesrooms.php +++ b/app/controllers/course/timesrooms.php @@ -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 * diff --git a/app/views/course/timesrooms/_cycleRow.php b/app/views/course/timesrooms/_cycleRow.php index 5a5f60b15dc211c6502ade540b99c51ffedc6d28..ce286ed76e5d94169b6eaf04fabd730682e5e6b2 100644 --- a/app/views/course/timesrooms/_cycleRow.php +++ b/app/views/course/timesrooms/_cycleRow.php @@ -126,6 +126,13 @@ $is_exTermin = $termin instanceof CourseExDate; Icon::create('edit'), ['data-dialog' => ''] ) ?> + <? if (!$termin->metadate_id): ?> + <? $actionMenu->addLink( + $controller->url_for('course/timesrooms/cloneDate/' . $termin->id, $linkAttributes), + _('Termin duplizieren'), + Icon::create('copy') + ) ?> + <? endif ?> <? $actionMenu ->conditionAll(Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) ->condition((bool) $room_request)