PageRenderTime 25ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/oc-admin/themes/modern/comments/index.php

https://github.com/nsswaga/OSClass
PHP | 168 lines | 140 code | 12 blank | 16 comment | 17 complexity | 70c7e5fb0d85413fbea287e818d88d41 MD5 | raw file
  1. <?php
  2. /**
  3. * OSClass – software for creating and publishing online classified advertising platforms
  4. *
  5. * Copyright (C) 2010 OSCLASS
  6. *
  7. * This program is free software: you can redistribute it and/or modify it under the terms
  8. * of the GNU Affero General Public License as published by the Free Software Foundation,
  9. * either version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  12. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public
  16. * License along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. $comments = __get('comments');
  19. if(!is_array($comments)) { $comments = array(); };
  20. $last = end($comments);
  21. $last_id = $last['pk_i_id'] ;
  22. ?>
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
  25. <head>
  26. <?php osc_current_admin_theme_path('head.php') ; ?>
  27. </head>
  28. <body>
  29. <?php osc_current_admin_theme_path('header.php') ; ?>
  30. <div id="update_version" style="display:none;"></div>
  31. <script type="text/javascript">
  32. $(function() {
  33. $.fn.dataTableExt.oApi.fnGetFilteredNodes = function ( oSettings ) {
  34. var anRows = [];
  35. for (var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ ) {
  36. var nRow = oSettings.aoData[ oSettings.aiDisplay[i] ].nTr;
  37. anRows.push(nRow);
  38. }
  39. return anRows;
  40. };
  41. sSearchName = "<?php _e('Search'); ?>...";
  42. oTable = $('#datatables_list').dataTable({
  43. "bAutoWidth": false,
  44. "sDom": '<"top"fl>rt<"bottom"ip<"clear">',
  45. "oLanguage": {
  46. "sProcessing": "<?php _e('Processing'); ?>...",
  47. "sLengthMenu": "<?php _e('Show _MENU_ entries'); ?>",
  48. "sZeroRecords": "<?php _e('No matching records found'); ?>",
  49. "sInfo": "<?php _e('Showing _START_ to _END_ of _TOTAL_ entries'); ?>",
  50. "sInfoEmpty": "<?php _e('Showing 0 to 0 of 0 entries'); ?>",
  51. "sInfoFiltered": "(<?php _e('filtered from _MAX_ total entries'); ?>)",
  52. "sInfoPostFix": "",
  53. "sSearch": "<?php _e('Search'); ?>:",
  54. "sUrl": "",
  55. "oPaginate": {
  56. "sFirst": "<?php _e('First'); ?>",
  57. "sPrevious": "<?php _e('Previous'); ?>",
  58. "sNext": "<?php _e('Next'); ?>",
  59. "sLast": "<?php _e('Last'); ?>"
  60. },
  61. "sLengthMenu": '<div style="float:left;"><?php _e('Show'); ?> <select class="display" id="select_range">'+
  62. '<option value="10">10</option>'+
  63. '<option value="15">15</option>'+
  64. '<option value="20">20</option>'+
  65. '<option value="100">100</option>'+
  66. '</select> <?php _e('entries'); ?>'
  67. ,"sSearch": '<span class="ui-icon ui-icon-search" style="display: inline-block;"></span>'
  68. }
  69. ,"sPaginationType": "full_numbers"
  70. ,"aaData": [
  71. <?php foreach(__get('comments') as $c) { ?>
  72. [
  73. "<input type='checkbox' name='id[]' value='<?php echo $c['pk_i_id']; ?>' />"
  74. ,"<?php echo addcslashes($c['s_author_name'],'"'); ?> (<a target='_blank' href='<?php echo osc_item_url_ns( $c['fk_i_item_id'] ) ; ?>'><?php echo $c['s_title']; ?></a>)<div id='datatables_quick_edit'><a href='<?php echo osc_admin_base_url(true) ; ?>?page=comments&action=comment_edit&id=<?php echo $c['pk_i_id'] ; ?>' id='dt_link_edit'><?php _e('Edit'); ?></a><?php
  75. if(isset($c['b_active']) && ($c['b_active'] == 1)) {
  76. echo ' | <a href=\'' . osc_admin_base_url(true) . '?page=comments&action=status&id='. $c['pk_i_id'] .'&value=INACTIVE\'>' . __('Deactivate') . '</a>' ;
  77. } else if (isset($c['b_active']) && ($c['b_active'] == 0)) {
  78. echo ' | <a href=\'' . osc_admin_base_url(true) . '?page=comments&action=status&id='. $c['pk_i_id'] .'&value=ACTIVE\'>' . __('Activate') . '</a>' ;
  79. }
  80. if(isset($c['b_enabled']) && ($c['b_enabled'] == 1)) {
  81. echo ' | <a href=\'' . osc_admin_base_url(true) . '?page=comments&action=status&id='. $c['pk_i_id'] .'&value=DISABLE\'>' . __('Disable') . '</a>' ;
  82. } else if (isset($c['b_enabled']) && ($c['b_enabled'] == 0)) {
  83. echo ' | <a href=\'' . osc_admin_base_url(true) . '?page=comments&action=status&id='. $c['pk_i_id'] .'&value=ENABLE\'>' . __('Enable') . '</a>' ;
  84. }
  85. ?> | <a onclick=\"javascript:return confirm('<?php _e('This action can\'t be undone. Are you sure you want to continue?'); ?>')\" href='<?php echo osc_admin_base_url(true) ; ?>?page=comments&action=delete&id=<?php echo $c['pk_i_id'] ; ?>' id='dt_link_delete'><?php _e('Delete') ; ?></a></div>"
  86. ,"<?php echo addcslashes(preg_replace('|\s+|',' ',$c['s_body']),'"'); ?>"
  87. ,"<?php echo $c['dt_pub_date'] ; ?>"
  88. ] <?php echo $last_id != $c['pk_i_id'] ? ',' : ''; ?>
  89. <?php } ?>
  90. ]
  91. ,"aoColumns": [
  92. {"sTitle": "<div style='margin-left: 8px;'><input id='check_all' type='checkbox' /></div>"
  93. ,"bSortable": false
  94. ,"sClass": "center"
  95. ,"sWidth": "10px"
  96. ,"bSearchable": false
  97. }
  98. ,{"sTitle": "<?php _e('Author'); ?>"
  99. ,"sWidth": "auto"
  100. }
  101. ,{"sTitle": "<?php _e('Comment'); ?>"}
  102. ,{"sTitle": "<?php _e('Date'); ?>"
  103. ,"sWidth": "100px"
  104. ,"sClass": "center"
  105. ,"bSearchable": false
  106. }
  107. ]
  108. });
  109. });
  110. </script>
  111. <script type="text/javascript" src="<?php echo osc_current_admin_theme_js_url('datatables.post_init.js') ; ?>"></script>
  112. <div id="content">
  113. <div id="separator"></div>
  114. <?php osc_current_admin_theme_path ( 'include/backoffice_menu.php' ) ; ?>
  115. <div id="right_column">
  116. <div id="content_header" class="content_header">
  117. <div style="float: left;">
  118. <img src="<?php echo osc_current_admin_theme_url('images/comments-icon2.png') ; ?>" title="" alt=""/>
  119. </div>
  120. <div id="content_header_arrow">&raquo; <?php _e('Manage Comments') ; ?></div>
  121. <div style="clear: both;"></div>
  122. </div>
  123. <div id="content_separator"></div>
  124. <?php osc_show_flash_message('admin') ; ?>
  125. <form id="datatablesForm" action="<?php osc_admin_base_url(true) ; ?>" method="post">
  126. <div id="TableToolsToolbar">
  127. <select id="bulk_actions" name="bulk_actions" class="display">
  128. <option value=""><?php _e('Bulk actions'); ?></option>
  129. <option value="delete_all"><?php _e('Delete') ?></option>
  130. <option value="activate_all"><?php _e('Activate') ?></option>
  131. <option value="deactivate_all"><?php _e('Deactivate') ?></option>
  132. <option value="enable_all"><?php _e('Enable') ?></option>
  133. <option value="disable_all"><?php _e('Disable') ?></option>
  134. </select>
  135. &nbsp;<button id="bulk_apply" class="display"><?php _e('Apply') ?></button>
  136. </div>
  137. <input type="hidden" name="action" value="bulk_actions" />
  138. <table cellpadding="0" cellspacing="0" border="0" class="display" id="datatables_list"></table>
  139. <br />
  140. </form>
  141. </div> <!-- end of right column -->
  142. <script type="text/javascript">
  143. $(document).ready(function() {
  144. $('#datatables_list tr').live('mouseover', function(event) {
  145. $('#datatables_quick_edit', this).show();
  146. });
  147. $('#datatables_list tr').live('mouseleave', function(event) {
  148. $('#datatables_quick_edit', this).hide();
  149. });
  150. });
  151. </script>
  152. <div style="clear: both;"></div>
  153. </div> <!-- end of container -->
  154. <?php osc_current_admin_theme_path('footer.php') ; ?>
  155. </body>
  156. </html>