/** * Swaps the position of two categories * * @param String $id0 Id of the category to be swapped * @param String $id1 Id of the other category to be swapped */ public function swap_action($id0, $id1) { $category0 = Kategorie::find($id0); $category1 = Kategorie::find($id1); $priorities = $category0->priority + $category1->priority; $category0->priority = $priorities - $category0->priority; $category1->priority = $priorities - $category1->priority; if ($category0->store() && $category1->store()) { $this->reportSuccess(_('Kategorien wurden neu geordnet')); } else { $this->reportError(_('Kategorien konnten nicht neu geordnet werden.')); } $this->redirect('settings/categories'); }
<? use Studip\Button, Studip\LinkButton; ?> <? if ($verify && $verify['action'] === 'delete'): ?> <?php echo $controller->verifyDialog(sprintf(_('Möchten Sie wirklich die Kategorie "%s" löschen?'), Kategorie::find($verify['id'])->name), array('settings/categories/delete', $verify['id'], true), array('settings/categories')); ?> <? endif; ?> <? if (count($categories) === 0): ?> <p class="info"><?php echo _('Es existieren zur Zeit keine eigenen Kategorien.'); ?> </p> <? else: ?> <form action="<?php echo $controller->url_for('settings/categories/store'); ?> " method="post" name="main_content"> <?php echo CSRFProtection::tokenTag(); ?> <input type="hidden" name="studipticket" value="<?php echo get_ticket(); ?> "> <table class="default nohover"> <colgroup> <col width="100px"> <col> <col width="200px"> <col width="100px">