Merge pull request #4764 from rohankatkar/CRM-15615
[civicrm-core.git] / CRM / Admin / Page / Persistent.php
CommitLineData
6a488035
TO
1<?php
2/*
3+--------------------------------------------------------------------+
06b69b18 4| CiviCRM version 4.5 |
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 */
39class 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
45 * @static
46 */
47 private static $_stringActionLinks;
48 private static $_customizeActionLinks;
49
50 /**
51 * Get action Links
52 *
53 * @return array (reference) of action links
54 */ function &stringActionLinks() {
55 // check if variable _actionsLinks is populated
56 if (!isset(self::$_stringActionLinks)) {
57
58 self::$_stringActionLinks = array(
59 CRM_Core_Action::UPDATE => array(
60 'name' => ts('Edit'),
61 'url' => 'civicrm/admin/tplstrings/add',
62 'qs' => 'reset=1&action=update&id=%%id%%',
63 'title' => ts('Configure'),
64 ),
65 );
66 }
67 return self::$_stringActionLinks;
68 }
69
e0ef6999
EM
70 /**
71 * @return array
72 */
6a488035
TO
73 function &customizeActionLinks() {
74 // check if variable _actionsLinks is populated
75 if (!isset(self::$_customizeActionLinks)) {
76
77 self::$_customizeActionLinks = array(
78 CRM_Core_Action::UPDATE => array(
79 'name' => ts('Edit'),
80 'url' => 'civicrm/admin/tplstrings/add',
81 'qs' => 'reset=1&action=update&id=%%id%%&config=1',
82 'title' => ts('Configure'),
83 ),
84 );
85 }
86 return self::$_customizeActionLinks;
87 }
88
89 /**
90 * Run the basic page (run essentially starts execution for that page).
91 *
92 * @return void
93 */
94 function run() {
95 CRM_Utils_System::setTitle(ts('DB Template Strings'));
96 $this->browse();
97 return parent::run();
98 }
99
100 /**
101 * Browse all options
102 *
103 *
104 * @return void
105 * @access public
106 * @static
107 */
108 function browse() {
109 $permission = FALSE;
110 $this->assign('editClass', FALSE);
111 if (CRM_Core_Permission::check('access CiviCRM')) {
112 $this->assign('editClass', TRUE);
113 $permission = TRUE;
114 }
115
116 $daoResult = new CRM_Core_DAO_Persistent();
117 $daoResult->find();
118 $schoolValues = array();
119 while ($daoResult->fetch()) {
120 $values[$daoResult->id] = array();
121 CRM_Core_DAO::storeValues($daoResult, $values[$daoResult->id]);
122 if ($daoResult->is_config == 1) {
123 $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::customizeActionLinks(),
124 NULL,
87dab4a4
AH
125 array('id' => $daoResult->id),
126 ts('more'),
127 FALSE,
128 'persistent.config.actions',
129 'Persistent',
130 $daoResult->id
6a488035
TO
131 );
132 $values[$daoResult->id]['data'] = implode(',', unserialize($daoResult->data));
133 $configCustomization[$daoResult->id] = $values[$daoResult->id];
134 }
135 if ($daoResult->is_config == 0) {
136 $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::stringActionLinks(),
137 NULL,
87dab4a4
AH
138 array('id' => $daoResult->id),
139 ts('more'),
140 FALSE,
141 'persistent.row.actions',
142 'Persistent',
143 $daoResult->id
6a488035
TO
144 );
145 $configStrings[$daoResult->id] = $values[$daoResult->id];
146 }
147 }
148 $rows = array(
149 'configTemplates' => $configStrings,
150 'customizeTemplates' => $configCustomization,
151 );
152 $this->assign('rows', $rows);
153 }
154}
155