Guest User

Untitled

a guest
Feb 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. <?php
  2. class CommunitiesController extends AppController{
  3. /**
  4. * undocumented function
  5. *
  6. * @return void
  7. * @access public
  8. */
  9. function index() {
  10. $communities = $this->Community->find('all');
  11. $curSec = 'community';
  12. $this->set(compact('communities', 'curSec'));
  13. }
  14. /**
  15. * The Communities overview page
  16. *
  17. * @param string $id
  18. * @return void
  19. * @access public
  20. */
  21. function view($id, $batchFind = array()) {
  22. $community = $this->Community->find('first', array(
  23. 'fields' => array('id', 'title'),
  24. 'conditions' => compact('id')
  25. ));
  26. Assert::notEmpty($community, '404');
  27. Assert::true(empty($batchFind) || ($this->action != 'view'), '500');
  28.  
  29. if (empty($batchFind)) {
  30. $batchFind = array(
  31. 'news' => $id,
  32. 'users' => $id,
  33. 'conditions' => $id,
  34. 'conferences' => $id,
  35. 'ratings' => $id,
  36. 'classes' => $id,
  37. 'wall' => $id,
  38. );
  39. }
  40. $this->set(am(
  41. compact('id', 'community'),
  42. $this->Community->find('headerInfo'),
  43. $this->Community->batchFind($batchFind)
  44. ));
  45. }
  46. /**
  47. * undocumented function
  48. *
  49. * @param string $id
  50. * @return void
  51. * @access public
  52. */
  53. function news($id) {
  54. $this->view($id, array(
  55. 'news' => $id,
  56. 'classes' => $id,
  57. 'conditions' => $id
  58. ));
  59. }
  60. /**
  61. * undocumented function
  62. *
  63. * @param string $id
  64. * @return void
  65. * @access public
  66. */
  67. function discussions($id) {
  68. $this->view($id, array(
  69. 'discussions' => $id,
  70. 'classes' => $id,
  71. 'conditions' => $id
  72. ));
  73. }
  74. /**
  75. * undocumented function
  76. *
  77. * @param string $id
  78. * @return void
  79. * @access public
  80. */
  81. function conferences($id) {
  82. $this->view($id, array(
  83. 'conferences' => $id,
  84. 'ratings' => $id,
  85. 'classes' => $id,
  86. 'conditions' => $id,
  87. 'users' => $id,
  88. ));
  89. }
  90. /**
  91. * undocumented function
  92. *
  93. * @param string $id
  94. * @return void
  95. * @access public
  96. */
  97. function conditions($id) {
  98. $this->view($id, array(
  99. 'conditions' => $id,
  100. 'ratings' => $id,
  101. 'classes' => $id,
  102. ));
  103. }
  104. /**
  105. * undocumented function
  106. *
  107. * @param string $id
  108. * @return void
  109. * @access public
  110. */
  111. function related_drugs($id) {
  112. $this->view($id, array(
  113. 'classes' => $id,
  114. ));
  115. }
  116. }
  117. ?>
Add Comment
Please, Sign In to add comment