OXID eShop CE  4.10.2
 All Classes Namespaces 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  $sName = trim($sName);
73  //#6053 Allow "0" as a valid value.
74  if (!empty($sName) || $sName === '0') {
75  $sKey = $sValue;
76 
77  // creating new
78  if (!isset($this->_aList[$sKey])) {
79  $this->_aList[$sKey] = oxNew("oxSelection", $sName, $sValue, $blDisabled, $blActive);
80  } else {
81 
82  // overriding states
83  if ($this->_aList[$sKey]->isDisabled() && !$blDisabled) {
84  $this->_aList[$sKey]->setDisabled($blDisabled);
85  }
86 
87  if (!$this->_aList[$sKey]->isActive() && $blActive) {
88  $this->_aList[$sKey]->setActiveState($blActive);
89  }
90  }
91 
92  // storing active selection
93  if ($this->_aList[$sKey]->isActive()) {
94  $this->_oActiveSelection = $this->_aList[$sKey];
95  }
96  }
97  }
98 
104  public function getActiveSelection()
105  {
107  }
108 
114  public function getSelections()
115  {
116  return $this->_aList;
117  }
118 }