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