3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
37 * Page for displaying list of Gender
39 class CRM_Report_Page_Options
extends CRM_Core_Page_Basic
{
41 public $useLivePageJS = TRUE;
44 * The action links that we need to display for the browse screen
48 static $_links = NULL;
51 * The option group name
55 static $_gName = NULL;
58 * The option group name in display format (capitalized, without underscores...etc)
62 static $_GName = NULL;
72 * Obtains the group name from url and sets the title.
76 public function preProcess() {
77 $this->_action
= CRM_Utils_Request
::retrieve('action', 'String', $this, FALSE);
78 $this->_id
= CRM_Utils_Request
::retrieve('id', 'String', $this, FALSE);
80 self
::$_gName = "report_template";
83 self
::$_gId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', self
::$_gName, 'id', 'name');
86 CRM_Core_Error
::fatal();
89 self
::$_GName = ucwords(str_replace('_', ' ', self
::$_gName));
91 $this->assign('GName', self
::$_GName);
92 $newReportURL = CRM_Utils_System
::url("civicrm/admin/report/register",
95 $this->assign('newReport', $newReportURL);
96 CRM_Utils_System
::setTitle(ts('Registered Templates'));
105 public function getBAOName() {
106 return 'CRM_Core_BAO_OptionValue';
113 * (reference) of action links
115 public function &links() {
116 if (!(self
::$_links)) {
117 self
::$_links = array(
118 CRM_Core_Action
::UPDATE
=> array(
119 'name' => ts('Edit'),
120 'url' => 'civicrm/admin/report/register/' . self
::$_gName,
121 'qs' => 'action=update&id=%%id%%&reset=1',
122 'title' => ts('Edit %1', array(1 => self
::$_gName)),
124 CRM_Core_Action
::DISABLE
=> array(
125 'name' => ts('Disable'),
126 'ref' => 'crm-enable-disable',
127 'title' => ts('Disable %1', array(1 => self
::$_gName)),
129 CRM_Core_Action
::ENABLE
=> array(
130 'name' => ts('Enable'),
131 'ref' => 'crm-enable-disable',
132 'title' => ts('Enable %1', array(1 => self
::$_gName)),
134 CRM_Core_Action
::DELETE
=> array(
135 'name' => ts('Delete'),
136 'url' => 'civicrm/admin/report/register/' . self
::$_gName,
137 'qs' => 'action=delete&id=%%id%%&reset=1',
138 'title' => ts('Delete %1 Type', array(1 => self
::$_gName)),
143 return self
::$_links;
147 * Run the basic page (run essentially starts execution for that page).
151 public function run() {
153 return parent
::run();
162 public function browse() {
163 $groupParams = array('name' => self
::$_gName);
164 $optionValue = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'weight');
165 $gName = self
::$_gName;
166 $returnURL = CRM_Utils_System
::url("civicrm/admin/report/options/$gName",
169 $filter = "option_group_id = " . self
::$_gId;
171 $session = new CRM_Core_Session();
172 $session->replaceUserContext($returnURL);
173 CRM_Utils_Weight
::addOrder($optionValue, 'CRM_Core_DAO_OptionValue',
174 'id', $returnURL, $filter
176 $this->assign('rows', $optionValue);
180 * Get name of edit form
183 * Classname of edit form.
185 public function editForm() {
186 return 'CRM_Report_Form_Register';
195 public function editName() {
196 return self
::$_GName;
207 public function userContext($mode = NULL) {
208 return 'civicrm/report/options/' . self
::$_gName;
212 * Get userContext params
215 * Mode that we are in.
219 public function userContextParams($mode = NULL) {
220 return 'reset=1&action=browse';