/** * @see OptionType::getFormElement() */ public function getFormElement(&$optionData) { if (!isset($optionData['optionValue'])) { if (isset($optionData['defaultValue'])) { $optionData['optionValue'] = $optionData['defaultValue']; } else { $optionData['optionValue'] = false; } } // get options $options = LanguageEditor::getLanguages(); WCF::getTPL()->assign(array('optionData' => $optionData, 'options' => $options)); return WCF::getTPL()->fetch('optionTypeSelect'); }
/** * @see AdminToolsFunction::execute($data) */ public function execute($data) { parent::execute($data); $parameters = $data['parameters']['user.languagedefaults']; $condition = ''; if ($parameters['correctonly']) { $languages = array_keys(LanguageEditor::getLanguages()); foreach ($languages as $language) { if (!empty($condition)) { $condition .= ','; } $condition .= $language; } } $sql = "UPDATE wcf" . WCF_N . "_user\n\t\t\t\tSET languageID = " . $parameters['languageID'] . (!empty($condition) ? " WHERE languageID NOT IN(" . $condition . ")" : ""); WCF::getDB()->sendQuery($sql); $message = WCF::getLanguage()->get('wcf.acp.admintools.function.success', array('$functionName' => WCF::getLanguage()->get('wcf.acp.admintools.function.' . $data['functionName']))); $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.' . $data['functionName'] . '.affectedUsers', array('$affectedUsers' => WCF::getDB()->getAffectedRows())); $this->setReturnMessage('success', $message); $this->executed(); }