function getAllTopics($checkRight = true, $permission = "nw_view") { $topics_arr = array(); $db =& Database::getInstance(); $table = $db->prefix('nw_topics'); $sql = "SELECT * FROM ".$table; if ($checkRight) { $topics = nw_MygetItemIds($permission); if (count($topics) == 0) { return array(); } $topics = implode(',', $topics); $sql .= " WHERE topic_id IN (".$topics.")"; } $sql .= " ORDER BY topic_title"; $result = $db->query($sql); while ($array = $db->fetchArray($result)) { $topic = new nw_NewsTopic(); $topic->makeTopic($array); $topics_arr[$array['topic_id']] = $topic; unset($topic); } return $topics_arr; }