Merge pull request #21943 from mattwire/gccacheignore
[civicrm-core.git] / CRM / Financial / Page / FinancialBatch.php
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 financial types
20 */
21 class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic {
22
23 /**
24 * The action links that we need to display for the browse screen.
25 *
26 * @var array
27 */
28 public static $_links = NULL;
29
30 /**
31 * Get BAO Name.
32 *
33 * @return string
34 * classname of BAO.
35 */
36 public function getBAOName() {
37 return 'CRM_Batch_BAO_Batch';
38 }
39
40 /**
41 * Get action Links.
42 *
43 * @return array
44 * (reference) of action links
45 */
46 public function &links() {
47 if (!(self::$_links)) {
48 self::$_links = [];
49 }
50 return self::$_links;
51 }
52
53 /**
54 * Run the page.
55 *
56 * This method is called after the page is created. It checks for the
57 * type of action and executes that action.
58 * Finally it calls the parent's run method.
59 */
60 public function run() {
61 $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
62 $this->set("context", $context);
63
64 $id = $this->getIdAndAction();
65
66 // what action to take ?
67 if ($this->_action & (CRM_Core_Action::UPDATE |
68 CRM_Core_Action::ADD |
69 CRM_Core_Action::CLOSE |
70 CRM_Core_Action::REOPEN |
71 CRM_Core_Action::EXPORT)
72 ) {
73 $this->edit($this->_action, $id);
74 }
75 // parent run
76 return CRM_Core_Page::run();
77 }
78
79 /**
80 * Get name of edit form.
81 *
82 * @return string
83 * classname of edit form.
84 */
85 public function editForm() {
86 return 'CRM_Financial_Form_FinancialBatch';
87 }
88
89 /**
90 * Get edit form name.
91 *
92 * @return string
93 * name of this page.
94 */
95 public function editName() {
96 return 'Accounting Batch';
97 }
98
99 /**
100 * Get user context.
101 *
102 * Redirect to civicrm home page when clicked on cancel button
103 *
104 * @param null $mode
105 *
106 * @return string
107 * user context.
108 */
109 public function userContext($mode = NULL) {
110 $context = $this->get("context");
111 if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) {
112 return "civicrm/financial/financialbatches";
113 }
114 return 'civicrm';
115 }
116
117 /**
118 * @param null $mode
119 *
120 * @return string
121 */
122 public function userContextParams($mode = NULL) {
123 $context = $this->get("context");
124 if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) {
125 return "reset=1&batchStatus={$context}";
126 }
127 }
128
129 }