1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Panel;
14:
15: use DcGeneral\Data\ConfigInterface;
16: use DcGeneral\EnvironmentInterface;
17:
18: /**
19: * Default implementation of a panel container.
20: *
21: * @package DcGeneral\Panel
22: */
23: class DefaultPanelContainer
24: implements PanelContainerInterface
25: {
26: /**
27: * The environment in use.
28: *
29: * @var EnvironmentInterface
30: */
31: protected $objEnvironment;
32:
33: /**
34: * The panels contained within this container.
35: *
36: * @var PanelInterface[]
37: */
38: protected $arrPanels = array();
39:
40: /**
41: * {@inheritdoc}
42: */
43: public function getEnvironment()
44: {
45: return $this->objEnvironment;
46: }
47: /**
48: * {@inheritdoc}
49: */
50: public function setEnvironment(EnvironmentInterface $objEnvironment)
51: {
52: $this->objEnvironment = $objEnvironment;
53: return $this;
54: }
55:
56: /**
57: * {@inheritdoc}
58: */
59: public function addPanel($strKey, $objPanel)
60: {
61: $this->arrPanels[$strKey] = $objPanel;
62: $objPanel->setContainer($this);
63:
64: return $this;
65: }
66:
67: /**
68: * {@inheritdoc}
69: */
70: public function getPanel($strKey)
71: {
72: return $this->arrPanels[$strKey];
73: }
74:
75: /**
76: * {@inheritdoc}
77: */
78: public function initialize(ConfigInterface $objConfig, PanelElementInterface $objElement = null)
79: {
80: /** @var PanelInterface $objPanel */
81:
82: foreach ($this as $objPanel)
83: {
84: $objPanel->initialize($objConfig, $objElement);
85: }
86: }
87:
88: /**
89: * {@inheritdoc}
90: */
91: public function updateValues()
92: {
93: return ($this->getEnvironment()->getInputProvider()->getValue('FORM_SUBMIT') === 'tl_filters');
94: }
95:
96: /**
97: * {@inheritdoc}
98: */
99: public function getIterator()
100: {
101: return new \ArrayIterator($this->arrPanels);
102: }
103: }
104: