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(
73 'data' => array_merge($this->additionalFields
, array(
74 'smileyTitle' => $this->smileyTitle
,
75 'smileyCode' => $this->smileyCode
,
76 'aliases' => $this->aliases
,
77 'smileyPath' => $this->smileyPath
,
78 'showOrder' => $this->showOrder
,
79 'categoryID' => $this->categoryID ?
: null
81 'fileLocation' => $this->uploadedFilename ? WCF_DIR
.'images/smilies/tmp/'.$this->uploadedFilename
: ''
83 $this->objectAction
->executeAction();
85 $this->uploadedFilename
= '';
90 WCF
::getTPL()->assign(array(
96 * @see \wcf\page\IPage::readData()
98 public function readData() {
102 I18nHandler
::getInstance()->setOptions('smileyTitle', 1, $this->smiley
->smileyTitle
, 'wcf.smiley.title\d+');
103 $this->smileyTitle
= $this->smiley
->smileyTitle
;
105 $this->smileyCode
= $this->smiley
->smileyCode
;
106 $this->aliases
= $this->smiley
->aliases
;
107 $this->smileyPath
= $this->smiley
->smileyPath
;
108 $this->showOrder
= $this->smiley
->showOrder
;
109 $this->categoryID
= $this->smiley
->categoryID
;
114 * @see \wcf\page\IPage::assignVariables()
116 public function assignVariables() {
117 parent
::assignVariables();
119 I18nHandler
::getInstance()->assignVariables(!empty($_POST));
121 WCF
::getTPL()->assign(array(
122 'smiley' => $this->smiley
,