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