| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package Dolphin Core |
|---|
| 4 | * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ |
|---|
| 5 | * @license CC-BY - http://creativecommons.org/licenses/by/3.0/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | require_once('./inc/header.inc.php'); |
|---|
| 9 | require_once(BX_DIRECTORY_PATH_INC . "languages.inc.php"); |
|---|
| 10 | require_once(BX_DIRECTORY_PATH_INC . "params.inc.php"); |
|---|
| 11 | require_once(BX_DIRECTORY_PATH_INC . "design.inc.php"); |
|---|
| 12 | |
|---|
| 13 | // TODO: move HTML to templates and maybe other refactoring |
|---|
| 14 | |
|---|
| 15 | $oTemplate = BxDolTemplate::getInstance(); |
|---|
| 16 | |
|---|
| 17 | $sPageMainCode = PageMainCode(); |
|---|
| 18 | |
|---|
| 19 | if (!$sPageMainCode || !isset($_GET['explain'])) |
|---|
| 20 | $oTemplate->displayPageNotFound(); |
|---|
| 21 | |
|---|
| 22 | $sExplanation = _t("_".bx_process_pass($_GET['explain'])); |
|---|
| 23 | $sHeader = _t("_EXPLANATION_H") . ": " . $sExplanation; // TODO: remake this line using parameters in lang string |
|---|
| 24 | |
|---|
| 25 | $oTemplate->setPageNameIndex (BX_PAGE_POPUP); |
|---|
| 26 | $oTemplate->setPageHeader ($sHeader); |
|---|
| 27 | $oTemplate->setPageContent ('body_onload', 'javascript: void(0)'); |
|---|
| 28 | $oTemplate->setPageContent ('page_main_code', DesignBoxContent($sHeader, $sPageMainCode, BX_DB_PADDING_DEF)); |
|---|
| 29 | |
|---|
| 30 | PageCode(); |
|---|
| 31 | |
|---|
| 32 | // --------------- page components functions |
|---|
| 33 | |
|---|
| 34 | function membershipActionsList($membershipID) |
|---|
| 35 | { |
|---|
| 36 | $oDb = BxDolDb::getInstance(); |
|---|
| 37 | $sQuery = $oDb->prepare(" |
|---|
| 38 | SELECT IDAction, |
|---|
| 39 | Name, |
|---|
| 40 | AllowedCount, |
|---|
| 41 | AllowedPeriodLen, |
|---|
| 42 | AllowedPeriodStart, |
|---|
| 43 | AllowedPeriodEnd, |
|---|
| 44 | AdditionalParamName, |
|---|
| 45 | AdditionalParamValue |
|---|
| 46 | FROM `sys_acl_matrix` |
|---|
| 47 | INNER JOIN `sys_acl_actions` |
|---|
| 48 | ON `sys_acl_matrix`.IDAction = `sys_acl_actions`.ID |
|---|
| 49 | WHERE `sys_acl_matrix`.IDLevel = ? |
|---|
| 50 | ORDER BY `sys_acl_actions`.Name", $membershipID); |
|---|
| 51 | $aLevelActions = $oDb->getAll($sQuery); |
|---|
| 52 | |
|---|
| 53 | ob_start(); |
|---|
| 54 | ?> |
|---|
| 55 | <!-- [START] List Membership Actions --> |
|---|
| 56 | |
|---|
| 57 | <style type="text/css"> |
|---|
| 58 | table.allowedActionsTable{ |
|---|
| 59 | border-bottom:1px solid; |
|---|
| 60 | border-right:1px solid; |
|---|
| 61 | } |
|---|
| 62 | table.allowedActionsTable td{ |
|---|
| 63 | padding: 5px; |
|---|
| 64 | text-align: center; |
|---|
| 65 | border-top:1px solid; |
|---|
| 66 | border-left:1px solid; |
|---|
| 67 | } |
|---|
| 68 | </style> |
|---|
| 69 | <table cellpadding="0" cellspacing="0" border="0" style="font-size: 8pt" class="allowedActionsTable" align="center" width="100%"> |
|---|
| 70 | <tr> |
|---|
| 71 | <td colspan="5" align="center"><?= _t("_Allowed actions") ?></td> |
|---|
| 72 | </tr> |
|---|
| 73 | <tr> |
|---|
| 74 | <td><b><?= _t("_Action") ?></b></td> |
|---|
| 75 | <td><b><?= _t("_Times allowed") ?></b></td> |
|---|
| 76 | <td><b><?= _t("_Period (hours)") ?></b></td> |
|---|
| 77 | <td><b><?= _t("_Allowed Since") ?></b></td> |
|---|
| 78 | <td><b><?= _t("_Allowed Until") ?></b></td> |
|---|
| 79 | </tr> |
|---|
| 80 | <?php |
|---|
| 81 | if (!$aLevelActions) { |
|---|
| 82 | ?> |
|---|
| 83 | <tr> |
|---|
| 84 | <td colspan="5"><?= _t("_No actions allowed for this membership") ?></td> |
|---|
| 85 | </tr> |
|---|
| 86 | <?php |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | foreach ($aLevelActions as $membershipAction) { |
|---|
| 90 | ?> |
|---|
| 91 | <tr> |
|---|
| 92 | <td style="text-align: left;"><b><?= _t("_mma_".str_replace(' ', '_', $membershipAction['Name'])) ?></b></td> |
|---|
| 93 | <td><?= $membershipAction['AllowedCount'] ? $membershipAction['AllowedCount'] : _t("_no limit") ?></td> |
|---|
| 94 | <td><?= $membershipAction['AllowedPeriodLen'] ? $membershipAction['AllowedPeriodLen'] : _t("_no limit") ?></td> |
|---|
| 95 | <td><?= $membershipAction['AllowedPeriodStart'] ? $membershipAction['AllowedPeriodStart'] : _t("_no limit") ?></td> |
|---|
| 96 | <td><?= $membershipAction['AllowedPeriodEnd'] ? $membershipAction['AllowedPeriodEnd'] : _t("_no limit") ?></td> |
|---|
| 97 | </tr> |
|---|
| 98 | <?php |
|---|
| 99 | } |
|---|
| 100 | ?> |
|---|
| 101 | </table> |
|---|
| 102 | |
|---|
| 103 | <?php |
|---|
| 104 | return ob_get_clean(); |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | /** |
|---|
| 108 | * Prints HTML Code for explanation |
|---|
| 109 | */ |
|---|
| 110 | function PageMainCode() { |
|---|
| 111 | $iType = bx_process_input(bx_get('type'), BX_DATA_INT); |
|---|
| 112 | $sExplain = bx_process_input(bx_get('explain')); |
|---|
| 113 | switch ($sExplain) |
|---|
| 114 | { |
|---|
| 115 | case 'Unconfirmed': return _t("_ATT_UNCONFIRMED_E"); |
|---|
| 116 | case 'Approval': return _t("_ATT_APPROVAL_E"); |
|---|
| 117 | case 'Active': return _t("_ATT_ACTIVE_E"); |
|---|
| 118 | case 'Rejected': return _t("_ATT_REJECTED_E"); |
|---|
| 119 | case 'Suspended': return _t("_ATT_SUSPENDED_E", getParam('site_title')); |
|---|
| 120 | case 'membership': return membershipActionsList($iType); |
|---|
| 121 | default: return false; |
|---|
| 122 | } |
|---|
| 123 | } |
|---|