OXID eShop CE  4.9.5
 All Classes Files Functions Variables Pages
oxvariantselectlist.php
Go to the documentation of this file.
1 <?php
2 
8 {
9 
15  protected $_sLabel = null;
16 
22  protected $_iIndex = 0;
23 
29  protected $_aList = array();
30 
36  protected $_oActiveSelection = null;
37 
46  public function __construct($sLabel, $iIndex)
47  {
48  $this->_sLabel = trim($sLabel);
49  $this->_iIndex = $iIndex;
50  }
51 
57  public function getLabel()
58  {
59  return getStr()->htmlspecialchars($this->_sLabel);
60  }
61 
70  public function addVariant($sName, $sValue, $blDisabled, $blActive)
71  {
72  if (($sName = trim($sName))) {
73  $sKey = $sValue;
74 
75  // creating new
76  if (!isset($this->_aList[$sKey])) {
77  $this->_aList[$sKey] = oxNew("oxSelection", $sName, $sValue, $blDisabled, $blActive);
78  } else {
79 
80  // overriding states
81  if ($this->_aList[$sKey]->isDisabled() && !$blDisabled) {
82  $this->_aList[$sKey]->setDisabled($blDisabled);
83  }
84 
85  if (!$this->_aList[$sKey]->isActive() && $blActive) {
86  $this->_aList[$sKey]->setActiveState($blActive);
87  }
88  }
89 
90  // storing active selection
91  if ($this->_aList[$sKey]->isActive()) {
92  $this->_oActiveSelection = $this->_aList[$sKey];
93  }
94  }
95  }
96 
102  public function getActiveSelection()
103  {
105  }
106 
112  public function getSelections()
113  {
114  return $this->_aList;
115  }
116 }