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']); - } - + case 'evaluation': + activate_evaluation($gdt); break; } } - if (isset($gdt["app"])){ - if (isset($gdt["autorenew"])){ - $db->dbexec("UPDATE userservices set autorenew=".$db->secvalue($gdt["autorenew"])." WHERE service='".$db->secvalue($gdt["app"])."' and id_user=".$user['id'].";)"); - } - 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; - } + if (isset($gdt["enable"])){ + enable_app($gdt); } - } - + } } function save_rendezvous($rdv){ @@ -398,15 +380,55 @@ return $rows; } - // function send_company_invitation($pdt){ - // } - - // function delete_profile_company($pdt){ - - // } - - function delete_profile_user($pdt){ + function delete_profile_user(){ + //must save email in separate table to + //first save user to evaluationtable + $db->dbexec("delete FROM users WHERE id=".$user["id"])." cascade;"; + } + function activate_evaluation($gdt){ + global $db,$user,$msg; + $sql = "select us.service,us.expiration,us.payeddate,us.isevaluation,apps.name from userservices us join apps on (us.id_app=apps.id) where us.id_app='".$gdt["id"]."' and us.id_user=".$user["id"].";"; + $eval = $db->dbquery($sql); + if ($eval){ + $msg = '
Vous avez déjà testé le service '.$eval["name"].'
'; + } else { + $sql = "select id,app,name,evaluationdays from apps where id=".$gdt["id"]; + + $eapp = $db->dbquery($sql); + if ($eapp["evaluationdays"] == null){ + $msg = '
Cette Application n\'a pas une periode d\'évaluation
'; + }else { + $evaldate = date('Y-m-d',strtotime("+".$eapp["evaluationdays"]." days")); + $evaldateshow = date('d.m.Y',strtotime("+".$eapp["evaluationdays"]." days")); + $sql = "INSERT INTO userservices (id_user,service,expiration,isevaluation,id_app) VALUES (".$user["id"].",".$eapp["app"].",date('".$evaldate."'),1,".$gdt["id"].")"; + $db->dbexec($sql); + $msg = '
Periode d\'évaluation a été activé jusqu\'au '.$evaldateshow.'
'; + } + + + } } + function enable_app($gdt){ + global $db,$user,$msg; + $sql = "select id,service,expiration,payeddate,isevaluation from userservices where id_app='".$gdt["id"]."' and id_user=".$user["id"].";"; + $eval = $db->dbquery($sql); + // $msg = $sql; + if ($eval){ + if ($gdt["enable"] == "0"){ $gdt["enable"] = 'null';} + $sql = "UPDATE userservices set enabled=".$gdt["enable"]." WHERE id=".$eval["id"].";"; + // $msg .= '
'.$sql; + $db->dbexec($sql); + } else { + $sql = "select id,evaluationdays,app from apps where id=".$gdt["id"].";"; + $eapp = $db->dbquery($sql); + if (($eapp) && ($eapp["evaluationdays"] == null)){ + + $sql = "INSERT INTO userservices (id_user,service,id_app,enabled) VALUES (".$user["id"].",'".$eapp["app"]."',".$gdt["id"].",".$gdt["enable"].")"; + // $msg .= '
'.$sql; + $db->dbexec($sql); + } + } + } ?> \ No newline at end of file diff --git a/tmpl/blocks/avocatsearch.php b/tmpl/blocks/avocatsearch.php index 1ef7927..f56bb8c 100644 --- a/tmpl/blocks/avocatsearch.php +++ b/tmpl/blocks/avocatsearch.php @@ -1,11 +1,18 @@ = CURRENT_DATE then 1 else null end as rendezvous_active,usr.* from users usr left join userservices srv on (usr.id=srv.id_user) where usr.usergroup in ('administrator','avocat') and usr.userblocked is null and usr.activationkey is null group by usr.id;"; + $sql = "SELECT case when srv.service = 'rendezvous' and srv.enabled='1' and srv.expiration >= CURRENT_DATE then 1 else null end as rendezvous_active,usr.* from users usr + join userservices annu on (usr.id=annu.id_user and annu.service='annuaire' and annu.enabled=1) + join userservices srv on (usr.id=srv.id_user) + where usr.usergroup in ('avocat') and usr.userblocked is null and usr.activationkey is null group by usr.id;"; $avocats = $db->dbqueryall($sql); + ?> + +
+

Annuaire des avocats au Luxembourg

+
+ -
-

Annuaire des avocats au Luxembourg

-
+
diff --git a/tmpl/pages/profile/applications.php b/tmpl/pages/profile/applications.php index b2a2d69..823cb2f 100644 --- a/tmpl/pages/profile/applications.php +++ b/tmpl/pages/profile/applications.php @@ -1,7 +1,7 @@ dbqueryall($sql); @@ -34,24 +34,24 @@ ''.$appdata["name"].''. ''.$appdata["description"].''. ''; - if (($appdata["prices"] == "0") || ($appdata["expiration"] >= today )){ - if ($userapps["enabled"] == 1){ - echo ''; + if (($appdata["prices"] == "0") || ($appdata["expiration"] >= $today )){ + if ($appdata["enabled"] == "1"){ + echo ''; } else if (($appdata["prices"] == "0") || ($userapps["enabled"] == 0)) { - echo ''; + echo ''; } } else if ($appdata["payeddate"] != null) { echo 'désactivé'; } echo ''. - ''.$appdata["expiration"].''. + ''.(($appdata["expiration"] != null)?date('d.m.Y',strtotime($appdata["expiration"])):'').''. ''; if ($appdata["prices"] == "0"){ echo 'activé'; } else if ($appdata["payeddate"] == null){ - echo 'Souscrire'; + echo ''; } else if ($appdata["expiration"] >= torenewstart) { - echo 'Prolonger'; + echo ''; } echo ''. ''; diff --git a/tmpl/pages/profile/package.php b/tmpl/pages/profile/package.php index 28855fd..37e3086 100644 --- a/tmpl/pages/profile/package.php +++ b/tmpl/pages/profile/package.php @@ -27,7 +27,7 @@
Evaluation
jours gratuit

- Activer + " class="btn btn-block btn-primary text-uppercase">Activer
diff --git a/tmpl/pages/profile/profile.php b/tmpl/pages/profile/profile.php index 5f9936a..edbedb7 100644 --- a/tmpl/pages/profile/profile.php +++ b/tmpl/pages/profile/profile.php @@ -32,10 +32,15 @@ // echo ' Factures'; // } + ?> = 0 ){ ?> + + if (strpos($user["service_valid"],'rendezvous') !== false ){ + //echo "srvvaid:".strpos($user["service_valid"],'rendezvous').""; + ?> + Mes Clients Mes Rendez-Vous @@ -132,8 +137,6 @@ - -  supprimer la photo @@ -143,12 +146,7 @@
-
-
- - /> -
-
+
diff --git a/tmpl/pages/rendezvous.php b/tmpl/pages/rendezvous.php index 93d0cd3..6d731f5 100644 --- a/tmpl/pages/rendezvous.php +++ b/tmpl/pages/rendezvous.php @@ -17,8 +17,8 @@ $avolist = $db->dbqueryall($sql);
- - '.$avosel['usersurname'].' '.$avosel['userprename'].' '.(($avosel['usercompany'] != '')?' ('.$avosel['usercompany'].')':'').''; -- 2.39.5