Changeset 2146 for plugins/pollsFactory/inc/class.postoption.php
- Timestamp:
- 03/30/10 02:37:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/pollsFactory/inc/class.postoption.php
r2139 r2146 110 110 public function getOptions($params=array(),$count_only=false) 111 111 { 112 // This limit field to only one and group results on this field.113 $group = array();114 if (!empty($params['group'])) {115 if (is_array($params['group'])) {116 foreach($params['group'] as $k => $v) {117 $group[] = $this->con->escape($v);118 }119 }120 else {121 $group[] = $this->con->escape($params['group']);122 }123 }124 125 112 if ($count_only) { 126 if (!empty($group)) { 127 $q = 'SELECT count('.$group[0].') '; 128 } 129 else { 130 $q = 'SELECT count(O.option_id) '; 131 } 113 $q = 'SELECT count(O.option_id) '; 132 114 } 133 115 else { 134 if (!empty($group)) { 135 $q = 'SELECT '.implode(', ',$group).' '; 136 } 137 else { 138 $q = 'SELECT O.option_id, O.post_id, O.option_meta, '; 139 140 if (!empty($params['columns']) && is_array($params['columns'])) { 141 $q .= implode(', ',$params['columns']).', '; 142 } 143 $q .= 144 'O.option_creadt, O.option_upddt, O.option_type, O.option_format, '. 145 'O.option_title, O.option_content, O.option_content_xhtml, '. 146 'O.option_selected, O.option_position, '. 147 'P.blog_id, P.post_type, P.post_title '; 148 } 116 $q = 'SELECT O.option_id, O.post_id, O.option_meta, '; 117 118 if (!empty($params['columns']) && is_array($params['columns'])) { 119 $q .= implode(', ',$params['columns']).', '; 120 } 121 $q .= 122 'O.option_creadt, O.option_upddt, O.option_type, O.option_format, '. 123 'O.option_title, O.option_content, O.option_content_xhtml, '. 124 'O.option_selected, O.option_position, '. 125 'P.blog_id, P.post_type, P.post_title '; 149 126 } 150 127 … … 212 189 $q .= $params['sql'].' '; 213 190 } 214 # group215 if (!empty($group)) {216 if (!$count_only) {217 $q .= 'GROUP BY '.implode(', ',$group).' ';218 }219 else {220 $q .= 'GROUP BY '.$group[0].' ';221 }222 }223 191 # order 224 192 if (!$count_only) {
Note: See TracChangeset
for help on using the changeset viewer.