Skip to content
Snippets Groups Projects
Unverified Commit 2614eef6 authored by Rasmus Fuhse's avatar Rasmus Fuhse Committed by GitHub
Browse files

Merge pull request #3 from noackorama/master

fix letzte Semesterwoche
parents 766d3519 c9e7079a
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ class CopyController extends PluginController
}
if (count(Request::getArray("c")) == 1) {
$this->single_course = Course::find(current(Request::getArray("c")));
$this->single_course_name = $course->name;
$this->single_course_name = $this->single_course;
}
} else {
throw new Trails_Exception(400);
......@@ -97,6 +97,7 @@ class CopyController extends PluginController
$newcourse['mkdate'] = time();
$newcourse->setId($newcourse->getNewId());
$newcourse['start_time'] = $semester['beginn'];
$newcourse['duration_time'] = 0;
if ($invisible_copied_courses) {
$newcourse['visible'] = 0;
}
......@@ -222,6 +223,7 @@ class CopyController extends PluginController
if (Request::get("cycles")) {
$last_week = count($semester->getStartWeeks()) - 1;
foreach ($oldcourse->cycles as $cycledate) {
$statement = DBManager::get()->prepare("
......@@ -242,10 +244,8 @@ class CopyController extends PluginController
$newcycle->setData($cycledate->toArray());
$newcycle->setId($newcycle->getNewId());
$newcycle['seminar_id'] = $newcourse->getId();
$newcycle['week_offset'] = Request::get("week_offset");
$newcycle['end_offset'] = Request::get("end_offset") !== 10000
? Request::get("end_offset")
: floor(($semester['vorles_ende'] - $semester['vorles_beginn']) / (86400 * 7));
$newcycle['week_offset'] = Request::int("week_offset");
$newcycle['end_offset'] = Request::get('end_offset') == 'last' ? $last_week : Request::int("end_offset");
$newcycle['mkdate'] = time();
$newcycle['chdate'] = time();
$newcycle->store();
......
pluginname=CourseCopy
pluginclassname=CourseCopy
version=1.9.3
version=1.9.4
origin=data-quest
studipMinVersion=4.0
studipMaxVersion=5.3.99
<?php
$start_weeks = $semester->getStartWeeks();
$last_week = count($start_weeks) - 1;
?>
<label>
<?= _("Startwoche") ?>
<select name="week_offset">
<? $i = 0 ?>
<? while ($semester['vorles_beginn'] + 43200 + 86400 * 7 * $i < $semester['vorles_ende']) : ?>
<? foreach ($start_weeks as $i => $text) : ?>
<option value="<?= $i ?>"<?= UserConfig::get($GLOBALS['user']->id)->COURSECOPY_SETTINGS_WEEK_OFFSET == $i ? " checked" : "" ?>>
<?
$timestamp = $semester['vorles_beginn'] + 43200 + 86400 * 7 * $i;
$timestamp = $timestamp - ((date("w", $timestamp) - 1) % 7) * 86400;
?>
<?= sprintf(_("%s. Semesterwoche (ab %s)"), $i + 1, date("d.m.Y", $timestamp)) ?>
<?= $text?>
</option>
<? $i++ ?>
<? endwhile ?>
<? endforeach; ?>
</select>
</label>
<label>
<?= _("Endwoche") ?>
<select name="end_offset">
<option value="10000"<?= UserConfig::get($GLOBALS['user']->id)->COURSECOPY_SETTINGS_END_OFFSET == 10000 ? " checked" : "" ?>>
<?= _("Letzte Semesterwoche") ?>
<? foreach (array_reverse($start_weeks, true) as $i => $text) : ?>
<? if ($i == $last_week) : ?>
<option value="last">
<?= _('Semesterende: ') . $text?>
</option>
<? $i = floor(($semester['vorles_ende'] - $semester['vorles_beginn']) / (86400 * 7)) - 1 ?>
<? while ($i >= 0) : ?>
<? else : ?>
<option value="<?= $i ?>"<?= UserConfig::get($GLOBALS['user']->id)->COURSECOPY_SETTINGS_END_OFFSET == $i ? " checked" : "" ?>>
<?
$timestamp = $semester['vorles_beginn'] + 43200 + 86400 * 7 * $i;
$timestamp = $timestamp - ((date("w", $timestamp) - 1) % 7) * 86400;
?>
<?= sprintf(_("%s. Semesterwoche (ab %s)"), $i + 1, date("d.m.Y", $timestamp)) ?>
<?= $text?>
</option>
<? $i-- ?>
<? endwhile ?>
<? endif ?>
<? endforeach ?>
</select>
</label>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment