1: <?php
2: /**
3: * This file contains the category frontend logic class.
4: *
5: * @package Plugin
6: * @subpackage FrontendLogic
7: * @version SVN Revision $Rev:$
8: *
9: * @author Andreas Lindner
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: /**
19: * Category frontend logic class.
20: * TODO: comments
21: *
22: * @package Plugin
23: * @subpackage FrontendLogic
24: */
25: class frontendlogic_category extends FrontendLogic
26: {
27: function getFriendlyName ()
28: {
29: return i18n("Category", "frontendlogic_category");
30: }
31:
32: function listActions ()
33: {
34: $actions = array();
35: $actions["access"] = i18n("Access category", "frontendlogic_category");
36:
37: return ($actions);
38: }
39:
40: function listItems ()
41: {
42: global $lang, $db, $cfg;
43:
44: if (!is_object($db)) {
45: $db = cRegistry::getDb();
46: }
47:
48: $sSQL = "SELECT
49: b.idcatlang,
50: b.name,
51: c.level
52: FROM
53: ".$cfg['tab']['cat']." AS a,
54: ".$cfg['tab']['cat_lang']." AS b,
55: ".$cfg['tab']['cat_tree']." AS c
56: WHERE
57: a.idcat = b.idcat AND
58: a.idcat = c.idcat AND
59: b.idlang = ".$lang." AND
60: b.public = 0
61: ORDER BY c.idtree ASC";
62:
63: $db->query($sSQL);
64: while ($db->nextRecord()) {
65: $items[$db->f("idcatlang")] =
66: '<span style="padding-left: '.($db->f("level")*10).'px;">'.htmldecode($db->f("name")).'</span>';
67:
68: }
69:
70: return ($items);
71: }
72: }
73: ?>