| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * @package CRM |
| 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * Page for displaying list of categories. |
| 20 | */ |
| 21 | class CRM_Admin_Page_Mapping extends CRM_Core_Page_Basic { |
| 22 | |
| 23 | public $useLivePageJS = TRUE; |
| 24 | |
| 25 | /** |
| 26 | * The action links that we need to display for the browse screen. |
| 27 | * |
| 28 | * @var array |
| 29 | */ |
| 30 | public static $_links = NULL; |
| 31 | |
| 32 | /** |
| 33 | * Get BAO. |
| 34 | * |
| 35 | * @return string |
| 36 | * Classname of BAO. |
| 37 | */ |
| 38 | public function getBAOName() { |
| 39 | return 'CRM_Core_BAO_Mapping'; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get action Links. |
| 44 | * |
| 45 | * @return array |
| 46 | * (reference) of action links |
| 47 | */ |
| 48 | public function &links() { |
| 49 | if (!(self::$_links)) { |
| 50 | // helper variable for nicer formatting |
| 51 | $deleteExtra = ts('Are you sure you want to delete this mapping?') . ' ' . ts('This operation cannot be undone.'); |
| 52 | self::$_links = [ |
| 53 | CRM_Core_Action::UPDATE => [ |
| 54 | 'name' => ts('Edit'), |
| 55 | 'url' => 'civicrm/admin/mapping', |
| 56 | 'qs' => 'action=update&id=%%id%%&reset=1', |
| 57 | 'title' => ts('Edit Mapping'), |
| 58 | ], |
| 59 | CRM_Core_Action::DELETE => [ |
| 60 | 'name' => ts('Delete'), |
| 61 | 'url' => 'civicrm/admin/mapping', |
| 62 | 'qs' => 'action=delete&id=%%id%%', |
| 63 | 'title' => ts('Delete Mapping'), |
| 64 | ], |
| 65 | ]; |
| 66 | } |
| 67 | return self::$_links; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Get name of edit form. |
| 72 | * |
| 73 | * @return string |
| 74 | * Classname of edit form. |
| 75 | */ |
| 76 | public function editForm() { |
| 77 | return 'CRM_Admin_Form_Mapping'; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Get form name for edit form. |
| 82 | * |
| 83 | * @return string |
| 84 | * name of this page. |
| 85 | */ |
| 86 | public function editName() { |
| 87 | return 'Mapping'; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Get form name for delete form. |
| 92 | * |
| 93 | * @return string |
| 94 | * name of this page. |
| 95 | */ |
| 96 | public function deleteName() { |
| 97 | return 'Mapping'; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Get user context. |
| 102 | * |
| 103 | * @param null $mode |
| 104 | * |
| 105 | * @return string |
| 106 | * user context. |
| 107 | */ |
| 108 | public function userContext($mode = NULL) { |
| 109 | return 'civicrm/admin/mapping'; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Get name of delete form. |
| 114 | * |
| 115 | * @return string |
| 116 | * Classname of delete form. |
| 117 | */ |
| 118 | public function deleteForm() { |
| 119 | return 'CRM_Admin_Form_Mapping'; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Run the basic page. |
| 124 | */ |
| 125 | public function run() { |
| 126 | $sort = 'mapping_type asc'; |
| 127 | return parent::run($sort); |
| 128 | } |
| 129 | |
| 130 | } |