Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright (C) 2011 Marty Wright | | |
7 | | Licensed to CiviCRM under the Academic Free License version 3.0. | | |
8 | +--------------------------------------------------------------------+ | |
9 | | This file is a part of CiviCRM. | | |
10 | | | | |
11 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
12 | | under the terms of the GNU Affero General Public License | | |
13 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
14 | | | | |
15 | | CiviCRM is distributed in the hope that it will be useful, but | | |
16 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
17 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
18 | | See the GNU Affero General Public License for more details. | | |
19 | | | | |
20 | | You should have received a copy of the GNU Affero General Public | | |
21 | | License and the CiviCRM Licensing Exception along | | |
22 | | with this program; if not, contact CiviCRM LLC | | |
23 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
24 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
25 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
26 | +--------------------------------------------------------------------+ | |
d25dd0ee | 27 | */ |
6a488035 TO |
28 | |
29 | /** | |
30 | * | |
31 | * @package CRM | |
8c9251b3 | 32 | * @copyright CiviCRM LLC (c) 2004-2018 |
6a488035 TO |
33 | */ |
34 | ||
35 | /** | |
ce064e4f | 36 | * Page for displaying list of PDF Page Formats. |
6a488035 TO |
37 | */ |
38 | class CRM_Admin_Page_PdfFormats extends CRM_Core_Page_Basic { | |
39 | ||
96f50de2 CW |
40 | public $useLivePageJS = TRUE; |
41 | ||
6a488035 | 42 | /** |
eceb18cc | 43 | * The action links that we need to display for the browse screen. |
6a488035 TO |
44 | * |
45 | * @var array | |
6a488035 TO |
46 | */ |
47 | static $_links = NULL; | |
48 | ||
49 | /** | |
eceb18cc | 50 | * Get BAO Name. |
6a488035 | 51 | * |
a6c01b45 CW |
52 | * @return string |
53 | * Classname of BAO. | |
6a488035 | 54 | */ |
00be9182 | 55 | public function getBAOName() { |
6a488035 TO |
56 | return 'CRM_Core_BAO_PdfFormat'; |
57 | } | |
58 | ||
59 | /** | |
eceb18cc | 60 | * Get action Links. |
6a488035 | 61 | * |
a6c01b45 CW |
62 | * @return array |
63 | * (reference) of action links | |
6a488035 | 64 | */ |
00be9182 | 65 | public function &links() { |
6a488035 TO |
66 | if (!(self::$_links)) { |
67 | // helper variable for nicer formatting | |
68 | self::$_links = array( | |
69 | CRM_Core_Action::UPDATE => array( | |
70 | 'name' => ts('Edit'), | |
71 | 'url' => 'civicrm/admin/pdfFormats', | |
72 | 'qs' => 'action=update&id=%%id%%&reset=1', | |
73 | 'title' => ts('Edit PDF Page Format'), | |
74 | ), | |
75 | CRM_Core_Action::DELETE => array( | |
76 | 'name' => ts('Delete'), | |
77 | 'url' => 'civicrm/admin/pdfFormats', | |
78 | 'qs' => 'action=delete&id=%%id%%', | |
79 | 'title' => ts('Delete PDF Page Format'), | |
80 | ), | |
81 | ); | |
82 | } | |
83 | ||
84 | return self::$_links; | |
85 | } | |
86 | ||
87 | /** | |
eceb18cc | 88 | * Get name of edit form. |
6a488035 | 89 | * |
a6c01b45 CW |
90 | * @return string |
91 | * Classname of edit form. | |
6a488035 | 92 | */ |
00be9182 | 93 | public function editForm() { |
6a488035 TO |
94 | return 'CRM_Admin_Form_PdfFormats'; |
95 | } | |
96 | ||
97 | /** | |
eceb18cc | 98 | * Get edit form name. |
6a488035 | 99 | * |
a6c01b45 CW |
100 | * @return string |
101 | * name of this page. | |
6a488035 | 102 | */ |
00be9182 | 103 | public function editName() { |
6a488035 TO |
104 | return 'PDF Page Formats'; |
105 | } | |
106 | ||
107 | /** | |
108 | * Get user context. | |
109 | * | |
dd244018 EM |
110 | * @param null $mode |
111 | * | |
a6c01b45 CW |
112 | * @return string |
113 | * user context. | |
6a488035 | 114 | */ |
00be9182 | 115 | public function userContext($mode = NULL) { |
6a488035 TO |
116 | return 'civicrm/admin/pdfFormats'; |
117 | } | |
118 | ||
119 | /** | |
eceb18cc | 120 | * Browse all PDF Page Formats. |
6a488035 | 121 | * |
dd244018 | 122 | * @param null $action |
6a488035 | 123 | */ |
00be9182 | 124 | public function browse($action = NULL) { |
6a488035 TO |
125 | // Get list of configured PDF Page Formats |
126 | $pdfFormatList = CRM_Core_BAO_PdfFormat::getList(); | |
127 | ||
128 | // Add action links to each of the PDF Page Formats | |
129 | $action = array_sum(array_keys($this->links())); | |
130 | foreach ($pdfFormatList as & $format) { | |
87dab4a4 AH |
131 | $format['action'] = CRM_Core_Action::formLink( |
132 | self::links(), | |
133 | $action, | |
134 | array('id' => $format['id']), | |
135 | ts('more'), | |
136 | FALSE, | |
137 | 'pdfFormat.manage.action', | |
138 | 'PdfFormat', | |
139 | $format['id'] | |
140 | ); | |
6a488035 TO |
141 | } |
142 | ||
143 | // Order Label Formats by weight | |
144 | $returnURL = CRM_Utils_System::url(self::userContext()); | |
145 | CRM_Core_BAO_PdfFormat::addOrder($pdfFormatList, $returnURL); | |
146 | ||
147 | $this->assign('rows', $pdfFormatList); | |
148 | } | |
96025800 | 149 | |
6a488035 | 150 | } |