<fieldset>
<legend>{lang}wcf.acp.user.option.access{/lang}</legend>
-
+
<dl>
<dt><label for="editable">{lang}wcf.acp.user.option.editable{/lang}</label></dt>
<dd>
use wcf\data\user\option\UserOptionAction;
use wcf\data\user\option\UserOptionEditor;
use wcf\form\AbstractForm;
-use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
use wcf\system\WCF;
*/
public function readParameters() {
parent::readParameters();
-
+
I18nHandler::getInstance()->register('optionName');
I18nHandler::getInstance()->register('optionDescription');
*/
public function readFormParameters() {
parent::readFormParameters();
-
+
I18nHandler::getInstance()->readValues();
if (I18nHandler::getInstance()->isPlainValue('optionName')) $this->optionName = I18nHandler::getInstance()->getValue('optionName');
*/
public function validate() {
parent::validate();
-
+
// option name
if (!I18nHandler::getInstance()->validateValue('optionName', true)) {
throw new UserInputException('optionName');
throw new UserInputException('selectOptions');
}
+ if ($this->outputClass && !class_exists($this->outputClass)) {
+ throw new UserInputException('outputClass', 'doesNotExist');
+ }
+
if ($this->editable < 1 || $this->editable > 3) {
$this->editable = 3;
}
*/
public function save() {
parent::save();
-
+
$this->objectAction = new UserOptionAction(array(), 'create', array('data' => array(
'optionName' => StringUtil::getRandomID(),
'categoryName' => $this->categoryName,
'additionalData' => ($this->optionType == 'select' ? serialize(array('allowEmptyValue' => true)) : '')
)));
$this->objectAction->executeAction();
-
+
$returnValues = $this->objectAction->getReturnValues();
$userOption = $returnValues['returnValues'];
'optionName' => 'option'.$userOption->optionID
));
$this->saved();
-
+
// reset values
$this->optionName = $this->optionDescription = $this->categoryName = $this->optionType = $this->defaultValue = $this->validationPattern = $this->optionType = $this->selectOptions = $this->outputClass = '';
$this->required = $this->searchable = $this->showOrder = $this->askDuringRegistration = 0;
*/
public function assignVariables() {
parent::assignVariables();
-
+
I18nHandler::getInstance()->assignVariables();
WCF::getTPL()->assign(array(
use wcf\data\user\option\UserOption;
use wcf\data\user\option\UserOptionAction;
use wcf\form\AbstractForm;
-use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\system\exception\IllegalLinkException;
use wcf\system\language\I18nHandler;
use wcf\system\WCF;
*/
public function readParameters() {
parent::readParameters();
-
+
if (isset($_REQUEST['id'])) $this->optionID = intval($_REQUEST['id']);
$this->userOption = new UserOption($this->optionID);
if (!$this->userOption->optionID) {
*/
public function save() {
AbstractForm::save();
-
+
I18nHandler::getInstance()->save('optionName', 'wcf.user.option.'.$this->userOption->optionName, 'wcf.user.option');
I18nHandler::getInstance()->save('optionDescription', 'wcf.user.option.'.$this->userOption->optionName.'.description', 'wcf.user.option');
-
+
$this->objectAction = new UserOptionAction(array($this->userOption), 'update', array('data' => array(
'categoryName' => $this->categoryName,
'optionType' => $this->optionType,
)));
$this->objectAction->executeAction();
$this->saved();
-
+
WCF::getTPL()->assign('success', true);
}
*/
public function readData() {
parent::readData();
-
+
I18nHandler::getInstance()->setOptions('optionName', 1, 'wcf.user.option.'.$this->userOption->optionName, 'wcf.user.option.option\d+');
I18nHandler::getInstance()->setOptions('optionDescription', 1, 'wcf.user.option.'.$this->userOption->optionName.'.description', 'wcf.user.option.option\d+.description');
- if (!count($_POST)) {
+ if (empty($_POST)) {
$this->categoryName = $this->userOption->categoryName;
$this->optionType = $this->userOption->optionType;
$this->defaultValue = $this->userOption->defaultValue;
*/
public function assignVariables() {
parent::assignVariables();
-
+
I18nHandler::getInstance()->assignVariables(!empty($_POST));
WCF::getTPL()->assign(array(
<item name="wcf.acp.user.option.typeData"><![CDATA[Eigenschaften]]></item>
<item name="wcf.acp.user.option.outputClass"><![CDATA[PHP-Klasse für Ausgabe]]></item>
<item name="wcf.acp.user.option.outputClass.description"><![CDATA[Erlaubt die Angabe einer speziellen PHP-Klasse für die Ausgabeformatierung bei der Anzeige des Feldes.]]></item>
+ <item name="wcf.acp.user.option.outputClass.error.doesNotExist"><![CDATA[Eine Klasse mit dem angegeben Namen existiert nicht.]]></item>
</category>
<category name="wcf.ajax">
<item name="wcf.acp.user.option.typeData"><![CDATA[TODO: Eigenschaften]]></item>
<item name="wcf.acp.user.option.outputClass"><![CDATA[TODO: PHP-Klasse für Ausgabe]]></item>
<item name="wcf.acp.user.option.outputClass.description"><![CDATA[TODO: Erlaubt die Angabe einer speziellen PHP-Klasse für die Ausgabeformatierung bei der Anzeige des Feldes.]]></item>
+ <item name="wcf.acp.user.option.outputClass.error.doesNotExist"><![CDATA[Unable to find the specified class.]]></item>
</category>
<category name="wcf.ajax">