| @@ 2101-2136 (lines=36) @@ | ||
| 2098 | $topten = []; |
|
| 2099 | $data = []; |
|
| 2100 | ||
| 2101 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
| 2102 | if ($this->groupSupport) { |
|
| 2103 | if (!in_array($row->user_id, array(-1, $this->user)) || !in_array($row->group_id, $this->groups)) { |
|
| 2104 | continue; |
|
| 2105 | } |
|
| 2106 | } else { |
|
| 2107 | if (!in_array($row->user_id, array(-1, $this->user))) { |
|
| 2108 | continue; |
|
| 2109 | } |
|
| 2110 | } |
|
| 2111 | ||
| 2112 | $data['visits'] = $row->visits; |
|
| 2113 | $data['question'] = $row->question; |
|
| 2114 | $data['date'] = $row->updated; |
|
| 2115 | $data['last_visit'] = $row->last_visit; |
|
| 2116 | ||
| 2117 | $title = $row->question; |
|
| 2118 | $url = sprintf( |
|
| 2119 | '%sindex.php?%saction=artikel&cat=%d&id=%d&artlang=%s', |
|
| 2120 | $this->_config->getDefaultUrl(), |
|
| 2121 | $sids, |
|
| 2122 | $row->category_id, |
|
| 2123 | $row->id, |
|
| 2124 | $row->lang |
|
| 2125 | ); |
|
| 2126 | $oLink = new PMF_Link($url, $this->_config); |
|
| 2127 | $oLink->itemTitle = $row->question; |
|
| 2128 | $oLink->tooltip = $title; |
|
| 2129 | $data['url'] = $oLink->toString(); |
|
| 2130 | ||
| 2131 | $topten[$row->id] = $data; |
|
| 2132 | ||
| 2133 | if (count($topten) === $count) { |
|
| 2134 | break; |
|
| 2135 | } |
|
| 2136 | } |
|
| 2137 | ||
| 2138 | return $topten; |
|
| 2139 | } |
|
| @@ 2206-2241 (lines=36) @@ | ||
| 2203 | $latest = []; |
|
| 2204 | $data = []; |
|
| 2205 | ||
| 2206 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
|
| 2207 | if ($this->groupSupport) { |
|
| 2208 | if (!in_array($row->user_id, array(-1, $this->user)) || !in_array($row->group_id, $this->groups)) { |
|
| 2209 | continue; |
|
| 2210 | } |
|
| 2211 | } else { |
|
| 2212 | if (!in_array($row->user_id, array(-1, $this->user))) { |
|
| 2213 | continue; |
|
| 2214 | } |
|
| 2215 | } |
|
| 2216 | ||
| 2217 | $data['date'] = $row->updated; |
|
| 2218 | $data['question'] = $row->question; |
|
| 2219 | $data['answer'] = $row->content; |
|
| 2220 | $data['visits'] = $row->visits; |
|
| 2221 | ||
| 2222 | $title = $row->question; |
|
| 2223 | $url = sprintf( |
|
| 2224 | '%sindex.php?%saction=artikel&cat=%d&id=%d&artlang=%s', |
|
| 2225 | $this->_config->getDefaultUrl(), |
|
| 2226 | $sids, |
|
| 2227 | $row->category_id, |
|
| 2228 | $row->id, |
|
| 2229 | $row->lang |
|
| 2230 | ); |
|
| 2231 | $oLink = new PMF_Link($url, $this->_config); |
|
| 2232 | $oLink->itemTitle = $row->question; |
|
| 2233 | $oLink->tooltip = $title; |
|
| 2234 | $data['url'] = $oLink->toString(); |
|
| 2235 | ||
| 2236 | $latest[$row->id] = $data; |
|
| 2237 | ||
| 2238 | if (count($latest) === $count) { |
|
| 2239 | break; |
|
| 2240 | } |
|
| 2241 | } |
|
| 2242 | ||
| 2243 | return $latest; |
|
| 2244 | } |
|