PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/com_flexicontent_v2.x/site/views/favourites/tmpl/default.php

http://flexicontent.googlecode.com/
PHP | 246 lines | 218 code | 7 blank | 21 comment | 3 complexity | 0ca2908a117db29cf0794cbfd693c57a MD5 | raw file
Possible License(s): MIT, GPL-2.0, Apache-2.0
  1. <?php
  2. /**
  3. * @version 1.5 stable $Id: default.php 1674 2013-04-18 03:41:15Z 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. jimport( 'joomla.html.parameter' );
  20. $params = $this->params;
  21. $db = JFactory::getDBO();
  22. // Date configuration
  23. $use_date = $params->get( 'show_modify_date', 1 ) ;
  24. $dateformat = $params->get( 'date_format', 'DATE_FORMAT_LC2' ) ;
  25. $customdate = $params->get( 'custom_date', '' ) ;
  26. $dateformat = ($dateformat != "DATE_FORMAT_CUSTOM") ? $dateformat : $customdate;
  27. // Image configuration
  28. $use_image = (int)$params->get('use_image', 1);
  29. $image_source = $params->get('image_source');
  30. $image_height = (int)$params->get('image_height', 40);
  31. $image_width = (int)$params->get('image_width', 40);
  32. $image_method = (int)$params->get('image_method', 1);
  33. $image_size = $params->get('image_size', '');
  34. // Retrieve default image for the image field
  35. if ($use_image && $image_source) {
  36. $query = 'SELECT attribs, name FROM #__flexicontent_fields WHERE id = '.(int) $image_source;
  37. $db->setQuery($query);
  38. $image_dbdata = $db->loadObject();
  39. //$image_dbdata->params = FLEXI_J16GE ? new JRegistry($image_dbdata->params) : new JParameter($image_dbdata->params);
  40. $img_size_map = array('l'=>'large', 'm'=>'medium', 's'=>'small', '' => '');
  41. $img_field_size = $img_size_map[ $image_size ];
  42. $img_field_name = $image_dbdata->name;
  43. }
  44. // Extra fields configuration
  45. $use_fields = (int)$params->get('use_fields', 1);
  46. $fields = $params->get('fields');
  47. $fields = preg_replace("/[\"'\\\]/u", "", $fields);
  48. $fields = array_unique(preg_split("/\s*,\s*/u", $fields));
  49. if ( !strlen($fields[0]) ) unset($fields[0]);
  50. $page_classes = '';
  51. $page_classes .= $this->pageclass_sfx ? ' page'.$this->pageclass_sfx : '';
  52. $page_classes .= ' fcfavourites';
  53. $menu = JFactory::getApplication()->getMenu()->getActive();
  54. if ($menu) $page_classes .= ' menuitem'.$menu->id;
  55. ?>
  56. <!--script type="text/javascript">
  57. </script-->
  58. <div id="flexicontent" class="flexicontent <?php echo $page_classes; ?>" >
  59. <?php if ( $this->params->get( 'show_page_heading', 1 ) ) : ?>
  60. <h1 class="componentheading">
  61. <?php echo $this->params->get('page_heading'); ?>
  62. </h1>
  63. <?php else : ?>
  64. <h2 class="contentheading">
  65. <?php echo JText::_( 'FLEXI_YOUR_FAVOURED_ITEMS' ).' '; ?>
  66. </h2>
  67. <?php endif; ?>
  68. <?php if (!count($this->items)) : ?>
  69. <div class="note">
  70. <?php echo JText::_( 'FLEXI_NO_FAVOURED_ITEMS_INFO' ); ?>
  71. </div>
  72. <?php else : ?>
  73. <?php
  74. if ($use_fields && count($fields)) {
  75. foreach ($this->items as $i => $item) {
  76. foreach ($fields as $fieldname) {
  77. // IMPORTANT: below we must use $this->items[$i], and not $item, otherwise joomla will not cache value !!!
  78. FlexicontentFields::getFieldDisplay($this->items[$i], $fieldname, $values=null, $method='display');
  79. if ( !empty($this->items[$i]->fields[$fieldname]->display) ) $found_fields[$fieldname] = 1;
  80. }
  81. }
  82. }
  83. ?>
  84. <form action="<?php echo $this->action; ?>" method="POST" id="adminForm" name="adminForm" onsubmit="">
  85. <?php
  86. $this->params->set('use_filters',0); // Currently not supported by the view, disable it
  87. $this->params->set('show_alpha',0); // Currently not supported by the view, disable it
  88. // Body of form for (a) Text search, Field Filters, Alpha-Index, Items Total Statistics, Selectors(e.g. per page, orderby)
  89. // If customizing via CSS rules or JS scripts is not enough, then please copy the following file here to customize the HTML too
  90. include(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'tmpl_common'.DS.'listings_filter_form_body.php');
  91. ?>
  92. <input type="hidden" name="option" value="com_flexicontent" />
  93. <input type="hidden" name="filter_order" value="<?php echo $this->lists['filter_order']; ?>" />
  94. <input type="hidden" name="filter_order_Dir" value="" />
  95. <input type="hidden" name="view" value="favourites" />
  96. <input type="hidden" name="task" value="" />
  97. </form>
  98. <table class="flexitable" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<?php echo JText::_( 'FLEXI_YOUR_FAVOURED_ITEMS' ).' '; ?>">
  99. <thead>
  100. <tr>
  101. <?php if ($use_image) : ?>
  102. <th id="fc_image"><?php echo JText::_( 'FLEXI_IMAGE' ); ?></th>
  103. <?php endif; ?>
  104. <th id="fc_title"><?php echo JText::_( 'FLEXI_ITEMS' ); ?></th>
  105. <th id="fc_desc"><?php echo JText::_( 'FLEXI_DESCRIPTION' ); ?></th>
  106. <?php if ($use_date) : ?>
  107. <th id="fc_modified"><?php echo JText::_( 'FLEXI_LAST_UPDATED' ); ?></th>
  108. <?php endif; ?>
  109. <?php if ($use_fields && count($fields)) : ?>
  110. <?php foreach ($fields as $fieldname) : ?>
  111. <?php if ( empty($found_fields[$fieldname]) ) continue; ?>
  112. <th id="fc_<?php echo $fieldname; ?>" ><?php echo $this->items[0]->fields[$fieldname]->label; ?></th>
  113. <?php endforeach; ?>
  114. <?php endif; ?>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. <?php
  119. foreach ($this->items as $i => $item) :
  120. if ($use_image) {
  121. $src = '';
  122. $thumb = '';
  123. if ($image_source)
  124. {
  125. FlexicontentFields::getFieldDisplay($item, $img_field_name, null, 'display', 'module');
  126. $img_field = $item->fields[$img_field_name];
  127. if ( !$img_field_size ) {
  128. $src = str_replace(JURI::root(), '', $img_field->thumbs_src['large'][0] );
  129. } else {
  130. $thumb = $img_field->thumbs_src[ $img_field_size ][0];
  131. }
  132. } else {
  133. $src = flexicontent_html::extractimagesrc($item);
  134. }
  135. $RESIZE_FLAG = !$image_source || !$img_field_size;
  136. if ( $src && $RESIZE_FLAG ) {
  137. // Resize image when src path is set and RESIZE_FLAG: (a) using image extracted from item main text OR (b) not using image field's already created thumbnails
  138. $h = '&amp;h=' . $image_height;
  139. $w = '&amp;w=' . $image_width;
  140. $aoe = '&amp;aoe=1';
  141. $q = '&amp;q=95';
  142. $zc = $image_method ? '&amp;zc=' . $image_method : '';
  143. $ext = pathinfo($src, PATHINFO_EXTENSION);
  144. $f = in_array( $ext, array('png', 'ico', 'gif') ) ? '&amp;f='.$ext : '';
  145. $conf = $w . $h . $aoe . $q . $zc . $f;
  146. $base_url = (!preg_match("#^http|^https|^ftp#i", $src)) ? JURI::base(true).'/' : '';
  147. $thumb = JURI::base(true).'/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.$base_url.$src.$conf;
  148. } else {
  149. // Do not resize image when (a) image src path not set or (b) using image field's already created thumbnails
  150. }
  151. }
  152. $item_link = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug));
  153. $fc_item_classes = 'sectiontableentry';
  154. foreach ($item->categories as $item_cat) {
  155. $fc_item_classes .= ' fc_itemcat_'.$item_cat->id;
  156. }
  157. $fc_item_classes .= $item->has_access ? ' fc_item_has_access' : ' fc_item_no_access';
  158. $markup_tags = '<span class="fc_mublock">';
  159. foreach($item->css_markups as $grp => $css_markups) {
  160. if ( empty($css_markups) ) continue;
  161. $fc_item_classes .= ' fc'.implode(' fc', $css_markups);
  162. $ecss_markups = $item->ecss_markups[$grp];
  163. $title_markups = $item->title_markups[$grp];
  164. foreach($css_markups as $mui => $css_markup) {
  165. $markup_tags .= '<span class="fc_markup mu' . $css_markups[$mui] . $ecss_markups[$mui] .'">' .$title_markups[$mui]. '</span>';
  166. }
  167. }
  168. $markup_tags .= '</span>';
  169. ?>
  170. <tr id="tablelist_item_<?php echo $i; ?>" class="<?php echo $fc_item_classes; ?>">
  171. <?php if ($use_image) : ?>
  172. <td headers="fc_image" align="center">
  173. <?php if (!empty($thumb)) : ?>
  174. <?php if ($this->params->get('link_image', 1)) { ?>
  175. <a href="<?php echo $item_link; ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . '::' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>">
  176. <img src="<?php echo $thumb; ?>" />
  177. </a>
  178. <?php } else { ?>
  179. <img src="<?php echo $thumb; ?>" />
  180. <?php } ?>
  181. <?php else : ?>
  182. <small><i><?php echo JText::_('FLEXI_NO_IMAGE'); ?></i></small>
  183. <?php endif; ?>
  184. </td>
  185. <?php endif; ?>
  186. <td headers="fc_title">
  187. <a href="<?php echo $item_link; ?>"><?php echo $this->escape($item->title); ?></a>
  188. <?php echo $markup_tags; ?>
  189. </td>
  190. <td headers="fc_intro">
  191. <?php echo flexicontent_html::striptagsandcut( $item->introtext, 150 ); ?>
  192. </td>
  193. <?php if ($use_date) : ?>
  194. <td headers="fc_modified">
  195. <?php echo JHTML::_( 'date', ($item->modified ? $item->modified : $item->created), JText::_($dateformat) ); ?>
  196. </td>
  197. <?php endif; ?>
  198. <?php if ($use_fields && count($fields)) : ?>
  199. <?php foreach ($fields as $fieldname) : ?>
  200. <?php if ( empty($found_fields[$fieldname]) ) continue; ?>
  201. <td headers="fc_<?php echo $item->fields[$fieldname]->name; ?>" ><?php echo $item->fields[$fieldname]->display; ?></th>
  202. <?php endforeach; ?>
  203. <?php endif; ?>
  204. </tr>
  205. <?php endforeach; ?>
  206. </tbody>
  207. </table>
  208. <?php endif; ?>
  209. <!-- BOF pagination -->
  210. <?php
  211. // If customizing via CSS rules or JS scripts is not enough, then please copy the following file here to customize the HTML too
  212. include(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'tmpl_common'.DS.'pagination.php');
  213. ?>
  214. <!-- EOF pagination -->
  215. </div>