Exemplo n.º 1
0
 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     // save label group
     $labelGroup = LabelGroupEditor::create($data);
     // save objects
     if (!empty($additionalData['objects'])) {
         $sql = "INSERT INTO\twcf" . WCF_N . "_label_group_to_object\n\t\t\t\t\t\t(groupID, objectTypeID, objectID)\n\t\t\t\tVALUES\t\t(?, ?, ?)";
         $statement = WCF::getDB()->prepareStatement($sql);
         foreach ($additionalData['objects'] as $objectTypeID => $objectIDs) {
             foreach ($objectIDs as $objectID) {
                 $statement->execute(array($labelGroup->groupID, $objectTypeID, $objectID));
             }
         }
     }
     ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.label.group', $oldID, $labelGroup->groupID);
     return $labelGroup->groupID;
 }
Exemplo n.º 2
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // save label
     $this->objectAction = new LabelGroupAction(array(), 'create', array('data' => array_merge($this->additionalFields, array('forceSelection' => $this->forceSelection ? 1 : 0, 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'showOrder' => $this->showOrder))));
     $returnValues = $this->objectAction->executeAction();
     if (!I18nHandler::getInstance()->isPlainValue('groupName')) {
         I18nHandler::getInstance()->save('groupName', 'wcf.acp.label.group' . $returnValues['returnValues']->groupID, 'wcf.acp.label', 1);
         // update group name
         $groupEditor = new LabelGroupEditor($returnValues['returnValues']);
         $groupEditor->update(array('groupName' => 'wcf.acp.label.group' . $returnValues['returnValues']->groupID));
     }
     // save acl
     ACLHandler::getInstance()->save($returnValues['returnValues']->groupID, $this->objectTypeID);
     ACLHandler::getInstance()->disableAssignVariables();
     // save object type relations
     $this->saveObjectTypeRelations($returnValues['returnValues']->groupID);
     foreach ($this->labelObjectTypes as $objectTypeID => $labelObjectType) {
         $labelObjectType->save();
     }
     $this->saved();
     // reset values
     $this->forceSelection = false;
     $this->groupName = $this->groupDescription = '';
     $this->objectTypes = array();
     $this->showOrder = 0;
     $this->setObjectTypeRelations();
     // show success
     WCF::getTPL()->assign(array('success' => true));
     I18nHandler::getInstance()->reset();
 }