diff --git a/pages_template/vouchers/Default.html b/pages_template/vouchers/Default.html new file mode 100644 index 0000000..858176f --- /dev/null +++ b/pages_template/vouchers/Default.html @@ -0,0 +1,27 @@ + + + + +
+
[[company_name]]
+ + + + + + + + + + + + + + + +
[[qrcode]] +
+ [[price]]
+ [[voucher_code]]
+ [[plan]] - [[counter]]
+
\ No newline at end of file diff --git a/pages_template/vouchers/Logo Header Center.html b/pages_template/vouchers/Logo Header Center.html new file mode 100644 index 0000000..22ee25e --- /dev/null +++ b/pages_template/vouchers/Logo Header Center.html @@ -0,0 +1,24 @@ + + + + +
+
+ + + + + + + + + + + + +
+ [[qrcode]]
+ [[voucher_code]]
+ [[plan]] [[price]]
+
[[company_name]]
+
\ No newline at end of file diff --git a/pages_template/vouchers/Logo Header.html b/pages_template/vouchers/Logo Header.html new file mode 100644 index 0000000..9e0bb6d --- /dev/null +++ b/pages_template/vouchers/Logo Header.html @@ -0,0 +1,28 @@ + + + + +
+
+ + + + + + + + + + + + + + + +
[[qrcode]] +
+ [[price]]
+ [[voucher_code]]
+ [[plan]] - [[counter]]
+
[[company_name]]
+
\ No newline at end of file diff --git a/system/controllers/pages.php b/system/controllers/pages.php index 1d60dfa..6dd8e73 100644 --- a/system/controllers/pages.php +++ b/system/controllers/pages.php @@ -31,6 +31,7 @@ if(strpos($action,"-reset")!==false){ _alert(Lang::T('You do not have permission to access this page'),'danger', "dashboard"); } $path = "pages/".str_replace(".","",$action).".html"; + $ui->assign("action", $action); //echo $path; run_hook('view_edit_pages'); #HOOK if(!file_exists($path)){ @@ -44,6 +45,15 @@ if(strpos($action,"-reset")!==false){ } } if(file_exists($path)){ + if($action=='Voucher'){ + if(!file_exists("pages/vouchers/")){ + mkdir("pages/vouchers/"); + if(file_exists("pages_template/vouchers/")){ + File::copyFolder("pages_template/vouchers/", "pages/vouchers/"); + } + } + $ui->assign("vouchers", scandir("pages/vouchers/")); + } $html = file_get_contents($path); $ui->assign("htmls",str_replace([""],"",$html)); $ui->assign("writeable",is_writable($path)); @@ -61,7 +71,12 @@ if(strpos($action,"-reset")!==false){ if(file_exists($path)){ $html = _post("html"); run_hook('save_pages'); #HOOK - if(file_put_contents($path, str_replace([""],"",$html))){ + if(file_put_contents($path, $html)){ + if(_post('template_save')=='yes'){ + if(!empty(_post('template_name'))){ + file_put_contents("pages/vouchers/"._post('template_name').'.html', $html); + } + } r2(U . 'pages/'.$action, 's', Lang::T("Saving page success")); }else{ r2(U . 'pages/'.$action, 'e', Lang::T("Failed to save page, make sure i can write to folder pages, chmod 664 pages/*.html")); diff --git a/ui/ui/page-edit.tpl b/ui/ui/page-edit.tpl index d0ae192..a44bdd0 100644 --- a/ui/ui/page-edit.tpl +++ b/ui/ui/page-edit.tpl @@ -1,50 +1,82 @@ {include file="sections/header.tpl"}
-
-
-
-
-
- +
+
+
+
+ {if $action!='Voucher'} +
+ +
+ {/if} + {$pageHeader}
- {$pageHeader} + + {if $writeable} + + {else} + + {/if} + {if $PageFile=='Voucher'} + + {/if}
- - {if $writeable} - - {else} - - {/if} - {if $PageFile=='Voucher'} - - {/if}
+ {if $action=='Voucher'} +
+ {foreach $vouchers as $v} + {if is_file("pages/vouchers/$v")} +
+
{str_replace(".html", '', $v)}
+
{include file="pages/vouchers/$v"}
+
+ {/if} + {/foreach} +
+ {/if}
-
{literal} {/literal}