Feuerwehr-eppingen/app/Helpers/WizardHelper.php

81 lines
2.2 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: Marco Glietsch
* Date: 19.03.2019
* Time: 13:07
*/
namespace App\Helpers;
class WizardHelper
{
static function buttonOptions($button, $wizardOptions)
{
switch(strtoupper($button))
{
case 'PREVIOUS':
$wizardButtonOptions['style'] = 'btn-success';
$wizardButtonOptions['class'] = 'wizard_step_back';
$wizardButtonOptions['icon'] = 'fas fa-arrow-left';
$wizardButtonOptions['label'] = __("admin.back");
break;
case 'NEXT':
$wizardButtonOptions['style'] = 'btn-success';
$wizardButtonOptions['class'] = 'wizard_step_forward';
$wizardButtonOptions['icon'] = 'fas fa-arrow-right';
$wizardButtonOptions['label'] = __("admin.next");
break;
case 'SAVE':
$wizardButtonOptions['style'] = 'btn-success';
$wizardButtonOptions['class'] = 'save';
$wizardButtonOptions['icon'] = 'far fa-save';
$wizardButtonOptions['label'] = __("admin.save");
break;
case 'CANCEL':
$wizardButtonOptions['style'] = 'btn-warning';
$wizardButtonOptions['class'] = 'cancel';
$wizardButtonOptions['icon'] = 'fa fa-times';
$wizardButtonOptions['label'] = __("admin.cancel");
$wizardButtonOptions['data']['dismiss'] = 'modal';
break;
case 'DELETE':
$wizardButtonOptions['style'] = 'btn-danger';
$wizardButtonOptions['class'] = '';
$wizardButtonOptions['icon'] = 'fa fa-trash-alt';
$wizardButtonOptions['label'] = __("admin.delete");
$wizardButtonOptions['data']['dismiss'] = 'modal';
break;
default:
$wizardButtonOptions['style'] = 'btn-success';
$wizardButtonOptions['class'] = '';
$wizardButtonOptions['icon'] = '';
$wizardButtonOptions['label'] = $button;
break;
}
if(isset($wizardOptions))
{
if(key_exists('buttons', $wizardOptions))
{
if(key_exists($button, $wizardOptions['buttons']))
{
foreach($wizardButtonOptions as $key => $value)
{
if(key_exists($key, $wizardOptions['buttons'][$button]))
{
$wizardButtonOptions[$key] = $wizardOptions['buttons'][$button][$key];
}
}
}
}
}
return $wizardButtonOptions;
}
}