2 namespace wcf\acp\form
;
3 use wcf\data\smiley\Smiley
;
4 use wcf\data\smiley\SmileyAction
;
5 use wcf\form\AbstractForm
;
6 use wcf\system\exception\IllegalLinkException
;
7 use wcf\system\language\I18nHandler
;
11 * Shows the smiley edit form.
13 * @author Tim Duesterhus
14 * @copyright 2001-2014 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package com.woltlab.wcf
17 * @subpackage acp.form
18 * @category Community Framework
20 class SmileyEditForm
extends SmileyAddForm
{
22 * @see \wcf\page\AbstractPage::$activeMenuItem
24 public $activeMenuItem = 'wcf.acp.menu.link.smiley';
27 * @see \wcf\page\AbstractPage::$neededPermissions
29 public $neededPermissions = array('admin.content.smiley.canManageSmiley');
39 * @var \wcf\data\smiley\Smiley
41 public $smiley = null;
44 * @see \wcf\page\IPage::readParameters()
46 public function readParameters() {
47 parent
::readParameters();
49 if (isset($_REQUEST['id'])) $this->smileyID
= intval($_REQUEST['id']);
50 $this->smiley
= new Smiley($this->smileyID
);
51 if (!$this->smiley
->smileyID
) {
52 throw new IllegalLinkException();
57 * @see \wcf\form\IForm::save()
59 public function save() {
62 $this->smileyTitle
= 'wcf.smiley.title'.$this->smiley
->smileyID
;
63 if (I18nHandler
::getInstance()->isPlainValue('smileyTitle')) {
64 I18nHandler
::getInstance()->remove($this->smileyTitle
);
65 $this->smileyTitle
= I18nHandler
::getInstance()->getValue('smileyTitle');
68 I18nHandler
::getInstance()->save('smileyTitle', $this->smileyTitle
, 'wcf.smiley', 1);
72 $this->objectAction
= new SmileyAction(array($this->smileyID
), 'update', array('data' => array_merge($this->additionalFields
, array(
73 'smileyTitle' => $this->smileyTitle
,
74 'smileyCode' => $this->smileyCode
,
75 'aliases' => $this->aliases
,
76 'smileyPath' => $this->smileyPath
,
77 'showOrder' => $this->showOrder
,
78 'categoryID' => $this->categoryID ?
: null
80 $this->objectAction
->executeAction();
85 WCF
::getTPL()->assign(array(
91 * @see \wcf\page\IPage::readData()
93 public function readData() {
97 I18nHandler
::getInstance()->setOptions('smileyTitle', 1, $this->smiley
->smileyTitle
, 'wcf.smiley.title\d+');
98 $this->smileyTitle
= $this->smiley
->smileyTitle
;
100 $this->smileyCode
= $this->smiley
->smileyCode
;
101 $this->aliases
= $this->smiley
->aliases
;
102 $this->smileyPath
= $this->smiley
->smileyPath
;
103 $this->showOrder
= $this->smiley
->showOrder
;
104 $this->categoryID
= $this->smiley
->categoryID
;
109 * @see \wcf\page\IPage::assignVariables()
111 public function assignVariables() {
112 parent
::assignVariables();
114 I18nHandler
::getInstance()->assignVariables(!empty($_POST));
116 WCF
::getTPL()->assign(array(
117 'smiley' => $this->smiley
,