This repository has been archived by the owner on Mar 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
MASTER PR DO NOT MERGE #156
Open
bembelimen
wants to merge
352
commits into
4.0-dev
Choose a base branch
from
staging
base: 4.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 250 commits
Commits
Show all changes
352 commits
Select commit
Hold shift + click to select a range
c2a9fbb
Fix filtering issue in articles list
2f15b10
Fix code style
998284d
Fix code style
785391c
Fix issue with run transition, Removes button in toolbar to run trans…
7274f93
Merge branch '0.0.1-basic' of https://github.com/joomla-projects/GSoC…
63764e0
Merge branch 'master' of https://github.com/joomla-projects/GSoC17_pu…
8d026cc
Removes descriptions from fields in adding views, Fix not displaying …
38f83db
Adds basic acl for toolbar buttons
52de06d
Adds basic staff to front with errors
8fd0344
Fix typos
91d24f2
Remove "archived" status (#69)
bembelimen fbfaecb
Rename the default workflow (#68)
bembelimen 51913f1
Show workflow menu only if the parameter is activated
bembelimen 2a5197f
Implement frontend filter (#72)
bembelimen aed6d55
Merge branch 'front-side' of /home/janek/Dokumenty/GSoC/PublishingWor…
ceb8599
Adds changes from states to workflows to all of models in com_content…
f23cbb5
Corrects sql queries
08bd28d
Set published as default state (#73)
bembelimen 70a3685
Merge branch '0.0.1-basic' into front-side
bembelimen c3b70e5
Fix save as copy (#71)
bembelimen 1a186d7
Correct typo
f062192
Merge branch 'front-side' of https://github.com/joomla-projects/GSoC1…
da5d2b9
Merge branch 'front-side' into 0.0.1-basic
5190905
Merge branch 'master' of https://github.com/joomla-projects/GSoC17_pu…
db9f642
Fix code style
22ea314
fixing frontend condition for decide published article (#74)
Buddhima b274a67
Changes to frontend to work with reordered states (#76)
Buddhima 032a710
Changes archive view to select which state you want, Changes mod arti…
b1a5c80
Improve ugly part
0a6bd5d
Multi select states in com_content Archived Articles view
1ae6a60
fixing front-end issue again (#77)
Buddhima 213110b
Merge branch 'master' of https://github.com/joomla-projects/GSoC17_pu…
6b7ea8c
Merge branch 'master' of https://github.com/joomla-projects/GSoC17_pu…
39df0f6
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into a…
7549e82
Merge branch 'archived-status' of https://github.com/joomla-projects/…
e8ac00a
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into a…
10d8da0
Changes plugins, modules to com_workflow and adds select with availab…
a171d64
Fix publishing fields in edit view
3ddf4e2
Fix menu workflow item
5bf746c
Fix transition select field, Adds acl checking in that field
21f5291
Fix plugin
a5dee4c
This trying to fix module issue with passing states
3ea6fe4
Add states to archive model
bembelimen 0ce67f6
Fix all bugs
8ecbf76
Fix code style
0895502
Fix bug with workflows, Fix deletion issue
6a98f44
Fix featured list view (#83)
Buddhima 4a74000
fix getting state in front end menu-item and module (#81)
Buddhima b818382
Adds minified version of core.js
55936ac
Merge branch 'front-side-bugs' of https://github.com/joomla-projects/…
8ca5202
Update filter_workflows.xml (#87)
coolcat-creations 336e068
Update filter_transitions.xml (#92)
coolcat-creations dcda9a9
Update filter_states.xml (#93)
coolcat-creations 657462c
Fixed: id of the select list mus be unique, Improve class
chmst e171ac9
Resolve issue #97, Resolve issue #84, Resolve partly #95
48c41a3
Changes default view of com_workflow to visible
daeabf6
Merge pull request #101 from joomla-projects/issues
bembelimen 5faca98
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into staging
bembelimen 754d374
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
bembelimen 5c0de9f
Improve the default workflow installation
bembelimen 2daa87c
Merge pull request #102 from joomla-projects/creation_date_on_install
bembelimen 1f323e6
Merged modified and creation date
bembelimen 63380cd
Merge pull request #103 from joomla-projects/merge_created_and_modifi…
bembelimen ef108d2
enable the workflow by default
bembelimen e13f314
Fix wrong enable default value
bembelimen 5cb54a9
Fix enable check
bembelimen 839c129
Set workflow visibility to 1 as default
bembelimen 6fb4d80
Merge branch 'staging' into publish_parameter
bembelimen dc3710c
Merge branch 'publish_parameter' of github.com:joomla-projects/GSoC17…
bembelimen 30c0353
Fix wrong component name com_workflows
bembelimen 53a791e
Merge pull request #70 from joomla-projects/publish_parameter
bembelimen 5f25a8b
Merge pull request #98 from chmst/Improve_transition_generic.select_l…
bembelimen 917100e
fixing current date function issue
Buddhima 2383382
Merge pull request #105 from Buddhima/fix_create_time_sql
bembelimen a9b6933
Fix context when saving a workflow
bembelimen b4c49ce
Merge pull request #106 from joomla-projects/Fix_context_while_saving
bembelimen 88a0198
Create a default state while creating a new workflow
bembelimen 63b533c
save2copy button added
HRIT-Florian 15761f9
Rename "workflow" to "workflows" in the menu
bembelimen 2f8e5c1
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
HRIT-Florian b1ffd48
Auto-populate the model state. filter.extension
HRIT-Florian 7c9bf89
Fix context for state model
bembelimen c9354af
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
HRIT-Florian 8118524
save2copy workfolow > states
HRIT-Florian 376da72
Fix saving context in transiton model
bembelimen 0769f1b
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
HRIT-Florian ca6b85c
Add number of transitions/states in workflows view
bembelimen 33882e0
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
HRIT-Florian 602f6ba
Clean up code
HRIT-Florian dea615c
save2copy workflow > transitions
HRIT-Florian b05fd2a
generateNewTitle when save2copy added
HRIT-Florian 07bad9b
Merge pull request #107 from Didldu-Florian/save_copy
bembelimen 70a2498
Add published filter for status/transition listing in workflow view
bembelimen 74a4ef3
Fix trashed status when filtered
bembelimen 6707421
Merge transition and state column with special transition
bembelimen b5180d3
Use plurals for the sidebar
chmst 2f3a470
Align states to the left
bembelimen d7c3eb5
Converted articles state filter to a grouped list
bembelimen 9588e40
Merge pull request #109 from joomla-projects/transitions_in_article_list
bembelimen 606a7d7
Sniffer satisfaction
bembelimen f04f855
Sniffer satisfaction
bembelimen fa1c727
Code cleanup
bembelimen dd123d8
Fix articles count in category
bembelimen 94260f2
Merge pull request #115 from joomla-projects/fix_sniffer
bembelimen 0ce906d
Fix execute transitions on all articles #112 (#117)
0b07295
Rename extenstion => extension
bembelimen 3904b7a
Improve state edit layout - move condition from publishing area to ma…
chmst 9fc24fc
Label with generic text
chmst 987bbed
adding new workflow states field
Buddhima 2581a86
fix codesniffer issues
Buddhima 480c779
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
bembelimen 05cdd51
Merge pull request #116 from joomla-projects/fix_articles_count_in_ca…
bembelimen 8edc355
Merge pull request #118 from chmst/Move_field_condition
bembelimen c4a6d32
update field class according to suggesstions
Buddhima 95e5d6f
Merge pull request #119 from Buddhima/grouped_state_filter_field
bembelimen 5700ccc
Merge pull request #111 from joomla-projects/grouped_state_filter
bembelimen 0f3f95c
fix issue with settting the default value with state edit form
Buddhima 6d040f9
Merge pull request #120 from Buddhima/fix_issue_states_default
bembelimen f4a66dd
Reolve https://github.com/joomla-projects/GSoC17_publishing_workflow/…
chmst d45fcce
Code changed: getTable, use sprintf
chmst c5e3671
Unpublish new copy
HRIT-Florian c7bc6d9
Merge pull request #123 from Didldu-Florian/save_copy
bembelimen 0f2fe70
Save2copy for states
HRIT-Florian 9061873
save2copy check if title exists
HRIT-Florian 9bd1e14
Merge pull request #122 from chmst/more_plurals_in_sidebar
bembelimen 2fe7b6d
Disable the switcher on edit state if the state is default
chmst bfb899e
Fixed getValue
chmst 5810ae5
Merge pull request #125 from chmst/disable_default-switcher_on_edit_s…
bembelimen 71dcc6b
Simplified and escaped
chmst cda42b9
fixed: check for table-entry workflow
chmst 6e963f3
Merge pull request #121 from chmst/Workflow_name_in_lists
bembelimen c6afde7
merge 4.0-dev
zero-24 dfdbd14
recompile core.min.js
zero-24 4a5672a
Fix new class structure
bembelimen 5c2c1a6
Fix #110 deletion of trashed articles
bembelimen 7298671
Readd featuring articles
bembelimen 9fdaa16
Adds ordering to the states and transitions #94
b544eb2
adding current state to article edit view, transition drop-down
Buddhima a74dfad
remove default value in XML config
Buddhima 4381447
Merge pull request #128 from Buddhima/improve_article_edit_transition
bembelimen 1a9727f
Shorten return code
bembelimen ed9caed
Merge pull request #129 from joomla-projects/improve_article_edit_tra…
bembelimen cea5f1a
Merge remote-tracking branch 'origin/staging' into ordering
4545873
Moved form xml to "forms" folder
bembelimen 54c8842
Moved validation to the table class
bembelimen b8e8541
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into staging
bembelimen 58cddb0
Add deploy version instead of a normal version
bembelimen 057b8e2
Add more deploy versions
bembelimen b3688ff
Merge pull request #124 from Didldu-Florian/save_copy
bembelimen 58e9fc6
Merge branch 'staging' into improve_saving
bembelimen 0442c28
Fix saving with workflow_id
bembelimen 237a912
Merge pull request #134 from joomla-projects/Deploy_version
bembelimen db4fdcc
Merge pull request #133 from joomla-projects/improve_saving
bembelimen 6a28c8e
adding workflow_associations table structure
Buddhima cdf27ae
fix sql issue
Buddhima 3c0ffc2
adding new workflow-association manipulations
Buddhima 0b5d565
change article saving to use associations
Buddhima c4a59ab
changing article saving, transition saving actions to do via associat…
Buddhima 7c43e94
update state filtering field to use workflow_associations
Buddhima 01de3b7
fix issue with identifying transitionId when executing runTransition
Buddhima beb54f7
First rewrite to reflect the new class convention
bembelimen 52b7736
Change table class where needed
bembelimen 09544f4
Fix wrong language string
bembelimen 8e432ca
More table fixes
bembelimen a15abdf
Next table classname fix
bembelimen 6b8ca8b
Table::getInstance => new Table
bembelimen 2e74e67
Sniffer fixes
bembelimen 6dd98e4
Fix where in workflow table
bembelimen 5994700
Fix where in workflow table
bembelimen 5d885ca
Fix saving error for workflows
bembelimen 808e91f
adding comments and remove an unnecessary method
Buddhima 23b3e6f
Move the main properties auf a transition from the right column to th…
chmst 15388f2
Merge pull request #135 from Buddhima/workflow_associations_impl
Buddhima 66e037c
move namespace to state filter field
Buddhima 7d86308
update featured article view according to articles view changes
Buddhima a116283
fixing style issue in featured default
Buddhima 353da7e
style fixing in featured default 2
Buddhima 1bccea0
style fixing in featured default 3
Buddhima 7f81551
Merge branch 'staging' of https://github.com/joomla-projects/GSoC17_p…
3177778
Merge branch 'staging' into ordering
bembelimen 6c5036d
Set default values
bembelimen c0fb0de
Merge branch 'staging' into ordering
bembelimen be3369f
Move table for workflow association
bembelimen 20a95b6
Fix sql default value
bembelimen 592c9bd
Move table for workflow association
bembelimen 69d2f79
Merge branch 'staging' into ordering
bembelimen ca9693e
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into staging
bembelimen b7faf2c
Remove colored workflow param select
bembelimen 1abef37
Merge branch 'staging' of github.com:joomla-projects/GSoC17_publishin…
bembelimen 640546a
Add workflow ordering
bembelimen cf7c0eb
Merge pull request #136 from chmst/improve-transition-edit-view
bembelimen 3356864
Merge pull request #137 from Buddhima/update_featured_article_view_wi…
Buddhima 82d82f1
adding final state in transition drop-down
Buddhima 233d6ec
adding workflow helper to return condition name and append it to the …
Buddhima ce379ac
Add ordering to the state and transition
10cc00c
Merge branch 'ordering' of https://github.com/joomla-projects/GSoC17_…
26838ea
Add condition to the transition field
bembelimen fd99424
Merge pull request #1 from joomla-projects/add_state_in_transition_text
Buddhima 829c410
Merge pull request #142 from Buddhima/add_state_in_transition_text
Buddhima e1df907
implementing delete record in workflow associations table when deleti…
Buddhima a9e3b1f
Merge pull request #144 from Buddhima/impl_workflow_associations_delete
Buddhima 22ff96e
update admin mod_latest to use workflow_state
Buddhima 12dbc84
Fixing issues from review
8e0df22
Merge remote-tracking branch 'origin/staging' into ordering
04c4967
Fixing conlict with staging
95f318b
Fixing projection to int on workflow_id
62476b5
Merge pull request #143 from joomla-projects/ordering
bembelimen 4eef4fa
fixing issues with using workflow_associations in category view
Buddhima be78904
update archive articles modulw with workflow_association changes
Buddhima b091911
fixing transition field ambiguity in ordering
Buddhima 6dc75ed
Merge pull request #149 from Buddhima/fix_transition-field_ordering
Buddhima ded7185
Merge pull request #147 from Buddhima/fixing_category_list_view
Buddhima 6574b04
adding layouts for batch processing
Buddhima 57ce615
fixing display issues with workflow states dropdown
Buddhima 96c37db
adding workfow state change functionality
Buddhima 175185c
adding access control checks for workflows list related places
Buddhima 96e4750
few modifications to workflow model
Buddhima 3efb1b8
update controller and models of state, transition
Buddhima 3312363
modify config files according to com_workflow permission hierarchy
Buddhima 25ecaae
refactor models and views to use permissions
Buddhima 624ecfe
fix suggesstion in PR
Buddhima bdbef68
fix for adding users
Buddhima 1025334
adding transition.run permission to com_content entry
Buddhima cc11b56
fixing workflow saving issue and use permissions for list view state …
Buddhima 62131fe
fix suggesstion in PR-2
Buddhima 7b5b9d6
fixing suggesstion in PR
Buddhima 84a10e3
Merge branch 'master' into staging
bembelimen cc22a18
Merge branch '4.0-dev' into 4.0_alpha_integration
bembelimen d2ec5c4
Merge pull request #155 from joomla-projects/4.0_alpha_integration
bembelimen 7e29b1b
Rename transition.run => core.execute.transition
bembelimen e8dd905
Merge pull request #157 from joomla-projects/impl_access_control
bembelimen 8f46f7f
Merge branch 'staging' into update_archive_article_with_associations
bembelimen 0486060
Add parameter to WorkflowState field, so it's possible to show all st…
bembelimen 570a30b
Merge pull request #158 from joomla-projects/update_archive_article_w…
bembelimen 49d8c8a
Merge branch 'staging' into implementing_batch_processing
bembelimen c6e230c
Add permission check for batch transition executions
bembelimen c29a2cb
Fix broken transition batch
bembelimen c4f4a7e
Merge pull request #159 from joomla-projects/implementing_batch_proce…
bembelimen 5f81e50
Merge pull request #145 from Buddhima/update_admin_module
bembelimen 56b9ca9
Set transition batch execution to super users only
bembelimen 7c3d60c
Implement some cleanups
bembelimen b6a1429
Fix article saving
bembelimen c207fbb
Implement email notification for transition execution
bembelimen 7ff5bb1
Merge pull request #160 from joomla-projects/email_notification
bembelimen c06af6e
Rename the transition dropdown in the article edit form
bembelimen 71e3a8f
Readd save2copy
bembelimen 2976e68
Convert frontend state to transition in edit form
bembelimen e2c437a
Merge branch '4.0-dev' into staging
bembelimen c4a451b
Merge 4.0 dev from core
bembelimen 7502626
Merge branch '4.0-dev' into staging
bembelimen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
|
||
namespace Joomla\Component\Content\Administrator\Helper; | ||
|
||
use Joomla\CMS\Factory; | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
|
@@ -41,6 +43,34 @@ public static function addSubmenu($vName) | |
'index.php?option=com_categories&extension=com_content', | ||
$vName == 'categories' | ||
); | ||
|
||
if (\JComponentHelper::isEnabled('com_workflow') && \JComponentHelper::getParams('com_content')->get('workflows_enable', 1)) | ||
{ | ||
\JHtmlSidebar::addEntry( | ||
\JText::_('COM_CONTENT_SUBMENU_WORKFLOWS'), | ||
'index.php?option=com_workflow&extension=com_content', | ||
$vName == 'workflows' | ||
); | ||
|
||
if ($vName == 'states' || $vName == 'transitions') | ||
{ | ||
$app = Factory::getApplication(); | ||
$workflowID = $app->getUserStateFromRequest('filter.workflow_id', 'workflow_id', 1, 'int'); | ||
|
||
\JHtmlSidebar::addEntry( | ||
\JText::_('COM_WORKFLOW_STATES'), | ||
'index.php?option=com_workflow&view=states&workflow_id=' . $workflowID . "&extension=com_content", | ||
$vName == 'states`' | ||
); | ||
|
||
\JHtmlSidebar::addEntry( | ||
\JText::_('COM_WORKFLOW_TRANSITIONS'), | ||
'index.php?option=com_workflow&view=transitions&workflow_id=' . $workflowID . "&extension=com_content", | ||
$vName == 'transitions' | ||
); | ||
} | ||
} | ||
|
||
\JHtmlSidebar::addEntry( | ||
\JText::_('COM_CONTENT_SUBMENU_FEATURED'), | ||
'index.php?option=com_content&view=featured', | ||
|
@@ -104,36 +134,38 @@ public static function countItems(&$items) | |
|
||
foreach ($items as $item) | ||
{ | ||
$item->count_trashed = 0; | ||
$item->count_archived = 0; | ||
$item->count_trashed = 0; | ||
$item->count_unpublished = 0; | ||
$item->count_published = 0; | ||
$query = $db->getQuery(true); | ||
$query->select('state, count(*) AS count') | ||
->from($db->qn('#__content')) | ||
->where('catid = ' . (int) $item->id) | ||
->group('state'); | ||
$db->setQuery($query); | ||
$articles = $db->loadObjectList(); | ||
$item->count_published = 0; | ||
|
||
$query = $db->getQuery(true); | ||
|
||
$query ->select($db->qn('condition')) | ||
->select('COUNT(*) AS ' . $db->qn('count')) | ||
->from($db->qn('#__content', 'c')) | ||
->from($db->qn('#__workflow_states', 's')) | ||
->from($db->qn('#__workflow_associations', 'a')) | ||
->where($db->qn('a.item_id') . ' = ' . $db->qn('c.id')) | ||
->where($db->qn('s.id') . ' = ' . $db->qn('a.state_id')) | ||
->where('catid = ' . (int) $item->id) | ||
->where('a.extension = ' . $db->quote('com_content')) | ||
->group($db->qn('condition')); | ||
|
||
$articles = $db->setQuery($query)->loadObjectList(); | ||
|
||
foreach ($articles as $article) | ||
{ | ||
if ($article->state == 1) | ||
if ($article->condition == 1) | ||
{ | ||
$item->count_published = $article->count; | ||
} | ||
|
||
if ($article->state == 0) | ||
if ($article->condition == 0) | ||
{ | ||
$item->count_unpublished = $article->count; | ||
} | ||
|
||
if ($article->state == 2) | ||
{ | ||
$item->count_archived = $article->count; | ||
} | ||
|
||
if ($article->state == -2) | ||
if ($article->condition == -2) | ||
{ | ||
$item->count_trashed = $article->count; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This approach requires changes when states/conditions are added or removed. Better: class WorkflowConditions
{
const PUBLISHED = 1;
const UNPUBLISHED = 0;
const ARCHIVED = 2;
const TRASHED = -2;
} The loop should look like $item->count = [];
foreach ($articles as $article)
{
$item->count[$article->condition] = ($item->count[$article->condition] ?: 0) + $article->count;
} In subsequent code, you'll access $item->count[WorkflowConditions::PUBLISHED] instead of $item->count_published |
||
|
@@ -155,9 +187,9 @@ public static function countItems(&$items) | |
*/ | ||
public static function countTagItems(&$items, $extension) | ||
{ | ||
$db = \JFactory::getDbo(); | ||
$parts = explode('.', $extension); | ||
$section = null; | ||
$db = \JFactory::getDbo(); | ||
$parts = explode('.', $extension); | ||
$section = null; | ||
|
||
if (count($parts) > 1) | ||
{ | ||
|
@@ -169,17 +201,17 @@ public static function countTagItems(&$items, $extension) | |
|
||
if ($section === 'category') | ||
{ | ||
$join = $db->qn('#__categories') . ' AS c ON ct.content_item_id=c.id'; | ||
$join = $db->qn('#__categories') . ' AS c ON ct.content_item_id=c.id'; | ||
$state = 'published as state'; | ||
} | ||
|
||
foreach ($items as $item) | ||
{ | ||
$item->count_trashed = 0; | ||
$item->count_archived = 0; | ||
$item->count_trashed = 0; | ||
$item->count_archived = 0; | ||
$item->count_unpublished = 0; | ||
$item->count_published = 0; | ||
$query = $db->getQuery(true); | ||
$item->count_published = 0; | ||
$query = $db->getQuery(true); | ||
$query->select($state . ', count(*) AS count') | ||
->from($db->qn('#__contentitem_tag_map') . 'AS ct ') | ||
->where('ct.tag_id = ' . (int) $item->id) | ||
|
@@ -236,7 +268,7 @@ public static function validateSection($section) | |
// Editing an article | ||
case 'form': | ||
|
||
// Category list view | ||
// Category list view | ||
case 'featured': | ||
case 'category': | ||
$section = 'article'; | ||
|
@@ -270,4 +302,86 @@ public static function getContexts() | |
|
||
return $contexts; | ||
} | ||
|
||
/** | ||
* Check if state can be deleted | ||
* | ||
* @param int $stateID Id of state to delete | ||
* | ||
* @return boolean | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public static function canDeleteState($stateID) | ||
{ | ||
$db = \JFactory::getDbo(); | ||
$query = $db->getQuery(true); | ||
|
||
$query->select('id') | ||
->from($db->qn('#__content')) | ||
->where('state = ' . (int) $stateID); | ||
$db->setQuery($query); | ||
$states = $db->loadResult(); | ||
|
||
return empty($states); | ||
} | ||
|
||
/** | ||
* Method to filter transitions by given id of state | ||
* | ||
* @param int $transitions Array of transitions | ||
* @param int $pk Id of state | ||
* | ||
* @return array | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public static function filterTransitions($transitions, $pk) | ||
{ | ||
return array_values( | ||
array_filter( | ||
$transitions, | ||
function ($var) use ($pk) | ||
{ | ||
return $var['from_state_id'] == $pk; | ||
} | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Method to change state of multiple ids | ||
* | ||
* @param int $pks Array of IDs | ||
* @param int $condition Condition of the workflow state | ||
* | ||
* @return boolean | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public static function updateContentState($pks, $condition) | ||
{ | ||
if (empty($pks)) | ||
{ | ||
return false; | ||
} | ||
|
||
try | ||
{ | ||
$db = Factory::getDbo(); | ||
$query = $db->getQuery(true); | ||
|
||
$query->update($db->qn('#__content')) | ||
->set($db->qn('state') . '=' . (int) $condition) | ||
->where($db->qn('id') . ' IN (' . implode(', ', $pks) . ')'); | ||
|
||
$db->setQuery($query)->execute(); | ||
} | ||
catch (\Exception $e) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file seem not to be related to Workflow.