$title) {
$title = acym_translation($title);
$class = 'step';
if ($disableTabs) $class .= ' disabled_step';
if ($currentStep === $task) $class .= ' current_step';
if (!$disableTabs) {
if ($editionMode) {
$link = $ctrl.'&task=edit&step='.$task.'&'.$idName.'='.$id;
} else {
$link = $ctrl.'&task='.$task;
}
$title = ''.$title.'';
}
$workflow[] = '
'.$title.'';
$workflow[] = '';
if ($task === $this->disabledAfter) {
$disableTabs = true;
}
}
array_pop($workflow);
$result = '';
$result .= implode('', $workflow);
$result .= '
';
return $result;
}
public function displayNew(array $steps, string $currentStep, bool $edition = true, string $linkParameters = '', string $idName = 'id'): string
{
$ctrl = acym_getVar('cmd', 'ctrl');
$id = acym_getVar('int', $idName, 0);
$workflow = [];
$disableTabs = false;
foreach ($steps as $task => $title) {
if ($disableTabs) {
continue;
}
$title = acym_translation($title);
$classCurrentStep = $currentStep === $task ? 'acym__workflow__step__active' : '';
$classDisabled = $disableTabs ? 'acym__workflow__step__disabled' : '';
$label = $title;
if (!$disableTabs) {
if ($edition) {
$link = $ctrl.'&task=edit&step='.$task.'&'.$idName.'='.$id;
} else {
$link = $ctrl.'&task='.$task;
}
$label = ''.$title.'';
}
$step = ''.$label.'
';
$workflow[] = $step;
if ($task === $this->disabledAfter) {
$disableTabs = true;
}
}
$result = '';
$result .= implode('', $workflow);
$result .= '
';
return $result;
}
public function displayTabs(array $steps, string $currentStep, array $options = []): string
{
$ctrl = acym_getVar('cmd', 'ctrl');
$mailTypes = ['mailbox_action'];
$workflow = [];
foreach ($steps as $task => $title) {
if (in_array($task, $mailTypes)) {
$searchSettings = [
'offset' => 0,
'mailsPerPage' => 1,
'key' => '',
];
$mailClass = new \AcyMailing\Classes\MailClass();
$existingMailbox = $mailClass->getMailsByType($task, $searchSettings);
if (empty($existingMailbox['mails'])) {
continue;
}
}
$title = acym_translation($title);
$linkAttribute = $currentStep === $task ? 'aria-selected="true"' : '';
if (!empty($options['query'])) {
$link = $ctrl.$options['query'].$task;
} else {
$link = $ctrl.'&task='.$task;
}
if (!empty($options['disableTabs']) && in_array($task, $options['disableTabs'])) {
$link = '';
$linkAttribute = 'aria-disabled="true"';
}
$hrefAttribute = $link ? 'href="'.acym_completeLink($link).'"' : '';
$title = ''.$title.'';
$workflow[] = ''.$title.'';
}
$result = '';
$result .= implode('', $workflow);
$result .= '
';
return $result;
}
}