2 namespace wcf\system\clipboard\action
;
3 use wcf\data\article\Article
;
4 use wcf\data\article\ArticleAction
;
5 use wcf\data\category\CategoryNodeTree
;
6 use wcf\data\clipboard\action\ClipboardAction
;
10 * Clipboard action implementation for articles.
12 * @author Matthias Schmidt
13 * @copyright 2001-2018 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\Clipboard\Action
18 class ArticleClipboardAction
extends AbstractClipboardAction
{
22 protected $actionClassActions = [
33 protected $supportedActions = [
45 public function execute(array $objects, ClipboardAction
$action) {
46 $item = parent
::execute($objects, $action);
53 switch ($action->actionName
) {
55 $item->addInternalData('confirmMessage', WCF
::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.article.delete.confirmMessage', [
56 'count' => $item->getCount()
61 $item->addInternalData('template', WCF
::getTPL()->fetch('articleCategoryDialog', 'wcf', [
62 'categoryNodeList' => (new CategoryNodeTree('com.woltlab.wcf.article.category'))->getIterator()
67 $item->addInternalData('confirmMessage', WCF
::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.article.trash.confirmMessage', [
68 'count' => $item->getCount()
79 public function getClassName() {
80 return ArticleAction
::class;
86 public function getTypeName() {
87 return 'com.woltlab.wcf.article';
91 * Returns the ids of the articles that can be deleted.
95 public function validateDelete() {
98 /** @var Article $article */
99 foreach ($this->objects
as $article) {
100 if ($article->canDelete() && $article->isDeleted
) {
101 $objectIDs[] = $article->articleID
;
109 * Returns the ids of the articles that can be published.
113 public function validatePublish() {
116 /** @var Article $article */
117 foreach ($this->objects
as $article) {
118 if ($article->canPublish() && $article->publicationStatus
== Article
::UNPUBLISHED
) {
119 $objectIDs[] = $article->articleID
;
127 * Returns the ids of the articles that can be restored.
131 public function validateRestore() {
132 return $this->validateDelete();
136 * Returns the ids of the articles whose category can be set.
140 public function validateSetCategory() {
141 if (!WCF
::getSession()->getPermission('admin.content.article.canManageArticle')) {
145 return array_keys($this->objects
);
149 * Returns the ids of the articles that can be trashed.
153 public function validateTrash() {
156 /** @var Article $article */
157 foreach ($this->objects
as $article) {
158 if ($article->canDelete() && !$article->isDeleted
) {
159 $objectIDs[] = $article->articleID
;
167 * Returns the ids of the articles that can be unpublished.
171 public function validateUnpublish() {
174 /** @var Article $article */
175 foreach ($this->objects
as $article) {
176 if ($article->canPublish() && $article->publicationStatus
== Article
::PUBLISHED
) {
177 $objectIDs[] = $article->articleID
;