Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * Page for displaying Parent Information Section tabs | |
38 | */ | |
39 | class CRM_Admin_Page_Persistent extends CRM_Core_Page { | |
40 | ||
41 | /** | |
42 | * The action links that we need to display for the browse screen | |
43 | * | |
44 | * @var array | |
6a488035 TO |
45 | */ |
46 | private static $_stringActionLinks; | |
47 | private static $_customizeActionLinks; | |
48 | ||
49 | /** | |
50 | * Get action Links | |
51 | * | |
a6c01b45 CW |
52 | * @return array |
53 | * (reference) of action links | |
95ea96be EM |
54 | */ |
55 | function &stringActionLinks() { | |
6a488035 TO |
56 | // check if variable _actionsLinks is populated |
57 | if (!isset(self::$_stringActionLinks)) { | |
58 | ||
59 | self::$_stringActionLinks = array( | |
60 | CRM_Core_Action::UPDATE => array( | |
61 | 'name' => ts('Edit'), | |
62 | 'url' => 'civicrm/admin/tplstrings/add', | |
63 | 'qs' => 'reset=1&action=update&id=%%id%%', | |
64 | 'title' => ts('Configure'), | |
65 | ), | |
66 | ); | |
67 | } | |
68 | return self::$_stringActionLinks; | |
69 | } | |
70 | ||
e0ef6999 EM |
71 | /** |
72 | * @return array | |
73 | */ | |
00be9182 | 74 | public function &customizeActionLinks() { |
6a488035 TO |
75 | // check if variable _actionsLinks is populated |
76 | if (!isset(self::$_customizeActionLinks)) { | |
77 | ||
78 | self::$_customizeActionLinks = array( | |
79 | CRM_Core_Action::UPDATE => array( | |
80 | 'name' => ts('Edit'), | |
81 | 'url' => 'civicrm/admin/tplstrings/add', | |
82 | 'qs' => 'reset=1&action=update&id=%%id%%&config=1', | |
83 | 'title' => ts('Configure'), | |
84 | ), | |
85 | ); | |
86 | } | |
87 | return self::$_customizeActionLinks; | |
88 | } | |
89 | ||
90 | /** | |
91 | * Run the basic page (run essentially starts execution for that page). | |
92 | * | |
93 | * @return void | |
94 | */ | |
00be9182 | 95 | public function run() { |
6a488035 TO |
96 | CRM_Utils_System::setTitle(ts('DB Template Strings')); |
97 | $this->browse(); | |
98 | return parent::run(); | |
99 | } | |
100 | ||
101 | /** | |
102 | * Browse all options | |
103 | * | |
104 | * | |
105 | * @return void | |
6a488035 | 106 | */ |
00be9182 | 107 | public function browse() { |
6a488035 TO |
108 | $permission = FALSE; |
109 | $this->assign('editClass', FALSE); | |
110 | if (CRM_Core_Permission::check('access CiviCRM')) { | |
111 | $this->assign('editClass', TRUE); | |
112 | $permission = TRUE; | |
113 | } | |
114 | ||
115 | $daoResult = new CRM_Core_DAO_Persistent(); | |
116 | $daoResult->find(); | |
117 | $schoolValues = array(); | |
118 | while ($daoResult->fetch()) { | |
119 | $values[$daoResult->id] = array(); | |
120 | CRM_Core_DAO::storeValues($daoResult, $values[$daoResult->id]); | |
121 | if ($daoResult->is_config == 1) { | |
122 | $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::customizeActionLinks(), | |
123 | NULL, | |
87dab4a4 AH |
124 | array('id' => $daoResult->id), |
125 | ts('more'), | |
126 | FALSE, | |
127 | 'persistent.config.actions', | |
128 | 'Persistent', | |
129 | $daoResult->id | |
6a488035 TO |
130 | ); |
131 | $values[$daoResult->id]['data'] = implode(',', unserialize($daoResult->data)); | |
132 | $configCustomization[$daoResult->id] = $values[$daoResult->id]; | |
133 | } | |
134 | if ($daoResult->is_config == 0) { | |
135 | $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::stringActionLinks(), | |
136 | NULL, | |
87dab4a4 AH |
137 | array('id' => $daoResult->id), |
138 | ts('more'), | |
139 | FALSE, | |
140 | 'persistent.row.actions', | |
141 | 'Persistent', | |
142 | $daoResult->id | |
6a488035 TO |
143 | ); |
144 | $configStrings[$daoResult->id] = $values[$daoResult->id]; | |
145 | } | |
146 | } | |
147 | $rows = array( | |
148 | 'configTemplates' => $configStrings, | |
149 | 'customizeTemplates' => $configCustomization, | |
150 | ); | |
151 | $this->assign('rows', $rows); | |
152 | } | |
153 | } |