@@ 173-188 (lines=16) @@ | ||
170 | * rating of this page by this user ... |
|
171 | * @return ArrayList |
|
172 | */ |
|
173 | public function CurrentUserRating() |
|
174 | { |
|
175 | $sqlQuery = new SQLQuery(); |
|
176 | $sqlQuery->setSelect("AVG(\"PageRating\".\"Rating\") RatingAverage, ParentID"); |
|
177 | $sqlQuery->setFrom("\"PageRating\" "); |
|
178 | if ($this->onlyShowApprovedPageRatings()) { |
|
179 | $sqlQuery->setWhere("\"ParentID\" = ".$this->owner->ID." AND \"PageRating\".\"ID\" = '".Session::get('PageRated'.$this->owner->ID)."' AND \"PageRating\".\"IsApproved\" = 1"); |
|
180 | } else { |
|
181 | $sqlQuery->setWhere("\"ParentID\" = ".$this->owner->ID." AND \"PageRating\".\"ID\" = '".Session::get('PageRated'.$this->owner->ID)."'"); |
|
182 | } |
|
183 | ||
184 | $sqlQuery->setOrderBy("RatingAverage DESC"); |
|
185 | $sqlQuery->setGroupby("\"ParentID\""); |
|
186 | $sqlQuery->setLimit(1); |
|
187 | return $this->turnPageRaterSQLIntoArrayList($sqlQuery, "CurrentUserRating"); |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * list of all rated pages ... |
@@ 179-194 (lines=16) @@ | ||
176 | * rating of this page by this user ... |
|
177 | * @return ArrayList |
|
178 | */ |
|
179 | public function CurrentUserRating() |
|
180 | { |
|
181 | $sqlQuery = new SQLQuery(); |
|
182 | $sqlQuery->setSelect("AVG(\"PageRating\".\"Rating\") RatingAverage, ParentID"); |
|
183 | $sqlQuery->setFrom("\"PageRating\" "); |
|
184 | if ($this->onlyShowApprovedPageRatings()) { |
|
185 | $sqlQuery->setWhere("\"ParentID\" = ".$this->owner->ID." AND \"PageRating\".\"ID\" = '".Session::get('PageRated'.$this->owner->ID)."' AND \"PageRating\".\"IsApproved\" = 1"); |
|
186 | } else { |
|
187 | $sqlQuery->setWhere("\"ParentID\" = ".$this->owner->ID." AND \"PageRating\".\"ID\" = '".Session::get('PageRated'.$this->owner->ID)."'"); |
|
188 | } |
|
189 | ||
190 | $sqlQuery->setOrderBy("RatingAverage DESC"); |
|
191 | $sqlQuery->setGroupby("\"ParentID\""); |
|
192 | $sqlQuery->setLimit(1); |
|
193 | return $this->turnPageRaterSQLIntoArrayList($sqlQuery, "CurrentUserRating"); |
|
194 | } |
|
195 | ||
196 | ||
197 | /** |