'items' => array()
);
- foreach ($itemData['items'] as $item) {
- $items['items'][] = array(
+ foreach ($itemData['items'] as $showOrder => $item) {
+ $items['items'][$showOrder] = array(
'actionName' => $item->getName(),
'internalData' => $item->getInternalData(),
'parameters' => $item->getParameters(),
// load actions
$actions = array();
foreach ($actionIDs as $actionID) {
- $actionClassName = $this->actionCache[$actionID]->actionClassName;
- $actionName = $this->actionCache[$actionID]->actionName;
+ $actionObject = $this->actionCache[$actionID];
+ $actionClassName = $actionObject->actionClassName;
if (!isset($actions[$actionClassName])) {
// validate class
if (!ClassUtil::isInstanceOf($actionClassName, 'wcf\system\clipboard\action\IClipboardAction')) {
);
}
- $actions[$actionClassName]['actions'][] = $actionName;
+ $actions[$actionClassName]['actions'][] = $actionObject;
}
// execute actions
);
}
- foreach ($actionData['actions'] as $action) {
- $data = $actionData['object']->execute($objects, $action);
+ foreach ($actionData['actions'] as $actionObject) {
+ $data = $actionData['object']->execute($objects, $actionObject);
if ($data === null) {
continue;
}
- $editorData[$typeName]['items'][$action] = $data;
+ $editorData[$typeName]['items'][$actionObject->showOrder] = $data;
}
}
<?php
namespace wcf\system\clipboard\action;
+use wcf\data\clipboard\action\ClipboardAction;
use wcf\system\clipboard\ClipboardEditorItem;
use wcf\system\exception\SystemException;
use wcf\system\WCF;
* Abstract implementation of a clipboard action handler.
*
* @author Matthias Schmidt
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.clipboard.action
/**
* @see wcf\system\clipboard\action\IClipboardAction::execute()
*/
- public function execute(array $objects, $actionName) {
- if (!in_array($actionName, $this->supportedActions)) {
- throw new SystemException("Unknown clipboard action '".$actionName."'");
+ public function execute(array $objects, ClipboardAction $action) {
+ if (!in_array($action->actionName, $this->supportedActions)) {
+ throw new SystemException("Unknown clipboard action '".$action->actionName."'");
}
$this->objects = $objects;
$item = new ClipboardEditorItem();
- $item->setName($this->getTypeName().'.'.$actionName);
+ $item->setName($this->getTypeName().'.'.$action->actionName);
// set action class-related data
- if (in_array($actionName, $this->actionClassActions)) {
- $item->addParameter('actionName', $actionName);
+ if (in_array($action->actionName, $this->actionClassActions)) {
+ $item->addParameter('actionName', $action->actionName);
$item->addParameter('className', $this->getClassName());
}
// validate objects if relevant method exists and set valid object ids
- $methodName = 'validate'.ucfirst($actionName);
+ $methodName = 'validate'.ucfirst($action->actionName);
if (method_exists($this, $methodName)) {
$objectIDs = $this->$methodName();
if (empty($objectIDs)) {
<?php
namespace wcf\system\clipboard\action;
+use wcf\data\clipboard\action\ClipboardAction;
/**
* Basic interface for all clipboard editor actions.
*
* @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.clipboard.action
* Returns editor item for the clipboard action with the given name or null
* if the action is not applicable to the given objects.
*
- * @param array $objects
- * @param string $actionName
+ * @param array<wcf\data\DatabaseObject> $objects
+ * @param wcf\data\clipboard\action\ClipboardAction $action
* @return wcf\system\clipboard\ClipboardEditorItem
*/
- public function execute(array $objects, $actionName);
+ public function execute(array $objects, ClipboardAction $action);
/**
* Filters the given objects by the given type data and returns the filtered
<?php
namespace wcf\system\clipboard\action;
+use wcf\data\clipboard\action\ClipboardAction;
use wcf\data\user\group\UserGroup;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\request\LinkHandler;
* Prepares clipboard editor items for user objects.
*
* @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.clipboard.action
/**
* @see wcf\system\clipboard\action\IClipboardAction::execute()
*/
- public function execute(array $objects, $actionName) {
- $item = parent::execute($objects, $actionName);
+ public function execute(array $objects, ClipboardAction $action) {
+ $item = parent::execute($objects, $action);
if ($item === null) {
return null;
}
// handle actions
- switch ($actionName) {
+ switch ($action->actionName) {
case 'assignToGroup':
$item->setURL(LinkHandler::getInstance()->getLink('UserAssignToGroup'));
break;