Merge pull request #12520 from civicrm/5.4
[civicrm-core.git] / CRM / Admin / Page / Persistent.php
CommitLineData
6a488035
TO
1<?php
2/*
3+--------------------------------------------------------------------+
fee14197 4| CiviCRM version 5 |
6a488035 5+--------------------------------------------------------------------+
8c9251b3 6| Copyright CiviCRM LLC (c) 2004-2018 |
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+--------------------------------------------------------------------+
e70a7fc0 26 */
6a488035
TO
27
28/**
29 *
30 * @package CRM
8c9251b3 31 * @copyright CiviCRM LLC (c) 2004-2018
6a488035
TO
32 */
33
34/**
35 * Page for displaying Parent Information Section tabs
36 */
37class CRM_Admin_Page_Persistent extends CRM_Core_Page {
38
39 /**
eceb18cc 40 * The action links that we need to display for the browse screen.
6a488035
TO
41 *
42 * @var array
6a488035
TO
43 */
44 private static $_stringActionLinks;
45 private static $_customizeActionLinks;
46
47 /**
eceb18cc 48 * Get action Links.
6a488035 49 *
a6c01b45
CW
50 * @return array
51 * (reference) of action links
95ea96be 52 */
2da40d21 53 public function &stringActionLinks() {
6a488035
TO
54 // check if variable _actionsLinks is populated
55 if (!isset(self::$_stringActionLinks)) {
56
57 self::$_stringActionLinks = array(
58 CRM_Core_Action::UPDATE => array(
59 'name' => ts('Edit'),
60 'url' => 'civicrm/admin/tplstrings/add',
61 'qs' => 'reset=1&action=update&id=%%id%%',
62 'title' => ts('Configure'),
63 ),
64 );
65 }
66 return self::$_stringActionLinks;
67 }
68
e0ef6999
EM
69 /**
70 * @return array
71 */
00be9182 72 public function &customizeActionLinks() {
6a488035
TO
73 // check if variable _actionsLinks is populated
74 if (!isset(self::$_customizeActionLinks)) {
75
76 self::$_customizeActionLinks = array(
77 CRM_Core_Action::UPDATE => array(
78 'name' => ts('Edit'),
79 'url' => 'civicrm/admin/tplstrings/add',
80 'qs' => 'reset=1&action=update&id=%%id%%&config=1',
81 'title' => ts('Configure'),
82 ),
83 );
84 }
85 return self::$_customizeActionLinks;
86 }
87
88 /**
89 * Run the basic page (run essentially starts execution for that page).
6a488035 90 */
00be9182 91 public function run() {
6a488035
TO
92 CRM_Utils_System::setTitle(ts('DB Template Strings'));
93 $this->browse();
94 return parent::run();
95 }
96
97 /**
eceb18cc 98 * Browse all options.
6a488035 99 */
00be9182 100 public function browse() {
6a488035
TO
101 $permission = FALSE;
102 $this->assign('editClass', FALSE);
103 if (CRM_Core_Permission::check('access CiviCRM')) {
104 $this->assign('editClass', TRUE);
105 $permission = TRUE;
106 }
107
108 $daoResult = new CRM_Core_DAO_Persistent();
109 $daoResult->find();
110 $schoolValues = array();
111 while ($daoResult->fetch()) {
112 $values[$daoResult->id] = array();
113 CRM_Core_DAO::storeValues($daoResult, $values[$daoResult->id]);
114 if ($daoResult->is_config == 1) {
115 $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::customizeActionLinks(),
116 NULL,
87dab4a4
AH
117 array('id' => $daoResult->id),
118 ts('more'),
119 FALSE,
120 'persistent.config.actions',
121 'Persistent',
122 $daoResult->id
6a488035
TO
123 );
124 $values[$daoResult->id]['data'] = implode(',', unserialize($daoResult->data));
125 $configCustomization[$daoResult->id] = $values[$daoResult->id];
126 }
127 if ($daoResult->is_config == 0) {
128 $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::stringActionLinks(),
129 NULL,
87dab4a4
AH
130 array('id' => $daoResult->id),
131 ts('more'),
132 FALSE,
133 'persistent.row.actions',
134 'Persistent',
135 $daoResult->id
6a488035
TO
136 );
137 $configStrings[$daoResult->id] = $values[$daoResult->id];
138 }
139 }
140 $rows = array(
141 'configTemplates' => $configStrings,
142 'customizeTemplates' => $configCustomization,
143 );
144 $this->assign('rows', $rows);
145 }
96025800 146
6a488035 147}