diff --git a/administrator/components/com_content/Extension/ContentComponent.php b/administrator/components/com_content/Extension/ContentComponent.php index 20f7eeab31212..2207edc5c6150 100644 --- a/administrator/components/com_content/Extension/ContentComponent.php +++ b/administrator/components/com_content/Extension/ContentComponent.php @@ -53,11 +53,11 @@ class ContentComponent extends MVCComponent implements * * @since 4.0.0 */ - const CONDITION_NAMES = [ - self::CONDITION_PUBLISHED => 'JPUBLISHED', - self::CONDITION_UNPUBLISHED => 'JUNPUBLISHED', - self::CONDITION_ARCHIVED => 'JARCHIVED', - self::CONDITION_TRASHED => 'JTRASHED', + const STATE_NAMES = [ + self::STATE_PUBLISHED => 'JPUBLISHED', + self::STATE_UNPUBLISHED => 'JUNPUBLISHED', + self::STATE_ARCHIVED => 'JARCHIVED', + self::STATE_TRASHED => 'JTRASHED', ]; /** @@ -65,28 +65,28 @@ class ContentComponent extends MVCComponent implements * * @since 4.0.0 */ - const CONDITION_ARCHIVED = 2; + const STATE_ARCHIVED = 2; /** * The published condition * * @since 4.0.0 */ - const CONDITION_PUBLISHED = 1; + const STATE_PUBLISHED = 1; /** * The unpublished condition * * @since 4.0.0 */ - const CONDITION_UNPUBLISHED = 0; + const STATE_UNPUBLISHED = 0; /** * The trashed condition * * @since 4.0.0 */ - const CONDITION_TRASHED = -2; + const STATE_TRASHED = -2; /** * Booting the extension. This is the function to set up the environment of the extension like diff --git a/administrator/components/com_content/Model/ArticleModel.php b/administrator/components/com_content/Model/ArticleModel.php index fad9c89dddf07..db3e1069d8f29 100644 --- a/administrator/components/com_content/Model/ArticleModel.php +++ b/administrator/components/com_content/Model/ArticleModel.php @@ -269,7 +269,7 @@ protected function batchMove($value, $pks, $contexts) */ protected function canDelete($record) { - if (!empty($record->id) && $record->state == ContentComponent::CONDITION_TRASHED) + if (!empty($record->id) && $record->state == ContentComponent::STATE_TRASHED) { return Factory::getUser()->authorise('core.delete', 'com_content.article.' . (int) $record->id); } @@ -318,12 +318,12 @@ protected function canEditState($record) protected function prepareTable($table) { // Set the publish date to now - if ($table->state == ContentComponent::CONDITION_PUBLISHED && (int) $table->publish_up == 0) + if ($table->state == ContentComponent::STATE_PUBLISHED && (int) $table->publish_up == 0) { $table->publish_up = Factory::getDate()->toSql(); } - if ($table->state == ContentComponent::CONDITION_PUBLISHED && intval($table->publish_down) == 0) + if ($table->state == ContentComponent::STATE_PUBLISHED && intval($table->publish_down) == 0) { $table->publish_down = null; } @@ -787,7 +787,7 @@ public function save($data) $table['parent_id'] = 1; $table['extension'] = 'com_content'; $table['language'] = $data['language']; - $table['published'] = ContentComponent::CONDITION_PUBLISHED; + $table['published'] = ContentComponent::STATE_PUBLISHED; // Create new category and get catid back $data['catid'] = CategoriesHelper::createCategory($table); diff --git a/administrator/components/com_content/Model/ArticlesModel.php b/administrator/components/com_content/Model/ArticlesModel.php index 2ca9133ee3803..b8206f94abc2e 100644 --- a/administrator/components/com_content/Model/ArticlesModel.php +++ b/administrator/components/com_content/Model/ArticlesModel.php @@ -337,8 +337,8 @@ protected function getListQuery() $query->whereIn( $db->quoteName('a.state'), [ - ContentComponent::CONDITION_PUBLISHED, - ContentComponent::CONDITION_UNPUBLISHED + ContentComponent::STATE_PUBLISHED, + ContentComponent::STATE_UNPUBLISHED ] ); } @@ -574,7 +574,7 @@ public function getTransitions() { // @TODO: Benjamin fix // Update the transition text with final state value - //$conditionName = $workflow->getConditionName($transition['stage_condition']); + //$conditionName = $workflow->getStateName($transition['stage_condition']); //$transitions[$key]['text'] .= ' [' . Text::_($conditionName) . ']'; } diff --git a/administrator/components/com_content/Model/FeaturedModel.php b/administrator/components/com_content/Model/FeaturedModel.php index 923965d37176e..538122cd4bb6a 100644 --- a/administrator/components/com_content/Model/FeaturedModel.php +++ b/administrator/components/com_content/Model/FeaturedModel.php @@ -195,8 +195,8 @@ protected function getListQuery() $query->whereIn( $db->quoteName('ws.condition'), [ - ContentComponent::CONDITION_PUBLISHED, - ContentComponent::CONDITION_UNPUBLISHED + ContentComponent::STATE_PUBLISHED, + ContentComponent::STATE_UNPUBLISHED ] ); } diff --git a/administrator/components/com_content/Service/HTML/Icon.php b/administrator/components/com_content/Service/HTML/Icon.php index b65243d3062af..87c2d17e5832b 100644 --- a/administrator/components/com_content/Service/HTML/Icon.php +++ b/administrator/components/com_content/Service/HTML/Icon.php @@ -147,7 +147,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false) } // Ignore if the state is negative (trashed). - if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED])) + if (!in_array($article->state, [Workflow::STATE_UNPUBLISHED, Workflow::STATE_PUBLISHED])) { return; } @@ -176,7 +176,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false) $contentUrl = \ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language); $url = $contentUrl . '&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri); - if ($article->state == Workflow::CONDITION_UNPUBLISHED) + if ($article->state == Workflow::STATE_UNPUBLISHED) { $overlib = Text::_('JUNPUBLISHED'); } diff --git a/administrator/components/com_content/View/Articles/HtmlView.php b/administrator/components/com_content/View/Articles/HtmlView.php index 5474e0dc3a551..27d5619f7b778 100644 --- a/administrator/components/com_content/View/Articles/HtmlView.php +++ b/administrator/components/com_content/View/Articles/HtmlView.php @@ -129,19 +129,19 @@ public function display($tpl = null) // { // switch ($transition['stage_condition']) // { -// case ContentComponent::CONDITION_PUBLISHED: +// case ContentComponent::STATE_PUBLISHED: // $transitions['publish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_UNPUBLISHED: +// case ContentComponent::STATE_UNPUBLISHED: // $transitions['unpublish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_ARCHIVED: +// case ContentComponent::STATE_ARCHIVED: // $transitions['archive'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_TRASHED: +// case ContentComponent::STATE_TRASHED: // $transitions['trash'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // } @@ -246,7 +246,7 @@ protected function addToolbar() } } - if ($this->state->get('filter.condition') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) + if ($this->state->get('filter.condition') == ContentComponent::STATE_TRASHED && $canDo->get('core.delete')) { $toolbar->delete('articles.delete') ->text('JTOOLBAR_EMPTY_TRASH') diff --git a/administrator/components/com_content/View/Featured/HtmlView.php b/administrator/components/com_content/View/Featured/HtmlView.php index 8d1d86ba2b0ce..f1027d2b525e4 100644 --- a/administrator/components/com_content/View/Featured/HtmlView.php +++ b/administrator/components/com_content/View/Featured/HtmlView.php @@ -108,19 +108,19 @@ public function display($tpl = null) // { // switch ($transition['stage_condition']) // { -// case ContentComponent::CONDITION_PUBLISHED: +// case ContentComponent::STATE_PUBLISHED: // $transitions['publish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_UNPUBLISHED: +// case ContentComponent::STATE_UNPUBLISHED: // $transitions['unpublish'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_ARCHIVED: +// case ContentComponent::STATE_ARCHIVED: // $transitions['archive'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // -// case ContentComponent::CONDITION_TRASHED: +// case ContentComponent::STATE_TRASHED: // $transitions['trash'][$transition['workflow_id']][$transition['from_stage_id']][] = $transition; // break; // } @@ -209,7 +209,7 @@ protected function addToolbar() } } - if ($this->state->get('filter.condition') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) + if ($this->state->get('filter.condition') == ContentComponent::STATE_TRASHED && $canDo->get('core.delete')) { $toolbar->delete('articles.delete') ->text('JTOOLBAR_EMPTY_TRASH') diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php index 7c3f8fa85e4be..52bbfd721a06d 100644 --- a/administrator/components/com_content/tmpl/articles/default.php +++ b/administrator/components/com_content/tmpl/articles/default.php @@ -182,16 +182,16 @@ // foreach ($transitions as $transition) : // switch ($transition['stage_condition']) : -// case ContentComponent::CONDITION_PUBLISHED: +// case ContentComponent::STATE_PUBLISHED: // ++$publish; // break; -// case ContentComponent::CONDITION_UNPUBLISHED: +// case ContentComponent::STATE_UNPUBLISHED: // ++$unpublish; // break; -// case ContentComponent::CONDITION_ARCHIVED: +// case ContentComponent::STATE_ARCHIVED: // ++$archive; // break; -// case ContentComponent::CONDITION_TRASHED: +// case ContentComponent::STATE_TRASHED: // ++$trash; // break; // endswitch; @@ -247,10 +247,10 @@ ->removeState(1) ->removeState(2) ->removeState(-2) - ->addState(ContentComponent::CONDITION_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED']) - ->addState(ContentComponent::CONDITION_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED']) - ->addState(ContentComponent::CONDITION_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED']) - ->addState(ContentComponent::CONDITION_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED']) + ->addState(ContentComponent::STATE_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED']) + ->addState(ContentComponent::STATE_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED']) + ->addState(ContentComponent::STATE_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED']) + ->addState(ContentComponent::STATE_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED']) ->setLayout('joomla.button.transition-button') ->render($item->state, $i, $options, $item->publish_up, $item->publish_down); ?> diff --git a/administrator/components/com_content/tmpl/featured/default.php b/administrator/components/com_content/tmpl/featured/default.php index 1ba5c19f416aa..56e6410c03f75 100644 --- a/administrator/components/com_content/tmpl/featured/default.php +++ b/administrator/components/com_content/tmpl/featured/default.php @@ -164,16 +164,16 @@ // foreach ($transitions as $transition) : // switch ($transition['stage_condition']) : -// case ContentComponent::CONDITION_PUBLISHED: +// case ContentComponent::STATE_PUBLISHED: // ++$publish; // break; -// case ContentComponent::CONDITION_UNPUBLISHED: +// case ContentComponent::STATE_UNPUBLISHED: // ++$unpublish; // break; -// case ContentComponent::CONDITION_ARCHIVED: +// case ContentComponent::STATE_ARCHIVED: // ++$archive; // break; -// case ContentComponent::CONDITION_TRASHED: +// case ContentComponent::STATE_TRASHED: // ++$trash; // break; // endswitch; @@ -230,10 +230,10 @@ ->removeState(1) ->removeState(2) ->removeState(-2) - ->addState(ContentComponent::CONDITION_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED']) - ->addState(ContentComponent::CONDITION_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED']) - ->addState(ContentComponent::CONDITION_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED']) - ->addState(ContentComponent::CONDITION_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED']) + ->addState(ContentComponent::STATE_PUBLISHED, '', 'publish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JPUBLISHED']) + ->addState(ContentComponent::STATE_UNPUBLISHED, '', 'unpublish', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JUNPUBLISHED']) + ->addState(ContentComponent::STATE_ARCHIVED, '', 'archive', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JARCHIVED']) + ->addState(ContentComponent::STATE_TRASHED, '', 'trash', 'COM_CONTENT_CHANGE_STAGE', ['tip_title' => 'JTRASHED']) ->setLayout('joomla.button.transition-button') ->render($item->state, $i, $options, $item->publish_up, $item->publish_down); ?> diff --git a/administrator/components/com_workflow/Model/TransitionsModel.php b/administrator/components/com_workflow/Model/TransitionsModel.php index 39f17eecc7b27..638758c96e4f7 100644 --- a/administrator/components/com_workflow/Model/TransitionsModel.php +++ b/administrator/components/com_workflow/Model/TransitionsModel.php @@ -144,9 +144,7 @@ public function getListQuery() ); $select[] = $db->quoteName('f_stage.title', 'from_stage'); - $select[] = $db->quoteName('f_stage.condition', 'from_condition'); $select[] = $db->quoteName('t_stage.title', 'to_stage'); - $select[] = $db->quoteName('t_stage.condition', 'to_condition'); $joinTo = $db->quoteName('#__workflow_stages', 't_stage') . ' ON ' . $db->quoteName('t_stage.id') . ' = ' . $db->quoteName('t.to_stage_id'); @@ -166,7 +164,7 @@ public function getListQuery() $status = $this->getState('filter.published'); - // Filter by condition + // Filter by state if (is_numeric($status)) { $query->where($db->quoteName('t.published') . ' = ' . (int) $status); diff --git a/administrator/components/com_workflow/Model/WorkflowModel.php b/administrator/components/com_workflow/Model/WorkflowModel.php index a588e9a5ff7d8..9cfae22d4fa83 100644 --- a/administrator/components/com_workflow/Model/WorkflowModel.php +++ b/administrator/components/com_workflow/Model/WorkflowModel.php @@ -113,23 +113,23 @@ public function save($data) $stages = [ [ 'title' => 'JUNPUBLISHED', - 'condition' => Workflow::CONDITION_UNPUBLISHED, + 'condition' => Workflow::STATE_UNPUBLISHED, 'default' => 1, 'transition' => 'Unpublish' ], [ 'title' => 'JPUBLISHED', - 'condition' => Workflow::CONDITION_PUBLISHED, + 'condition' => Workflow::STATE_PUBLISHED, 'transition' => 'Publish' ], [ 'title' => 'JTRASHED', - 'condition' => Workflow::CONDITION_TRASHED, + 'condition' => Workflow::STATE_TRASHED, 'transition' => 'Trash' ], [ 'title' => 'JARCHIVED', - 'condition' => Workflow::CONDITION_ARCHIVED, + 'condition' => Workflow::STATE_ARCHIVED, 'transition' => 'Archive' ] ]; diff --git a/administrator/components/com_workflow/View/Stages/HtmlView.php b/administrator/components/com_workflow/View/Stages/HtmlView.php index 150d15794f98d..34b4f7a88930e 100644 --- a/administrator/components/com_workflow/View/Stages/HtmlView.php +++ b/administrator/components/com_workflow/View/Stages/HtmlView.php @@ -130,18 +130,6 @@ public function display($tpl = null) WorkflowHelper::addSubmenu('stages'); $this->sidebar = \JHtmlSidebar::render(); - - if (!empty($this->stages)) - { - $extension = Factory::getApplication()->input->getCmd('extension'); - $workflow = new Workflow(['extension' => $extension]); - - foreach ($this->stages as $i => $item) - { - $item->condition = $workflow->getConditionName($item->condition); - } - } - $this->addToolbar(); return parent::display($tpl); diff --git a/administrator/components/com_workflow/tmpl/stages/default.php b/administrator/components/com_workflow/tmpl/stages/default.php index 426111bfa0757..2a0efb1076054 100644 --- a/administrator/components/com_workflow/tmpl/stages/default.php +++ b/administrator/components/com_workflow/tmpl/stages/default.php @@ -74,12 +74,9 @@ - + - - - @@ -135,21 +132,6 @@
escape(Text::_($item->description)); ?>
- - condition == 'JARCHIVED'): - $icon = 'icon-archive'; - elseif ($item->condition == 'JTRASHED'): - $icon = 'icon-trash'; - elseif ($item->condition == 'JPUBLISHED'): - $icon = 'icon-publish'; - elseif ($item->condition == 'JUNPUBLISHED'): - $icon = 'icon-unpublish'; - endif; - ?> - - condition); ?> - id; ?> diff --git a/administrator/components/com_workflow/tmpl/transitions/default.php b/administrator/components/com_workflow/tmpl/transitions/default.php index abf62b4215f04..c7b830e2ac6b4 100644 --- a/administrator/components/com_workflow/tmpl/transitions/default.php +++ b/administrator/components/com_workflow/tmpl/transitions/default.php @@ -136,41 +136,39 @@ from_condition == Workflow::CONDITION_ARCHIVED): + if ($item->from_condition == Workflow::STATE_ARCHIVED): $icon = 'icon-archive'; $condition = Text::_('JARCHIVED'); - elseif ($item->from_condition == Workflow::CONDITION_TRASHED): + elseif ($item->from_condition == Workflow::STATE_TRASHED): $icon = 'icon-trash'; $condition = Text::_('JTRASHED'); - elseif ($item->from_condition == Workflow::CONDITION_PUBLISHED): + elseif ($item->from_condition == Workflow::STATE_PUBLISHED): $icon = 'icon-publish'; $condition = Text::_('JPUBLISHED'); - elseif ($item->from_condition == Workflow::CONDITION_UNPUBLISHED): + elseif ($item->from_condition == Workflow::STATE_UNPUBLISHED): $icon = 'icon-unpublish'; $condition = Text::_('JUNPUBLISHED'); endif; ?> - escape(Text::_($item->from_stage)); ?> to_condition == Workflow::CONDITION_ARCHIVED): + if ($item->to_condition == Workflow::STATE_ARCHIVED): $icon = 'icon-archive'; $condition = Text::_('JARCHIVED'); - elseif ($item->to_condition == Workflow::CONDITION_TRASHED): + elseif ($item->to_condition == Workflow::STATE_TRASHED): $icon = 'icon-trash'; $condition = Text::_('JTRASHED'); - elseif ($item->to_condition == Workflow::CONDITION_PUBLISHED): + elseif ($item->to_condition == Workflow::STATE_PUBLISHED): $icon = 'icon-publish'; $condition = Text::_('JPUBLISHED'); - elseif ($item->to_condition == Workflow::CONDITION_UNPUBLISHED): + elseif ($item->to_condition == Workflow::STATE_UNPUBLISHED): $icon = 'icon-unpublish'; $condition = Text::_('JUNPUBLISHED'); endif; ?> - escape(Text::_($item->to_stage)); ?> diff --git a/administrator/language/en-GB/en-GB.com_workflow.ini b/administrator/language/en-GB/en-GB.com_workflow.ini index 61f8f54a560e1..1cb012c6452b0 100644 --- a/administrator/language/en-GB/en-GB.com_workflow.ini +++ b/administrator/language/en-GB/en-GB.com_workflow.ini @@ -7,10 +7,6 @@ COM_WORKFLOW_ARE_YOU_SURE="Are you sure?" COM_WORKFLOW_AUTHOR="Author" COM_WORKFLOW_BASIC_TAB="Basic" COM_WORKFLOW_CHOOSE_CONTEXT_LABEL="Context" -COM_WORKFLOW_CONDITION="Condition of items in this stage: " -COM_WORKFLOW_CONDITION_DESC="Defines item behaviour." -COM_WORKFLOW_CONDITION_SORT_ASC="Condition ascending" -COM_WORKFLOW_CONDITION_SORT_DESC="Condition descending" COM_WORKFLOW_CONFIGURATION="Workflow: Options" COM_WORKFLOW_COUNT_STAGES="Stages" COM_WORKFLOW_COUNT_TRANSITIONS="Transitions" diff --git a/components/com_content/Model/ArchiveModel.php b/components/com_content/Model/ArchiveModel.php index 47f55386769e0..df63a14ef80d2 100644 --- a/components/com_content/Model/ArchiveModel.php +++ b/components/com_content/Model/ArchiveModel.php @@ -51,7 +51,7 @@ protected function populateState($ordering = null, $direction = null) $params = $this->state->get('params'); // Filter on archived articles - $this->setState('filter.condition', ContentComponent::CONDITION_ARCHIVED); + $this->setState('filter.condition', ContentComponent::STATE_ARCHIVED); // Filter on month, year $this->setState('filter.month', $app->input->getInt('month')); @@ -199,7 +199,7 @@ public function getYears() ->from($db->quoteName('#__workflow_stages', 'ws')) ->where($db->quoteName('c.id') . ' = ' . $db->quoteName('wa.item_id')) ->where($db->quoteName('ws.id') . ' = ' . $db->quoteName('wa.stage_id')) - ->where($db->quoteName('ws.condition') . '= ' . (int) ContentComponent::CONDITION_ARCHIVED) + ->where($db->quoteName('ws.condition') . '= ' . (int) ContentComponent::STATE_ARCHIVED) ->where('(c.publish_up IS NULL OR c.publish_up <= ' . $nowDate . ')') ->where('(c.publish_down IS NULL OR c.publish_down >= ' . $nowDate . ')') ->order('1 ASC'); diff --git a/components/com_content/Model/ArticleModel.php b/components/com_content/Model/ArticleModel.php index 7dbbe71b47244..f785667253c58 100644 --- a/components/com_content/Model/ArticleModel.php +++ b/components/com_content/Model/ArticleModel.php @@ -65,8 +65,8 @@ protected function populateState() if ((!$user->authorise('core.edit.state', $asset)) && (!$user->authorise('core.edit', $asset))) { - $this->setState('filter.published', ContentComponent::CONDITION_PUBLISHED); - $this->setState('filter.archived', ContentComponent::CONDITION_ARCHIVED); + $this->setState('filter.published', ContentComponent::STATE_PUBLISHED); + $this->setState('filter.archived', ContentComponent::STATE_ARCHIVED); } $this->setState('filter.language', Multilanguage::isEnabled()); diff --git a/components/com_content/Model/ArticlesModel.php b/components/com_content/Model/ArticlesModel.php index 0904e4d0af708..3b52a08bfa1d6 100644 --- a/components/com_content/Model/ArticlesModel.php +++ b/components/com_content/Model/ArticlesModel.php @@ -124,7 +124,7 @@ protected function populateState($ordering = 'ordering', $direction = 'ASC') if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { // Filter on published for those who do not have edit or edit.state rights. - $this->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED); + $this->setState('filter.condition', ContentComponent::STATE_PUBLISHED); } $this->setState('filter.language', Multilanguage::isEnabled()); @@ -204,8 +204,8 @@ protected function getListQuery() 'a.catid, a.created, a.created_by, a.created_by_alias, ' . // Published/archived article in archive category is treats as archive article // If category is not published then force 0 - 'CASE WHEN c.published = 2 AND ws.condition > 0 THEN ' . (int) ContentComponent::CONDITION_ARCHIVED . - ' WHEN c.published != 1 THEN ' . (int) ContentComponent::CONDITION_UNPUBLISHED . ' ELSE ws.condition END as state,' . + 'CASE WHEN c.published = 2 AND ws.condition > 0 THEN ' . (int) ContentComponent::STATE_ARCHIVED . + ' WHEN c.published != 1 THEN ' . (int) ContentComponent::STATE_UNPUBLISHED . ' ELSE ws.condition END as state,' . 'a.modified, a.modified_by, uam.name as modified_by_name,' . // Use created if publish_up is null 'CASE WHEN a.publish_up IS NULL THEN a.created ELSE a.publish_up END as publish_up,' . @@ -285,14 +285,14 @@ protected function getListQuery() // Filter by published state $published = $this->getState('filter.published'); - if (is_numeric($published) && $published == ContentComponent::CONDITION_ARCHIVED) + if (is_numeric($published) && $published == ContentComponent::STATE_ARCHIVED) { /** * If category is archived then article has to be published or archived. * Or categogy is published then article has to be archived. */ - $query->where('((c.published = 2 AND a.state > ' . (int) ContentComponent::CONDITION_UNPUBLISHED . - ') OR (c.published = 1 AND a.state = ' . (int) ContentComponent::CONDITION_ARCHIVED . '))' + $query->where('((c.published = 2 AND a.state > ' . (int) ContentComponent::STATE_UNPUBLISHED . + ') OR (c.published = 1 AND a.state = ' . (int) ContentComponent::STATE_ARCHIVED . '))' ); } elseif (is_numeric($published)) diff --git a/components/com_content/Model/FeaturedModel.php b/components/com_content/Model/FeaturedModel.php index 15053add24296..6544fdd4e04fb 100644 --- a/components/com_content/Model/FeaturedModel.php +++ b/components/com_content/Model/FeaturedModel.php @@ -76,11 +76,11 @@ protected function populateState($ordering = null, $direction = null) if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { // Filter on published for those who do not have edit or edit.state rights. - $this->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED); + $this->setState('filter.condition', ContentComponent::STATE_PUBLISHED); } else { - $this->setState('filter.condition', array(ContentComponent::CONDITION_UNPUBLISHED, ContentComponent::CONDITION_PUBLISHED)); + $this->setState('filter.condition', array(ContentComponent::STATE_UNPUBLISHED, ContentComponent::STATE_PUBLISHED)); } // Process show_noauth parameter diff --git a/components/com_content/tmpl/article/default.php b/components/com_content/tmpl/article/default.php index 5c8a58052d3a3..53b1a9e874337 100644 --- a/components/com_content/tmpl/article/default.php +++ b/components/com_content/tmpl/article/default.php @@ -55,7 +55,7 @@ escape($this->item->title); ?> - item->condition == ContentComponent::CONDITION_UNPUBLISHED) : ?> + item->condition == ContentComponent::STATE_UNPUBLISHED) : ?> item->publish_up) > strtotime(Factory::getDate())) : ?> diff --git a/components/com_content/tmpl/category/blog_item.php b/components/com_content/tmpl/category/blog_item.php index ce8078a520c29..609a7b37e7fd2 100644 --- a/components/com_content/tmpl/category/blog_item.php +++ b/components/com_content/tmpl/category/blog_item.php @@ -29,7 +29,7 @@ item); ?>
- item->stage_condition == ContentComponent::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) + item->stage_condition == ContentComponent::STATE_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) || (!is_null($this->item->publish_down) && strtotime($this->item->publish_down) < strtotime(Factory::getDate()))) : ?>
@@ -85,7 +85,7 @@ - item->stage_condition == ContentComponent::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) + item->stage_condition == ContentComponent::STATE_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) || (!is_null($this->item->publish_down) && strtotime($this->item->publish_down) < strtotime(Factory::getDate()))) : ?>
diff --git a/components/com_content/tmpl/category/default_articles.php b/components/com_content/tmpl/category/default_articles.php index c981fc03dafac..8ae761ca6fb20 100644 --- a/components/com_content/tmpl/category/default_articles.php +++ b/components/com_content/tmpl/category/default_articles.php @@ -180,7 +180,7 @@ items as $i => $article) : ?> - items[$i]->stage_condition == ContentComponent::CONDITION_UNPUBLISHED) : ?> + items[$i]->stage_condition == ContentComponent::STATE_UNPUBLISHED) : ?> @@ -225,7 +225,7 @@ - stage_condition == ContentComponent::CONDITION_UNPUBLISHED) : ?> + stage_condition == ContentComponent::STATE_UNPUBLISHED) : ?> diff --git a/components/com_content/tmpl/featured/default_item.php b/components/com_content/tmpl/featured/default_item.php index e15f89d36b5db..a42a935ec2e4f 100644 --- a/components/com_content/tmpl/featured/default_item.php +++ b/components/com_content/tmpl/featured/default_item.php @@ -29,7 +29,7 @@ item); ?>
- item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) + item->state == Workflow::STATE_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) || (!is_null($this->item->publish_down) && strtotime($this->item->publish_down) < strtotime(Factory::getDate()))) : ?>
@@ -46,7 +46,7 @@ - item->state == Workflow::CONDITION_UNPUBLISHED) : ?> + item->state == Workflow::STATE_UNPUBLISHED) : ?> item->publish_up) > strtotime(Factory::getDate())) : ?> @@ -103,7 +103,7 @@ - item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) + item->state == Workflow::STATE_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate()) || (!is_null($this->item->publish_down) && strtotime($this->item->publish_down) < strtotime(Factory::getDate()))) : ?>
diff --git a/libraries/src/Form/Field/TransitionField.php b/libraries/src/Form/Field/TransitionField.php index b2b7cffac3af7..acd06970b16a6 100644 --- a/libraries/src/Form/Field/TransitionField.php +++ b/libraries/src/Form/Field/TransitionField.php @@ -107,7 +107,7 @@ protected function getOptions() $workflowStage = $this->workflowStage; $query = $db->getQuery(true) - ->select($db->quoteName(['t.id', 't.title', 's.condition'], ['value', 'text', 'condition'])) + ->select($db->quoteName(['t.id', 't.title'], ['value', 'text'])) ->from($db->quoteName('#__workflow_transitions', 't')) ->from($db->quoteName('#__workflow_stages', 's')) ->from($db->quoteName('#__workflow_stages', 's2')) @@ -133,20 +133,6 @@ function ($item) use ($user, $extension) return $user->authorise('core.execute.transition', $extension . '.transition.' . $item->value); } ); - - // Sort by transition name - $items = ArrayHelper::sortObjects($items, 'value', 1, true, true); - - Factory::getLanguage()->load('com_workflow', JPATH_ADMINISTRATOR); - - $workflow = new Workflow(['extension' => $this->extension]); - - foreach ($items as $item) - { - $conditionName = $workflow->getConditionName($item->condition); - - $item->text .= ' [' . Text::_($conditionName) . ']'; - } } // Get workflow stage title diff --git a/libraries/src/Form/Field/WorkflowconditionField.php b/libraries/src/Form/Field/WorkflowconditionField.php index 0d1b07956871f..5967ee463de24 100644 --- a/libraries/src/Form/Field/WorkflowconditionField.php +++ b/libraries/src/Form/Field/WorkflowconditionField.php @@ -101,7 +101,7 @@ protected function getOptions() if ($component instanceof WorkflowServiceInterface) { - $conditions = $component->getConditions($this->extension); + $conditions = $component->getStates($this->extension); } foreach ($conditions as $value => $option) diff --git a/libraries/src/Workflow/Workflow.php b/libraries/src/Workflow/Workflow.php index 9d0cc9622aeef..2cd5e1413e3a2 100644 --- a/libraries/src/Workflow/Workflow.php +++ b/libraries/src/Workflow/Workflow.php @@ -53,32 +53,32 @@ class Workflow * * @since 4.0.0 */ - const CONDITION_NAMES = [ - self::CONDITION_PUBLISHED => 'JPUBLISHED', - self::CONDITION_UNPUBLISHED => 'JUNPUBLISHED', - self::CONDITION_TRASHED => 'JTRASHED', - self::CONDITION_ARCHIVED => 'JARCHIVED', + const STATE_NAMES = [ + self::STATE_PUBLISHED => 'JPUBLISHED', + self::STATE_UNPUBLISHED => 'JUNPUBLISHED', + self::STATE_TRASHED => 'JTRASHED', + self::STATE_ARCHIVED => 'JARCHIVED', ]; /** - * Every item with a state which has the condition PUBLISHED is visible/active on the page + * Every item with a state which is visible/active on the page */ - const CONDITION_PUBLISHED = 1; + const STATE_PUBLISHED = 1; /** - * Every item with a state which has the condition UNPUBLISHED is not visible/inactive on the page + * Every item with a state which is not visible/inactive on the page */ - const CONDITION_UNPUBLISHED = 0; + const STATE_UNPUBLISHED = 0; /** - * Every item with a state which has the condition TRASHED is trashed + * Every item with a state which is trashed */ - const CONDITION_TRASHED = -2; + const STATE_TRASHED = -2; /** - * Every item with a state which has the condition ARCHIVED is archived + * Every item with a state which is archived */ - const CONDITION_ARCHIVED = 2; + const STATE_ARCHIVED = 2; /** * Class constructor @@ -109,17 +109,17 @@ public function __construct($options) * * @since 4.0.0 */ - public function getConditionName($value) + public function getStateName($value) { $component = $this->getComponent(); if ($component instanceof WorkflowServiceInterface) { - $conditions = $component->getConditions($this->extension); + $conditions = $component->getStates($this->extension); } else { - $conditions = self::CONDITION_NAMES; + $conditions = self::STATE_NAMES; } return ArrayHelper::getValue($conditions, $value, '', 'string'); diff --git a/libraries/src/Workflow/WorkflowServiceInterface.php b/libraries/src/Workflow/WorkflowServiceInterface.php index c6497cf2385b1..a322f8445dd29 100644 --- a/libraries/src/Workflow/WorkflowServiceInterface.php +++ b/libraries/src/Workflow/WorkflowServiceInterface.php @@ -50,7 +50,7 @@ public static function updateContentState($pks, $condition): bool; * * @since 4.0.0 */ - public static function getConditions($extension): array; + public static function getStates($extension): array; /** * Returns a table name for the state association diff --git a/libraries/src/Workflow/WorkflowServiceTrait.php b/libraries/src/Workflow/WorkflowServiceTrait.php index c03c1e70f822d..7d6bca985aae0 100644 --- a/libraries/src/Workflow/WorkflowServiceTrait.php +++ b/libraries/src/Workflow/WorkflowServiceTrait.php @@ -26,8 +26,8 @@ trait WorkflowServiceTrait * * @since 4.0.0 */ - public static function getConditions($extension): array + public static function getStates($extension): array { - return \defined('self::CONDITION_NAMES') ? self::CONDITION_NAMES : Workflow::CONDITION_NAMES; + return \defined('self::STATE_NAMES') ? self::STATE_NAMES : Workflow::STATE_NAMES; } } diff --git a/modules/mod_articles_archive/Helper/ArticlesArchiveHelper.php b/modules/mod_articles_archive/Helper/ArticlesArchiveHelper.php index f0671a1d561ed..7c73268274d3a 100644 --- a/modules/mod_articles_archive/Helper/ArticlesArchiveHelper.php +++ b/modules/mod_articles_archive/Helper/ArticlesArchiveHelper.php @@ -38,7 +38,7 @@ public static function getList(&$params) { $app = Factory::getApplication(); $db = Factory::getDbo(); - $condition = ContentComponent::CONDITION_ARCHIVED; + $condition = ContentComponent::STATE_ARCHIVED; $query = $db->getQuery(true); $query->select($query->month($db->quoteName('created')) . ' AS created_month') diff --git a/modules/mod_articles_category/Helper/ArticlesCategoryHelper.php b/modules/mod_articles_category/Helper/ArticlesCategoryHelper.php index 038362af3ba51..b12081d2c3a60 100644 --- a/modules/mod_articles_category/Helper/ArticlesCategoryHelper.php +++ b/modules/mod_articles_category/Helper/ArticlesCategoryHelper.php @@ -51,7 +51,7 @@ public static function getList(&$params) $articles->setState('params', $appParams); $articles->setState('list.start', 0); - $articles->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED); + $articles->setState('filter.condition', ContentComponent::STATE_PUBLISHED); // Set the filters based on the module params $articles->setState('list.limit', (int) $params->get('count', 0)); diff --git a/modules/mod_articles_news/Helper/ArticlesNewsHelper.php b/modules/mod_articles_news/Helper/ArticlesNewsHelper.php index e05cbdfad5228..fc8690c02512f 100644 --- a/modules/mod_articles_news/Helper/ArticlesNewsHelper.php +++ b/modules/mod_articles_news/Helper/ArticlesNewsHelper.php @@ -49,7 +49,7 @@ public static function getList(&$params) $model->setState('params', $appParams); $model->setState('list.start', 0); - $model->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED); + $model->setState('filter.condition', ContentComponent::STATE_PUBLISHED); // Set the filters based on the module params $model->setState('list.limit', (int) $params->get('count', 5)); diff --git a/modules/mod_articles_popular/Helper/ArticlesPopularHelper.php b/modules/mod_articles_popular/Helper/ArticlesPopularHelper.php index 0e1b29f793a55..b1348e10650a1 100644 --- a/modules/mod_articles_popular/Helper/ArticlesPopularHelper.php +++ b/modules/mod_articles_popular/Helper/ArticlesPopularHelper.php @@ -44,7 +44,7 @@ public static function getList(&$params) $model->setState('params', $appParams); $model->setState('list.start', 0); - $model->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED); + $model->setState('filter.condition', ContentComponent::STATE_PUBLISHED); // Set the filters based on the module params $model->setState('list.limit', (int) $params->get('count', 5)); diff --git a/modules/mod_related_items/Helper/RelatedItemsHelper.php b/modules/mod_related_items/Helper/RelatedItemsHelper.php index f696c5c67194e..605196722e3fb 100644 --- a/modules/mod_related_items/Helper/RelatedItemsHelper.php +++ b/modules/mod_related_items/Helper/RelatedItemsHelper.php @@ -40,7 +40,7 @@ public static function getList(&$params) $groups = Factory::getUser()->getAuthorisedViewLevels(); $maximum = (int) $params->get('maximum', 5); $factory = $app->bootComponent('com_content')->getMVCFactory(); - $condition = ContentComponent::CONDITION_PUBLISHED; + $condition = ContentComponent::STATE_PUBLISHED; // Get an instance of the generic articles model /** @var \Joomla\Component\Content\Site\Model\ArticlesModel $articles */