PageRenderTime 22ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/protected/modules/content/views/forum/index.php

https://github.com/kadishmal/tilchi.com
PHP | 110 lines | 104 code | 6 blank | 0 comment | 17 complexity | 5dab687e9a62fcde2afadda4401bd435 MD5 | raw file
  1. <?php
  2. $this->pageTitle = Yii::t('ContentModule.forum', 'Forum') . ' | ' . Yii::app()->name;
  3. ?>
  4. <div id="forum">
  5. <div class="forum-body">
  6. <div class="frame">
  7. <div class="title"><h2><?php echo Yii::t('ContentModule.forum', 'Forums'); ?></h2></div>
  8. <div id="forum-search">
  9. <?php
  10. $form = $this->beginWidget('CActiveForm', array(
  11. 'id'=>'forum-search-form',
  12. 'action'=>'/forum/search'
  13. ));
  14. echo CHtml::hiddenField('Forum[scope]', Post::TYPE_FORUMS) .
  15. CHtml::textField('Forum[phrase]', '', array('class'=>'textField')) . CHtml::submitButton(Yii::t('site', 'Search'), array('class'=>'button big'));
  16. $this->endWidget();
  17. ?>
  18. </div>
  19. <div class="body" id="search-container">
  20. <div id="results" class="list">
  21. <?php
  22. $cs = Yii::app()->clientScript;
  23. $cs->registerScript('forum-search-form',"
  24. activateSearchForm('forum-search-form');
  25. ");
  26. ?>
  27. </div>
  28. <div class="options">
  29. <h2><?php echo Yii::t('ContentModule.forum', 'Didn\'t find what you were looking for?'); ?></h2>
  30. <div class="option question"><a href="/forum/new/question"><i></i><h3><?php echo Yii::t('ContentModule.forum', 'Ask a question'); ?></h3></a></div>
  31. <div class="option idea"><a href="/forum/new/idea"><i></i><h3><?php echo Yii::t('ContentModule.forum', 'Submit an idea'); ?></h3></a></div>
  32. <div class="option issue"><a href="/forum/new/issue"><i></i><h3><?php echo Yii::t('ContentModule.forum', 'Report an issue'); ?></h3></a></div>
  33. </div>
  34. </div>
  35. </div>
  36. <?php
  37. $questions = 0;
  38. $ideas = 0;
  39. $issues = 0;
  40. foreach ($dataProvider as $post)
  41. {
  42. if ($post['type'] == Post::TYPE_QUESTION)
  43. {
  44. if ($questions++ == 0){
  45. echo '<div class="frame">
  46. <div class="title""><h3>' . CHtml::link(Yii::t('ContentModule.forum', 'Questions'), '/forum/questions') . '</h3></div>
  47. <div class="body list">';
  48. }
  49. }
  50. else if ($post['type'] == Post::TYPE_IDEA)
  51. {
  52. if ($questions > 0){
  53. $questions = 0;
  54. echo '</div>
  55. </div>';
  56. }
  57. if ($ideas++ == 0){
  58. echo '<div class="frame">
  59. <div class="title""><h3>' . CHtml::link(Yii::t('ContentModule.forum', 'Ideas'), '/forum/ideas') . '</h3></div>
  60. <div class="body list">';
  61. }
  62. }
  63. else if ($post['type'] == Post::TYPE_ISSUE)
  64. {
  65. if ($ideas > 0){
  66. $ideas = 0;
  67. echo '</div>
  68. </div>';
  69. }
  70. if ($issues++ == 0){
  71. echo '<div class="frame">
  72. <div class="title""><h3>' . CHtml::link(Yii::t('ContentModule.forum', 'Issues'), '/forum/issues') . '</h3></div>
  73. <div class="body list">';
  74. }
  75. }
  76. echo '<div class="item ' . Post::getTypeTitle($post['type']) . '">' .
  77. ($post['response_type'] > Post::RESPONSE_NEW ?
  78. '<div class="status ' . Post::getResponseTitle($post['response_type']) . '">' . Post::getResponseText($post['response_type'], $post['type']) . '</div>'
  79. : ''
  80. ) .
  81. '<div class="icon"><i></i>' .
  82. '<span class="answer" title="' . Yii::t('ContentModule.forum', '{n} vote|{n} votes', $post['votesCount']) . '">' . '<i></i>' . $post['votesCount'] . '</span>' .
  83. '</div>' .
  84. '<div class="info">' .
  85. '<h3>' . CHtml::link($post['title'], '/forum/' . $post['slug']) . '</h3>' .
  86. '<span class="meta">' .
  87. $post['first_name'] . ' ' . mb_substr($post['last_name'], 0, 1, 'UTF-8') . '.' .
  88. '<span class="date" title="' . ContentModule::getFormattedFullDate($post['publish_date']) . '">' .
  89. '<i></i>' . ContentModule::getFormattedRelativeDate($post['publish_date']) .
  90. '<span class="count" title="' . Yii::t('ContentModule.comment', '{n} comment|{n} comments', $post['commentsCount']) . '">' .
  91. '<i></i>' . $post['commentsCount'] .
  92. '</span>' .
  93. '</span>' .
  94. '</span>' .
  95. '</div>' .
  96. '</div>';
  97. }
  98. if ($issues > 0){
  99. echo '</div>
  100. </div>';
  101. }
  102. ?>
  103. </div>
  104. </div>