Esempio n. 1
0
 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $data['groupID']);
     if (!$data['groupID']) {
         $data['groupID'] = UserGroup::getGroupByType(UserGroup::USERS)->groupID;
     }
     $rank = UserRankEditor::create($data);
     ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.rank', $oldID, $rank->rankID);
     return $rank->rankID;
 }
Esempio n. 2
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // save label
     $this->objectAction = new UserRankAction(array(), 'create', array('data' => array_merge($this->additionalFields, array('rankTitle' => $this->rankTitle, 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'groupID' => $this->groupID, 'requiredPoints' => $this->requiredPoints, 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender))));
     $this->objectAction->executeAction();
     if (!I18nHandler::getInstance()->isPlainValue('rankTitle')) {
         $returnValues = $this->objectAction->getReturnValues();
         $rankID = $returnValues['returnValues']->rankID;
         I18nHandler::getInstance()->save('rankTitle', 'wcf.user.rank.userRank' . $rankID, 'wcf.user', 1);
         // update name
         $rankEditor = new UserRankEditor($returnValues['returnValues']);
         $rankEditor->update(array('rankTitle' => 'wcf.user.rank.userRank' . $rankID));
     }
     $this->saved();
     // reset values
     $this->rankTitle = $this->cssClassName = $this->customCssClassName = $this->rankImage = '';
     $this->groupID = $this->requiredPoints = $this->requiredGender = 0;
     $this->repeatImage = 1;
     I18nHandler::getInstance()->reset();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }