<?php
$heading = '';
$message = '';
$class = '';
if ($this->session->userdata('success')) :
    $heading = $this->lang->line('success');
    $message = $this->session->userdata('success');
    $this->session->unset_userdata('success');
    $class = 'success';
elseif ($this->session->userdata('error')) :
    $heading = $this->lang->line('error');
    $message = $this->session->userdata('error');
    $this->session->unset_userdata('error');
    $class = 'error';
elseif ($this->session->userdata('warning')) :
    $heading = $this->lang->line('warning');
    $message = $this->session->userdata('warning');
    $this->session->unset_userdata('warning');
    $class = 'warning';
elseif ($this->session->userdata('info')) :
    $heading = $this->lang->line('info');
    $message = $this->session->userdata('info');
    $this->session->unset_userdata('alert_info');
    $class = 'info';
endif;
?>

<?php if ($message) :  ?>
    <script>
        $.toast({
            heading: '<?php echo $heading; ?>',
            text: "<p><?php echo $message; ?></p>",
            position: 'top-right',
            loaderBg: '#7a5449',
            class: 'jq-toast-<?php echo $class; ?>',
            hideAfter: 3500,
            stack: 6,
            showHideTransition: 'fade'
        });
    </script>
<?php endif; ?>