/** * @see \wcf\system\importer\IImporter::import() */ public function import($oldID, array $data, array $additionalData = array()) { $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.label.group', $data['groupID']); if (!$data['groupID']) { return 0; } $label = LabelEditor::create($data); ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.label', $oldID, $label->labelID); return $label->labelID; }
/** * @see \wcf\form\IForm::save() */ public function save() { parent::save(); // save label $this->objectAction = new LabelAction(array(), 'create', array('data' => array_merge($this->additionalFields, array('label' => $this->label, 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'groupID' => $this->groupID)))); $this->objectAction->executeAction(); if (!I18nHandler::getInstance()->isPlainValue('label')) { $returnValues = $this->objectAction->getReturnValues(); $labelID = $returnValues['returnValues']->labelID; I18nHandler::getInstance()->save('label', 'wcf.acp.label.label' . $labelID, 'wcf.acp.label', 1); // update group name $labelEditor = new LabelEditor($returnValues['returnValues']); $labelEditor->update(array('label' => 'wcf.acp.label.label' . $labelID)); } $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType'); foreach ($objectTypes as $objectType) { $objectType->getProcessor()->save(); } $this->saved(); // reset values $this->label = $this->cssClassName = $this->customCssClassName = ''; $this->groupID = 0; I18nHandler::getInstance()->reset(); // show success WCF::getTPL()->assign(array('success' => true)); }