/** * If workflow states are configured, adds a cell with the workflow state to the row, * @param String $target Whose workflow state do we want, such as language code or group id. * @param String $state The workflow state id * @return string Html */ protected function getWorkflowStateCell($target, $state) { // This will be set by addWorkflowStatesColumn if needed if (!isset($this->states)) { return ''; } if ($state === '') { return "\n\t\t" . $this->table->element('', '', -1); } if ($this instanceof SpecialMessageGroupStats) { // Same for every language $group = MessageGroups::getGroup($this->target); $stateConfig = $group->getMessageGroupStates()->getStates(); } else { // The message group for this row $group = MessageGroups::getGroup($target); $stateConfig = $group->getMessageGroupStates()->getStates(); } $sortValue = -1; $stateColor = ''; if (isset($stateConfig[$state])) { $sortIndex = array_flip(array_keys($stateConfig)); $sortValue = $sortIndex[$state] + 1; if (is_string($stateConfig[$state])) { // BC for old configuration format $stateColor = $stateConfig[$state]; } elseif (isset($stateConfig[$state]['color'])) { $stateColor = $stateConfig[$state]['color']; } } $stateMessage = $this->msg("translate-workflow-state-{$state}"); $stateText = $stateMessage->isBlank() ? $state : $stateMessage->text(); return "\n\t\t" . $this->table->element($stateText, $stateColor, $sortValue); }
/** * If workflow states are configured, adds a cell with the workflow state to the row, * @param $target Whose workflow state do we want, such as language code or group id. * @return string */ function getWorkflowStateCell($target) { global $wgTranslateWorkflowStates; if ($wgTranslateWorkflowStates) { $state = isset($this->states[$target]) ? $this->states[$target] : ''; $sort = isset($this->statemap[$state]) ? $this->statemap[$state] + 1 : -1; $stateMessage = wfMessage("translate-workflow-state-{$state}"); $stateText = $stateMessage->isBlank() ? $state : $stateMessage->text(); return "\n\t\t" . $this->table->element($stateText, isset($wgTranslateWorkflowStates[$state]) ? $wgTranslateWorkflowStates[$state] : '', $sort); } return ''; }