4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.4 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2013
38 * Page for displaying list of Gender
40 class CRM_Report_Page_Options
extends CRM_Core_Page_Basic
{
43 * The action links that we need to display for the browse screen
48 static $_links = NULL;
51 * The option group name
56 static $_gName = NULL;
59 * The option group name in display format (capitalized, without underscores...etc)
64 static $_GName = NULL;
75 * Obtains the group name from url and sets the title.
81 function preProcess() {
82 $this->_action
= CRM_Utils_Request
::retrieve('action', 'String', $this, FALSE);
83 $this->_id
= CRM_Utils_Request
::retrieve('id', 'String', $this, FALSE);
85 self
::$_gName = "report_template";
88 self
::$_gId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', self
::$_gName, 'id', 'name');
91 CRM_Core_Error
::fatal();
94 self
::$_GName = ucwords(str_replace('_', ' ', self
::$_gName));
96 $this->assign('GName', self
::$_GName);
97 $newReportURL = CRM_Utils_System
::url("civicrm/admin/report/register",
100 $this->assign('newReport', $newReportURL);
101 CRM_Utils_System
::setTitle(ts('Registered Templates'));
107 * @return string Classname of BAO.
109 function getBAOName() {
110 return 'CRM_Core_BAO_OptionValue';
116 * @return array (reference) of action links
119 if (!(self
::$_links)) {
120 self
::$_links = array(
121 CRM_Core_Action
::UPDATE
=> array(
122 'name' => ts('Edit'),
123 'url' => 'civicrm/admin/report/register/' . self
::$_gName,
124 'qs' => 'action=update&id=%%id%%&reset=1',
125 'title' => ts('Edit %1', array(1 => self
::$_gName)),
127 CRM_Core_Action
::DISABLE
=> array(
128 'name' => ts('Disable'),
129 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'enable-disable' . '\' );"',
130 'ref' => 'disable-action',
131 'title' => ts('Disable %1', array(1 => self
::$_gName)),
133 CRM_Core_Action
::ENABLE
=> array(
134 'name' => ts('Enable'),
135 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'disable-enable' . '\' );"',
136 'ref' => 'enable-action',
137 'title' => ts('Enable %1', array(1 => self
::$_gName)),
139 CRM_Core_Action
::DELETE
=> array(
140 'name' => ts('Delete'),
141 'url' => 'civicrm/admin/report/register/' . self
::$_gName,
142 'qs' => 'action=delete&id=%%id%%&reset=1',
143 'title' => ts('Delete %1 Type', array(1 => self
::$_gName)),
148 return self
::$_links;
152 * Run the basic page (run essentially starts execution for that page).
158 return parent
::run();
170 $groupParams = array('name' => self
::$_gName);
171 $optionValue = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'weight');
172 $gName = self
::$_gName;
173 $returnURL = CRM_Utils_System
::url("civicrm/admin/report/options/$gName",
176 $filter = "option_group_id = " . self
::$_gId;
178 $session = new CRM_Core_Session();
179 $session->replaceUserContext($returnURL);
180 CRM_Utils_Weight
::addOrder($optionValue, 'CRM_Core_DAO_OptionValue',
181 'id', $returnURL, $filter
183 $this->assign('rows', $optionValue);
187 * Get name of edit form
189 * @return string Classname of edit form.
191 function editForm() {
192 return 'CRM_Report_Form_Register';
198 * @return string name of this page.
200 function editName() {
201 return self
::$_GName;
207 * @return string user context.
209 function userContext($mode = NULL) {
210 return 'civicrm/report/options/' . self
::$_gName;
214 * function to get userContext params
216 * @param int $mode mode that we are in
221 function userContextParams($mode = NULL) {
222 return 'reset=1&action=browse';