|
Revision 1087, 1.3 kB
(checked in by d0nut, 3 years ago)
|
|
create instance of tagged
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | // wcf imports |
|---|
| 3 | require_once(WCF_DIR.'lib/action/AbstractAction.class.php'); |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * ajax tagging |
|---|
| 7 | * |
|---|
| 8 | * @author Torben Brodt |
|---|
| 9 | * @copyright 2009 TBR Solutions |
|---|
| 10 | * @license commercial |
|---|
| 11 | * @package de.easy-coding.wcf.taggingreloaded |
|---|
| 12 | */ |
|---|
| 13 | class TaggingReloadedSaveAction extends AbstractAction { |
|---|
| 14 | protected $taggableID = 0; |
|---|
| 15 | protected $className = ''; |
|---|
| 16 | protected $entryKey = 'entryID'; |
|---|
| 17 | protected $entryID = 0; |
|---|
| 18 | protected $languageID = 0; |
|---|
| 19 | |
|---|
| 20 | /** |
|---|
| 21 | * @see Action::readParameters() |
|---|
| 22 | */ |
|---|
| 23 | public function readParameters() { |
|---|
| 24 | parent::readParameters(); |
|---|
| 25 | |
|---|
| 26 | $this->taggableID = intval($_REQUEST['taggableID']); |
|---|
| 27 | $this->className = $_REQUEST['className']; |
|---|
| 28 | $this->entryID = intval($_REQUEST['entryID']); |
|---|
| 29 | |
|---|
| 30 | if(isset($_REQUEST['entryKey']) $this->entryKey = $_REQUEST['entryKey']; |
|---|
| 31 | if(isset($_REQUEST['languageID']) $this->languageID = intval($_REQUEST['languageID']); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | /** |
|---|
| 35 | * @see Action::execute() |
|---|
| 36 | */ |
|---|
| 37 | public function execute() { |
|---|
| 38 | parent::execute(); |
|---|
| 39 | |
|---|
| 40 | $tagged = new $this->className(array( |
|---|
| 41 | $this->entryKey => $this->entryID, |
|---|
| 42 | 'taggable' => TagEngine::getInstance()->getTaggable($this->taggable) |
|---|
| 43 | )); |
|---|
| 44 | |
|---|
| 45 | if(!($tagged instanceof Tagged)) { |
|---|
| 46 | throw new PermissionDeniedException(); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | TaggingUtil::save($userid. $tags, $tagged, $this->languageID); |
|---|
| 50 | |
|---|
| 51 | $this->executed(); |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | ?> |
|---|