| @@ 651-692 (lines=42) @@ | ||
| 648 | /** |
|
| 649 | * Draw all notifications to the page |
|
| 650 | */ |
|
| 651 | private function renderNotifications() |
|
| 652 | { |
|
| 653 | $count = count($this->notifications); |
|
| 654 | if($count === 0) |
|
| 655 | { |
|
| 656 | return; |
|
| 657 | } |
|
| 658 | for($i = 0; $i < $count; $i++) |
|
| 659 | { |
|
| 660 | $class = 'alert '.$this->notifications[$i]['sev']; |
|
| 661 | $button = ''; |
|
| 662 | if($this->notifications[$i]['dismissible']) |
|
| 663 | { |
|
| 664 | $class .= ' alert-dismissible'; |
|
| 665 | $button = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; |
|
| 666 | } |
|
| 667 | $prefix = ''; |
|
| 668 | switch($this->notifications[$i]['sev']) |
|
| 669 | { |
|
| 670 | case self::NOTIFICATION_INFO: |
|
| 671 | $prefix = '<strong>Notice:</strong> '; |
|
| 672 | break; |
|
| 673 | case self::NOTIFICATION_WARNING: |
|
| 674 | $prefix = '<strong>Warning!</strong> '; |
|
| 675 | break; |
|
| 676 | case self::NOTIFICATION_FAILED: |
|
| 677 | $prefix = '<strong>Warning!</strong> '; |
|
| 678 | break; |
|
| 679 | } |
|
| 680 | $style = ''; |
|
| 681 | if(($i + 1) < count($this->notifications)) |
|
| 682 | { |
|
| 683 | //Not the last notification, remove the end margin |
|
| 684 | $style = 'style="margin: 0px;"'; |
|
| 685 | } |
|
| 686 | $this->body = ' |
|
| 687 | <div class="'.$class.'" role="alert" '.$style.'> |
|
| 688 | '.$button.$prefix.$this->notifications[$i]['msg'].' |
|
| 689 | </div> |
|
| 690 | '.$this->body; |
|
| 691 | } |
|
| 692 | } |
|
| 693 | ||
| 694 | /** |
|
| 695 | * Add the no script block |
|
| @@ 636-677 (lines=42) @@ | ||
| 633 | /** |
|
| 634 | * Draw all notifications to the page |
|
| 635 | */ |
|
| 636 | private function renderNotifications() |
|
| 637 | { |
|
| 638 | $count = count($this->notifications); |
|
| 639 | if($count === 0) |
|
| 640 | { |
|
| 641 | return; |
|
| 642 | } |
|
| 643 | for($i = 0; $i < $count; $i++) |
|
| 644 | { |
|
| 645 | $class = 'alert '.$this->notifications[$i]['sev']; |
|
| 646 | $button = ''; |
|
| 647 | if($this->notifications[$i]['dismissible']) |
|
| 648 | { |
|
| 649 | $class .= ' alert-dismissible'; |
|
| 650 | $button = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; |
|
| 651 | } |
|
| 652 | $prefix = ''; |
|
| 653 | switch($this->notifications[$i]['sev']) |
|
| 654 | { |
|
| 655 | case self::NOTIFICATION_INFO: |
|
| 656 | $prefix = '<strong>Notice:</strong> '; |
|
| 657 | break; |
|
| 658 | case self::NOTIFICATION_WARNING: |
|
| 659 | $prefix = '<strong>Warning!</strong> '; |
|
| 660 | break; |
|
| 661 | case self::NOTIFICATION_FAILED: |
|
| 662 | $prefix = '<strong>Warning!</strong> '; |
|
| 663 | break; |
|
| 664 | } |
|
| 665 | $style = ''; |
|
| 666 | if(($i + 1) < count($this->notifications)) |
|
| 667 | { |
|
| 668 | //Not the last notification, remove the end margin |
|
| 669 | $style = 'style="margin: 0px;"'; |
|
| 670 | } |
|
| 671 | $this->body = ' |
|
| 672 | <div class="'.$class.'" role="alert" '.$style.'> |
|
| 673 | '.$button.$prefix.$this->notifications[$i]['msg'].' |
|
| 674 | </div> |
|
| 675 | '.$this->body; |
|
| 676 | } |
|
| 677 | } |
|
| 678 | ||
| 679 | /** |
|
| 680 | * Add the no script block |
|