Skip to content

Commit

Permalink
simplify data structure and view; add proxy checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
tleilax committed Aug 12, 2015
1 parent 2e69735 commit 3882dc3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions controllers/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function prepareCourses($ids)
$_course['visitdate'] = object_get_visit($course->id, 'sem', '');

$user_status = @$member_ships[$course->id]['status'];
if(!$user_status && Config::get()->DEPUTIES_ENABLE && isDeputy($GLOBALS['user']->id, $course->id)) {
if (!$user_status && Config::get()->DEPUTIES_ENABLE && isDeputy($GLOBALS['user']->id, $course->id)) {
$user_status = 'dozent';
$is_deputy = true;
} else {
Expand Down Expand Up @@ -158,7 +158,7 @@ protected function getCourses()
$_ids[] = $a['Seminar_id'];
}
});
$courses[$sem['name']]['courses'] = $cm;
$courses[$sem['name']] = $cm;
}
}

Expand All @@ -177,7 +177,7 @@ protected function getCourses()
$_ids[] = $a['Seminar_id'];
}
});
$courses['unbegrenzt laufende']['courses'] = $cm;
$courses['unbegrenzt laufende'] = $cm;
}
}

Expand Down
34 changes: 18 additions & 16 deletions views/show/settings.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
<form action="<?= $controller->url_for('show/save_settings')?>" method="post">
<?=CSRFProtection::tokenTag()?>
<table class="default">

<? foreach ($courses as $sem => $c) : ?>
<thead>
<table class="default">
<colgroup>
<col width="20px">
<col>
</colgroup>
<? foreach ($courses as $sem => $courses): ?>
<tbody id="sem-<?= md5($sem) ?>">
<tr>
<th></th>
<th>
<input type="checkbox" data-proxyfor="#sem-<?= md5($sem) ?> td :checkbox">
</th>
<th><?= htmlReady($sem) ?></th>
</tr>
</thead>
<tbody>
<? foreach ($c['courses'] as $cm) : ?>

<tr>
<td><input type="checkbox" name="favorites[]" value="<?= $cm['Seminar_id']?>" <?= in_array($cm['Seminar_id'], $ids) ? 'checked' : ''?> /></td>
<td><?= htmlReady($cm['course_name']) ?></td>
</tr>

<? endforeach ?>
</tbody>
<? endforeach ?>
<? foreach ($courses as $course): ?>
<tr>
<td><input type="checkbox" name="favorites[]" value="<?= $course['Seminar_id']?>" <?= in_array($course['Seminar_id'], $ids) ? 'checked' : ''?> /></td>
<td><?= htmlReady($course['course_name']) ?></td>
</tr>
<? endforeach; ?>
</tbody>
<? endforeach; ?>
</table>

<div data-dialog-button>
Expand Down

0 comments on commit 3882dc3

Please sign in to comment.