/** * @see \wcf\form\IForm::save() */ public function save() { $description = 'wcf.jcoins.shop.item.description' . $this->item->itemID; if (I18nHandler::getInstance()->isPlainValue('description')) { I18nHandler::getInstance()->remove($description); $description = I18nHandler::getInstance()->getValue('description'); } else { I18nHandler::getInstance()->save('description', $description, 'wcf.jcoins'); } $name = 'wcf.jcoins.shop.item.name' . $this->item->itemID; if (I18nHandler::getInstance()->isPlainValue('name')) { I18nHandler::getInstance()->remove($description); $name = I18nHandler::getInstance()->getValue('name'); } else { I18nHandler::getInstance()->save('name', $name, 'wcf.jcoins'); } $action = new \wcf\data\jcoins\shop\item\JCoinsShopItemAction(array($this->item), 'update', array('data' => array('itemType' => $this->type->itemTypeID, 'price' => $this->price, 'description' => $description, 'name' => $name, 'showOrder' => $this->showOrder), 'parameters' => $this->parameterParameters)); $action->executeAction(); $this->saved(); // show success WCF::getTPL()->assign('success', true); }
/** * @see \wcf\form\IForm::save() */ public function save() { parent::save(); $action = new \wcf\data\jcoins\shop\item\JCoinsShopItemAction(array(), 'create', array('data' => array('itemType' => $this->type->itemTypeID, 'isDisabled' => 0, 'price' => $this->price, 'description' => I18nHandler::getInstance()->isPlainValue('description') ? I18nHandler::getInstance()->getValue('description') : '', 'name' => I18nHandler::getInstance()->isPlainValue('name') ? I18nHandler::getInstance()->getValue('name') : '', 'parseBBCodes' => $this->parseBBCodes ? 1 : 0, 'allowHTML' => $this->allowHTML ? 1 : 0, 'allowSmileys' => $this->allowSmileys ? 1 : 0, 'showOrder' => $this->showOrder), 'parameters' => $this->parameterParameters)); $return = $action->executeAction(); $itemID = $return['returnValues']->itemID; $updateData = array(); // save I18n name if (!I18nHandler::getInstance()->isPlainValue('name')) { $updateData['name'] = 'wcf.jcoins.shop.item.name' . $itemID; I18nHandler::getInstance()->save('name', $updateData['name'], 'wcf.jcoins'); } // save I18n description if (!I18nHandler::getInstance()->isPlainValue('description')) { $updateData['description'] = 'wcf.jcoins.shop.item.description' . $itemID; I18nHandler::getInstance()->save('description', $updateData['description'], 'wcf.jcoins'); } if (count($updateData)) { $editor = new \wcf\data\jcoins\shop\item\JCoinsShopItemEditor($return['returnValues']); $editor->update($updateData); } $this->saved(); I18nHandler::getInstance()->reset(); $this->price = 0; $this->parameterParameters = array(); $this->parseBBCodes = true; $this->allowHTML = $this->allowSmileys = false; // show success WCF::getTPL()->assign('success', true); }