/** * Moves a topic from one date to another. * This action will be called from an ajax request and will return only * the neccessary output for a single topic element. * * @param String $topic_id The id of the topic * @param String $old_date_id The id of the original date of the topic * @param String $new_date_id The id of the new date of the topic * @throws MethodNotAllowedException if request method is not post * @throws AccessDeniedException if the user is not allowed to execute the * action (at least tutor of the course) */ public function move_topic_action($topic_id, $old_date_id, $new_date_id) { if (!Request::isPost()) { throw new MethodNotAllowedException(); } if (!$GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessionSeminar'])) { throw new AccessDeniedException(); } $this->topic = CourseTopic::find($topic_id); $this->date = new CourseDate($new_date_id); $this->topic->dates->unsetByPK($old_date_id); if (!$this->topic->dates->findOneBy('termin_id', $new_date_id)) { $this->topic->dates[] = CourseDate::find($new_date_id); } $this->topic->store(); $this->set_content_type('text/html;charset=windows-1252'); $this->render_template('course/dates/_topic_li.php'); }