OXID eShop CE  4.8.11
 All Classes Files Functions Variables Pages
oxvariantselectlist.php
Go to the documentation of this file.
1 <?php
2 
8 {
13  protected $_sLabel = null;
14 
19  protected $_iIndex = 0;
20 
25  protected $_aList = array();
26 
31  protected $_oActiveSelection = null;
32 
41  public function __construct( $sLabel, $iIndex )
42  {
43  $this->_sLabel = trim( $sLabel );
44  $this->_iIndex = $iIndex;
45  }
46 
52  public function getLabel()
53  {
54  return getStr()->htmlspecialchars( $this->_sLabel );
55  }
56 
67  public function addVariant( $sName, $sValue, $blDisabled, $blActive )
68  {
69  if ( ( $sName = trim( $sName ) ) ) {
70  $sKey = $sValue;
71 
72  // creating new
73  if ( !isset( $this->_aList[$sKey] ) ) {
74  $this->_aList[$sKey] = oxNew( "oxSelection", $sName, $sValue, $blDisabled, $blActive );
75  } else {
76 
77  // overriding states
78  if ( $this->_aList[$sKey]->isDisabled() && !$blDisabled ) {
79  $this->_aList[$sKey]->setDisabled( $blDisabled );
80  }
81 
82  if ( !$this->_aList[$sKey]->isActive() && $blActive ) {
83  $this->_aList[$sKey]->setActiveState( $blActive );
84  }
85  }
86 
87  // storing active selection
88  if ( $this->_aList[$sKey]->isActive() ) {
89  $this->_oActiveSelection = $this->_aList[$sKey];
90  }
91  }
92  }
93 
99  public function getActiveSelection()
100  {
102  }
103 
109  public function getSelections()
110  {
111  return $this->_aList;
112  }
113 }