@@ -599,10 +599,8 @@ public static function saveUserTermsAcceptance(int $userId, string $legalAcceptT
599
599
600
600
/**
601
601
* Displays the Terms and Conditions page.
602
- *
603
- * @param string $returnUrl The URL to redirect back to after acceptance
604
602
*/
605
- public static function displayLegalTermsPage (string $ returnUrl = '/home ' ): void
603
+ public static function displayLegalTermsPage (string $ returnUrl = '/home ' , bool $ canAccept = true , string $ infoMessage = '' ): void
606
604
{
607
605
$ iso = api_get_language_isocode ();
608
606
$ langId = api_get_language_id ($ iso );
@@ -612,56 +610,63 @@ public static function displayLegalTermsPage(string $returnUrl = '/home'): void
612
610
// No T&C for current language → show a message
613
611
Display::display_header (get_lang ('Terms and Conditions ' ));
614
612
echo '<div class="max-w-3xl mx-auto text-gray-90 text-lg text-center"> '
615
- .get_lang ('No terms and conditions available for this language. ' )
616
- .'</div> ' ;
613
+ . get_lang ('No terms and conditions available for this language. ' )
614
+ . '</div> ' ;
617
615
Display::display_footer ();
618
-
619
616
exit ;
620
617
}
621
618
622
619
Display::display_header (get_lang ('Terms and Conditions ' ));
623
620
624
621
if (!empty ($ term ['content ' ])) {
625
622
echo '<div class="max-w-3xl mx-auto bg-white shadow p-8 rounded"> ' ;
626
- echo '<h1 class="text-2xl font-bold text-primary mb-6"> ' .get_lang ('Terms and Conditions ' ).'</h1> ' ;
627
- echo '<div class="prose prose-sm max-w-none mb-6"> ' .$ term ['content ' ].'</div> ' ;
623
+ echo '<h1 class="text-2xl font-bold text-primary mb-6"> ' . get_lang ('Terms and Conditions ' ) . '</h1> ' ;
624
+
625
+ if (!empty ($ infoMessage )) {
626
+ echo '<div class="mb-4"> ' .$ infoMessage .'</div> ' ;
627
+ }
628
+
629
+ echo '<div class="prose prose-sm max-w-none mb-6"> ' . $ term ['content ' ] . '</div> ' ;
628
630
629
631
$ extra = new ExtraFieldValue ('terms_and_condition ' );
630
632
foreach ($ extra ->getAllValuesByItem ($ term ['id ' ]) as $ field ) {
631
633
if (!empty ($ field ['field_value ' ])) {
632
634
echo '<div class="mb-4"> ' ;
633
- echo '<h3 class="text-lg font-semibold text-primary"> ' . $ field ['display_text ' ]. '</h3> ' ;
634
- echo '<p class="text-gray-90 mt-1"> ' . $ field ['field_value ' ]. '</p> ' ;
635
+ echo '<h3 class="text-lg font-semibold text-primary"> ' . $ field ['display_text ' ] . '</h3> ' ;
636
+ echo '<p class="text-gray-90 mt-1"> ' . $ field ['field_value ' ] . '</p> ' ;
635
637
echo '</div> ' ;
636
638
}
637
639
}
638
640
639
- $ hide = 'true ' === api_get_setting ('registration.hide_legal_accept_checkbox ' );
640
-
641
- echo '<form method="post" action="tc.php?return= ' .urlencode ($ returnUrl ).'" class="space-y-6"> ' ;
642
- echo '<input type="hidden" name="legal_accept_type" value=" ' .$ term ['version ' ].': ' .$ term ['language_id ' ].'"> ' ;
643
- echo '<input type="hidden" name="return" value=" ' .htmlspecialchars ($ returnUrl ).'"> ' ;
641
+ echo '<form method="post" action="tc.php?return= ' . urlencode ($ returnUrl ) . '" class="space-y-6"> ' ;
642
+ echo '<input type="hidden" name="legal_accept_type" value=" ' . $ term ['version ' ] . ': ' . $ term ['language_id ' ] . '"> ' ;
643
+ echo '<input type="hidden" name="return" value=" ' . htmlspecialchars ($ returnUrl ) . '"> ' ;
644
+
645
+ if ($ canAccept ) {
646
+ $ hide = 'true ' === api_get_setting ('registration.hide_legal_accept_checkbox ' );
647
+ if ($ hide ) {
648
+ echo '<input type="hidden" name="legal_accept" value="1"> ' ;
649
+ } else {
650
+ echo '<label class="flex items-start space-x-2"> ' ;
651
+ echo '<input type="checkbox" name="legal_accept" value="1" required class="rounded border-gray-300 text-primary focus:ring-primary"> ' ;
652
+ echo '<span class="text-gray-90 text-sm"> ' . get_lang ('I have read and agree to the ' ) . ' ' ;
653
+ echo '<a href="tc.php?preview=1" target="_blank" class="text-primary hover:underline"> ' . get_lang ('Terms and Conditions ' ) . '</a> ' ;
654
+ echo '</span> ' ;
655
+ echo '</label> ' ;
656
+ }
644
657
645
- if ($ hide ) {
646
- echo '<input type="hidden" name="legal_accept" value="1"> ' ;
658
+ echo '<div><button type="submit" class="inline-block bg-primary text-white font-semibold px-6 py-3 rounded hover:opacity-90 transition"> ' . get_lang ('Accept Terms and Conditions ' ) . '</button></div> ' ;
647
659
} else {
648
- echo '<label class="flex items-start space-x-2"> ' ;
649
- echo '<input type="checkbox" name="legal_accept" value="1" required class="rounded border-gray-300 text-primary focus:ring-primary"> ' ;
650
- echo '<span class="text-gray-90 text-sm"> ' .get_lang ('I have read and agree to the ' ).' ' ;
651
- echo '<a href="tc.php?preview=1" target="_blank" class="text-primary hover:underline"> ' .get_lang ('Terms and Conditions ' ).'</a> ' ;
652
- echo '</span> ' ;
653
- echo '</label> ' ;
660
+ echo '<div><button type="button" class="inline-block bg-gray-400 text-white font-semibold px-6 py-3 rounded cursor-not-allowed" disabled> ' . get_lang ('Accept Terms and Conditions ' ) . '</button></div> ' ;
654
661
}
655
662
656
- echo '<div><button type="submit" class="inline-block bg-primary text-white font-semibold px-6 py-3 rounded hover:opacity-90 transition"> ' .get_lang ('Accept Terms and Conditions ' ).'</button></div> ' ;
657
663
echo '</form> ' ;
658
664
echo '</div> ' ;
659
665
} else {
660
- echo '<div class="text-center text-gray-90 text-lg"> ' . get_lang ('Coming soon... ' ). '</div> ' ;
666
+ echo '<div class="text-center text-gray-90 text-lg"> ' . get_lang ('Coming soon... ' ) . '</div> ' ;
661
667
}
662
668
663
669
Display::display_footer ();
664
-
665
670
exit ;
666
671
}
667
672
}
0 commit comments