|
152 | 152 | endif; ?>> |
153 | 153 | <?php foreach ($this->items as $i => $item) : |
154 | 154 | $item->max_ordering = 0; |
155 | | - $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); |
156 | | - $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); |
157 | | - $canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId; |
158 | | - $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; |
159 | | - $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); |
160 | | - $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; |
161 | | - $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); |
162 | | - $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; |
| 155 | + $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); |
| 156 | + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); |
| 157 | + $canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId; |
| 158 | + $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; |
| 159 | + $canExecuteTransition = $user->authorise('core.execute.transition', 'com_content.article.' . $item->id); |
| 160 | + $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); |
| 161 | + $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; |
| 162 | + $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); |
| 163 | + $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; |
163 | 164 |
|
164 | | - $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id); |
| 165 | + // Transition button options |
| 166 | + $options = [ |
| 167 | + 'title' => Text::_($item->stage_title), |
| 168 | + 'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)), |
| 169 | + 'id' => 'workflow-' . $item->id, |
| 170 | + 'task' => 'articles.runTransition', |
| 171 | + 'disabled' => !$canExecuteTransition, |
| 172 | + ]; |
165 | 173 |
|
166 | | - $transition_ids = ArrayHelper::getColumn($transitions, 'value'); |
167 | | - $transition_ids = ArrayHelper::toInteger($transition_ids); |
| 174 | + if ($canExecuteTransition) { |
| 175 | + $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id); |
| 176 | + |
| 177 | + $transition_ids = ArrayHelper::getColumn($transitions, 'value'); |
| 178 | + $transition_ids = ArrayHelper::toInteger($transition_ids); |
| 179 | + |
| 180 | + $dataTransitionsAttribute = 'data-transitions="' . implode(',', $transition_ids) . '"'; |
| 181 | + |
| 182 | + $options = array_merge($options, ['transitions' => $transitions]); |
| 183 | + } |
168 | 184 |
|
169 | 185 | ?> |
170 | 186 | <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->catid; ?>" |
171 | | - data-transitions="<?php echo implode(',', $transition_ids); ?>" |
| 187 | + <?php echo $dataTransitionsAttribute ?? '' ?> |
172 | 188 | > |
173 | 189 | <td class="text-center"> |
174 | 190 | <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?> |
|
192 | 208 | <?php if ($workflow_enabled) : ?> |
193 | 209 | <td class="article-stage text-center"> |
194 | 210 | <?php |
195 | | - $options = [ |
196 | | - 'transitions' => $transitions, |
197 | | - 'title' => Text::_($item->stage_title), |
198 | | - 'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)), |
199 | | - 'id' => 'workflow-' . $item->id, |
200 | | - 'task' => 'articles.runTransition' |
201 | | - ]; |
202 | | - |
203 | 211 | echo (new TransitionButton($options)) |
204 | 212 | ->render(0, $i); |
205 | 213 | ?> |
|
0 commit comments