subscriptionView.inc 896 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. $session = new Session();
  3. $userId = $session->getValue('logged_in');
  4. ?>
  5. <?=$header?>
  6. <div id="contentContainer">
  7. <div id="content">
  8. <ul>
  9. <?php foreach($topics as $topic) { ?>
  10. <li><?php if($userId) {?><input class="subscribe" data-id="<?=$topic['topic_id']?>" type="checkbox" <?=$topic['subscribed'] ? 'checked="checked"' : ""?> /><?php } ?><a href="?a=topic&id=<?=$topic['topic_id']?>"><?=$topic['display_name']?></a> - <?=$topic['description']?></li>
  11. <?php } ?>
  12. </ul>
  13. </div>
  14. </div>
  15. <?php include "sidebar.inc"; ?>
  16. <script type="text/javascript">
  17. $(document).ready(function(){
  18. $('.subscribe').click(function(){
  19. var checkbox = $(this);
  20. var topicId = checkbox.data('id');
  21. if(checkbox.is(':checked')) {
  22. $.ajax('?a=changesubscription&id=' + topicId + '&s=1');
  23. } else {
  24. $.ajax('?a=changesubscription&id=' + topicId + '&s=0');
  25. }
  26. });
  27. });
  28. </script>
  29. </body>
  30. </html>