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

/components/com_weblinks/views/category/tmpl/default_items.php

https://github.com/joebushi/joomla
PHP | 131 lines | 106 code | 12 blank | 13 comment | 4 complexity | d57b25f6b597b1065f2db85fb9badab7 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id: default_items.php 13471 2009-11-12 00:38:49Z eddieajau
  4. * @package Joomla.Site
  5. * @subpackage com_weblinks
  6. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. // no direct access
  10. defined('_JEXEC') or die;
  11. // TODO: Optimise some of the fixed params in the loops
  12. ?>
  13. <script type="text/javascript">
  14. function tableOrdering(order, dir, task) {
  15. var form = document.adminForm;
  16. form.filter_order.value = order;
  17. form.filter_order_Dir.value = dir;
  18. document.adminForm.submit(task);
  19. }
  20. </script>
  21. <form action="<?php echo JFilterOutput::ampReplace(JFactory::getURI()->toString()); ?>" method="post" name="adminForm">
  22. <div class="filter">
  23. <?php echo JText::_('Display Num'); ?>
  24. <?php echo $this->pagination->getLimitBox(); ?>
  25. </div>
  26. <input type="hidden" name="filter_order" value="<?php echo $this->state->get('list.ordering'); ?>" />
  27. <input type="hidden" name="filter_order_Dir" value="<?php echo $this->state->get('list.direction'); ?>" />
  28. </form>
  29. <table class="weblinks">
  30. <?php if ($this->params->def('show_headings', 1)) : ?>
  31. <thead>
  32. <tr>
  33. <th class="num">
  34. <?php echo JText::_('Num'); ?>
  35. </th>
  36. <th class="title">
  37. <?php echo JHtml::_('grid.sort', 'Web Link', 'title', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
  38. </th>
  39. <?php if ($this->params->get('show_link_hits')) : ?>
  40. <th class="hits">
  41. <?php echo JHtml::_('grid.sort', 'Hits', 'hits', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
  42. </th>
  43. <?php endif; ?>
  44. </tr>
  45. </thead>
  46. <?php endif; ?>
  47. <tbody>
  48. <?php foreach ($this->items as $i => $item) : ?>
  49. <tr class="<?php echo $i % 2 ? 'odd' : 'even';?>">
  50. <td class="num">
  51. <?php echo $this->pagination->getRowOffset($i); ?>
  52. </td>
  53. <td class="title">
  54. <p>
  55. <?php if ($this->params->get('link_icons') <> -1) : ?>
  56. <?php echo JHtml::_('image', 'system/'.$this->params->get('link_icons', 'weblink.png'), JText::_('Link'), NULL, true);?>
  57. <?php endif; ?>
  58. <?php
  59. // Compute the correct link
  60. $menuclass = 'category'.$this->params->get('pageclass_sfx');
  61. $link = JRoute::_('index.php?task=weblink.go&&id='. $item->id);
  62. switch ($item->params->get('target', $this->params->get('target')))
  63. {
  64. case 1:
  65. // open in a new window
  66. echo '<a href="'. $link .'" target="_blank" class="'. $menuclass .'" rel="nofollow">'.
  67. $this->escape($item->title) .'</a>';
  68. break;
  69. case 2:
  70. // open in a popup window
  71. echo "<a href=\"#\" onclick=\"javascript: window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\">".
  72. $this->escape($item->title) ."</a>\n";
  73. break;
  74. case 3:
  75. // TODO: open in a modal window
  76. JHtml::_('behavior.modal', 'a.modal'); ?>
  77. <a class="modal" title="<?php echo $this->escape($item->title) ?> " href="<?php echo $link;?>" rel="{handler: 'iframe', size: {x: 500, y: 506}}\">
  78. <?php echo $this->escape($item->title). ' </a>' ;
  79. break;
  80. default:
  81. // open in parent window
  82. echo '<a href="'. $link . '\" class="'. $menuclass .'" rel="nofollow">'.
  83. $this->escape($item->title) . ' </a>';
  84. break;
  85. }
  86. ?>
  87. </p>
  88. <?php if (($this->params->get('show_link_description')) AND ($item->description !='')): ?>
  89. <p>
  90. <?php echo nl2br($item->description); ?>
  91. </p>
  92. <?php endif; ?>
  93. </td>
  94. <?php if ($this->params->get('show_link_hits')) : ?>
  95. <td class="hits">
  96. <?php echo $item->hits; ?>
  97. </td>
  98. <?php endif; ?>
  99. </tr>
  100. <?php endforeach; ?>
  101. </tbody>
  102. </table>
  103. <? if($this->pagination->get('pages.total')>1): ?>
  104. <div class="pagination">
  105. <p><?php echo $this->pagination->getPagesCounter(); ?></p>
  106. <?php echo $this->pagination->getPagesLinks(); ?>
  107. </div>
  108. <?php endif; ?>