1: <?php
2:
3: /**
4: * This file contains the list GUI class.
5: *
6: * @package Core
7: * @subpackage GUI
8: * @version SVN Revision $Rev:$
9: *
10: * @author Timo Hummel
11: * @copyright four for business AG <www.4fb.de>
12: * @license http://www.contenido.org/license/LIZENZ.txt
13: * @link http://www.4fb.de
14: * @link http://www.contenido.org
15: */
16:
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18:
19: /**
20: * List GUI class
21: *
22: * @package Core
23: * @subpackage GUI
24: */
25: class cGuiList {
26:
27: /**
28: *
29: * @var array
30: */
31: protected $cells;
32:
33: /**
34: *
35: */
36: public function __construct() {
37: $this->cells = array();
38: }
39:
40: /**
41: *
42: * @param string|int $item
43: * @param string|int $cell
44: * @param string $value
45: */
46: public function setCell($item, $cell, $value) {
47: $this->cells[$item][$cell] = $value;
48: }
49:
50: /**
51: *
52: * @param bool $print [optional]
53: * @return Ambigous <string, void, mixed>
54: */
55: public function render($print = false) {
56: global $cfg;
57:
58: $backendPath = cRegistry::getBackendPath();
59:
60: $tpl = new cTemplate();
61: $tpl2 = new cTemplate();
62:
63: $colcount = 0;
64:
65: if (is_array($this->cells)) {
66: foreach ($this->cells as $row => $cells) {
67: $thefont = '';
68: $unne = '';
69:
70: $colcount++;
71:
72: $content = "";
73: $count = 0;
74:
75: foreach ($cells as $key => $value) {
76: $count++;
77: $tpl2->reset();
78:
79: $tpl2->set('s', 'CONTENT', $value);
80: if ($colcount == 1) {
81: $content .= $tpl2->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['generic_list_head'], true);
82: } else {
83: $content .= $tpl2->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['generic_list_row'], true);
84: }
85: }
86:
87: $tpl->set('d', 'ROWS', $content);
88: $tpl->next();
89: }
90: }
91:
92: $rendered = $tpl->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['generic_list'], true);
93:
94: if ($print == true) {
95: echo $rendered;
96: } else {
97: return $rendered;
98: }
99: }
100:
101: }
102: