BxBaseAcl.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. bx_import('BxDolAcl');
  10. /**
  11. * Acl representation.
  12. * @see BxDolAcl
  13. */
  14. class BxBaseAcl extends BxDolAcl {
  15. public function __construct () {
  16. parent::__construct ();
  17. }
  18. /**
  19. * Print code for membership status
  20. * $iProfileId - ID of profile
  21. * $offer_upgrade - will this code be printed at [c]ontrol [p]anel
  22. */
  23. function GetMembershipStatus($iProfileId, $bOfferUpgrade = true) {
  24. $aMembershipInfo = $this->getMemberMembershipInfo($iProfileId);
  25. $sViewMembershipActions = "<br />(<a onclick=\"javascript:window.open('explanation.php?explain=membership&amp;type=".$aMembershipInfo['ID']."', '', 'width=660, height=500, menubar=no, status=no, resizable=no, scrollbars=yes, toolbar=no, location=no');\" href=\"javascript:void(0);\">"._t("_VIEW_MEMBERSHIP_ACTIONS")."</a>)<br />";
  26. // Show colored membership name
  27. $ret = '';
  28. if ( $aMembershipInfo['ID'] == MEMBERSHIP_ID_STANDARD || $aMembershipInfo['ID'] == MEMBERSHIP_ID_AUTHENTICATED) {
  29. $ret .= _t( "_MEMBERSHIP_STANDARD" ). $sViewMembershipActions;
  30. if ( $bOfferUpgrade )
  31. $ret .= " ". _t( "_MEMBERSHIP_UPGRADE_FROM_STANDARD" );
  32. } else {
  33. $ret .= "<font color=\"red\">{$aMembershipInfo['Name']}</font>$sViewMembershipActions";
  34. $days_left = (int)( ($aMembershipInfo['DateExpires'] - time()) / (24 * 3600) );
  35. if(!is_null($aMembershipInfo['DateExpires'])) {
  36. $ret .= ( $days_left > 0 ) ? _t( "_MEMBERSHIP_EXPIRES_IN_DAYS", $days_left ) : _t( "_MEMBERSHIP_EXPIRES_TODAY", date( "H:i", $aMembershipInfo['DateExpires'] ), date( "H:i" ) );
  37. } else {
  38. $ret.= _t("_MEMBERSHIP_EXPIRES_NEVER");
  39. }
  40. }
  41. return $ret;
  42. }
  43. }
  44. /** @} */