foreach ($index as $letter => $data) { //Link: Nur Begriffe mit diesem Buchstaben $letterlink = mklink('glossar.php?catid=' . $_REQUEST['catid'] . '&letter=' . iif($letter == '#', 'spchar', strtolower($letter)), 'glossar,' . $_REQUEST['catid'] . ',' . iif($letter == '#', 'spchar', strtolower($letter)) . ',1' . urlformat($catinfo['title']) . '.html'); foreach ($data as $res) { ++$i; //Link $link = mklink('glossar.php?id=' . $res['id'], 'glossar,id' . $res['id'] . urlformat($res['title']) . '.html'); //Text $text = ''; if (in_array('INDEX.TEXT', $parse)) { $text = mediamanager_inline($res['text']); $text = glossar_highlight($text); } //Tags if (in_array('INDEX.TAG', $parse) || in_array('INDEX.TAG_IDS', $parse) || in_array('INDEX.KEYWORDS', $parse)) { list($tagdata, $tagids, $keywords) = glossar_tags($res['id']); } $tabledata[$i]['LETTER'] = $letter; $tabledata[$i]['LETTERLINK'] = $letterlink; $tabledata[$i]['TITLE'] = $res['title']; $tabledata[$i]['TEXT'] = $text; $tabledata[$i]['SPELLING'] = $res['spelling']; $tabledata[$i]['LINK'] = $link; $tabledata[$i]['TIME'] = $res['starttime']; $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.'); //Tags $tabledata[$i]['TAG'] = $tagdata; $tabledata[$i]['TAG_IDS'] = $tagids; $tabledata[$i]['KEYWORDS'] = $keywords; //Kommentare if ($apx->is_module('comments') && $set['glossar']['coms'] && $res['allowcoms']) {
function glossar_print($data, $template, $alphabetical = false) { global $set, $db, $apx, $user; $tmpl = new tengine(); $apx->lang->drop('func', 'glossar'); //Verwendete Variablen auslesen $parse = $apx->tmpl->used_vars($template, 'glossar'); //Kategorien auslesen & Info vorbereiten if (in_array('INDEX.CATID', $parse) || in_array('INDEX.CATTITLE', $parse) || in_array('INDEX.CATTEXT', $parse) || in_array('INDEX.CATICON', $parse)) { $catids = get_ids($data, 'catid'); if (count($catids)) { $catdata = $db->fetch("SELECT * FROM " . PRE . "_glossar_cat WHERE id IN (" . implode(',', $catids) . ")"); foreach ($catdata as $res) { $catinfo[$res['id']] = $res; $catinfo[$res['id']]['link'] = mklink('glossar.php?catid=' . $res['id'], 'glossar,' . $res['id'] . ',0,1' . urlformat($res['title']) . '.html'); } } } //Begriffe auflisten if (count($data)) { //Nach Buchstaben sortieren $letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ#'; for ($i = 0; $i < strlen($letters); $i++) { $index[$letters[$i]] = array(); } if ($alphabetical) { foreach ($data as $res) { $letter = glossar_letter($res['title']); $index[$letter][] = $res; } } else { foreach ($data as $res) { $index[0][] = $res; } } //Index erstellen foreach ($index as $letter => $data) { //Link: Nur Begriffe mit diesem Buchstaben $letterlink = mklink('glossar.php?catid=' . $_REQUEST['catid'] . '&letter=' . iif($letter == '#', 'spchar', strtolower($letter)), 'glossar,' . $_REQUEST['catid'] . ',' . iif($letter == '#', 'spchar', strtolower($letter)) . ',1' . urlformat($catinfo['title']) . '.html'); foreach ($data as $res) { ++$i; //Link $link = mklink('glossar.php?id=' . $res['id'], 'glossar,id' . $res['id'] . urlformat($res['title']) . '.html'); //Tags if (in_array('INDEX.TAG', $parse) || in_array('INDEX.TAG_IDS', $parse) || in_array('INDEX.KEYWORDS', $parse)) { list($tagdata, $tagids, $keywords) = glossar_tags($res['id']); } $tabledata[$i]['LETTER'] = $letter; $tabledata[$i]['LETTERLINK'] = $letterlink; $tabledata[$i]['TITLE'] = $res['title']; $tabledata[$i]['TEXT'] = $res['text']; $tabledata[$i]['SPELLING'] = $res['spelling']; $tabledata[$i]['LINK'] = $link; $tabledata[$i]['TIME'] = $res['starttime']; $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.'); //Tags $tabledata[$i]['TAG'] = $tagdata; $tabledata[$i]['TAG_IDS'] = $tagids; $tabledata[$i]['KEYWORDS'] = $keywords; $tabledata[$i]['CATID'] = $catinfo[$res['catid']]['id']; $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title']; $tabledata[$i]['CATTEXT'] = $catinfo[$res['catid']]['text']; $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon']; $tabledata[$i]['CATLINK'] = $catinfo[$res['catid']]['link']; //Kommentare if ($apx->is_module('comments') && $set['glossar']['coms'] && $res['allowcoms']) { require_once BASEDIR . getmodulepath('comments') . 'class.comments.php'; if (!isset($coms)) { $coms = new comments('glossar', $res['id']); } else { $coms->mid = $res['id']; } $link = mklink('glossar.php?id=' . $res['id'], 'glossar,id' . $res['id'] . urlformat($res['title']) . '.html'); $tabledata[$i]['COMMENT_COUNT'] = $coms->count(); $tabledata[$i]['COMMENT_LINK'] = $coms->link($link); $tabledata[$i]['DISPLAY_COMMENTS'] = 1; if (in_template(array('INDEX.COMMENT_LAST_USERID', 'INDEX.COMMENT_LAST_NAME', 'INDEX.COMMENT_LAST_TIME'), $parse)) { $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid(); $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name(); $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time(); } } //Bewertungen if ($apx->is_module('ratings') && $set['glossar']['ratings'] && $res['allowrating']) { require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php'; if (!isset($rate)) { $rate = new ratings('glossar', $res['id']); } else { $rate->mid = $res['id']; } $tabledata[$i]['RATING'] = $rate->display(); $tabledata[$i]['RATING_VOTES'] = $rate->count(); $tabledata[$i]['DISPLAY_RATING'] = 1; } } } } $tmpl->assign('INDEX', $tabledata); $tmpl->parse($template, 'glossar'); }