RemoveSubTopicController.inc 601 B

1234567891011121314151617
  1. <?php
  2. class RemoveSubTopicController implements IController {
  3. public function execute() {
  4. //TODO: only admin, owner, moderator can see this page
  5. $form = new Form();
  6. $topicId = $form->getCleanDefaulted('id', 0);
  7. $subtopicId = $form->getCleanDefaulted('subtopic', 0);
  8. $topicModel = new TopicModel();
  9. $sql = sprintf("DELETE FROM topic_topic_associations WHERE topic_id = '%s' AND subtopic_id = '%s'", $topicId, $subtopicId);
  10. var_dump($sql);
  11. $database = new Database();
  12. $database->write($sql);
  13. $header = new Header();
  14. $header->redirect('?a=topicmanagement&id=' . $topicId);
  15. }
  16. }