From 7ab4731bc113062f7bc517127eaf45054c1e1f90 Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Thu, 21 Feb 2019 21:44:15 +0100 Subject: [PATCH] application added --- lib/processdata.php | 55 ++++++++++++++++++++--------- tmpl/pages/profile/applications.php | 45 +++++++++++++++++++---- tmpl/pages/profile/payement.php | 3 ++ tmpl/pages/profile/profile.php | 16 ++++----- 4 files changed, 88 insertions(+), 31 deletions(-) create mode 100644 tmpl/pages/profile/payement.php diff --git a/lib/processdata.php b/lib/processdata.php index 458f55c..1fb3bca 100644 --- a/lib/processdata.php +++ b/lib/processdata.php @@ -58,6 +58,37 @@ return; } + function process_getdata($gdt){ + global $baseurl,$p,$db,$user; + if (isset($gdt["action"])){ + switch ($gdt['action']){ + case 'logout': + $db->dbexec("delete from usersession where sessionid='".$user["sessionid"]."';"); + $user=array(); + setcookie("juridig",""); + $p='home'; + break; + case 'edit': + break; + case 'delete': + break; + } + } + if (isset($gdt["activate"])){ + switch ($gdt['activate']){ + case 'rendezvous': + $expiredate = date('Y-m-d',strtotime('+21 days')); + if (!(strpos($user['service_valid'],'rendezvous') > 0) && !(strpos($user['service_expired'],'rendezvous') > 0)){ + $db->dbexec("INSERT INTO userservices (id_user,service,expiration) VALUES (".$user['id'].",'rendezvous',date('".$expiredate."'))"); + $user = getsessiondata($user['sessionid']); + } + + break; + } + } + + } + function register_user($pdt){ global $db,$msg,$p; //do we have already an account for this user? @@ -152,25 +183,17 @@ return $retuser; } - function process_getdata($gdt){ - global $baseurl,$p,$db,$user; - $action = $gdt["action"]; - if ($action == "logout"){ - $db->dbexec("delete from usersession where sessionid='".$user["sessionid"]."';"); - $user=array(); - setcookie("juridig",""); - $p='home'; - #header("location:".$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$baseurl.'/'.$p); - } else if ($action == "edit") { - - } else if ($action == "delete") { - - } - } + function getsessiondata($sessid){ global $db; - $sql = "SELECT us.*,ses.sessionid from usersession ses LEFT JOIN users us on (ses.id_user=us.id) where ses.sessionid='".$sessid."';"; + $sql = "SELECT us.*,ses.sessionid, + GROUP_CONCAT(CASE WHEN srv.expiration >= CURRENT_DATE then srv.service else null end) as service_valid, + GROUP_CONCAT(CASE WHEN srv.expiration < CURRENT_DATE then srv.service else null end) as service_expired + from usersession ses + LEFT JOIN users us on (ses.id_user=us.id) + left join userservices srv on (srv.id_user=us.id) + where ses.sessionid='".$sessid."';"; $sesuser = $db->dbquery($sql); return $sesuser; } diff --git a/tmpl/pages/profile/applications.php b/tmpl/pages/profile/applications.php index 6c6611b..f02307b 100644 --- a/tmpl/pages/profile/applications.php +++ b/tmpl/pages/profile/applications.php @@ -1,23 +1,54 @@ +dbqueryall($sql); + $today = date('Y-m-d'); + $torenewstart = date('Y-m-d',strtotime("-14 days")) +?>
+ + $appdata){ + if (($appdata["activated"] == 1) || ($user["usergroup"] == "administrator")){ + ?>
- rendez-Vous -
Rendez-Vous
+ " alt="" src=""/> +
-

Donner à vos mandataires et futur mandaires la posisibilité de demander un rendez-vous en ligne en quelques clicks!

- -

Periode d'essaie: 3 semaines à partir de l'activation

+

+ + +

Periode d'essaie: semaines à partir de l'activation

+ = $today) { + echo ''; + echo '

Expire le:  '.date("d.m.Y", strtotime($appdata['expiration'])).'

'; + + } else { + ?> + + Est expiré le:  '.date("d.m.Y", strtotime($appdata['expiration'])).'

'; + } + ?> +
- Prix: 50€ HTVA / mois
(payable par année)

- + Prix: € HTVA / mois
(payable par année)

+
\ No newline at end of file diff --git a/tmpl/pages/profile/payement.php b/tmpl/pages/profile/payement.php new file mode 100644 index 0000000..69007d5 --- /dev/null +++ b/tmpl/pages/profile/payement.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/tmpl/pages/profile/profile.php b/tmpl/pages/profile/profile.php index 17403a9..ef6d539 100644 --- a/tmpl/pages/profile/profile.php +++ b/tmpl/pages/profile/profile.php @@ -6,10 +6,10 @@ $subpath = ""; } } - $activatedapps = array(); - if (($user['usergroup'] != 'client') && ($user['services'] != "")){ - $activatedapps = explode(',',$user['services']); - } + // $activatedapps = array(); + // if (($user['usergroup'] != 'client') && ($user['service'] != "")){ + // $activatedapps = explode(',',$user['services']); + // } ?>