PageRenderTime 27ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/com_flexicontent_v2.x/site/templates/faq/category_items.php

http://flexicontent.googlecode.com/
PHP | 337 lines | 246 code | 64 blank | 27 comment | 42 complexity | 71f7f8e55bc0255e6e1d240dd9335902 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 1033 2011-12-08 08:58:02Z enjoyman@gmail.com $
  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. $items = & $this->items;
  37. // -- Check matching items found
  38. if (!$items) {
  39. // No items exist
  40. if ($this->getModel()->getState('limit')) {
  41. // Not creating a category view without items
  42. echo '<div class="noitems group">' . JText::_( 'FLEXI_NO_ITEMS_FOUND' ) . '</div>';
  43. }
  44. return;
  45. }
  46. // -- Decide whether to show the item edit options
  47. if ( $user->id ) :
  48. $show_editbutton = $this->params->get('show_editbutton', 1);
  49. foreach ($items as $item) :
  50. if ( $show_editbutton ) :
  51. if ($item->editbutton = flexicontent_html::editbutton( $item, $this->params )) :
  52. $item->editbutton = '<div class="fc_edit_link_nopad">'.$item->editbutton.'</div>';
  53. endif;
  54. if ($item->statebutton = flexicontent_html::statebutton( $item, $this->params )) :
  55. $item->statebutton = '<div class="fc_state_toggle_link_nopad">'.$item->statebutton.'</div>';
  56. endif;
  57. endif;
  58. if ($item->approvalbutton = flexicontent_html::approvalbutton( $item, $this->params )) :
  59. $item->approvalbutton = '<div class="fc_approval_request_link_nopad">'.$item->approvalbutton.'</div>';
  60. endif;
  61. endforeach;
  62. endif;
  63. // -- Find all categories used by items
  64. $currcatid = $this->category->id;
  65. $cat_items[$currcatid] = array();
  66. $sub_cats[$currcatid] = & $this->category;
  67. foreach ($this->categories as $subindex => $sub) :
  68. $cat_items[$sub->id] = array();
  69. $sub_cats[$sub->id] = & $this->categories[$subindex];
  70. endforeach;
  71. // -- Group items into categories
  72. for ($i=0; $i<count($items); $i++) :
  73. foreach ($items[$i]->cats as $cat) :
  74. if (isset($cat_items[$cat->id])) :
  75. $cat_items[$cat->id][] = & $items[$i];
  76. endif;
  77. endforeach;
  78. endfor;
  79. // -- Decide CSS classes
  80. $tmpl_cols = $this->params->get('tmpl_cols', 2);
  81. $tmpl_cols_classes = array(1=>'one',2=>'two',3=>'three',4=>'four');
  82. $classnum = $tmpl_cols_classes[$tmpl_cols];
  83. // bootstrap span
  84. $tmpl_cols_spanclasses = array(1=>'span12',2=>'span6',3=>'span4',4=>'span3');
  85. $classspan = $tmpl_cols_spanclasses[$tmpl_cols];
  86. ?>
  87. <ul class="faqblock <?php echo $classnum; ?> group">
  88. <?php
  89. $show_itemcount = $this->params->get('show_itemcount', 1);
  90. $show_subcatcount = $this->params->get('show_subcatcount', 0);
  91. $itemcount_label = ($show_itemcount==2 ? JText::_('FLEXI_ITEM_S') : '');
  92. $subcatcount_label = ($show_subcatcount==2 ? JText::_('FLEXI_CATEGORIES') : '');
  93. global $globalcats;
  94. $count_cat = -1;
  95. foreach ($cat_items as $catid => $items) :
  96. $sub = & $sub_cats[$catid];
  97. if (count($items)==0) continue;
  98. if ($catid!=$currcatid) $count_cat++;
  99. ?>
  100. <li class="<?php echo $catid==$currcatid ? 'full' : ($count_cat%2 ? 'even' : 'odd'); ?>">
  101. <div class="group">
  102. <div class="flexi-cat group">
  103. <?php if (!empty($sub->image) && $this->params->get(($catid!=$currcatid? 'show_description_image_subcat' : 'show_description_image'), 1)) : ?>
  104. <!-- BOF subcategory image -->
  105. <div class="catimg">
  106. <?php echo $sub->image; ?>
  107. </div>
  108. <!-- EOF subcategory image -->
  109. <?php endif; ?>
  110. <?php if ($catid!=$currcatid) { ?> <a class='fc_cat_title' href="<?php echo JRoute::_( FlexicontentHelperRoute::getCategoryRoute($sub->slug) ); ?>"> <?php } else { echo "<span class='fc_cat_title'>"; } ?>
  111. <!-- BOF subcategory title -->
  112. <?php echo $sub->title; ?>
  113. <!-- EOF subcategory title -->
  114. <?php if ($catid!=$currcatid) { ?> </a> <?php } else { echo "</span>"; } ?>
  115. <?php if ($catid!=$currcatid) : ?>
  116. <!-- BOF subcategory assigned/subcats_count -->
  117. <?php
  118. $infocount_str = '';
  119. if ($show_itemcount) $infocount_str .= (int) $sub->assigneditems . $itemcount_label;
  120. if ($show_subcatcount) $infocount_str .= ($show_itemcount ? ' / ' : '').count($sub->subcats) . $subcatcount_label;
  121. if ($infocount_str) $infocount_str = ' (' . $infocount_str . ')';
  122. ?>
  123. <!-- EOF subcategory assigned/subcats_count -->
  124. <?php endif; ?>
  125. <?php if ($this->params->get(($catid!=$currcatid? 'show_description_subcat' : 'show_description'), 1)) : ?>
  126. <!-- BOF subcategory description -->
  127. <div class="catdescription group">
  128. <?php echo flexicontent_html::striptagsandcut( $sub->description, $this->params->get(($catid!=$currcatid? 'description_cut_text_subcat' : 'description_cut_text'), 120) ); ?>
  129. </div>
  130. <!-- EOF subcategory description -->
  131. <?php endif; ?>
  132. </div>
  133. <?php if ( $items ) : ?>
  134. <!-- BOF subcategory items -->
  135. <div class="group">
  136. <ul class="flexi-itemlist">
  137. <?php foreach ($items as $i => $item) : ?>
  138. <?php
  139. $fc_item_classes = 'flexi-item';
  140. $markup_tags = '<span class="fc_mublock">';
  141. foreach($item->css_markups as $grp => $css_markups) {
  142. if ( empty($css_markups) ) continue;
  143. $fc_item_classes .= ' fc'.implode(' fc', $css_markups);
  144. $ecss_markups = $item->ecss_markups[$grp];
  145. $title_markups = $item->title_markups[$grp];
  146. foreach($css_markups as $mui => $css_markup) {
  147. $markup_tags .= '<span class="fc_markup mu' . $css_markups[$mui] . $ecss_markups[$mui] .'">' .$title_markups[$mui]. '</span>';
  148. }
  149. }
  150. $markup_tags .= '</span>';
  151. ?>
  152. <li id="faqlist_cat_<?php echo $catid; ?>item_<?php echo $i; ?>" class="<?php echo $fc_item_classes; ?>">
  153. <?php if ($item->event->beforeDisplayContent) : ?>
  154. <!-- BOF beforeDisplayContent -->
  155. <div class="fc_beforeDisplayContent group">
  156. <?php echo $item->event->beforeDisplayContent; ?>
  157. </div>
  158. <!-- EOF beforeDisplayContent -->
  159. <?php endif; ?>
  160. <ul class="flexi-fieldlist">
  161. <li class="flexi-field flexi-title">
  162. <?php echo @ $item->editbutton; ?>
  163. <?php echo @ $item->statebutton; ?>
  164. <?php echo @ $item->approvalbutton; ?>
  165. <?php if ($this->params->get('show_comments_count')) : ?>
  166. <?php if ( isset($this->comments[ $item->id ]->total) ) : ?>
  167. <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');?>">
  168. <?php echo $this->comments[ $item->id ]->total; ?>
  169. </div>
  170. <?php endif; ?>
  171. <?php endif; ?>
  172. <?php if ($this->params->get('show_title', 1)) : ?>
  173. <!-- BOF item title -->
  174. <?php if ($this->params->get('link_titles', 0)) : ?>
  175. <a class="fc_item_title" href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug)); ?>">
  176. <?php echo $item->title; ?>
  177. </a>
  178. <?php else : ?>
  179. <?php echo $item->title; ?>
  180. <?php endif; ?>
  181. <!-- BOF item title -->
  182. <?php endif; ?>
  183. <div class="clear"></div>
  184. <?php echo $markup_tags; ?>
  185. <?php if ($item->event->afterDisplayTitle) : ?>
  186. <!-- BOF afterDisplayTitle -->
  187. <div class="fc_afterDisplayTitle group">
  188. <?php echo $item->event->afterDisplayTitle; ?>
  189. </div>
  190. <!-- EOF afterDisplayTitle -->
  191. <?php endif; ?>
  192. </li>
  193. <?php if (isset($item->positions['aftertitle'])) : ?>
  194. <!-- BOF aftertitle block -->
  195. <?php foreach ($item->positions['aftertitle'] as $field) : ?>
  196. <li class="flexi-field">
  197. <?php if ($field->label) : ?>
  198. <span class="flexi label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
  199. <?php endif; ?>
  200. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  201. </li>
  202. <?php endforeach; ?>
  203. <!-- EOF aftertitle block -->
  204. <?php endif; ?>
  205. <?php if (isset($item->positions['aftertitle_nolabel'])) : ?>
  206. <!-- BOF aftertitle_nolabel block -->
  207. <?php foreach ($item->positions['aftertitle_nolabel'] as $field) : ?>
  208. <li class="flexi-field">
  209. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  210. </li>
  211. <?php endforeach; ?>
  212. <!-- EOF aftertitle_nolabel block -->
  213. <?php endif; ?>
  214. <?php if (isset($item->positions['aftertitle2'])) : ?>
  215. <!-- BOF aftertitle block -->
  216. <?php foreach ($item->positions['aftertitle2'] as $field) : ?>
  217. <li class="flexi-field">
  218. <?php if ($field->label) : ?>
  219. <span class="flexi label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
  220. <?php endif; ?>
  221. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  222. </li>
  223. <?php endforeach; ?>
  224. <!-- EOF aftertitle block -->
  225. <?php endif; ?>
  226. <?php if (isset($item->positions['aftertitle_nolabel2'])) : ?>
  227. <!-- BOF aftertitle_nolabel block -->
  228. <?php foreach ($item->positions['aftertitle_nolabel2'] as $field) : ?>
  229. <li class="flexi-field">
  230. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  231. </li>
  232. <?php endforeach; ?>
  233. <!-- EOF aftertitle_nolabel block -->
  234. <?php endif; ?>
  235. <?php if (isset($item->positions['aftertitle3'])) : ?>
  236. <!-- BOF aftertitle block -->
  237. <?php foreach ($item->positions['aftertitle3'] as $field) : ?>
  238. <li class="flexi-field">
  239. <?php if ($field->label) : ?>
  240. <span class="flexi label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
  241. <?php endif; ?>
  242. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  243. </li>
  244. <?php endforeach; ?>
  245. <!-- EOF aftertitle block -->
  246. <?php endif; ?>
  247. <?php if (isset($item->positions['aftertitle_nolabel3'])) : ?>
  248. <!-- BOF aftertitle_nolabel block -->
  249. <?php foreach ($item->positions['aftertitle_nolabel3'] as $field) : ?>
  250. <li class="flexi-field">
  251. <div class="flexi value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></div>
  252. </li>
  253. <?php endforeach; ?>
  254. <!-- EOF aftertitle_nolabel block -->
  255. <?php endif; ?>
  256. </ul>
  257. <?php if ($item->event->afterDisplayContent) : ?>
  258. <!-- BOF afterDisplayContent -->
  259. <div class="fc_afterDisplayContent group">
  260. <?php echo $item->event->afterDisplayContent; ?>
  261. </div>
  262. <!-- EOF afterDisplayContent -->
  263. <?php endif; ?>
  264. </li>
  265. <?php endforeach; ?>
  266. </ul>
  267. </div>
  268. <!-- EOF subcategory items -->
  269. <?php endif; ?>
  270. </div>
  271. </li>
  272. <?php endforeach; ?>
  273. </ul>