3 DEFINE(
"ERR_SUCCESS", 1);
4 DEFINE(
"ERR_REQUIREDMISSING", -1);
5 DEFINE(
"ERR_POSOUTOFBOUNDS", -2);
31 $sArticleTable = getViewName(
'oxarticles');
34 $this->_aViewData[
"edit"] =
oxNew(
"oxselectlist" );
36 if ( $sOxId !=
"-1" && isset( $sOxId)) {
43 $oAttr =
oxNew(
"oxselectlist" );
44 $oAttr->loadInLang( $this->_iEditLang, $sOxId );
46 $aFieldList = $oAttr->getFieldList();
47 if ( is_array( $aFieldList ) ) {
48 foreach ( $aFieldList as $key => $oField ) {
49 if ( $oField->priceUnit ==
'%' ) {
50 $oField->price = $oField->fprice;
55 $oOtherLang = $oAttr->getAvailableInLangs();
56 if (!isset($oOtherLang[$this->_iEditLang])) {
58 $oAttr->loadInLang( key($oOtherLang), $sOxId );
60 $this->_aViewData[
"edit"] = $oAttr;
66 $this->_aViewData[
"posslang"] =
$aLang;
68 foreach ( $oOtherLang as $id => $language) {
69 $oLang =
new stdClass();
70 $oLang->sLangDesc = $language;
72 $this->_aViewData[
"otherlang"][$id] = clone $oLang;
78 $this->_aViewData[
"iErrorCode"] = $iErr;
83 $oSelectlistMainAjax =
oxNew(
'selectlist_main_ajax' );
84 $this->_aViewData[
'oxajax'] = $oSelectlistMainAjax->getColumns();
86 return "popups/selectlist_main.tpl";
88 return "selectlist_main.tpl";
105 $aParams[
'oxselectlist__oxshopid'] = $sShopID;
106 $oAttr =
oxNew(
"oxselectlist" );
108 if ( $sOxId !=
"-1") {
109 $oAttr->loadInLang( $this->_iEditLang, $sOxId );
111 $aParams[
'oxselectlist__oxid'] = null;
116 $oAttr->setLanguage(0);
117 $oAttr->assign( $aParams);
120 if ( !is_array( $this->aFieldArray)) {
121 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText( $oAttr->oxselectlist__oxvaldesc->getRawValue() );
125 foreach ( $this->aFieldArray as $oField) {
126 $oAttr->oxselectlist__oxvaldesc->setValue( $oAttr->oxselectlist__oxvaldesc->getRawValue() . $oField->name,
oxField::T_RAW);
127 if ( isset( $oField->price) && $oField->price) {
128 $oAttr->oxselectlist__oxvaldesc->setValue( $oAttr->oxselectlist__oxvaldesc->getRawValue() .
"!P!" . trim(str_replace(
",",
".", $oField->price)),
oxField::T_RAW);
129 if ($oField->priceUnit ==
'%')
130 $oAttr->oxselectlist__oxvaldesc->setValue( $oAttr->oxselectlist__oxvaldesc->getRawValue() .
'%',
oxField::T_RAW);
132 $oAttr->oxselectlist__oxvaldesc->setValue( $oAttr->oxselectlist__oxvaldesc->getRawValue() .
"__@@",
oxField::T_RAW);
135 $oAttr->setLanguage($this->_iEditLang);
154 $aParams[
'oxselectlist__oxshopid'] = $sShopID;
155 $oObj =
oxNew(
"oxselectlist" );
158 $oObj->loadInLang( $this->_iEditLang, $sOxId );
160 $aParams[
'oxselectlist__oxid'] = null;
166 $oObj->setLanguage(0);
167 $oObj->assign( $aParams);
184 $oSelectlist =
oxNew(
"oxselectlist" );
185 if ( $oSelectlist->loadInLang( $this->_iEditLang, $this->getEditObjectId() ) ) {
188 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText( $oSelectlist->oxselectlist__oxvaldesc->getRawValue() );
190 if ( is_array( $aDelFields ) && count( $aDelFields ) ) {
191 foreach ( $aDelFields as $sDelField ) {
193 foreach ( $this->aFieldArray as $sKey => $oField ) {
194 if ( $oField->name == $sDel ) {
195 unset( $this->aFieldArray[$sKey]);
212 $oSelectlist =
oxNew(
"oxselectlist" );
213 if ( $oSelectlist->loadInLang( $this->_iEditLang, $this->getEditObjectId() ) ) {
217 if ( empty( $sAddField ) ) {
222 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText( $oSelectlist->oxselectlist__oxvaldesc->getRawValue() );
224 $oField =
new stdClass();
225 $oField->name = $sAddField;
229 $this->aFieldArray[] = $oField;
248 if ( empty( $sAddField ) ) {
254 if ( is_array( $aChangeFields ) && count( $aChangeFields ) ) {
256 $oSelectlist =
oxNew(
"oxselectlist" );
257 if ( $oSelectlist->loadInLang( $this->_iEditLang, $this->getEditObjectId() ) ) {
259 $this->aFieldArray =
oxRegistry::getUtils()->assignValuesFromText( $oSelectlist->oxselectlist__oxvaldesc->getRawValue() );
262 foreach ( $this->aFieldArray as $sKey => $oField ) {
263 if ( $oField->name == $sChangeFieldName ) {
264 $this->aFieldArray[$sKey]->name = $sAddField;
291 if ( !isset( $this->aFieldArray ) || !is_array( $this->aFieldArray ) ) {
295 $iFieldCount = count( $this->aFieldArray );
296 if ( $iPos < 0 || $iPos >= $iFieldCount ) {
302 for ( $i = 0; $i < $iFieldCount; $i++ ) {
303 if ( $this->aFieldArray[$i] == $oField ) {
309 if ( $iCurrentPos == -1 ) {
313 if ( $iCurrentPos == $iPos ) {
317 $sField = $this->aFieldArray[$iCurrentPos];
318 if ( $iCurrentPos < $iPos ) {
319 for ( $i = $iCurrentPos; $i < $iPos; $i++ ) {
320 $this->aFieldArray[$i] = $this->aFieldArray[$i+1];
322 $this->aFieldArray[$iPos] = $sField;
325 for ( $i = $iCurrentPos; $i > $iPos; $i-- ) {
326 $this->aFieldArray[$i] = $this->aFieldArray[$i-1];
328 $this->aFieldArray[$iPos] = $sField;
343 $aInput = explode(
'__@@', $sInput, 3);