|
@@ -30,13 +30,14 @@ if (!class_exists('modal')) {
|
|
|
|
|
|
static function create($array) {
|
|
|
|
|
|
- $modal = "<div id='".($array['id'] ? $array['id'] : 'modal')."' class='modal-window'>\n";
|
|
|
+ //add multi-lingual support
|
|
|
+ $language = new text;
|
|
|
+ $text = $language->get();
|
|
|
+
|
|
|
+ $modal = "<div id='".(!empty($array['id']) ? $array['id'] : 'modal')."' class='modal-window'>\n";
|
|
|
$modal .= " <div>\n";
|
|
|
- $modal .= " <span title=\"".$text['button-close']."\" class='modal-close' onclick=\"modal_close(); ".$array['onclose']."\">×</span>\n";
|
|
|
- if ($array['type'] != '') {
|
|
|
- //add multi-lingual support
|
|
|
- $language = new text;
|
|
|
- $text = $language->get();
|
|
|
+ $modal .= " <span title=\"".$text['button-close']."\" class='modal-close' onclick=\"modal_close(); ".($array['onclose'] ?? '')."\">×</span>\n";
|
|
|
+ if (!empty($array['type'])) {
|
|
|
//determine type
|
|
|
switch ($array['type']) {
|
|
|
case 'copy':
|
|
@@ -55,11 +56,11 @@ if (!class_exists('modal')) {
|
|
|
$array['title'] = $array['title'] ? $array['title'] : $text['modal_title-confirmation'];
|
|
|
}
|
|
|
//prefix cancel button to action
|
|
|
- $array['actions'] = button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'collapse'=>'never','onclick'=>'modal_close(); '.$array['onclose']]).$array['actions'];
|
|
|
+ $array['actions'] = button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'collapse'=>'never','onclick'=>'modal_close(); '.($array['onclose'] ?? '')]).$array['actions'];
|
|
|
}
|
|
|
- $modal .= $array['title'] ? " <span class='modal-title'>".$array['title']."</span>\n" : null;
|
|
|
- $modal .= $array['message'] ? " <span class='modal-message'>".$array['message']."</span>\n" : null;
|
|
|
- $modal .= $array['actions'] ? " <span class='modal-actions'>".$array['actions']."</span>\n" : null;
|
|
|
+ $modal .= !empty($array['title']) ? " <span class='modal-title'>".$array['title']."</span>\n" : null;
|
|
|
+ $modal .= !empty($array['message']) ? " <span class='modal-message'>".$array['message']."</span>\n" : null;
|
|
|
+ $modal .= !empty($array['actions']) ? " <span class='modal-actions'>".$array['actions']."</span>\n" : null;
|
|
|
$modal .= " </div>\n";
|
|
|
$modal .= "</div>";
|
|
|
|
|
@@ -71,4 +72,4 @@ if (!class_exists('modal')) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-?>
|
|
|
+?>
|