3 DEFINE(
"ERR_SUCCESS", 1);
4 DEFINE(
"ERR_REQUIREDMISSING", -1);
5 DEFINE(
"ERR_POSOUTOFBOUNDS", -2);
32 $sArticleTable = getViewName(
'oxarticles');
35 $this->_aViewData[
"edit"] =
oxNew(
"oxselectlist");
37 if ($sOxId !=
"-1" && isset($sOxId)) {
44 $oAttr =
oxNew(
"oxselectlist");
45 $oAttr->loadInLang($this->_iEditLang, $sOxId);
47 $aFieldList = $oAttr->getFieldList();
48 if (is_array($aFieldList)) {
49 foreach ($aFieldList as $key => $oField) {
50 if ($oField->priceUnit ==
'%') {
51 $oField->price = $oField->fprice;
56 $oOtherLang = $oAttr->getAvailableInLangs();
57 if (!isset($oOtherLang[$this->_iEditLang])) {
59 $oAttr->loadInLang(key($oOtherLang), $sOxId);
61 $this->_aViewData[
"edit"] = $oAttr;
67 $this->_aViewData[
"posslang"] =
$aLang;
70 foreach ($oOtherLang as $id => $language) {
71 $oLang =
new stdClass();
72 $oLang->sLangDesc = $language;
74 $this->_aViewData[
"otherlang"][$id] = clone $oLang;
83 $this->_aViewData[
"iErrorCode"] = $iErr;
88 $oSelectlistMainAjax =
oxNew(
'selectlist_main_ajax');
89 $this->_aViewData[
'oxajax'] = $oSelectlistMainAjax->getColumns();
91 return "popups/selectlist_main.tpl";
94 return "selectlist_main.tpl";
111 $aParams[
'oxselectlist__oxshopid'] = $sShopID;
112 $oAttr =
oxNew(
"oxselectlist");
114 if ($sOxId !=
"-1") {
115 $oAttr->loadInLang($this->_iEditLang, $sOxId);
117 $aParams[
'oxselectlist__oxid'] = null;
122 $oAttr->setLanguage(0);
123 $oAttr->assign($aParams);
126 if (!is_array($this->aFieldArray)) {
127 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText($oAttr->oxselectlist__oxvaldesc->getRawValue());
131 foreach ($this->aFieldArray as $oField) {
132 $oAttr->oxselectlist__oxvaldesc->setValue($oAttr->oxselectlist__oxvaldesc->getRawValue() . $oField->name,
oxField::T_RAW);
133 if (isset($oField->price) && $oField->price) {
134 $oAttr->oxselectlist__oxvaldesc->setValue($oAttr->oxselectlist__oxvaldesc->getRawValue() .
"!P!" . trim(str_replace(
",",
".", $oField->price)),
oxField::T_RAW);
135 if ($oField->priceUnit ==
'%') {
136 $oAttr->oxselectlist__oxvaldesc->setValue($oAttr->oxselectlist__oxvaldesc->getRawValue() .
'%',
oxField::T_RAW);
139 $oAttr->oxselectlist__oxvaldesc->setValue($oAttr->oxselectlist__oxvaldesc->getRawValue() .
"__@@",
oxField::T_RAW);
142 $oAttr->setLanguage($this->_iEditLang);
161 $aParams[
'oxselectlist__oxshopid'] = $sShopID;
162 $oObj =
oxNew(
"oxselectlist");
164 if ($sOxId !=
"-1") {
165 $oObj->loadInLang($this->_iEditLang, $sOxId);
167 $aParams[
'oxselectlist__oxid'] = null;
174 $oObj->setLanguage(0);
175 $oObj->assign($aParams);
192 $oSelectlist =
oxNew(
"oxselectlist");
193 if ($oSelectlist->loadInLang($this->_iEditLang, $this->getEditObjectId())) {
196 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText($oSelectlist->oxselectlist__oxvaldesc->getRawValue());
198 if (is_array($aDelFields) && count($aDelFields)) {
199 foreach ($aDelFields as $sDelField) {
201 foreach ($this->aFieldArray as $sKey => $oField) {
202 if ($oField->name == $sDel) {
203 unset($this->aFieldArray[$sKey]);
220 $oSelectlist =
oxNew(
"oxselectlist");
221 if ($oSelectlist->loadInLang($this->_iEditLang, $this->getEditObjectId())) {
225 if (empty($sAddField)) {
231 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText($oSelectlist->oxselectlist__oxvaldesc->getRawValue());
233 $oField =
new stdClass();
234 $oField->name = $sAddField;
238 $this->aFieldArray[] = $oField;
257 if (empty($sAddField)) {
264 if (is_array($aChangeFields) && count($aChangeFields)) {
266 $oSelectlist =
oxNew(
"oxselectlist");
267 if ($oSelectlist->loadInLang($this->_iEditLang, $this->getEditObjectId())) {
269 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText($oSelectlist->oxselectlist__oxvaldesc->getRawValue());
272 foreach ($this->aFieldArray as $sKey => $oField) {
273 if ($oField->name == $sChangeFieldName) {
274 $this->aFieldArray[$sKey]->name = $sAddField;
275 $this->aFieldArray[$sKey]->price =
oxRegistry::getConfig()->getRequestParameter(
"sAddFieldPriceMod");
276 $this->aFieldArray[$sKey]->priceUnit =
oxRegistry::getConfig()->getRequestParameter(
"sAddFieldPriceModUnit");
301 if (!isset($this->aFieldArray) || !is_array($this->aFieldArray)) {
305 $iFieldCount = count($this->aFieldArray);
306 if ($iPos < 0 || $iPos >= $iFieldCount) {
313 for ($i = 0; $i < $iFieldCount; $i++) {
314 if ($this->aFieldArray[$i] == $oField) {
320 if ($iCurrentPos == -1) {
324 if ($iCurrentPos == $iPos) {
328 $sField = $this->aFieldArray[$iCurrentPos];
329 if ($iCurrentPos < $iPos) {
330 for ($i = $iCurrentPos; $i < $iPos; $i++) {
331 $this->aFieldArray[$i] = $this->aFieldArray[$i + 1];
333 $this->aFieldArray[$iPos] = $sField;
337 for ($i = $iCurrentPos; $i > $iPos; $i--) {
338 $this->aFieldArray[$i] = $this->aFieldArray[$i - 1];
340 $this->aFieldArray[$iPos] = $sField;
356 $aInput = explode(
'__@@', $sInput, 3);