PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_flexicontent/templates/default/category_items.php

http://flexicontent.googlecode.com/
PHP | 193 lines | 131 code | 37 blank | 25 comment | 30 complexity | 5e69097aa4c04adecf9c7dffb066713c MD5 | raw file
Possible License(s): MIT, GPL-2.0, Apache-2.0
  1. <?php
  2. /**
  3. * @version 1.5 stable $Id: category_items.php 1872 2014-03-15 15:50:42Z ggppdk $
  4. * @package Joomla
  5. * @subpackage FLEXIcontent
  6. * @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr
  7. * @license GNU/GPL v2
  8. *
  9. * FLEXIcontent is a derivative work of the excellent QuickFAQ component
  10. * @copyright (C) 2008 Christoph Lukes
  11. * see www.schlu.net for more information
  12. *
  13. * FLEXIcontent is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. defined( '_JEXEC' ) or die( 'Restricted access' );
  19. // first define the template name
  20. $tmpl = $this->tmpl;
  21. $user = JFactory::getUser();
  22. ?>
  23. <?php
  24. ob_start();
  25. // Form for (a) Text search, Field Filters, Alpha-Index, Items Total Statistics, Selectors(e.g. per page, orderby)
  26. // If customizing via CSS rules or JS scripts is not enough, then please copy the following file here to customize the HTML too
  27. include(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'tmpl_common'.DS.'listings_filter_form.php');
  28. $filter_form_html = trim(ob_get_contents());
  29. ob_end_clean();
  30. if ( $filter_form_html ) {
  31. echo '<div class="group">'."\n".$filter_form_html."\n".'</div>';
  32. }
  33. ?>
  34. <div class="clear"></div>
  35. <?php
  36. if (!$this->items) {
  37. // No items exist
  38. if ($this->getModel()->getState('limit')) {
  39. // Not creating a category view without items
  40. echo '<div class="noitems group">' . JText::_( 'FLEXI_NO_ITEMS_FOUND' ) . '</div>';
  41. }
  42. return;
  43. }
  44. // routine to determine all used columns for this table
  45. $show_title = $this->params->get('show_title', 1);
  46. $link_titles = $this->params->get('link_titles', 0);
  47. $layout = $this->params->get('clayout', 'default');
  48. $fbypos = flexicontent_tmpl::getFieldsByPositions($layout, 'category');
  49. $columns = array();
  50. foreach ($this->items as $item) :
  51. if (isset($item->positions['table'])) :
  52. foreach ($fbypos['table']->fields as $f) :
  53. if ( ! @ $columns[$f] ) :
  54. $columns[$f] = @ $item->fields[$f]->label;
  55. endif;
  56. endforeach;
  57. endif;
  58. endforeach;
  59. $items = & $this->items;
  60. // Decide whether to show the edit column
  61. $buttons_exists = false;
  62. if ( $user->id ) :
  63. $show_editbutton = $this->params->get('show_editbutton', 1);
  64. foreach ($items as $item) :
  65. if ( $show_editbutton ) :
  66. if ($item->editbutton = flexicontent_html::editbutton( $item, $this->params )) :
  67. $buttons_exists = true;
  68. $item->editbutton = '<div class="fc_edit_link_nopad">'.$item->editbutton.'</div>';
  69. endif;
  70. if ($item->statebutton = flexicontent_html::statebutton( $item, $this->params )) :
  71. $buttons_exists = true;
  72. $item->statebutton = '<div class="fc_state_toggle_link_nopad">'.$item->statebutton.'</div>';
  73. endif;
  74. endif;
  75. if ($item->approvalbutton = flexicontent_html::approvalbutton( $item, $this->params )) :
  76. $buttons_exists = true;
  77. $item->approvalbutton = '<div class="fc_approval_request_link_nopad">'.$item->approvalbutton.'</div>';
  78. endif;
  79. endforeach;
  80. endif;
  81. // Decide whether to show the comments column
  82. $comments_non_zero = false;
  83. if ( $this->params->get('show_comments_count', 0) ) :
  84. if ( isset($this->comments) && count($this->comments) ) :
  85. $comments_non_zero = true;
  86. endif;
  87. endif;
  88. // Check to enable show title if not other columns were configured
  89. if (!$show_title && !count($columns)) :
  90. echo '<span style="font-weight:bold; color:red;">'.JText::_('FLEXI_TPL_NO_COLUMNS_SELECT_FORCING_DISPLAY_ITEM_TITLE').'</span>';
  91. $this->params->set('show_title', 1);
  92. endif;
  93. ?>
  94. <table id="flexitable" class="flexitable" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<?php echo @$this->category->name; ?>">
  95. <?php if ($this->params->get('show_field_labels_row', 1)) : ?>
  96. <thead>
  97. <tr>
  98. <?php if ( $buttons_exists || $comments_non_zero || $show_title || count($item->css_markups) ) : ?>
  99. <th id="flexi_title" scope="col">
  100. <?php echo $show_title ? JText::_( 'FLEXI_ITEMS' ) : ''; ?>
  101. </th>
  102. <?php endif; ?>
  103. <?php foreach ($columns as $name => $label) : ?>
  104. <th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th>
  105. <?php endforeach; ?>
  106. </tr>
  107. </thead>
  108. <?php endif; ?>
  109. <tbody>
  110. <?php foreach ($items as $i => $item) : ?>
  111. <tr id="tablelist_item_<?php echo $i; ?>" class="<?php echo $fc_item_classes; ?>">
  112. <?php
  113. $fc_item_classes = 'sectiontableentry';
  114. $markup_tags = '<span class="fc_mublock">';
  115. foreach($item->css_markups as $grp => $css_markups) {
  116. if ( empty($css_markups) ) continue;
  117. $fc_item_classes .= ' fc'.implode(' fc', $css_markups);
  118. $ecss_markups = $item->ecss_markups[$grp];
  119. $title_markups = $item->title_markups[$grp];
  120. foreach($css_markups as $mui => $css_markup) {
  121. $markup_tags .= '<span class="fc_markup mu' . $css_markups[$mui] . $ecss_markups[$mui] .'">' .$title_markups[$mui]. '</span>';
  122. }
  123. }
  124. $markup_tags .= '</span>';
  125. ?>
  126. <?php if ( $buttons_exists || $comments_non_zero || $show_title || count($item->css_markups) ) : ?>
  127. <td class="fc_title_col">
  128. <?php echo @ $item->editbutton; ?>
  129. <?php echo @ $item->statebutton; ?>
  130. <?php echo @ $item->approvalbutton; ?>
  131. <?php if ($this->params->get('show_comments_count')) : ?>
  132. <?php if ( isset($this->comments[ $item->id ]->total) ) : ?>
  133. <div class="fc_comments_count_nopad hasTip" alt="<?php echo JText::_('FLEXI_NUM_OF_COMMENTS');?>" title="<?php echo JText::_('FLEXI_NUM_OF_COMMENTS');?>::<?php echo JText::_('FLEXI_NUM_OF_COMMENTS_TIP');?>">
  134. <?php echo $this->comments[ $item->id ]->total; ?>
  135. </div>
  136. <?php endif; ?>
  137. <?php endif; ?>
  138. <!-- BOF item title -->
  139. <?php if ($show_title) : ?>
  140. <?php if ($link_titles) : ?>
  141. <a class="fc_item_title" href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug)); ?>"><?php echo $item->title; ?></a>
  142. <?php else : echo $item->title; endif; ?>
  143. <?php endif; ?>
  144. <!-- EOF item title -->
  145. <?php echo $markup_tags; ?>
  146. </td>
  147. <?php endif; ?>
  148. <!-- BOF item fields -->
  149. <?php foreach ($columns as $name => $label) : ?>
  150. <td><?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?></td>
  151. <?php endforeach; ?>
  152. <!-- EOF item fields -->
  153. </tr>
  154. <?php endforeach; ?>
  155. </tbody>
  156. </table>