| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: query.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Content 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * details. 13 */ 14 15 // no direct access 16 defined('_JEXEC') or die('Restricted access'); 17 18 /** 19 * Content Component Query Helper 20 * 21 * @static 22 * @package Joomla 23 * @subpackage Content 24 * @since 1.5 25 */ 26 class ContentHelperQuery 27 { 28 function orderbyPrimary($orderby) 29 { 30 switch ($orderby) 31 { 32 case 'alpha' : 33 $orderby = 'cc.title, '; 34 break; 35 36 case 'ralpha' : 37 $orderby = 'cc.title DESC, '; 38 break; 39 40 case 'order' : 41 $orderby = 'cc.ordering, '; 42 break; 43 44 default : 45 $orderby = ''; 46 break; 47 } 48 49 return $orderby; 50 } 51 52 function orderbySecondary($orderby) 53 { 54 switch ($orderby) 55 { 56 case 'date' : 57 $orderby = 'a.created'; 58 break; 59 60 case 'rdate' : 61 $orderby = 'a.created DESC'; 62 break; 63 64 case 'alpha' : 65 $orderby = 'a.title'; 66 break; 67 68 case 'ralpha' : 69 $orderby = 'a.title DESC'; 70 break; 71 72 case 'hits' : 73 $orderby = 'a.hits DESC'; 74 break; 75 76 case 'rhits' : 77 $orderby = 'a.hits'; 78 break; 79 80 case 'order' : 81 $orderby = 'a.ordering'; 82 break; 83 84 case 'author' : 85 $orderby = 'a.created_by_alias, u.name'; 86 break; 87 88 case 'rauthor' : 89 $orderby = 'a.created_by_alias DESC, u.name DESC'; 90 break; 91 92 case 'front' : 93 $orderby = 'f.ordering'; 94 break; 95 96 default : 97 $orderby = 'a.ordering'; 98 break; 99 } 100 101 return $orderby; 102 } 103 104 function buildVotingQuery($params=null) 105 { 106 if (!$params) { 107 $params = &JComponentHelper::getParams( 'com_content' ); 108 } 109 $voting = $params->get('show_vote'); 110 111 if ($voting) { 112 // calculate voting count 113 $select = ' , ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count'; 114 $join = ' LEFT JOIN #__content_rating AS v ON a.id = v.content_id'; 115 } else { 116 $select = ''; 117 $join = ''; 118 } 119 120 $results = array ('select' => $select, 'join' => $join); 121 122 return $results; 123 } 124 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |